diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-12-24 15:40:32 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-12-24 15:40:32 +0000 |
commit | 22fa9ed70a512feb6d603d24218e9a7db7610a0e (patch) | |
tree | 16b69a177c1645a7d3474bfe06e0571d7280b5d9 | |
parent | ca07ff36d600e778a71dbe52dce9e82c3f1ebd92 (diff) | |
download | brdo-22fa9ed70a512feb6d603d24218e9a7db7610a0e.tar.gz brdo-22fa9ed70a512feb6d603d24218e9a7db7610a0e.tar.bz2 |
- Refactored the administration pages.
35 files changed, 577 insertions, 969 deletions
@@ -1,6 +1,7 @@ Drupal x.x.x, xxxx-xx-xx (to be released) ------------------------ +- restructured all admininstration pages - node system improvements: * replaced the "post content" permission by more fine-grained permissions. * improved content submission: @@ -82,7 +83,7 @@ Drupal 4.0.0, 2002-06-15 * added support for session IDs in URLs instead of cookies. * made the type of content on the front page configurable. * made each cloud site have its own settings. - * modules and themes can now be enabled/disabled using the administrative pages. + * modules and themes can now be enabled/disabled using the administration pages. * added URL abstraction for links. * usability changes (renamed links, better UI, etc). - collaboratively revised and expanded the Drupal documentation. @@ -27,21 +27,42 @@ function admin_page($mod) { td { font-family: helvetica, arial; font-size: 12pt; } </style> <body bgcolor="#FFFFFF" link="#005599" vlink="#004499" alink="#FF0000"> - <h1><?php echo t("Administration"); ?></h1> <?php + module_invoke_all("link", "admin"); - $links[] = "<a href=\"index.php\">" . t("home") . "</a>"; - foreach (module_list() as $name) { - if (module_hook($name, "link")) { - $links = array_merge($links, module_invoke($name, "link", "admin")); - } - } - - print implode(" | ", $links) ."<hr />"; + print "<img align=\"right\" src=\"misc/druplicon-small.gif\" tag=\"Druplicon - Drupal logo\" />"; if ($mod) { + /* + ** Generate the admin page's header. + */ + + if ($path = menu_path()) { + print "<h2>". la(t("Administration")) ." > $path</h2>"; + } + else { + print "<h2>". t("Administration") ."</h2>"; + } + if ($data) { + print "<hr />". implode("<hr />", $data) ."<hr />"; + } + if ($menu = menu_menu()) { + print $menu; + } + if ($help = menu_help()) { + print "<hr />$help"; + } + print "<hr />"; + module_invoke($mod, "admin"); } + else { + print "<h2>". t("Administration") ."</h2>"; + print "<hr />"; + print menu_tree(); + } + + db_query("DELETE FROM menu"); ?> </body> </html> diff --git a/database/database.mysql b/database/database.mysql index 3aaa2f113..abe436601 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -220,6 +220,20 @@ CREATE TABLE locales ( ) TYPE=MyISAM; -- +-- Table structure for table 'menu' +-- + +CREATE TABLE menu ( + name varchar(255) NOT NULL default '', + link varchar(255) NOT NULL default '', + help TEXT default '', + title varchar(255) NOT NULL default '', + parent varchar(255) NOT NULL default '', + weight tinyint(4) DEFAULT '0' NOT NULL, + overview tinyint(1) DEFAULT '0' NOT NULL +) TYPE=MyISAM; + +-- -- Table structure for table 'moderation_filters' -- diff --git a/database/database.pgsql b/database/database.pgsql index 173eb3b11..62c7ae03d 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -217,6 +217,20 @@ CREATE TABLE locales ( ); -- +-- Table structure for table 'menu' +-- + +CREATE TABLE menu ( + name varchar(255) NOT NULL default '', + link varchar(255) NOT NULL default '', + help TEXT default '', + title varchar(255) NOT NULL default '', + parent varchar(255) NOT NULL default '', + weight tinyint(4) DEFAULT '0' NOT NULL, + overview tinyint(1) DEFAULT '0' NOT NULL +); + +-- -- Table structure for table 'moderation_filters' -- diff --git a/includes/common.inc b/includes/common.inc index 51f09a892..ea1139eee 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -844,6 +844,7 @@ include_once "includes/xmlrpc.inc"; include_once "includes/module.inc"; include_once "includes/theme.inc"; include_once "includes/pager.inc"; +include_once "includes/menu.inc"; // initialize configuration variables, using values from conf.php if available: $conf = variable_init(isset($conf) ? $conf : array()); diff --git a/includes/menu.inc b/includes/menu.inc new file mode 100644 index 000000000..0d592714f --- /dev/null +++ b/includes/menu.inc @@ -0,0 +1,127 @@ +<?php + +function menu_trail() { + + global $REQUEST_URI; + static $trail = NULL; + + /* + ** Retrieve the currently active link. + */ + + if (empty($trail)) { + + $path = array(); + $link = substr($REQUEST_URI, strrpos($REQUEST_URI, "/") + 1, strlen($REQUEST_URI)); + $item = db_fetch_object(db_query("SELECT * FROM menu WHERE link = '%s'", $link)); + + /* + ** Compile an array of menu objects that represent the path to + ** the root link. + */ + + if ($item) { + $path[] = $item; + + while ($item->parent) { + $result = db_query("SELECT * FROM menu WHERE name = '%s' ORDER BY weight, name", $item->parent); + if ($item = db_fetch_object($result)) { + $path[] = $item; + } + } + } + + $trail = array_reverse($path); + } + + return $trail; +} + +function menu_item($item) { + global $REQUEST_URI; + + /* + ** If you want to theme your links, or if you want to replace them + ** by an image, this would be the function to customize. + */ + + if (stristr($REQUEST_URI, $item->link) == $item->link) { + return t($item->name); + } + else if ($item->title) { + return "<a href=\"$item->link\" title=\"". t($item->title) ."\">". t($item->name) ."</a>"; + } + else { + return "<a href=\"$item->link\">". t($item->name) ."</a>"; + } +} + +function menu_path() { + + $path = menu_trail(); + + $links = array(); + + foreach ($path as $item) { + $links[] = menu_item($item); + } + + return implode(" > ", $links); +} + +function menu_menu_row($parent = "") { + + $links = array(); + + $result = db_query("SELECT * FROM menu WHERE parent = '%s' ORDER BY weight, name", $parent); + while ($menu = db_fetch_object($result)) { + $links[] = menu_item($menu); + } + + return $links; +} + +function menu_menu() { + $path = menu_trail(); + if ($path) { + $item = array_pop($path); + $output = implode(" · ", menu_menu_row($item->name)); + } + else { + $output = implode( " · ", menu_menu_row()); + } + + return $output; +} + +function menu_help() { + $path = menu_trail(); + if ($path) { + $item = array_pop($path); + $output = $item->help; + } + + return $output; +} + +function menu_tree($parent = "", $overview = 0) { + + $result = db_query("SELECT * FROM menu WHERE parent = '%s' AND overview = '%d' ORDER BY weight, name", $parent, $overview); + + print "<ul>"; + while ($item = db_fetch_object($result)) { + print "<li>". menu_item($item) ."</li>"; + menu_tree($item->name, 1); + } + print "</ul>"; + + return $links; +} + +function menu_add($name, $link, $title = NULL, $help = NULL, $parent = NULL, $weight = 1, $overview = 0) { + if (!db_result(db_query("SELECT name FROM menu WHERE link = '%s'", $link))) { + db_query("INSERT INTO menu (name, link, title, help, parent, weight, overview) VALUES ('%s', '%s', '%s', '%s', '%s', '%d', '%d')", $name, $link, $title, $help, $parent, $weight, $overview); + } +} + +?>
\ No newline at end of file diff --git a/misc/druplicon-small.gif b/misc/druplicon-small.gif Binary files differnew file mode 100644 index 000000000..0b1fb9cfe --- /dev/null +++ b/misc/druplicon-small.gif diff --git a/modules/aggregator.module b/modules/aggregator.module index 78fbe5c67..53ce4ea68 100644 --- a/modules/aggregator.module +++ b/modules/aggregator.module @@ -29,14 +29,19 @@ function import_perm() { } function import_link($type) { - if ($type == "admin" && user_access("administer news feeds")) { - $links[] = la(t("news feeds"), array("mod" => "import")); - } if ($type == "page" && user_access("access news feeds")) { $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites."))); } + if ($type == "admin" && user_access("administer news feeds")) { + menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3); + menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2); + menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3); + menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4); + menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5); + } + return $links ? $links : array(); } @@ -294,7 +299,7 @@ function import_save_item($edit) { function import_form_bundle($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -330,7 +335,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Url", "url", $edit["url"], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit["refresh"], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_submit("Submit"); @@ -398,65 +403,6 @@ function import_view() { return $output; } -function import_fd_form() { - - $form .= form_textfield("Feed directory file", "url", "http://", 64, 128, "The fully-qualified URL of the feed directory file."); - $form .= form_submit("Collect feeds"); - - return form($form); -} - -function import_fd_collect($edit) { - - set_time_limit(180); - - if ($fp = @fopen($edit["url"], "r")) { - // fetch data: - while (!feof($fp)) { - $data .= fgets($fp, 128); - } - fclose($fp); - - // initialize the translation table: - $tt = array_flip(get_html_translation_table(HTML_ENTITIES)); - $tt["'"] = "'"; - - $items = explode("</channel>", $data); - - foreach ($items as $item) { - unset($link, $title); - - // print "<pre>item = ". htmlentities($item) ."\n\n</pre>"; - - eregi("<link>(.*)</link>", $item, $link); - eregi("<title>(.*)</title>", $item, $title); - - $link = strip_tags(strtr($link[1], $tt)); - $title = strip_tags(strtr($title[1], $tt)); - - // print "<b>title = $title, link = $link<br /></b>"; - if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) { - $output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />"; - } - } - - $output .= "<input type=\"submit\" name=\"op\" value=\"Import feeds\" />\n"; - - return form($output); - } - else { - print status("failed to open '". $edit["url"] ."': $errstr."); - } -} - -function import_fd_import($edit) { - if ($edit) { - foreach ($edit as $title => $link) { - import_save_feed(array("title" => $title, "url" => $link, "refresh" => 3600)); - } - } -} - function import_tag() { $result = db_query("SELECT i.*, f.title AS feed FROM item i LEFT JOIN feed f ON i.fid = f.fid ORDER BY i.iid DESC LIMIT 50"); @@ -477,15 +423,6 @@ function import_admin() { if (user_access("administer news feeds")) { - $links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add")); - $links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add")); - $links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd")); - $links[] = la(t("tag items"), array("mod" => "import", "op" => "tag")); - $links[] = la(t("overview"), array("mod" => "import", "op" => "view")); - $links[] = la(t("help"), array("mod" => "import", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": print import_help(); @@ -506,16 +443,6 @@ function import_admin() { print import_form_feed(import_get_feed($id)); } break; - case "fd": - print import_fd_form(); - break; - case "Collect feeds": - print import_fd_collect($edit); - break; - case "Import feeds": - print import_fd_import($edit); - print import_view(); - break; case "remove": print status(import_remove(import_get_feed($id))); print import_view(); diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module index 78fbe5c67..53ce4ea68 100644 --- a/modules/aggregator/aggregator.module +++ b/modules/aggregator/aggregator.module @@ -29,14 +29,19 @@ function import_perm() { } function import_link($type) { - if ($type == "admin" && user_access("administer news feeds")) { - $links[] = la(t("news feeds"), array("mod" => "import")); - } if ($type == "page" && user_access("access news feeds")) { $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites."))); } + if ($type == "admin" && user_access("administer news feeds")) { + menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3); + menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2); + menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3); + menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4); + menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5); + } + return $links ? $links : array(); } @@ -294,7 +299,7 @@ function import_save_item($edit) { function import_form_bundle($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -330,7 +335,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Url", "url", $edit["url"], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit["refresh"], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_submit("Submit"); @@ -398,65 +403,6 @@ function import_view() { return $output; } -function import_fd_form() { - - $form .= form_textfield("Feed directory file", "url", "http://", 64, 128, "The fully-qualified URL of the feed directory file."); - $form .= form_submit("Collect feeds"); - - return form($form); -} - -function import_fd_collect($edit) { - - set_time_limit(180); - - if ($fp = @fopen($edit["url"], "r")) { - // fetch data: - while (!feof($fp)) { - $data .= fgets($fp, 128); - } - fclose($fp); - - // initialize the translation table: - $tt = array_flip(get_html_translation_table(HTML_ENTITIES)); - $tt["'"] = "'"; - - $items = explode("</channel>", $data); - - foreach ($items as $item) { - unset($link, $title); - - // print "<pre>item = ". htmlentities($item) ."\n\n</pre>"; - - eregi("<link>(.*)</link>", $item, $link); - eregi("<title>(.*)</title>", $item, $title); - - $link = strip_tags(strtr($link[1], $tt)); - $title = strip_tags(strtr($title[1], $tt)); - - // print "<b>title = $title, link = $link<br /></b>"; - if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) { - $output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />"; - } - } - - $output .= "<input type=\"submit\" name=\"op\" value=\"Import feeds\" />\n"; - - return form($output); - } - else { - print status("failed to open '". $edit["url"] ."': $errstr."); - } -} - -function import_fd_import($edit) { - if ($edit) { - foreach ($edit as $title => $link) { - import_save_feed(array("title" => $title, "url" => $link, "refresh" => 3600)); - } - } -} - function import_tag() { $result = db_query("SELECT i.*, f.title AS feed FROM item i LEFT JOIN feed f ON i.fid = f.fid ORDER BY i.iid DESC LIMIT 50"); @@ -477,15 +423,6 @@ function import_admin() { if (user_access("administer news feeds")) { - $links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add")); - $links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add")); - $links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd")); - $links[] = la(t("tag items"), array("mod" => "import", "op" => "tag")); - $links[] = la(t("overview"), array("mod" => "import", "op" => "view")); - $links[] = la(t("help"), array("mod" => "import", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": print import_help(); @@ -506,16 +443,6 @@ function import_admin() { print import_form_feed(import_get_feed($id)); } break; - case "fd": - print import_fd_form(); - break; - case "Collect feeds": - print import_fd_collect($edit); - break; - case "Import feeds": - print import_fd_import($edit); - print import_view(); - break; case "remove": print status(import_remove(import_get_feed($id))); print import_view(); diff --git a/modules/block.module b/modules/block.module index 406314ab5..be7ac7644 100644 --- a/modules/block.module +++ b/modules/block.module @@ -49,10 +49,13 @@ function block_perm() { function block_link($type) { if ($type == "admin" && user_access("administer blocks")) { - $links[] = la(t("blocks"), array("mod" => "block")); - } + $help["block"] = "Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the Drupal or by any of the active modules. Adminstrators can enable or disable block, as well control the block placement by assigning them a region and/or by assigning each block (within a region) a weight to sort them vertically. The path setting lets you define which pages you want the specific blocks to be shown."; - return $links ? $links : array(); + menu_add("block management", "admin.php?mod=block", "Block management", $help["block"], NULL, 2); + menu_add("add new block", "admin.php?mod=block&op=add", "Create a new block", $help["block"], "block management", 2); + menu_add("preview placement", "admin.php?mod=block&op=preview", "Preview the block placement", $help["block"], "block management", 3); + menu_add("help", "admin.php?mod=block&op=help", "More information about blocks", NULL, "block management", 5); + } } function block_block($op = "list", $delta = 0) { @@ -267,13 +270,6 @@ function block_admin() { if (user_access("administer blocks")) { - $links[] = la(t("configure"), array("mod" => "block")); - $links[] = la(t("add block"), array("mod" => "block", "op" => "add")); - $links[] = la(t("preview"), array("mod" => "block", "op" => "preview")); - $links[] = la(t("help"), array("mod" => "block", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": block_help(); diff --git a/modules/block/block.module b/modules/block/block.module index 406314ab5..be7ac7644 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -49,10 +49,13 @@ function block_perm() { function block_link($type) { if ($type == "admin" && user_access("administer blocks")) { - $links[] = la(t("blocks"), array("mod" => "block")); - } + $help["block"] = "Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the Drupal or by any of the active modules. Adminstrators can enable or disable block, as well control the block placement by assigning them a region and/or by assigning each block (within a region) a weight to sort them vertically. The path setting lets you define which pages you want the specific blocks to be shown."; - return $links ? $links : array(); + menu_add("block management", "admin.php?mod=block", "Block management", $help["block"], NULL, 2); + menu_add("add new block", "admin.php?mod=block&op=add", "Create a new block", $help["block"], "block management", 2); + menu_add("preview placement", "admin.php?mod=block&op=preview", "Preview the block placement", $help["block"], "block management", 3); + menu_add("help", "admin.php?mod=block&op=help", "More information about blocks", NULL, "block management", 5); + } } function block_block($op = "list", $delta = 0) { @@ -267,13 +270,6 @@ function block_admin() { if (user_access("administer blocks")) { - $links[] = la(t("configure"), array("mod" => "block")); - $links[] = la(t("add block"), array("mod" => "block", "op" => "add")); - $links[] = la(t("preview"), array("mod" => "block", "op" => "preview")); - $links[] = la(t("help"), array("mod" => "block", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": block_help(); diff --git a/modules/book.module b/modules/book.module index 161e84e16..4387490f1 100644 --- a/modules/book.module +++ b/modules/book.module @@ -108,15 +108,25 @@ function book_link($type, $node = 0, $main = 0) { $links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page."))); } - if ($type == "admin" && user_access("maintain books")) { - $links[] = la(t("collaborative book"), array("mod" => "book")); - } - if ($type == "node" && $node->type == "book" && book_access("update", $node)) { $links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page."))); $links[] = lm(t("printer-friendly version"), array("mod" => "book", "op" => "print", "id" => $node->nid), "", array("title" => t("Show a printer-friendly version of this book page and its sub-pages."))); } + if ($type == "admin" && user_access("maintain books")) { + $help["book"] = "The collaborative book offers a mean to organize content, authored by many users, in an online manual, outline or FAQ."; + $help["orphan"] = "As pages in a book are edited, reorganized and removed, child pages might be left behind. We refer to such pages as 'orphan pages'. On this page, administrators can review their books for orphans and reaffiliate those pages as desired."; + + menu_add("collaborative books", "admin.php?mod=book", "Maintain collaborative books.", $help["book"], "content management"); + menu_add("orphan pages", "admin.php?mod=book&op=orphan", "Display all orphan pages.", $orphan, "collaborative books", 8); + menu_add("help", "admin.php?mod=book&op=help", "More information about the collaborative book.", NULL, "collaborative books", 9); + + $result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title"); + while ($book = db_fetch_object($result)) { + menu_add("administer book '". check_output($book->title) ."'", "admin.php?mod=book&op=view&id=$book->nid", "Display a book outline.", NULL, "collaborative books"); + } + } + return $links ? $links : array(); } @@ -707,29 +717,12 @@ function book_admin_orphan() { } function book_admin_links() { - $result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title"); - - while ($book = db_fetch_object($result)) { - $links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid)); - } - $links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan")); - $links[] = la(t("help"), array("mod" => "book", "op" => "help")); - return $links; } function book_admin() { global $id, $op, $edit; if (user_access("administer nodes")) { - - /* - ** Compile a list of the administrative links: - */ - - $links = book_admin_links(); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case t("Edit book outline"): case t("Add to book outline"): diff --git a/modules/book/book.module b/modules/book/book.module index 161e84e16..4387490f1 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -108,15 +108,25 @@ function book_link($type, $node = 0, $main = 0) { $links[] = lm(t("create book page"), array("mod" => "node", "op" => "add", "type" => "book"), "", array("title" => t("Add a new book page."))); } - if ($type == "admin" && user_access("maintain books")) { - $links[] = la(t("collaborative book"), array("mod" => "book")); - } - if ($type == "node" && $node->type == "book" && book_access("update", $node)) { $links[] = lm(t("edit this page"), array("mod" => "node", "op" => "edit", "id" => $node->nid), "", array("title" => t("Suggest an update for this book page."))); $links[] = lm(t("printer-friendly version"), array("mod" => "book", "op" => "print", "id" => $node->nid), "", array("title" => t("Show a printer-friendly version of this book page and its sub-pages."))); } + if ($type == "admin" && user_access("maintain books")) { + $help["book"] = "The collaborative book offers a mean to organize content, authored by many users, in an online manual, outline or FAQ."; + $help["orphan"] = "As pages in a book are edited, reorganized and removed, child pages might be left behind. We refer to such pages as 'orphan pages'. On this page, administrators can review their books for orphans and reaffiliate those pages as desired."; + + menu_add("collaborative books", "admin.php?mod=book", "Maintain collaborative books.", $help["book"], "content management"); + menu_add("orphan pages", "admin.php?mod=book&op=orphan", "Display all orphan pages.", $orphan, "collaborative books", 8); + menu_add("help", "admin.php?mod=book&op=help", "More information about the collaborative book.", NULL, "collaborative books", 9); + + $result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title"); + while ($book = db_fetch_object($result)) { + menu_add("administer book '". check_output($book->title) ."'", "admin.php?mod=book&op=view&id=$book->nid", "Display a book outline.", NULL, "collaborative books"); + } + } + return $links ? $links : array(); } @@ -707,29 +717,12 @@ function book_admin_orphan() { } function book_admin_links() { - $result = db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid WHERE b.parent = 0 ORDER BY b.weight, n.title"); - - while ($book = db_fetch_object($result)) { - $links[] = la(t("book") .": <i>". check_output($book->title) ."</i>", array("mod" => "book", "op" => "view", "id" => $book->nid)); - } - $links[] = la(t("orphan pages"), array("mod" => "book", "op" => "orphan")); - $links[] = la(t("help"), array("mod" => "book", "op" => "help")); - return $links; } function book_admin() { global $id, $op, $edit; if (user_access("administer nodes")) { - - /* - ** Compile a list of the administrative links: - */ - - $links = book_admin_links(); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case t("Edit book outline"): case t("Add to book outline"): diff --git a/modules/cloud.module b/modules/cloud.module index 0847437c4..522756bc1 100644 --- a/modules/cloud.module +++ b/modules/cloud.module @@ -40,7 +40,11 @@ function cloud_link($type) { } if ($type == "admin" && user_access("administer site cloud")) { - $links[] = la(t("site cloud"), array("mod" => "cloud")); + $cloud = "The cloud monitor tracks or crawls other interesting websites and displays their last modification dates. Visitors to the host site learn about relevant sites and can easily see if there is new content."; + + menu_add("blogrolling", "admin.php?mod=cloud", "Maintain the sites in your blogroll.", $cloud, NULL, 3); + menu_add("add new site", "admin.php?mod=cloud&op=add", "Add a new sites to your blogroll.", NULL, "blogrolling", 3); + menu_add("help", "admin.php?mod=cloud&op=help", "More information about the site cloud.", NULL, "blogrolling", 9); } return $links ? $links : array(); @@ -89,7 +93,7 @@ function cloud_form($edit = array()) { $form .= form_textfield("Site URL", "link", $edit["link"], 50, 255, "The URL of the website you want to monitor for updates."); $form .= form_textfield("URL to monitor", "feed", $edit["feed"], 50, 255, "The URL of the page you want to monitor for updates. Likely to be same as the site's URL but useful to monitor framed pages and more accurate when pointed to a XML/RSS/RDF feed."); $form .= form_select("Update interval", "refresh", ($edit["refresh"] ? $edit["refresh"] : 3600), $period, "The refresh interval indicating how often you want to check this site for updates. Requires crontab."); - $form .= form_select("Change threshold", "threshold", ($edit["threshold"] ? $edit["threshold"] : 40), $threshold, "The number of bytes the site must have been modified before concidered changed."); + $form .= form_select("Change threshold", "threshold", ($edit["threshold"] ? $edit["threshold"] : 40), $threshold, "The number of bytes the site must have been modified before considered changed."); $form .= form_submit("Submit"); diff --git a/modules/comment.module b/modules/comment.module index 870809a1e..63c275816 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -10,7 +10,7 @@ function comment_help() { $output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>"; $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". la("filters", array("mod" => "system", "type" => "filter")) ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>"; $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". la("user permissions", array("mod" => "user", "op" => "permission")) ." administration page. Additionally, administrators may edit or search through comments on the ". la("comments admininistration page", array("mod" => "comment")) .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>"; - $output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment threshholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>"; + $output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>"; return $output; } @@ -32,7 +32,7 @@ function comment_conf_options() { $thresholds[$filter->fid] = ($filter->filter); } - $output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users.")); + $output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These thresholds are useful for busy sites which want to hide poor comments from most users.")); $output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?")); $output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?")); @@ -605,10 +605,6 @@ function comment_perm() { function comment_link($type, $node = 0, $main = 0) { - if ($type == "admin" && user_access("administer comments")) { - $links[] = la(t("comments"), array("mod" => "comment")); - } - if ($type == "node" && $node->comment) { if ($main) { @@ -658,6 +654,24 @@ function comment_link($type, $node = 0, $main = 0) { } } + if ($type == "admin" && user_access("administer comments")) { + $settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site."; + + menu_add("comment management", "admin.php?mod=comment", "Administer comments.", $help["comment"], "content management", 1, 1); + menu_add("new or updated comments", "admin.php?mod=comment&status=0", "Display new or updated comments.", NULL, "comment management"); + menu_add("comments that await approval", "admin.php?mod=comment&status=1", "Display comments that await approval.", NULL, "comment management"); + menu_add("search comment", "admin.php?mod=comment&op=search", "Search a comment.", NULL, "comment management", 8); + menu_add("help", "admin.php?mod=comment&op=help", "More information about the comment system.", NULL, "comment management", 9); + + // comment settings: + if (user_access("administer moderation")) { + menu_add("comment moderation votes", "admin.php?mod=comment&op=votes", "Configure the comment moderation votes.", $settings, "site configuration", 5); + menu_add("comment moderation matrix", "admin.php?mod=comment&op=matrix", "Configure the comment moderation matrix.", $settings, "site configuration", 5); + menu_add("comment moderation thresholds", "admin.php?mod=comment&op=filters", "Configure the comment moderation thresholds.", $settings, "site configuration", 5); + menu_add("initial comment scores", "admin.php?mod=comment&op=roles", "Configure the initial comment score.", $settings, "site configuration", 5); + } + } + return $links ? $links : array(); } @@ -795,7 +809,7 @@ function comment_admin_overview($status = 0, $comment_page = 0) { $start = $comment_page * $comments_per_page; - $output .= $status ? "<h3>" . t("Non-published comments") . "</h3>\n" : "<h3>" . t("Published comments") . "</h3>"; + $output .= $status ? "<h3>" . t("Comments that await approval") . "</h3>\n" : "<h3>" . t("New or updated comments") . "</h3>"; $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE c.status = '%d' ORDER BY timestamp DESC LIMIT $start, $comments_per_page", $status); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; @@ -944,21 +958,21 @@ function comment_mod_votes($edit) { function comment_mod_filters($edit) { global $op, $fid, $tid; - if ($op == t("Save threshhold")) { + if ($op == t("Save threshold")) { db_query("UPDATE moderation_filters SET filter = '%s', minimum = '%d' WHERE fid = '%d'", $edit["filter"], $edit["minimum"], $fid); $fid = 0; } - else if ($op == t("Delete threshhold")) { + else if ($op == t("Delete threshold")) { db_query("DELETE FROM moderation_filters WHERE fid = '%d'", $fid); $fid = 0; } - else if ($op == t("Add new threshhold")) { + else if ($op == t("Add new threshold")) { db_query("INSERT INTO moderation_filters (fid, filter, minimum) VALUES (NULL, '%s', '%d')", $edit["filter"], $edit["minimum"]); $fid = 0; } - $output .= "<h3>Comment threshhold overview</h3>"; - $output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users threshholds, which are used to hide all comments whose moderation score is lower than the threshhold. This cuts down on clutter while your readers view the site. These threshholds appear in the Comment Control Panel.</p>"; + $output .= "<h3>Comment threshold overview</h3>"; + $output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users thresholds, which are used to hide all comments whose moderation score is lower than the threshold. This cuts down on clutter while your readers view the site. These thresholds appear in the Comment Control Panel.</p>"; $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; $output .= " <tr><th>" . t("name") . "</th><th>" . t("minimum score") . "</th><th>" . t("operations") . "</th></tr>"; @@ -972,15 +986,15 @@ function comment_mod_filters($edit) { $filter = db_fetch_object(db_query("SELECT filter, fid, minimum FROM moderation_filters WHERE fid = '%d'", $fid)); } - $output .= "<h3>Add new threshhold</h3>"; - $form .= form_textfield(t("Threshhold name"), "filter", $filter->filter, 32, 64, t("The name of this threshhold. Example: 'good comments', '+1 comments', 'everything'.")); + $output .= "<h3>Add new threshold</h3>"; + $form .= form_textfield(t("Threshhold name"), "filter", $filter->filter, 32, 64, t("The name of this threshold. Example: 'good comments', '+1 comments', 'everything'.")); $form .= form_textfield(t("Minimum score"), "minimum", $filter->minimum, 32, 64, t("Show all comments whose score is larger or equal to the provided minimal score. Range: -127 + 128")); if ($fid) { - $form .= form_submit(t("Save threshhold")); - $form .= form_submit(t("Delete threshhold")); + $form .= form_submit(t("Save threshold")); + $form .= form_submit(t("Delete threshold")); } else { - $form .= form_submit(t("Add new threshhold")); + $form .= form_submit(t("Add new threshold")); } $output .= form($form); @@ -993,26 +1007,6 @@ function comment_admin() { global $op, $id, $edit, $mod, $keys, $order, $status, $comment_page, $comment_settings; if (user_access("administer comments")) { - - $links[] = la(t("published comments"), array("mod" => "comment", "status" => 0)); - $links[] = la(t("non-published comments"), array("mod" => "comment", "status" => 1)); - $links[] = la(t("search comments"), array("mod" => "comment", "op" => "search")); - - if (user_access("administer site configuration")) { - $links[] = la(t("settings"), array("mod" => "system", "op" => "settings"), "comment"); - } - - if (user_access("administer moderation")) { - $links[] = la(t("moderation votes"), array("mod" => "comment", "op" => "votes")); - $links[] = la(t("moderation matrix"), array("mod" => "comment", "op" => "matrix")); - $links[] = la(t("comment threshholds"), array("mod" => "comment", "op" => "filters")); - $links[] = la(t("initial comment scores"), array("mod" => "comment", "op" => "roles")); - } - - $links[] = la(t("help"), array("mod" => "comment", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />\n"; - switch ($op) { case "help": print comment_help(); @@ -1044,9 +1038,9 @@ function comment_admin() { } break; case "filters": - case t("Add new threshhold"): - case t("Delete threshhold"): - case t("Save threshhold"): + case t("Add new threshold"): + case t("Delete threshold"): + case t("Save threshold"): if (user_access("administer moderation")) { print comment_mod_filters($edit); } @@ -1133,7 +1127,7 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1, $nid, $page = 0 $output .= " ". form_submit(t("Update settings")); - $output = form_item(t("Comment viewing options"), $output, t("Select your prefered way to display the comments and click 'Update settings' to submit your changes.")); + $output = form_item(t("Comment viewing options"), $output, t("Select your preferred way to display the comments and click 'Update settings' to submit your changes.")); if (($mode == 2 || $mode == 4) && $comment_num > $comments_per_page) { if ($page > 1) { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 870809a1e..63c275816 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -10,7 +10,7 @@ function comment_help() { $output .= "<p>Since a busy site generates lots of comments, Drupal takes care to present a personalized view of comments for each user. The home page lists displays the number of read and unread comments for a given post for the current user. Also, the tracker module (when installed) displays all recent comments on the site. Finally, comments which the user has not yet read are highlighted with a red star (this graphic may depend on the current theme).</p>"; $output .= "<p>Comments behave like other user submissions in Drupal. Specifically, ". la("filters", array("mod" => "system", "type" => "filter")) ." like smileys and HTML work fine if the administrator has enabled them. Also, throttles are usually enabled to prevent a single user from spamming the web site with too many comments in a short period of time.</p>"; $output .= "<p>Administrators may control which persons are allowed to submit and administer comments. These controls appear in the ". la("user permissions", array("mod" => "user", "op" => "permission")) ." administration page. Additionally, administrators may edit or search through comments on the ". la("comments admininistration page", array("mod" => "comment")) .", as well as set the default display view for new users. Administrators can also state whether a certain role will have their comments published immediately, or just put in a queue to be reviewed.</p>"; - $output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment threshholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>"; + $output .= "<p>If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some \"moderation votes\"; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater \"weight\" in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site.</p>"; return $output; } @@ -32,7 +32,7 @@ function comment_conf_options() { $thresholds[$filter->fid] = ($filter->filter); } - $output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These threshholds are useful for busy sites which wan tto hide poor comments from most users.")); + $output .= form_select(t("Default threshold"), "comment_default_threshold", variable_get("comment_default_threshold", 0), $thresholds, t("Thresholds are values below which comments are hidden. These thresholds are useful for busy sites which want to hide poor comments from most users.")); $output .= form_select(t("Preview comment"), "comment_preview", variable_get("comment_preview", 1), array(t("Optional"), t("Required")), t("Must users preview comments before submitting?")); $output .= form_select(t("New comment form"), "comment_new_form", variable_get("comment_new_form", 0), array(t("Disabled"), t("Enabled")), t("New comment form in the node page?")); @@ -605,10 +605,6 @@ function comment_perm() { function comment_link($type, $node = 0, $main = 0) { - if ($type == "admin" && user_access("administer comments")) { - $links[] = la(t("comments"), array("mod" => "comment")); - } - if ($type == "node" && $node->comment) { if ($main) { @@ -658,6 +654,24 @@ function comment_link($type, $node = 0, $main = 0) { } } + if ($type == "admin" && user_access("administer comments")) { + $settings = "If you really have a lot of comments, you can enable moderation. You assign moderation permissions to role(s), then setup some 'moderation votes'; these votes will appear to moderators in a dropdown menu near the comment. You also have to assign, for every role and every vote, a value, which can be either positive or negative; use the moderation matrix to do this. This allows for some roles having greater 'weight' in their moderation, if you wish. If you set a value to 0, that vote won't be available to that role. When a user moderates, the value of their vote is added or subtracted to the score of that comment. Finally, you may want to setup the comment thresholds: these are floor/ceiling values which users see in the comment control panel. Threshholds are useful for hiding poorly rated comments while reading your site."; + + menu_add("comment management", "admin.php?mod=comment", "Administer comments.", $help["comment"], "content management", 1, 1); + menu_add("new or updated comments", "admin.php?mod=comment&status=0", "Display new or updated comments.", NULL, "comment management"); + menu_add("comments that await approval", "admin.php?mod=comment&status=1", "Display comments that await approval.", NULL, "comment management"); + menu_add("search comment", "admin.php?mod=comment&op=search", "Search a comment.", NULL, "comment management", 8); + menu_add("help", "admin.php?mod=comment&op=help", "More information about the comment system.", NULL, "comment management", 9); + + // comment settings: + if (user_access("administer moderation")) { + menu_add("comment moderation votes", "admin.php?mod=comment&op=votes", "Configure the comment moderation votes.", $settings, "site configuration", 5); + menu_add("comment moderation matrix", "admin.php?mod=comment&op=matrix", "Configure the comment moderation matrix.", $settings, "site configuration", 5); + menu_add("comment moderation thresholds", "admin.php?mod=comment&op=filters", "Configure the comment moderation thresholds.", $settings, "site configuration", 5); + menu_add("initial comment scores", "admin.php?mod=comment&op=roles", "Configure the initial comment score.", $settings, "site configuration", 5); + } + } + return $links ? $links : array(); } @@ -795,7 +809,7 @@ function comment_admin_overview($status = 0, $comment_page = 0) { $start = $comment_page * $comments_per_page; - $output .= $status ? "<h3>" . t("Non-published comments") . "</h3>\n" : "<h3>" . t("Published comments") . "</h3>"; + $output .= $status ? "<h3>" . t("Comments that await approval") . "</h3>\n" : "<h3>" . t("New or updated comments") . "</h3>"; $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE c.status = '%d' ORDER BY timestamp DESC LIMIT $start, $comments_per_page", $status); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; @@ -944,21 +958,21 @@ function comment_mod_votes($edit) { function comment_mod_filters($edit) { global $op, $fid, $tid; - if ($op == t("Save threshhold")) { + if ($op == t("Save threshold")) { db_query("UPDATE moderation_filters SET filter = '%s', minimum = '%d' WHERE fid = '%d'", $edit["filter"], $edit["minimum"], $fid); $fid = 0; } - else if ($op == t("Delete threshhold")) { + else if ($op == t("Delete threshold")) { db_query("DELETE FROM moderation_filters WHERE fid = '%d'", $fid); $fid = 0; } - else if ($op == t("Add new threshhold")) { + else if ($op == t("Add new threshold")) { db_query("INSERT INTO moderation_filters (fid, filter, minimum) VALUES (NULL, '%s', '%d')", $edit["filter"], $edit["minimum"]); $fid = 0; } - $output .= "<h3>Comment threshhold overview</h3>"; - $output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users threshholds, which are used to hide all comments whose moderation score is lower than the threshhold. This cuts down on clutter while your readers view the site. These threshholds appear in the Comment Control Panel.</p>"; + $output .= "<h3>Comment threshold overview</h3>"; + $output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users thresholds, which are used to hide all comments whose moderation score is lower than the threshold. This cuts down on clutter while your readers view the site. These thresholds appear in the Comment Control Panel.</p>"; $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; $output .= " <tr><th>" . t("name") . "</th><th>" . t("minimum score") . "</th><th>" . t("operations") . "</th></tr>"; @@ -972,15 +986,15 @@ function comment_mod_filters($edit) { $filter = db_fetch_object(db_query("SELECT filter, fid, minimum FROM moderation_filters WHERE fid = '%d'", $fid)); } - $output .= "<h3>Add new threshhold</h3>"; - $form .= form_textfield(t("Threshhold name"), "filter", $filter->filter, 32, 64, t("The name of this threshhold. Example: 'good comments', '+1 comments', 'everything'.")); + $output .= "<h3>Add new threshold</h3>"; + $form .= form_textfield(t("Threshhold name"), "filter", $filter->filter, 32, 64, t("The name of this threshold. Example: 'good comments', '+1 comments', 'everything'.")); $form .= form_textfield(t("Minimum score"), "minimum", $filter->minimum, 32, 64, t("Show all comments whose score is larger or equal to the provided minimal score. Range: -127 + 128")); if ($fid) { - $form .= form_submit(t("Save threshhold")); - $form .= form_submit(t("Delete threshhold")); + $form .= form_submit(t("Save threshold")); + $form .= form_submit(t("Delete threshold")); } else { - $form .= form_submit(t("Add new threshhold")); + $form .= form_submit(t("Add new threshold")); } $output .= form($form); @@ -993,26 +1007,6 @@ function comment_admin() { global $op, $id, $edit, $mod, $keys, $order, $status, $comment_page, $comment_settings; if (user_access("administer comments")) { - - $links[] = la(t("published comments"), array("mod" => "comment", "status" => 0)); - $links[] = la(t("non-published comments"), array("mod" => "comment", "status" => 1)); - $links[] = la(t("search comments"), array("mod" => "comment", "op" => "search")); - - if (user_access("administer site configuration")) { - $links[] = la(t("settings"), array("mod" => "system", "op" => "settings"), "comment"); - } - - if (user_access("administer moderation")) { - $links[] = la(t("moderation votes"), array("mod" => "comment", "op" => "votes")); - $links[] = la(t("moderation matrix"), array("mod" => "comment", "op" => "matrix")); - $links[] = la(t("comment threshholds"), array("mod" => "comment", "op" => "filters")); - $links[] = la(t("initial comment scores"), array("mod" => "comment", "op" => "roles")); - } - - $links[] = la(t("help"), array("mod" => "comment", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />\n"; - switch ($op) { case "help": print comment_help(); @@ -1044,9 +1038,9 @@ function comment_admin() { } break; case "filters": - case t("Add new threshhold"): - case t("Delete threshhold"): - case t("Save threshhold"): + case t("Add new threshold"): + case t("Delete threshold"): + case t("Save threshold"): if (user_access("administer moderation")) { print comment_mod_filters($edit); } @@ -1133,7 +1127,7 @@ function comment_controls($threshold = 1, $mode = 3, $order = 1, $nid, $page = 0 $output .= " ". form_submit(t("Update settings")); - $output = form_item(t("Comment viewing options"), $output, t("Select your prefered way to display the comments and click 'Update settings' to submit your changes.")); + $output = form_item(t("Comment viewing options"), $output, t("Select your preferred way to display the comments and click 'Update settings' to submit your changes.")); if (($mode == 2 || $mode == 4) && $comment_num > $comments_per_page) { if ($page > 1) { diff --git a/modules/help.module b/modules/help.module index 3974f6e74..856fd83df 100644 --- a/modules/help.module +++ b/modules/help.module @@ -8,10 +8,8 @@ function help_system($field){ function help_link($type) { if ($type == "admin") { - $links[] = la(t("help"), array("mod" => "help")); + menu_add("help", "admin.php?mod=help", "Help", NULL, NULL, 9); } - - return $links ? $links : array(); } function help_admin() { @@ -22,7 +20,7 @@ function help_admin() { } } - print "<small>". implode(" | ", $links) ."</small><hr />"; + print "<small>". implode(" · ", $links) ."</small><hr />"; foreach (module_list() as $name) { if (module_hook($name, "help")) { diff --git a/modules/help/help.module b/modules/help/help.module index 3974f6e74..856fd83df 100644 --- a/modules/help/help.module +++ b/modules/help/help.module @@ -8,10 +8,8 @@ function help_system($field){ function help_link($type) { if ($type == "admin") { - $links[] = la(t("help"), array("mod" => "help")); + menu_add("help", "admin.php?mod=help", "Help", NULL, NULL, 9); } - - return $links ? $links : array(); } function help_admin() { @@ -22,7 +20,7 @@ function help_admin() { } } - print "<small>". implode(" | ", $links) ."</small><hr />"; + print "<small>". implode(" · ", $links) ."</small><hr />"; foreach (module_list() as $name) { if (module_hook($name, "help")) { diff --git a/modules/import.module b/modules/import.module index 78fbe5c67..53ce4ea68 100644 --- a/modules/import.module +++ b/modules/import.module @@ -29,14 +29,19 @@ function import_perm() { } function import_link($type) { - if ($type == "admin" && user_access("administer news feeds")) { - $links[] = la(t("news feeds"), array("mod" => "import")); - } if ($type == "page" && user_access("access news feeds")) { $links[] = lm(t("news feeds"), array("mod" => "import"), "", array("title" => t("Read the latest news from syndicated websites."))); } + if ($type == "admin" && user_access("administer news feeds")) { + menu_add("news aggregation", "admin.php?mod=import", "Content syndication through RDF/RSS feeds.", NULL, NULL, 3); + menu_add("add new feed", "admin.php?mod=import&op=add&type=feed", "Add new news feed.", NULL, "news aggregation", 2); + menu_add("add new bundle", "admin.php?mod=import&op=add&type=bundle", "Create a new bundle.", NULL, "news aggregation", 3); + menu_add("tag news items", "admin.php?mod=import&op=tag", "Assign bundle attributes to a news item.", NULL, "news aggregation", 4); + menu_add("help", "admin.php?mod=import&op=help", "More information about news aggregation.", NULL, "news aggregation", 5); + } + return $links ? $links : array(); } @@ -294,7 +299,7 @@ function import_save_item($edit) { function import_form_bundle($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the bundle."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the bundle."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the bundle."); $form .= form_submit("Submit"); @@ -330,7 +335,7 @@ function import_form_feed($edit = array()) { $form .= form_textfield("Title", "title", $edit["title"], 50, 64, "The name of the feed; typically the name of the website you syndicate content from."); $form .= form_textfield("Url", "url", $edit["url"], 50, 128, "The fully-qualified URL of the feed."); - $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-seperated list of keywords describing the feed."); + $form .= form_textfield("Attributes", "attributes", $edit["attributes"], 50, 128, "A comma-separated list of keywords describing the feed."); $form .= form_select("Update interval", "refresh", $edit["refresh"], $period, "The refresh interval indicating how often you want to update this feed. Requires crontab."); $form .= form_submit("Submit"); @@ -398,65 +403,6 @@ function import_view() { return $output; } -function import_fd_form() { - - $form .= form_textfield("Feed directory file", "url", "http://", 64, 128, "The fully-qualified URL of the feed directory file."); - $form .= form_submit("Collect feeds"); - - return form($form); -} - -function import_fd_collect($edit) { - - set_time_limit(180); - - if ($fp = @fopen($edit["url"], "r")) { - // fetch data: - while (!feof($fp)) { - $data .= fgets($fp, 128); - } - fclose($fp); - - // initialize the translation table: - $tt = array_flip(get_html_translation_table(HTML_ENTITIES)); - $tt["'"] = "'"; - - $items = explode("</channel>", $data); - - foreach ($items as $item) { - unset($link, $title); - - // print "<pre>item = ". htmlentities($item) ."\n\n</pre>"; - - eregi("<link>(.*)</link>", $item, $link); - eregi("<title>(.*)</title>", $item, $title); - - $link = strip_tags(strtr($link[1], $tt)); - $title = strip_tags(strtr($title[1], $tt)); - - // print "<b>title = $title, link = $link<br /></b>"; - if ($link && $link && !db_fetch_array(db_query("SELECT * FROM feed WHERE url = '%s'", $link))) { - $output .= "<input type=\"checkbox\" name=\"edit[$title]\" value=\"$link\"> ". strtr($title, $tt) ."<br />"; - } - } - - $output .= "<input type=\"submit\" name=\"op\" value=\"Import feeds\" />\n"; - - return form($output); - } - else { - print status("failed to open '". $edit["url"] ."': $errstr."); - } -} - -function import_fd_import($edit) { - if ($edit) { - foreach ($edit as $title => $link) { - import_save_feed(array("title" => $title, "url" => $link, "refresh" => 3600)); - } - } -} - function import_tag() { $result = db_query("SELECT i.*, f.title AS feed FROM item i LEFT JOIN feed f ON i.fid = f.fid ORDER BY i.iid DESC LIMIT 50"); @@ -477,15 +423,6 @@ function import_admin() { if (user_access("administer news feeds")) { - $links[] = la(t("add new feed"), array("mod" => "import", "type" => "feed", "op" => "add")); - $links[] = la(t("add new bundle"), array("mod" => "import", "type" => "bundle", "op" => "add")); - $links[] = la(t("import feeds"), array("mod" => "import", "op" => "fd")); - $links[] = la(t("tag items"), array("mod" => "import", "op" => "tag")); - $links[] = la(t("overview"), array("mod" => "import", "op" => "view")); - $links[] = la(t("help"), array("mod" => "import", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": print import_help(); @@ -506,16 +443,6 @@ function import_admin() { print import_form_feed(import_get_feed($id)); } break; - case "fd": - print import_fd_form(); - break; - case "Collect feeds": - print import_fd_collect($edit); - break; - case "Import feeds": - print import_fd_import($edit); - print import_view(); - break; case "remove": print status(import_remove(import_get_feed($id))); print import_view(); diff --git a/modules/locale.module b/modules/locale.module index 8dfccad47..15abd50aa 100644 --- a/modules/locale.module +++ b/modules/locale.module @@ -45,11 +45,18 @@ function locale_perm() { } function locale_link($type) { + global $languages; + if ($type == "admin" && user_access("administer locales")) { - $links[] = la(t("locales"), array("mod" => "locale")); - } + menu_add("locale", "admin.php?mod=locale", "Translate this site.", NULL, NULL, 3); + menu_add("search string", "admin.php?mod=locale&op=search", "Search a string.", NULL, "locale", 8); + menu_add("help", "admin.php?mod=locale&op=help", "More information about the locale system.", NULL, "locale", 9); - return $links ? $links : array(); + foreach ($languages as $key => $value) { + menu_add("translated '$key' strings", "admin.php?mod=locale&op=translated&language=$key", "Display translated '$key' strings.", NULL, "locale"); + menu_add("untranslated '$key' strings", "admin.php?mod=locale&op=untranslated&language=$key", "Display untranslated '$key' strings.", NULL, "locale"); + } + } } function locale_delete($lid) { @@ -102,21 +109,6 @@ function locale_languages($translation) { return $output; } -function locale_links($translation) { - global $languages; - - foreach ($languages as $key=>$value) { - if ($translation) { - $output .= la(t("translated '%langcode' strings", array("%langcode" => $key)), array("mod" => "locale", "op" => "translated", "language" => $key)) ." · "; - } - else { - $output .= la(t("untranslated '%langcode' strings", array("%langcode" => $key)), array("mod" => "locale", "op" => "untranslated", "language" => $key)) ." · "; - } - } - - return $output; -} - function locale_seek() { global $id, $edit, $languages, $op, $locale_settings; @@ -216,7 +208,6 @@ function locale_admin() { if (user_access("administer locales")) { locale_admin_initialize(); - print "<small>". locale_links(1) . locale_links(0) . la(t("search"), array("mod" => "locale", "op" => "search")) ." · ". la(t("overview"), array("mod" => "locale", "op" => "overview")) ." · ". la(t("help"), array("mod" => "locale", "op" => "help")) ."</small><hr />\n"; switch ($op) { case "delete": diff --git a/modules/locale/locale.module b/modules/locale/locale.module index 8dfccad47..15abd50aa 100644 --- a/modules/locale/locale.module +++ b/modules/locale/locale.module @@ -45,11 +45,18 @@ function locale_perm() { } function locale_link($type) { + global $languages; + if ($type == "admin" && user_access("administer locales")) { - $links[] = la(t("locales"), array("mod" => "locale")); - } + menu_add("locale", "admin.php?mod=locale", "Translate this site.", NULL, NULL, 3); + menu_add("search string", "admin.php?mod=locale&op=search", "Search a string.", NULL, "locale", 8); + menu_add("help", "admin.php?mod=locale&op=help", "More information about the locale system.", NULL, "locale", 9); - return $links ? $links : array(); + foreach ($languages as $key => $value) { + menu_add("translated '$key' strings", "admin.php?mod=locale&op=translated&language=$key", "Display translated '$key' strings.", NULL, "locale"); + menu_add("untranslated '$key' strings", "admin.php?mod=locale&op=untranslated&language=$key", "Display untranslated '$key' strings.", NULL, "locale"); + } + } } function locale_delete($lid) { @@ -102,21 +109,6 @@ function locale_languages($translation) { return $output; } -function locale_links($translation) { - global $languages; - - foreach ($languages as $key=>$value) { - if ($translation) { - $output .= la(t("translated '%langcode' strings", array("%langcode" => $key)), array("mod" => "locale", "op" => "translated", "language" => $key)) ." · "; - } - else { - $output .= la(t("untranslated '%langcode' strings", array("%langcode" => $key)), array("mod" => "locale", "op" => "untranslated", "language" => $key)) ." · "; - } - } - - return $output; -} - function locale_seek() { global $id, $edit, $languages, $op, $locale_settings; @@ -216,7 +208,6 @@ function locale_admin() { if (user_access("administer locales")) { locale_admin_initialize(); - print "<small>". locale_links(1) . locale_links(0) . la(t("search"), array("mod" => "locale", "op" => "search")) ." · ". la(t("overview"), array("mod" => "locale", "op" => "overview")) ." · ". la(t("help"), array("mod" => "locale", "op" => "help")) ."</small><hr />\n"; switch ($op) { case "delete": diff --git a/modules/node.module b/modules/node.module index 7251d4fc2..9dd832fa3 100644 --- a/modules/node.module +++ b/modules/node.module @@ -414,10 +414,6 @@ function node_filter($text) { function node_link($type, $node = 0, $main = 0) { - if ($type == "admin" && user_access("administer nodes")) { - $links[] = la(t("content management"), array("mod" => "node")); - } - if ($type == "page") { $links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), "", array("title" => t("Submit or suggest new content."))); } @@ -436,46 +432,17 @@ function node_link($type, $node = 0, $main = 0) { } } - return $links ? $links : array(); -} - -function node_admin_settings($edit = array()) { - global $op; - - if ($op == t("Save configuration")) { - /* - ** Save the configuration options: - */ - - foreach ($edit as $name => $value) { - variable_set($name, $value); - } - } - - if ($op == t("Reset to defaults")) { - /* - ** Reset the configuration options to their default value: - */ - - foreach ($edit as $name => $value) { - variable_del($name); - } - } - - $output .= "<h3>". t("Global node settings") ."</h3>"; - $output .= node_conf_options(); + if ($type = "admin" && user_access("administer nodes")) { + $search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'."; - foreach (module_list() as $name) { - if (module_hook($name, "conf_options") && module_hook($name, "node")) { - $output .= "<h3>". t("%module settings", array("%module" => ucfirst(module_invoke($name, "node", "name")))) ."</h3>"; - $output .= module_invoke($name, "conf_options"); - } + menu_add("content management", "admin.php?mod=node", "Content management.", NULL, NULL); + menu_add("new or updated posts", "admin.php?mod=node&op=nodes&query=0", "Display all new or updated posts.", NULL, "content management", 0, 1); + menu_add("posts that await approval", "admin.php?mod=node&op=nodes&query=1", "Display posts that await approval.", NULL, "content management", 0, 1); + menu_add("search content", "admin.php?mod=node&op=search", "Search a post.", $search, "content management", 5); + menu_add("help", "admin.php?mod=node&op=help", "More information about content management.", NULL, "content management", 7); } - $output .= form_submit(t("Save configuration")); - $output .= form_submit(t("Reset to defaults")); - - return form($output); + return $links ? $links : array(); } function node_admin_edit($node) { @@ -521,15 +488,9 @@ function node_admin_edit($node) { function node_admin_nodes() { global $query; - $queries = array(array("ORDER BY n.created DESC", "new nodes"), array("ORDER BY n.changed DESC", "updated nodes"), array("WHERE n.status = 1 AND n.moderate = 0 ORDER BY n.nid DESC", "published nodes"), array("WHERE n.status = 0 AND n.moderate = 0 ORDER BY n.nid DESC", "non-published nodes"), array("WHERE n.status = 1 AND n.moderate = 1 ORDER BY n.nid DESC", "pending nodes"), array("WHERE n.status = 1 AND n.promote = 1 ORDER BY n.nid DESC", "promoted nodes")); - - $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0], 50); - - foreach ($queries as $key => $value) { - $links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key)); - } + $queries = array("ORDER BY n.changed DESC", "WHERE n.status = 0 OR n.moderate = 1 ORDER BY n.changed DESC"); - $output .= "<small>". implode(" :: ", $links) ."</small><hr />"; + $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 0], 50); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; $output .= " <tr><th>". t("title") ."</th><th>". t("type") ."</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n"; @@ -651,13 +612,6 @@ function node_admin() { ** Compile a list of the administrative links: */ - $links[] = la(t("nodes"), array("mod" => "node", "op" => "nodes")); - $links[] = la(t("search content"), array("mod" => "node", "op" => "search")); - $links[] = la(t("settings"), array("mod" => "node", "op" => "settings")); - $links[] = la(t("help"), array("mod" => "node", "op" => "help")); - - print "<small>". implode(" · ", $links) ."</small><hr />"; - switch ($op) { case "help": print node_help(); @@ -665,11 +619,6 @@ function node_admin() { case "search": print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin")); break; - case t("Save configuration"): - case t("Reset to defaults"): - case "settings": - print node_admin_settings($edit); - break; case "edit": print node_admin_edit($id); break; diff --git a/modules/node/node.module b/modules/node/node.module index 7251d4fc2..9dd832fa3 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -414,10 +414,6 @@ function node_filter($text) { function node_link($type, $node = 0, $main = 0) { - if ($type == "admin" && user_access("administer nodes")) { - $links[] = la(t("content management"), array("mod" => "node")); - } - if ($type == "page") { $links[] = lm(t("submit"), array("mod" => "node", "op" => "add"), "", array("title" => t("Submit or suggest new content."))); } @@ -436,46 +432,17 @@ function node_link($type, $node = 0, $main = 0) { } } - return $links ? $links : array(); -} - -function node_admin_settings($edit = array()) { - global $op; - - if ($op == t("Save configuration")) { - /* - ** Save the configuration options: - */ - - foreach ($edit as $name => $value) { - variable_set($name, $value); - } - } - - if ($op == t("Reset to defaults")) { - /* - ** Reset the configuration options to their default value: - */ - - foreach ($edit as $name => $value) { - variable_del($name); - } - } - - $output .= "<h3>". t("Global node settings") ."</h3>"; - $output .= node_conf_options(); + if ($type = "admin" && user_access("administer nodes")) { + $search = "On this page you can search for a post. For example, one may search for 'br' and Drupal might return 'bread brakers', 'our daily bread' and 'brenda'."; - foreach (module_list() as $name) { - if (module_hook($name, "conf_options") && module_hook($name, "node")) { - $output .= "<h3>". t("%module settings", array("%module" => ucfirst(module_invoke($name, "node", "name")))) ."</h3>"; - $output .= module_invoke($name, "conf_options"); - } + menu_add("content management", "admin.php?mod=node", "Content management.", NULL, NULL); + menu_add("new or updated posts", "admin.php?mod=node&op=nodes&query=0", "Display all new or updated posts.", NULL, "content management", 0, 1); + menu_add("posts that await approval", "admin.php?mod=node&op=nodes&query=1", "Display posts that await approval.", NULL, "content management", 0, 1); + menu_add("search content", "admin.php?mod=node&op=search", "Search a post.", $search, "content management", 5); + menu_add("help", "admin.php?mod=node&op=help", "More information about content management.", NULL, "content management", 7); } - $output .= form_submit(t("Save configuration")); - $output .= form_submit(t("Reset to defaults")); - - return form($output); + return $links ? $links : array(); } function node_admin_edit($node) { @@ -521,15 +488,9 @@ function node_admin_edit($node) { function node_admin_nodes() { global $query; - $queries = array(array("ORDER BY n.created DESC", "new nodes"), array("ORDER BY n.changed DESC", "updated nodes"), array("WHERE n.status = 1 AND n.moderate = 0 ORDER BY n.nid DESC", "published nodes"), array("WHERE n.status = 0 AND n.moderate = 0 ORDER BY n.nid DESC", "non-published nodes"), array("WHERE n.status = 1 AND n.moderate = 1 ORDER BY n.nid DESC", "pending nodes"), array("WHERE n.status = 1 AND n.promote = 1 ORDER BY n.nid DESC", "promoted nodes")); - - $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 1][0], 50); - - foreach ($queries as $key => $value) { - $links[] = la($value[1], array("mod" => "node", "op" => "nodes", "query" => $key)); - } + $queries = array("ORDER BY n.changed DESC", "WHERE n.status = 0 OR n.moderate = 1 ORDER BY n.changed DESC"); - $output .= "<small>". implode(" :: ", $links) ."</small><hr />"; + $result = pager_query("SELECT n.*, u.name, u.uid FROM node n LEFT JOIN users u ON n.uid = u.uid ". $queries[$query ? $query : 0], 50); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">\n"; $output .= " <tr><th>". t("title") ."</th><th>". t("type") ."</th><th>". t("author") ."</th><th>". t("status") ."</th><th colspan=\"2\">". t("operations") ."</th></tr>\n"; @@ -651,13 +612,6 @@ function node_admin() { ** Compile a list of the administrative links: */ - $links[] = la(t("nodes"), array("mod" => "node", "op" => "nodes")); - $links[] = la(t("search content"), array("mod" => "node", "op" => "search")); - $links[] = la(t("settings"), array("mod" => "node", "op" => "settings")); - $links[] = la(t("help"), array("mod" => "node", "op" => "help")); - - print "<small>". implode(" · ", $links) ."</small><hr />"; - switch ($op) { case "help": print node_help(); @@ -665,11 +619,6 @@ function node_admin() { case "search": print search_type("node", drupal_url(array("mod" => "node", "op" => "search"), "admin")); break; - case t("Save configuration"): - case t("Reset to defaults"): - case "settings": - print node_admin_settings($edit); - break; case "edit": print node_admin_edit($id); break; diff --git a/modules/statistics.module b/modules/statistics.module index 3b893ef86..f6460a10a 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -69,7 +69,7 @@ function statistics_perm() { /* ** statistics module defines the following permissions: ** administer statistics module - full administrative control of module - ** administer statistics - view statistics / referrers + ** administer statistics - view statistics / referrer log ** access statistics - see counts per node (if enabled) ** access userlist - see list of online users */ @@ -81,10 +81,6 @@ function statistics_perm() { function statistics_link($type, $node = 0, $main = 0) { global $id; - if ($type == "admin" && (user_access("administer statistics module") || (user_access("administer statistics")))) { - $links[] = la(t("statistics"), array("mod" => "statistics")); - } - if ($type == "node" && user_access("access statistics") && variable_get("statistics_display_counter", 0)) { $statistics = statistics_get($node->nid); if ($statistics) { @@ -104,6 +100,29 @@ function statistics_link($type, $node = 0, $main = 0) { } } + if ($type == "admin" && (user_access("administer statistics module") || (user_access("administer statistics")))) { + $help["statistics"] = "This page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your site is the most popular."; + $help["referrers"] = "This page shows you site-wide referrer statistics. You can see 'all referrers', 'external referrers' or 'internal referrers'. Defaults to 'external'."; + $help["access"] = "This pages shows you who is accessing your website. You can see the hostnames, referrers. In particular, it is easy to inspect a user's navigation history/trail by clicking the username."; + $help["top nodes page"] = "The statistics module creates a user page that can display summaries of the day's top viewed nodes, the all time top nodes and the last nodes viewed. Each of these summaries can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu."; + $help["top nodes block"] = "The statistics module exports a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear."; + $help["who is online block"] = "This statistics module exports a block that can display how many user's and guests are currently online. You can configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display."; + + menu_add("site monitoring", "admin.php?mod=statistics", "Monitor your site.", NULL, NULL, 2); + menu_add("popular posts", "admin.php?mod=statistics&op=statistics", "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1); + menu_add("referrer log", "admin.php?mod=statistics&op=referrers", "Display the referrers.", $help["referrers"], "site monitoring", 3, 1); + menu_add("view all referrers", "admin.php?mod=statistics&op=referrers&view=all", "Display all referrers.", $help["referrers"], "referre logs", 1); + menu_add("view internal referrers", "admin.php?mod=statistics&op=referrers&view=internal", "Display internal referrers.", $help["referrers"], "referrer log", 1); + menu_add("view external referrers", "admin.php?mod=statistics&op=referrers&view=external", "Display external referrers.", $help["referrers"], "referrer log", 1); + menu_add("access log", "admin.php?mod=statistics&op=log", "Display the access log.", $help["access"], "site monitoring", 4); + menu_add("configure 'top nodes' page", "admin.php?mod=statistics&op=top+nodes+page", "Configure the top node page.", $help["top nodes page"], "site monitoring", 5); + menu_add("help", "admin.php?mod=statistics&op=help", "More information about the statistics.", NULL, "site monitoring", 6); + + // block configuration: + menu_add("configure 'top nodes' block", "admin.php?mod=statistics&op=top+nodes+block", "Configure the 'top nodes block'", $help["top nodes block"], "block management"); + menu_add("configure 'who is online' block", "admin.php?mod=statistics&op=whos+online+block", "Configure the 'top nodes block'", $help["who is online block"], "block management"); + } + return $links ? $links : array(); } @@ -232,19 +251,6 @@ function statistics_admin() { /* Only allow people with sufficient access. */ if ((user_access("administer statistics module")) || (user_access("administer statistics"))) { - - /* Display the second level admin links */ - $links[] = la(t("view statistics"), array("mod" => "statistics", "op" => "statistics")); - $links[] = la(t("view referrers"), array("mod" => "statistics", "op" => "referrers")); - $links[] = la(t("view access log"), array("mod" => "statistics", "op" => "log")); - if (user_access("administer statistics module")) { - $links[] = la(t("top nodes block"), array("mod" => "statistics", "op" => "top nodes block")); - $links[] = la(t("top nodes page"), array("mod" => "statistics", "op" => "top nodes page")); - $links[] = la(t("who's online block"), array("mod" => "statistics", "op" => "whos online block")); - } - $links[] = la(t("help"), array("mod" => "statistics", "op" => "help")); - print "<small>". implode(" | ", $links) ."</small><hr />"; - /* non-configuration admin pages */ switch ($op) { case "help": @@ -391,12 +397,6 @@ function statistics_recent_refer($nid = 0) { $node = node_load(array("nid" => $nid)); - /* allow viewing of all, internal or external referrers */ - $links[] = la(t("all"), array("mod" => "statistics", "op" => "referrers", "view" => "all", "nid" => "$nid")); - $links[] = la(t("external"), array("mod" => "statistics", "op" => "referrers", "view" => "external", "nid" => "$nid")); - $links[] = la(t("internal"), array("mod" => "statistics", "op" => "referrers", "view" => "internal", "nid" => "$nid")); - print "<small>". implode(" :: ", $links) ."</small><hr />"; - if ($nid > 0) { if ($view == "all") { $query = "SELECT url,timestamp FROM accesslog WHERE nid='$nid' AND url <> '' ORDER BY timestamp DESC LIMIT 15"; diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 3b893ef86..f6460a10a 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -69,7 +69,7 @@ function statistics_perm() { /* ** statistics module defines the following permissions: ** administer statistics module - full administrative control of module - ** administer statistics - view statistics / referrers + ** administer statistics - view statistics / referrer log ** access statistics - see counts per node (if enabled) ** access userlist - see list of online users */ @@ -81,10 +81,6 @@ function statistics_perm() { function statistics_link($type, $node = 0, $main = 0) { global $id; - if ($type == "admin" && (user_access("administer statistics module") || (user_access("administer statistics")))) { - $links[] = la(t("statistics"), array("mod" => "statistics")); - } - if ($type == "node" && user_access("access statistics") && variable_get("statistics_display_counter", 0)) { $statistics = statistics_get($node->nid); if ($statistics) { @@ -104,6 +100,29 @@ function statistics_link($type, $node = 0, $main = 0) { } } + if ($type == "admin" && (user_access("administer statistics module") || (user_access("administer statistics")))) { + $help["statistics"] = "This page gives you an at-a-glance look at your top nodes. It is useful for understanding what content on your site is the most popular."; + $help["referrers"] = "This page shows you site-wide referrer statistics. You can see 'all referrers', 'external referrers' or 'internal referrers'. Defaults to 'external'."; + $help["access"] = "This pages shows you who is accessing your website. You can see the hostnames, referrers. In particular, it is easy to inspect a user's navigation history/trail by clicking the username."; + $help["top nodes page"] = "The statistics module creates a user page that can display summaries of the day's top viewed nodes, the all time top nodes and the last nodes viewed. Each of these summaries can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu."; + $help["top nodes block"] = "The statistics module exports a block that can display the day's top viewed nodes, the all time top viewed nodes and the last nodes viewed. Each of these links can be enabled or disabled individually, and the number of nodes displayed for each can be configured with a drop down menu. If you disable all sections of this block, it will not appear."; + $help["who is online block"] = "This statistics module exports a block that can display how many user's and guests are currently online. You can configure the name of the block, the name of a sub-block for displaying names of user's currently online, how recently a user must have been active to be considered online, the maximum characters to display from a user's name and the maximum number of user names to display."; + + menu_add("site monitoring", "admin.php?mod=statistics", "Monitor your site.", NULL, NULL, 2); + menu_add("popular posts", "admin.php?mod=statistics&op=statistics", "Display the top nodes.", $help["statistics"], "site monitoring", 2, 1); + menu_add("referrer log", "admin.php?mod=statistics&op=referrers", "Display the referrers.", $help["referrers"], "site monitoring", 3, 1); + menu_add("view all referrers", "admin.php?mod=statistics&op=referrers&view=all", "Display all referrers.", $help["referrers"], "referre logs", 1); + menu_add("view internal referrers", "admin.php?mod=statistics&op=referrers&view=internal", "Display internal referrers.", $help["referrers"], "referrer log", 1); + menu_add("view external referrers", "admin.php?mod=statistics&op=referrers&view=external", "Display external referrers.", $help["referrers"], "referrer log", 1); + menu_add("access log", "admin.php?mod=statistics&op=log", "Display the access log.", $help["access"], "site monitoring", 4); + menu_add("configure 'top nodes' page", "admin.php?mod=statistics&op=top+nodes+page", "Configure the top node page.", $help["top nodes page"], "site monitoring", 5); + menu_add("help", "admin.php?mod=statistics&op=help", "More information about the statistics.", NULL, "site monitoring", 6); + + // block configuration: + menu_add("configure 'top nodes' block", "admin.php?mod=statistics&op=top+nodes+block", "Configure the 'top nodes block'", $help["top nodes block"], "block management"); + menu_add("configure 'who is online' block", "admin.php?mod=statistics&op=whos+online+block", "Configure the 'top nodes block'", $help["who is online block"], "block management"); + } + return $links ? $links : array(); } @@ -232,19 +251,6 @@ function statistics_admin() { /* Only allow people with sufficient access. */ if ((user_access("administer statistics module")) || (user_access("administer statistics"))) { - - /* Display the second level admin links */ - $links[] = la(t("view statistics"), array("mod" => "statistics", "op" => "statistics")); - $links[] = la(t("view referrers"), array("mod" => "statistics", "op" => "referrers")); - $links[] = la(t("view access log"), array("mod" => "statistics", "op" => "log")); - if (user_access("administer statistics module")) { - $links[] = la(t("top nodes block"), array("mod" => "statistics", "op" => "top nodes block")); - $links[] = la(t("top nodes page"), array("mod" => "statistics", "op" => "top nodes page")); - $links[] = la(t("who's online block"), array("mod" => "statistics", "op" => "whos online block")); - } - $links[] = la(t("help"), array("mod" => "statistics", "op" => "help")); - print "<small>". implode(" | ", $links) ."</small><hr />"; - /* non-configuration admin pages */ switch ($op) { case "help": @@ -391,12 +397,6 @@ function statistics_recent_refer($nid = 0) { $node = node_load(array("nid" => $nid)); - /* allow viewing of all, internal or external referrers */ - $links[] = la(t("all"), array("mod" => "statistics", "op" => "referrers", "view" => "all", "nid" => "$nid")); - $links[] = la(t("external"), array("mod" => "statistics", "op" => "referrers", "view" => "external", "nid" => "$nid")); - $links[] = la(t("internal"), array("mod" => "statistics", "op" => "referrers", "view" => "internal", "nid" => "$nid")); - print "<small>". implode(" :: ", $links) ."</small><hr />"; - if ($nid > 0) { if ($view == "all") { $query = "SELECT url,timestamp FROM accesslog WHERE nid='$nid' AND url <> '' ORDER BY timestamp DESC LIMIT 15"; diff --git a/modules/system.module b/modules/system.module index ca580d7f8..1f4054995 100644 --- a/modules/system.module +++ b/modules/system.module @@ -9,7 +9,7 @@ function system_help() { } function system_system($field){ - $system["description"] = t("Configuration system that lets site admins modify the workings of the site."); + $system["description"] = t("Configuration system that lets administrators modify the workings of the site."); return $system[$field]; } @@ -34,10 +34,13 @@ function system_perm() { function system_link($type) { if ($type == "admin" && user_access("administer site configuration")) { - $links[] = la(t("site configuration"), array("mod" => "system")); + menu_add("site configuration", "admin.php?mod=system", "Site configuration.", NULL, NULL, 2); + menu_add("site settings", "admin.php?mod=system&op=options", "Site settings.", NULL, "site configuration", 1); + menu_add("content filters", "admin.php?mod=system&op=filters", "Content filters.", NULL, "site configuration", 2); + menu_add("module selector", "admin.php?mod=system&op=modules", "Module selector.", NULL, "site configuration", 3); + menu_add("theme selector", "admin.php?mod=system&op=themes", "Theme selector.", NULL, "site configuration", 4); + menu_add("help", "admin.php?mod=system&op=help", "Help.", NULL, "site configuration", 9); } - - return $links ? $links : array(); } function system_view_options() { @@ -123,7 +126,7 @@ function system_default($edit = array()) { function system_view($type) { switch ($type) { - case "filter": + case "filters": $form = system_view_filters(); break; default: @@ -221,10 +224,8 @@ function system_listing($type, $directory, $required = array()) { function system_admin() { global $edit, $op, $type; - if (user_access("administer site configuration")) { - - print "<small>". la(t("site settings"), array("mod" => "system", "type" => "options")) ." - ". la(t("content filters"), array("mod" => "system", "type" => "filter")) ." - ". la(t("modules"), array("mod" => "system", "op" => "modules")) ." - ". la(t("themes"), array("mod" => "system", "op" => "themes")) ." - ". la(t("help"), array("mod" => "system", "op" => "help")) ."</small><hr />\n"; + if (user_access("administer site configuration")) { switch ($op) { case "help": print system_help(); @@ -260,7 +261,7 @@ function system_admin() { cache_clear_all(); break; default: - print system_view($type); + print system_view($op); } } else { diff --git a/modules/system/system.module b/modules/system/system.module index ca580d7f8..1f4054995 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -9,7 +9,7 @@ function system_help() { } function system_system($field){ - $system["description"] = t("Configuration system that lets site admins modify the workings of the site."); + $system["description"] = t("Configuration system that lets administrators modify the workings of the site."); return $system[$field]; } @@ -34,10 +34,13 @@ function system_perm() { function system_link($type) { if ($type == "admin" && user_access("administer site configuration")) { - $links[] = la(t("site configuration"), array("mod" => "system")); + menu_add("site configuration", "admin.php?mod=system", "Site configuration.", NULL, NULL, 2); + menu_add("site settings", "admin.php?mod=system&op=options", "Site settings.", NULL, "site configuration", 1); + menu_add("content filters", "admin.php?mod=system&op=filters", "Content filters.", NULL, "site configuration", 2); + menu_add("module selector", "admin.php?mod=system&op=modules", "Module selector.", NULL, "site configuration", 3); + menu_add("theme selector", "admin.php?mod=system&op=themes", "Theme selector.", NULL, "site configuration", 4); + menu_add("help", "admin.php?mod=system&op=help", "Help.", NULL, "site configuration", 9); } - - return $links ? $links : array(); } function system_view_options() { @@ -123,7 +126,7 @@ function system_default($edit = array()) { function system_view($type) { switch ($type) { - case "filter": + case "filters": $form = system_view_filters(); break; default: @@ -221,10 +224,8 @@ function system_listing($type, $directory, $required = array()) { function system_admin() { global $edit, $op, $type; - if (user_access("administer site configuration")) { - - print "<small>". la(t("site settings"), array("mod" => "system", "type" => "options")) ." - ". la(t("content filters"), array("mod" => "system", "type" => "filter")) ." - ". la(t("modules"), array("mod" => "system", "op" => "modules")) ." - ". la(t("themes"), array("mod" => "system", "op" => "themes")) ." - ". la(t("help"), array("mod" => "system", "op" => "help")) ."</small><hr />\n"; + if (user_access("administer site configuration")) { switch ($op) { case "help": print system_help(); @@ -260,7 +261,7 @@ function system_admin() { cache_clear_all(); break; default: - print system_view($type); + print system_view($op); } } else { diff --git a/modules/taxonomy.module b/modules/taxonomy.module index bdc39bf01..44532589d 100644 --- a/modules/taxonomy.module +++ b/modules/taxonomy.module @@ -45,10 +45,13 @@ function taxonomy_perm() { function taxonomy_link($type) { if ($type == "admin" && user_access("administer taxonomy")) { - $links[] = la(t("taxonomy"), array("mod" => "taxonomy")); - } + $help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically)."; + $help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories."; - return $links ? $links : array(); + menu_add("taxonomy", "admin.php?mod=taxonomy", "Administer taxonomies.", $help["taxonomy"], "content management"); + menu_add("add new vocabulary", "admin.php?mod=taxonomy&op=add&type=vocabulary", "Add a new vocabulary.", $help["vocabulary"], "taxonomy"); + menu_add("help", "admin.php?mod=taxonomy&op=help", "More information about taxonomies.", NULL, "taxonomy", 9); + } } /* @@ -652,12 +655,6 @@ function taxonomy_admin() { global $edit, $type, $op, $id, $theme; if (user_access("administer taxonomy")) { - $links[] = la(t("add new vocabulary"), array("mod" => "taxonomy", "op" => "add", "type" => "vocabulary")); - $links[] = la(t("overview"), array("mod" => "taxonomy")); - $links[] = la(t("help"), array("mod" => "taxonomy", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr>\n"; - switch ($op) { case "add": if ($type == "vocabulary") { diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index bdc39bf01..44532589d 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -45,10 +45,13 @@ function taxonomy_perm() { function taxonomy_link($type) { if ($type == "admin" && user_access("administer taxonomy")) { - $links[] = la(t("taxonomy"), array("mod" => "taxonomy")); - } + $help["taxonomy"] = "The taxonomy module allows you to classify post into categories and subcategories; it allows multiple lists of categories for classification (controlled vocabularies) and offers the possibility of creating thesauri (controlled vocabularies that indicate the relationship of terms) and taxonomies (controlled vocabularies where relationships are indicated hierarchically)."; + $help["vocabulary"] = "When you create a controlled vocabulary you are creating a set of terms to use for describing content (known as descriptors in indexing lingo). Drupal allows you to describe each node of content (blog, story, etc.) using one or many of these terms. For simple implementations, you might create a set of categories without subcategories, similar to Slashdot.org's or Kuro5hin.org's sections. For more complex implementations, you might create a hierarchical list of categories."; - return $links ? $links : array(); + menu_add("taxonomy", "admin.php?mod=taxonomy", "Administer taxonomies.", $help["taxonomy"], "content management"); + menu_add("add new vocabulary", "admin.php?mod=taxonomy&op=add&type=vocabulary", "Add a new vocabulary.", $help["vocabulary"], "taxonomy"); + menu_add("help", "admin.php?mod=taxonomy&op=help", "More information about taxonomies.", NULL, "taxonomy", 9); + } } /* @@ -652,12 +655,6 @@ function taxonomy_admin() { global $edit, $type, $op, $id, $theme; if (user_access("administer taxonomy")) { - $links[] = la(t("add new vocabulary"), array("mod" => "taxonomy", "op" => "add", "type" => "vocabulary")); - $links[] = la(t("overview"), array("mod" => "taxonomy")); - $links[] = la(t("help"), array("mod" => "taxonomy", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr>\n"; - switch ($op) { case "add": if ($type == "vocabulary") { diff --git a/modules/user.module b/modules/user.module index d56e4f514..95f348179 100644 --- a/modules/user.module +++ b/modules/user.module @@ -393,7 +393,34 @@ function user_link($type) { } if ($type == "admin" && user_access("administer users")) { - $links[] = la(t("user management"), array("mod" => "user")); + $help["user"] = "Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account. There is several configuration pages that help administrators manage user accounts."; + $help["create"] = "If your site is completely private, and doesn't allow public registration, then you can add new users manually. This web page allows administrator to register a new users."; + $help["view"] = "This page allows you to review and edit any user's profile."; + $help["access"] = "Access rules enable administrators to filter out usernames and e-mail addresses which are not allowed in Drupal. An administrator creates a 'mask' against which each new registration is checked. Disallowed names and e-mail addresses are denied access to the site."; + $help["permission"] = "Each user role has certain things that its users are allowed to do, and some that are disallowed. For example, authenticated users may usually post a story but anonymous users may not. Each permission describes a fine-grained logical operation such as access administration pages or add and modify user accounts. You could say a permission represents access granted to a user to perform a set of operations."; + $help["role"] = "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users which have certain privileges. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. By default, Drupal comes with two user roles: <ul><li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li><li>Registered user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li></ul>"; + $help["search"] = "On this page you can query any username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."; + $help["setting"] = "Administrators may choose to restrict registration to their site. That restriction may be accomplished on this page. Also, the list of words which may be included in a system generated password is also listed on this page. Drupal generates passwords by joining small words from the password list until the new password is greater than 6 characters."; + + menu_add("user management", "admin.php?mod=user", "User management", $help["user"]); + menu_add("create new account", "admin.php?mod=user&op=create", "Create a new user account.", $help["create"], "user management", 1); + menu_add("view user accounts", "admin.php?mod=user&op=account", "Display user account listings.", $help["view"], "user management", 2, 1); + menu_add("access rules", "admin.php?mod=user&op=access", "Configure access rules.", $help["access"], "user management", 3); + menu_add("e-mail rules", "admin.php?mod=user&op=access&type=mail", "Allow or deny certain e-mail addresses.", $help["access"], "access rules"); + menu_add("username rules", "admin.php?mod=user&op=access&type=user", "Allow or deny certain usernames.", $help["access"], "access rules"); + menu_add("user roles", "admin.php?mod=user&op=role", "Configure user roles.", $help["role"], "user management", 4); + menu_add("user permissions", "admin.php?mod=user&op=permission", "Configure user permissions.", $help["permission"], "user management", 5); + menu_add("search account", "admin.php?mod=user&op=search", "Search a user account.", $help["search"], "user management", 5); + menu_add("help", "admin.php?mod=user&op=help", "More information about user management.", NULL, "user management", 7); + + menu_add("active users", "admin.php?mod=user&op=account&query=0", t("Active users."), $help["view"], "view user accounts", 1); + menu_add("new users", "admin.php?mod=user&op=account&query=1", t("New users."), $help["view"], "view user accounts", 2); + menu_add("blocked users", "admin.php?mod=user&op=account&query=2", t("Blocked users."), $help["view"], "view user accounts", 3); + + $i = 3; + foreach (user_roles(1) as $key => $value) { + menu_add("users with role '$value'", "admin.php?mod=user&op=account&query=". $i++, NULL, $help["view"], "view user accounts", 4); + } } return $links ? $links : array(); @@ -810,7 +837,7 @@ function user_register($edit = array()) { $affiliates = implode(", ", $affiliates); $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". lm("login now", array("mod" => "user", "op" => "login")) ." instead of registering.", array("%s" => $affiliates)) ."</p>"; } - $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate.")); foreach (module_list() as $module) { if (module_hook($module, "user")) { @@ -924,7 +951,7 @@ function user_edit($edit = array()) { $edit = object2array($user); } - $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); foreach (module_list() as $module) { @@ -940,7 +967,7 @@ function user_edit($edit = array()) { $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date("l, F dS, Y - h:i A", time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Timezone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your timezone settings will be set appropriate.")); + $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); $output .= form_select(t("Language"), "language", $edit["language"], $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); @@ -1086,33 +1113,6 @@ function user_conf_options() { return $output; } -function user_admin_settings($edit = array()) { - global $op; - - if ($op == t("Save configuration")) { - /* - ** Save the configuration options: - */ - - foreach ($edit as $name => $value) variable_set($name, $value); - } - - if ($op == t("Reset to defaults")) { - /* - ** Reset the configuration options to their default value: - */ - - foreach ($edit as $name=>$value) variable_del($name); - } - - $output .= user_conf_options(); - $output .= form_submit(t("Save configuration")); - $output .= form_submit(t("Reset to defaults")); - - return form($output); - -} - function user_admin_create($edit = array()) { if ($edit["name"] || $edit["mail"]) { @@ -1159,13 +1159,15 @@ function user_admin_create($edit = array()) { function user_admin_access($edit = array()) { global $op, $id, $type; - $output .= "<small>". la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail")) ." :: ". la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user")) ."</small><hr />"; // irc rules, too! + if (empty($type)) { + return; + } - if ($type != "user") { + if ($type == "mail") { $output .= "<h3>" . t("E-mail rules") . "</h3>"; - $type = "mail"; } - else { + + if ($type == "user") { $output .= "<h3>" . t("Username rules") . "</h3>"; } @@ -1418,7 +1420,7 @@ function user_admin_edit($edit = array()) { */ $output .= form_item(t("User ID"), check_output($account->uid)); - $output .= form_textfield(t("Username"), "name", $account->name, 30, 55, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $account->name, 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $account->mail, 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); foreach (module_list() as $module) { @@ -1433,7 +1435,7 @@ function user_admin_edit($edit = array()) { } $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date("l, F dS, Y - h:i A", time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Timezone"), "timezone", $account->timezone, $zones, t("Select what time you currently have and your timezone settings will be set appropriate.")); + $output .= form_select(t("Time zone"), "timezone", $account->timezone, $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); $output .= form_select(t("Language"), "language", $account->language, $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter a new password twice if you want to change the current password for this user or leave it blank if you are happy with the current password.")); $output .= form_select(t("Status"), "status", $account->status, array(t("Blocked"), t("Active"))); @@ -1455,18 +1457,12 @@ function user_admin_edit($edit = array()) { function user_admin_account() { global $query; - $queries = array(array("ORDER BY timestamp DESC", t("active users")), array("ORDER BY u.uid DESC", t("new users")), array("WHERE status = 0 ORDER BY u.uid DESC", t("blocked users"))); + $queries = array("ORDER BY timestamp DESC", "ORDER BY u.uid DESC", "WHERE status = 0 ORDER BY u.uid DESC"); foreach (user_roles(1) as $key => $value) { - $queries[] = array("WHERE r.name = '$value' ORDER BY u.uid DESC", $value . "s"); + $queries[] = "WHERE r.name = '$value' ORDER BY u.uid DESC"; } - $result = db_query("SELECT u.uid, u.name, u.timestamp FROM users u LEFT JOIN role r ON u.rid = r.rid ". $queries[$query ? $query : 0][0] ." LIMIT 50"); - - foreach ($queries as $key => $value) { - $links[] = la($value[1], array("mod" => "user", "op" => "account", "query" => $key)); - } - - $output .= "<small>". implode(" :: ", $links) ."</small><hr />"; + $result = db_query("SELECT u.uid, u.name, u.timestamp FROM users u LEFT JOIN role r ON u.rid = r.rid ". $queries[$query ? $query : 0] ." LIMIT 50"); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; $output .= " <tr><th>" . t("username") . "</th><th>" . t("last access") . "</th><th>" . t("operations") . "</th></tr>"; @@ -1501,21 +1497,6 @@ function user_admin() { user_role_init(); - /* - ** Compile a list of the administrative links: - */ - - $links[] = la(t("add new user"), array("mod" => "user", "op" => "create")); - $links[] = la(t("access rules"), array("mod" => "user", "op" => "access")); - $links[] = la(t("user accounts"), array("mod" => "user", "op" => "account")); - $links[] = la(t("user roles"), array("mod" => "user", "op" => "role")); - $links[] = la(t("user permissions"), array("mod" => "user", "op" => "permission")); - $links[] = la(t("search account"), array("mod" => "user", "op" => "search")); - $links[] = la(t("settings"), array("mod" => "user", "op" => "settings")); - $links[] = la(t("help"), array("mod" => "user", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": print user_help(); @@ -1523,11 +1504,6 @@ function user_admin() { case "search": print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin")); break; - case t("Save configuration"): - case t("Reset to defaults"): - case "settings": - print user_admin_settings($edit); - break; case t("Add rule"): case t("Check"): case "access": @@ -1642,83 +1618,10 @@ function user_help_admin() { utilizing their own preferences for how the pages are structured, how navigation lists and other page components are presented and much more. <br /> </p> -<h3>User administration</h3> -<p>Administrators manage user accounts by clicking on the <i>User management</i> link in - their Admin interface. There, you will find several configuration pages and - reports which help you manage your users. The following pages are available:</p> - -<h4>Add new user</h4> -<p>If your site is completely private, and doesn't allow registration for - any old web user (see <a href="#settings">settings</a> for this feature), then - you'll need to add new users manually. This web page allows any administrator - to register a new user.</p> -<h4>Access rules<a name="access"></a></h4> -<p>Access rules enable administrators to filter out usernames and e-mail addresses - which are not allowed in Drupal. An administrator creates a 'mask' against which - each new registration is checked. Disallowed names and e-mail addresses are denied - access to the site. Another handy use for this page is to disallow registration - to your site from an untrusted external authentication server. Just add their - server address to the username mask section and you've effectively blocked all - logins from that server.</p> -<p>To do describe access rules you can use the following wild-card characters:</p> - <ul> - <li> % : matches any number of characters, including zero characters.</li> - <li> _ : matches exactly one character.</li> - </ul> -<p><u>Examples:</u></p> - <ul> - <li>E-mail address bans <code>%@hotmail.com</code>, <code>%@altavista.%</code>, <code>%@usa.net</code>, etc. Used to prevent users from using free e-mail accounts, which might be used to cause trouble.</li> - <li>Username bans <code>root</code>, <code>webmaster</code>, <code>admin%</code>, etc. Used to prevent administrator impersonators.</li> - </ul> -<p>If no access rules are provided, access control is turned off and everybody will be able to access your website. The 'allow' rules are processed prior to the 'deny' rules and are thus considered to be stronger.</p> -<h4>User accounts</h4> -<p>This page is quite powerful. It allows an administrator to review any user's - profile. In addition, administrators may block any user, or assign him a <a href="#roles">role</a>, - using this page.</p> -<h4>User roles<a name="roles"></a></h4> -<p>Roles allow you to fine tune the security and administration of drupal. A role -defines a group of users which have certain privileges. Examples of roles -include: <I>anonymous user</I>, <I>authenticated user</I>, <I>moderator</I>, -<I>administrator</I> and so on. By default, Drupal comes with two commonly used -roles: -<ul> - <li>Anonymous user: this role is used for users that don't have a user account - or that are not authenticated. - <li>Registered user: this role is assigned automatically to authenticated users. - Most users will belong to this user role unless specified otherwise.</li> -</ul></p> -<p>These common roles will suffice for most sites. However, for a more complex site where you need to give several users different access privileges, you will - need to add a new role by clicking the "add new role" link. Then define what privileges that role will have by clicking the "permission overview" link and checking the appropriate boxes to give that role the permissions you desire. - <p>To attach a specific user to a role, use the "account" section of the drupal Administration. </p> - <p>Note: If you intend for a user to access certain sections of the administration - pages, they must have "access administration page" privileges. </p> -<h4>User permissions<a name="permissions"></a></h4> -<p>Each role has certain things that its users are allowed to do, and some that - are disallowed. For example, authenticated users may usually post a story but - Anonymous users may not. </p> -<p>Each permission describes a fine-grained logical operation such as <i>access administration pages</i> or <i>add and modify user accounts</i>. You could say a permission represents access granted to a user to perform a set of operations.</p> -<h4>Search account</h4> -<p>Search Account enables an admin to query for any username in the user table - and return users which match that query. For example, one may search for 'br' - and Drupal might return 'brian', 'brad', and 'brenda'.</p> -<h4>Settings<a name="settings"></a></h4> -<p>Administrators may choose to restrict registration to their site. That restriction - may be accomplished on this page. Also, the list of words which may be included - in a system generated password is also listed on this page. Drupal generates - passwords by joining small words from the password list until the new password - is greater than 6 characters.</p> -<h4>Active users - report</h4> -<p>All users sorted by most recent login.</p> -<h4>New users - report</h4> -<p>All users sorted by most recent registration</p> -<h4>Blocked users - report</h4> -<p>All users who have been blocked (status = 0) sorted by most recent registration</p> -<h4>Authenticated users, administrators, etc. - reports</h4> -<p>All <a href="#roles">roles</a> present a report listing their members</p> <h3>User preferences and profiles</h3> <p>Drupal comes with a set of user preferences and profile which a user may edit by clicking on the user account link. Of course, a user must be logged into reach those pages. - There, users will find a page for changing their preferred timezone, language, username, e-mail address, password, theme, signature, homepage, and <a href="#da">distributed authentication</a> names. + There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and <a href="#da">distributed authentication</a> names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in the Admin Center on behalf of their users.</p> <p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the <a href="http://www.drupal.org">Drupal Handbook</a>. For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>. </p> diff --git a/modules/user/user.module b/modules/user/user.module index d56e4f514..95f348179 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -393,7 +393,34 @@ function user_link($type) { } if ($type == "admin" && user_access("administer users")) { - $links[] = la(t("user management"), array("mod" => "user")); + $help["user"] = "Drupal allows users to register, login, logout, maintain user profiles, etc. No participant can use his own name to post content until he signs up for a user account. There is several configuration pages that help administrators manage user accounts."; + $help["create"] = "If your site is completely private, and doesn't allow public registration, then you can add new users manually. This web page allows administrator to register a new users."; + $help["view"] = "This page allows you to review and edit any user's profile."; + $help["access"] = "Access rules enable administrators to filter out usernames and e-mail addresses which are not allowed in Drupal. An administrator creates a 'mask' against which each new registration is checked. Disallowed names and e-mail addresses are denied access to the site."; + $help["permission"] = "Each user role has certain things that its users are allowed to do, and some that are disallowed. For example, authenticated users may usually post a story but anonymous users may not. Each permission describes a fine-grained logical operation such as access administration pages or add and modify user accounts. You could say a permission represents access granted to a user to perform a set of operations."; + $help["role"] = "Roles allow you to fine tune the security and administration of drupal. A role defines a group of users which have certain privileges. Examples of roles include: anonymous user, authenticated user, moderator, administrator and so on. By default, Drupal comes with two user roles: <ul><li>Anonymous user: this role is used for users that don't have a user account or that are not authenticated.</li><li>Registered user: this role is assigned automatically to authenticated users. Most registered users will belong to this user role unless specified otherwise.</li></ul>"; + $help["search"] = "On this page you can query any username. For example, one may search for 'br' and Drupal might return 'brian', 'brad', and 'brenda'."; + $help["setting"] = "Administrators may choose to restrict registration to their site. That restriction may be accomplished on this page. Also, the list of words which may be included in a system generated password is also listed on this page. Drupal generates passwords by joining small words from the password list until the new password is greater than 6 characters."; + + menu_add("user management", "admin.php?mod=user", "User management", $help["user"]); + menu_add("create new account", "admin.php?mod=user&op=create", "Create a new user account.", $help["create"], "user management", 1); + menu_add("view user accounts", "admin.php?mod=user&op=account", "Display user account listings.", $help["view"], "user management", 2, 1); + menu_add("access rules", "admin.php?mod=user&op=access", "Configure access rules.", $help["access"], "user management", 3); + menu_add("e-mail rules", "admin.php?mod=user&op=access&type=mail", "Allow or deny certain e-mail addresses.", $help["access"], "access rules"); + menu_add("username rules", "admin.php?mod=user&op=access&type=user", "Allow or deny certain usernames.", $help["access"], "access rules"); + menu_add("user roles", "admin.php?mod=user&op=role", "Configure user roles.", $help["role"], "user management", 4); + menu_add("user permissions", "admin.php?mod=user&op=permission", "Configure user permissions.", $help["permission"], "user management", 5); + menu_add("search account", "admin.php?mod=user&op=search", "Search a user account.", $help["search"], "user management", 5); + menu_add("help", "admin.php?mod=user&op=help", "More information about user management.", NULL, "user management", 7); + + menu_add("active users", "admin.php?mod=user&op=account&query=0", t("Active users."), $help["view"], "view user accounts", 1); + menu_add("new users", "admin.php?mod=user&op=account&query=1", t("New users."), $help["view"], "view user accounts", 2); + menu_add("blocked users", "admin.php?mod=user&op=account&query=2", t("Blocked users."), $help["view"], "view user accounts", 3); + + $i = 3; + foreach (user_roles(1) as $key => $value) { + menu_add("users with role '$value'", "admin.php?mod=user&op=account&query=". $i++, NULL, $help["view"], "view user accounts", 4); + } } return $links ? $links : array(); @@ -810,7 +837,7 @@ function user_register($edit = array()) { $affiliates = implode(", ", $affiliates); $output .= "<p>" . t("Note: If you have an account with one of our affiliates (%s), you may ". lm("login now", array("mod" => "user", "op" => "login")) ." instead of registering.", array("%s" => $affiliates)) ."</p>"; } - $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 64, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 64, t("A password and instructions will be sent to this e-mail address, so make sure it is accurate.")); foreach (module_list() as $module) { if (module_hook($module, "user")) { @@ -924,7 +951,7 @@ function user_edit($edit = array()) { $edit = object2array($user); } - $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $edit["name"], 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $edit["mail"], 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); foreach (module_list() as $module) { @@ -940,7 +967,7 @@ function user_edit($edit = array()) { $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date("l, F dS, Y - h:i A", time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Timezone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your timezone settings will be set appropriate.")); + $output .= form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); $output .= form_select(t("Language"), "language", $edit["language"], $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter your new password twice if you want to change your current password or leave it blank if you are happy with your current password.")); $output .= form_submit(t("Save user information")); @@ -1086,33 +1113,6 @@ function user_conf_options() { return $output; } -function user_admin_settings($edit = array()) { - global $op; - - if ($op == t("Save configuration")) { - /* - ** Save the configuration options: - */ - - foreach ($edit as $name => $value) variable_set($name, $value); - } - - if ($op == t("Reset to defaults")) { - /* - ** Reset the configuration options to their default value: - */ - - foreach ($edit as $name=>$value) variable_del($name); - } - - $output .= user_conf_options(); - $output .= form_submit(t("Save configuration")); - $output .= form_submit(t("Reset to defaults")); - - return form($output); - -} - function user_admin_create($edit = array()) { if ($edit["name"] || $edit["mail"]) { @@ -1159,13 +1159,15 @@ function user_admin_create($edit = array()) { function user_admin_access($edit = array()) { global $op, $id, $type; - $output .= "<small>". la(t("e-mail rules"), array("mod" => "user", "op" => "access", "type" => "mail")) ." :: ". la(t("username rules"), array("mod" => "user", "op" => "access", "type" => "user")) ."</small><hr />"; // irc rules, too! + if (empty($type)) { + return; + } - if ($type != "user") { + if ($type == "mail") { $output .= "<h3>" . t("E-mail rules") . "</h3>"; - $type = "mail"; } - else { + + if ($type == "user") { $output .= "<h3>" . t("Username rules") . "</h3>"; } @@ -1418,7 +1420,7 @@ function user_admin_edit($edit = array()) { */ $output .= form_item(t("User ID"), check_output($account->uid)); - $output .= form_textfield(t("Username"), "name", $account->name, 30, 55, t("Your full name or your prefered username: only letters, numbers and spaces are allowed.")); + $output .= form_textfield(t("Username"), "name", $account->name, 30, 55, t("Your full name or your preferred username: only letters, numbers and spaces are allowed.")); $output .= form_textfield(t("E-mail address"), "mail", $account->mail, 30, 55, t("Insert a valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.")); foreach (module_list() as $module) { @@ -1433,7 +1435,7 @@ function user_admin_edit($edit = array()) { } $output .= form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site.")); for ($zone = -43200; $zone <= 46800; $zone += 3600) $zones[$zone] = date("l, F dS, Y - h:i A", time() - date("Z") + $zone) ." (GMT ". $zone / 3600 .")"; - $output .= form_select(t("Timezone"), "timezone", $account->timezone, $zones, t("Select what time you currently have and your timezone settings will be set appropriate.")); + $output .= form_select(t("Time zone"), "timezone", $account->timezone, $zones, t("Select what time you currently have and your time zone settings will be set appropriate.")); $output .= form_select(t("Language"), "language", $account->language, $languages, t("Selecting a different language will change the language of the site.")); $output .= form_item(t("Password"), "<input type=\"password\" name=\"edit[pass1]\" size=\"12\" maxlength=\"24\" /> <input type=\"password\" name=\"edit[pass2]\" size=\"12\" maxlength=\"24\" />", t("Enter a new password twice if you want to change the current password for this user or leave it blank if you are happy with the current password.")); $output .= form_select(t("Status"), "status", $account->status, array(t("Blocked"), t("Active"))); @@ -1455,18 +1457,12 @@ function user_admin_edit($edit = array()) { function user_admin_account() { global $query; - $queries = array(array("ORDER BY timestamp DESC", t("active users")), array("ORDER BY u.uid DESC", t("new users")), array("WHERE status = 0 ORDER BY u.uid DESC", t("blocked users"))); + $queries = array("ORDER BY timestamp DESC", "ORDER BY u.uid DESC", "WHERE status = 0 ORDER BY u.uid DESC"); foreach (user_roles(1) as $key => $value) { - $queries[] = array("WHERE r.name = '$value' ORDER BY u.uid DESC", $value . "s"); + $queries[] = "WHERE r.name = '$value' ORDER BY u.uid DESC"; } - $result = db_query("SELECT u.uid, u.name, u.timestamp FROM users u LEFT JOIN role r ON u.rid = r.rid ". $queries[$query ? $query : 0][0] ." LIMIT 50"); - - foreach ($queries as $key => $value) { - $links[] = la($value[1], array("mod" => "user", "op" => "account", "query" => $key)); - } - - $output .= "<small>". implode(" :: ", $links) ."</small><hr />"; + $result = db_query("SELECT u.uid, u.name, u.timestamp FROM users u LEFT JOIN role r ON u.rid = r.rid ". $queries[$query ? $query : 0] ." LIMIT 50"); $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">"; $output .= " <tr><th>" . t("username") . "</th><th>" . t("last access") . "</th><th>" . t("operations") . "</th></tr>"; @@ -1501,21 +1497,6 @@ function user_admin() { user_role_init(); - /* - ** Compile a list of the administrative links: - */ - - $links[] = la(t("add new user"), array("mod" => "user", "op" => "create")); - $links[] = la(t("access rules"), array("mod" => "user", "op" => "access")); - $links[] = la(t("user accounts"), array("mod" => "user", "op" => "account")); - $links[] = la(t("user roles"), array("mod" => "user", "op" => "role")); - $links[] = la(t("user permissions"), array("mod" => "user", "op" => "permission")); - $links[] = la(t("search account"), array("mod" => "user", "op" => "search")); - $links[] = la(t("settings"), array("mod" => "user", "op" => "settings")); - $links[] = la(t("help"), array("mod" => "user", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": print user_help(); @@ -1523,11 +1504,6 @@ function user_admin() { case "search": print search_type("user", drupal_url(array("mod" => "user", "op" => "search"), "admin")); break; - case t("Save configuration"): - case t("Reset to defaults"): - case "settings": - print user_admin_settings($edit); - break; case t("Add rule"): case t("Check"): case "access": @@ -1642,83 +1618,10 @@ function user_help_admin() { utilizing their own preferences for how the pages are structured, how navigation lists and other page components are presented and much more. <br /> </p> -<h3>User administration</h3> -<p>Administrators manage user accounts by clicking on the <i>User management</i> link in - their Admin interface. There, you will find several configuration pages and - reports which help you manage your users. The following pages are available:</p> - -<h4>Add new user</h4> -<p>If your site is completely private, and doesn't allow registration for - any old web user (see <a href="#settings">settings</a> for this feature), then - you'll need to add new users manually. This web page allows any administrator - to register a new user.</p> -<h4>Access rules<a name="access"></a></h4> -<p>Access rules enable administrators to filter out usernames and e-mail addresses - which are not allowed in Drupal. An administrator creates a 'mask' against which - each new registration is checked. Disallowed names and e-mail addresses are denied - access to the site. Another handy use for this page is to disallow registration - to your site from an untrusted external authentication server. Just add their - server address to the username mask section and you've effectively blocked all - logins from that server.</p> -<p>To do describe access rules you can use the following wild-card characters:</p> - <ul> - <li> % : matches any number of characters, including zero characters.</li> - <li> _ : matches exactly one character.</li> - </ul> -<p><u>Examples:</u></p> - <ul> - <li>E-mail address bans <code>%@hotmail.com</code>, <code>%@altavista.%</code>, <code>%@usa.net</code>, etc. Used to prevent users from using free e-mail accounts, which might be used to cause trouble.</li> - <li>Username bans <code>root</code>, <code>webmaster</code>, <code>admin%</code>, etc. Used to prevent administrator impersonators.</li> - </ul> -<p>If no access rules are provided, access control is turned off and everybody will be able to access your website. The 'allow' rules are processed prior to the 'deny' rules and are thus considered to be stronger.</p> -<h4>User accounts</h4> -<p>This page is quite powerful. It allows an administrator to review any user's - profile. In addition, administrators may block any user, or assign him a <a href="#roles">role</a>, - using this page.</p> -<h4>User roles<a name="roles"></a></h4> -<p>Roles allow you to fine tune the security and administration of drupal. A role -defines a group of users which have certain privileges. Examples of roles -include: <I>anonymous user</I>, <I>authenticated user</I>, <I>moderator</I>, -<I>administrator</I> and so on. By default, Drupal comes with two commonly used -roles: -<ul> - <li>Anonymous user: this role is used for users that don't have a user account - or that are not authenticated. - <li>Registered user: this role is assigned automatically to authenticated users. - Most users will belong to this user role unless specified otherwise.</li> -</ul></p> -<p>These common roles will suffice for most sites. However, for a more complex site where you need to give several users different access privileges, you will - need to add a new role by clicking the "add new role" link. Then define what privileges that role will have by clicking the "permission overview" link and checking the appropriate boxes to give that role the permissions you desire. - <p>To attach a specific user to a role, use the "account" section of the drupal Administration. </p> - <p>Note: If you intend for a user to access certain sections of the administration - pages, they must have "access administration page" privileges. </p> -<h4>User permissions<a name="permissions"></a></h4> -<p>Each role has certain things that its users are allowed to do, and some that - are disallowed. For example, authenticated users may usually post a story but - Anonymous users may not. </p> -<p>Each permission describes a fine-grained logical operation such as <i>access administration pages</i> or <i>add and modify user accounts</i>. You could say a permission represents access granted to a user to perform a set of operations.</p> -<h4>Search account</h4> -<p>Search Account enables an admin to query for any username in the user table - and return users which match that query. For example, one may search for 'br' - and Drupal might return 'brian', 'brad', and 'brenda'.</p> -<h4>Settings<a name="settings"></a></h4> -<p>Administrators may choose to restrict registration to their site. That restriction - may be accomplished on this page. Also, the list of words which may be included - in a system generated password is also listed on this page. Drupal generates - passwords by joining small words from the password list until the new password - is greater than 6 characters.</p> -<h4>Active users - report</h4> -<p>All users sorted by most recent login.</p> -<h4>New users - report</h4> -<p>All users sorted by most recent registration</p> -<h4>Blocked users - report</h4> -<p>All users who have been blocked (status = 0) sorted by most recent registration</p> -<h4>Authenticated users, administrators, etc. - reports</h4> -<p>All <a href="#roles">roles</a> present a report listing their members</p> <h3>User preferences and profiles</h3> <p>Drupal comes with a set of user preferences and profile which a user may edit by clicking on the user account link. Of course, a user must be logged into reach those pages. - There, users will find a page for changing their preferred timezone, language, username, e-mail address, password, theme, signature, homepage, and <a href="#da">distributed authentication</a> names. + There, users will find a page for changing their preferred time zone, language, username, e-mail address, password, theme, signature, homepage, and <a href="#da">distributed authentication</a> names. Changes made here take effect immediately. Also, administrators may make profile and preferences changes in the Admin Center on behalf of their users.</p> <p>Module developers are provided several hooks for adding custom fields to the user view/edit pages. These hooks are described in the Developer section of the <a href="http://www.drupal.org">Drupal Handbook</a>. For an example, see the <code>jabber_user()</code> function in <i>/modules/jabber.module</i>. </p> diff --git a/modules/watchdog.module b/modules/watchdog.module index 6eb79b228..bf852c2e5 100644 --- a/modules/watchdog.module +++ b/modules/watchdog.module @@ -19,10 +19,16 @@ function watchdog_perm() { function watchdog_link($type) { if ($type == "admin" && user_access("administer watchdog")) { - $links[] = la(t("watchdog"), array("mod" => "watchdog")); + $help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on."; + + menu_add("watchdog", "admin.php?mod=watchdog", "Display system events.", $help, "site monitoring", 1, 1); + menu_add("user messages", "admin.php?mod=watchdog&type=user", "Display system events", $help, "watchdog"); + menu_add("regular messages", "admin.php?mod=watchdog&type=regular", "Display system events", $help, "watchdog"); + menu_add("special messages", "admin.php?mod=watchdog&type=special", "Display system events", $help, "watchdog"); + menu_add("warning messages", "admin.php?mod=watchdog&type=warning", "Display system events", $help, "watchdog"); + menu_add("error messages", "admin.php?mod=watchdog&type=error", "Display system events", $help, "watchdog"); + menu_add("httpd messages", "admin.php?mod=watchdog&type=httpd", "Display system events", $help, "watchdog"); } - - return $links ? $links : array(); } function watchdog_conf_options() { @@ -74,18 +80,6 @@ function watchdog_admin() { global $op, $id, $type, $order; if (user_access("administer watchdog")) { - - $links[] = la(t("user messages"), array("mod" => "watchdog", "type" => "user")); - $links[] = la(t("regular messages"), array("mod" => "watchdog", "type" => "regular")); - $links[] = la(t("special messages"), array("mod" => "watchdog", "type" => "special")); - $links[] = la(t("warning messages"), array("mod" => "watchdog", "type" => "warning")); - $links[] = la(t("error messages"), array("mod" => "watchdog", "type" => "error")); - $links[] = la(t("httpd messages"), array("mod" => "watchdog", "type" => "httpd")); - $links[] = la(t("overview"), array("mod" => "watchdog")); - $links[] = la(t("help"), array("mod" => "watchdog", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": watchdog_help(); diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module index 6eb79b228..bf852c2e5 100644 --- a/modules/watchdog/watchdog.module +++ b/modules/watchdog/watchdog.module @@ -19,10 +19,16 @@ function watchdog_perm() { function watchdog_link($type) { if ($type == "admin" && user_access("administer watchdog")) { - $links[] = la(t("watchdog"), array("mod" => "watchdog")); + $help = "The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on."; + + menu_add("watchdog", "admin.php?mod=watchdog", "Display system events.", $help, "site monitoring", 1, 1); + menu_add("user messages", "admin.php?mod=watchdog&type=user", "Display system events", $help, "watchdog"); + menu_add("regular messages", "admin.php?mod=watchdog&type=regular", "Display system events", $help, "watchdog"); + menu_add("special messages", "admin.php?mod=watchdog&type=special", "Display system events", $help, "watchdog"); + menu_add("warning messages", "admin.php?mod=watchdog&type=warning", "Display system events", $help, "watchdog"); + menu_add("error messages", "admin.php?mod=watchdog&type=error", "Display system events", $help, "watchdog"); + menu_add("httpd messages", "admin.php?mod=watchdog&type=httpd", "Display system events", $help, "watchdog"); } - - return $links ? $links : array(); } function watchdog_conf_options() { @@ -74,18 +80,6 @@ function watchdog_admin() { global $op, $id, $type, $order; if (user_access("administer watchdog")) { - - $links[] = la(t("user messages"), array("mod" => "watchdog", "type" => "user")); - $links[] = la(t("regular messages"), array("mod" => "watchdog", "type" => "regular")); - $links[] = la(t("special messages"), array("mod" => "watchdog", "type" => "special")); - $links[] = la(t("warning messages"), array("mod" => "watchdog", "type" => "warning")); - $links[] = la(t("error messages"), array("mod" => "watchdog", "type" => "error")); - $links[] = la(t("httpd messages"), array("mod" => "watchdog", "type" => "httpd")); - $links[] = la(t("overview"), array("mod" => "watchdog")); - $links[] = la(t("help"), array("mod" => "watchdog", "op" => "help")); - - print "<small>". implode(" | ", $links) ."</small><hr />"; - switch ($op) { case "help": watchdog_help(); diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index 0e340ee8d..21710f487 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -17,7 +17,7 @@ // General colorset that can be used for this theme var $foreground = "#000000"; var $background = "#EAEAEA"; - + function system($field) { $system["name"] = "Marvin"; $system["author"] = "Dries"; diff --git a/update.php b/update.php index 86e5e09a2..b1afc3d10 100644 --- a/update.php +++ b/update.php @@ -58,7 +58,8 @@ $mysql_updates = array( "2002-10-26" => "update_43", "2002-11-08" => "update_44", "2002-11-20" => "update_45", - "2002-12-10" => "update_46" + "2002-12-10" => "update_46", + "2002-12-22" => "update_47" ); // Update functions @@ -642,6 +643,18 @@ function update_46() { update_sql("ALTER TABLE cache ADD created int(11) NOT NULL default '0'"); } +function update_47() { + update_sql("CREATE TABLE menu ( + name varchar(255) NOT NULL default '', + link varchar(255) NOT NULL default '', + help TEXT default '', + title varchar(255) NOT NULL default '', + parent varchar(255) NOT NULL default '', + weight tinyint(4) DEFAULT '0' NOT NULL, + overview tinyint(1) DEFAULT '0' NOT NULL + );"); +} + function update_upgrade3() { update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1)"); update_sql("INSERT INTO system VALUES ('block.module','block','module','',1)"); |