diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-10 20:07:27 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-10 20:07:27 +0000 |
commit | 0f567be0ed1de29ecf213a19c96ebdc6611d196b (patch) | |
tree | 12f51df131fc213a42a42008c070eccc3946a5ef /modules/node.module | |
parent | 94d6b63f390a970ff96fb38df91a8b2ca2f1eec5 (diff) | |
download | brdo-0f567be0ed1de29ecf213a19c96ebdc6611d196b.tar.gz brdo-0f567be0ed1de29ecf213a19c96ebdc6611d196b.tar.bz2 |
- improved administrator interface of account, node, story and book
by (1) adding a few extra features to "easify" navigation and (b)
to start using "status messages" as once suggested on the mailing
list by Jeroen
Diffstat (limited to 'modules/node.module')
-rw-r--r-- | modules/node.module | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/modules/node.module b/modules/node.module index 48f680aa0..cbb0d5013 100644 --- a/modules/node.module +++ b/modules/node.module @@ -2,11 +2,12 @@ $module = array("admin" => "node_admin"); -function node_overview($query = 0) { +function node_overview($query = array()) { global $user, $rstatus; - $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id ". ($query ? "WHERE $query" : "") ." ORDER BY n.timestamp DESC"); + $result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id $query[1] LIMIT 50"); + $output .= status($query[0]); $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; $output .= " <TR><TH>title</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n"; while ($node = db_fetch_object($result)) { @@ -60,10 +61,26 @@ function node_delete($id) { return (node_del("nid", $id) ? "node has been deleted." : "failed to delete node: node must be dumped first."); } +function node_query($type = "") { + global $status; + $queries = array(0 => array("active nodes", "ORDER BY n.timestamp DESC"), 1 => array("posted nodes", "WHERE n.status = '$status[posted]' ORDER BY n.timestamp DESC"), 2 => array("queued nodes", "WHERE n.status = '$status[queued]' ORDER BY n.timestamp DESC"), 3 => array("dumped nodes", "WHERE n.status = '$status[dumped]' ORDER BY n.timestamp DESC")); + return ($queries[$type] ? $queries[$type] : $queries); +} + +function node_listing() { + foreach (node_query() as $key=>$array) { + $output .= "<LI><A HREF=\"admin.php?mod=node&type=$key\">$array[0]</A></LI>\n"; + } + return "<OL>$output</OL>\n"; +} + function node_admin() { - global $op, $id, $edit; + global $op, $id, $edit, $type; + + print "<SMALL><A HREF=\"admin.php?mod=node&op=listing\">node listings</A> | <A HREF=\"admin.php?mod=node\">overview</A></SMALL><HR>\n"; $id = check_input($edit[nid] ? $edit[nid] : $id); + $type = ($type ? $type : 0); switch ($op) { case "Edit node": @@ -74,6 +91,9 @@ function node_admin() { print status(node_delete($id)); print node_overview(); break; + case "listing": + print node_listing(); + break; case "Save node": print status(node_save($edit)); print node_admin_view($id); @@ -83,7 +103,7 @@ function node_admin() { print node_admin_view($id); break; default: - print node_overview(); + print node_overview(node_query($type)); } } |