From 0f567be0ed1de29ecf213a19c96ebdc6611d196b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 10 Apr 2001 20:07:27 +0000 Subject: - 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 --- modules/node.module | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'modules/node.module') 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 .= "\n"; $output .= " \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 .= "
  • $array[0]
  • \n"; + } + return "
      $output
    \n"; +} + function node_admin() { - global $op, $id, $edit; + global $op, $id, $edit, $type; + + print "node listings | overview
    \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)); } } -- cgit v1.2.3
    titletypestatusauthordateoperations