Commit 22fa9ed7 authored by Dries's avatar Dries

parent ca07ff36
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>
......
......@@ -219,6 +219,20 @@ CREATE TABLE locales (
PRIMARY KEY (lid)
) 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'
--
......
......@@ -216,6 +216,20 @@ CREATE TABLE locales (
PRIMARY KEY (lid)
);
--
-- 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'
--
......
......@@ -844,6 +844,7 @@ function page_footer() {
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());
......
<?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(" &gt; ", $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(" &middot; ", menu_menu_row($item->name));
}
else {
$output = implode( " &middot; ", 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
......@@ -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["&apos;"] = "'";
$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();
......
......@@ -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["&apos;"] = "'";
$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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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"):
......
......@@ -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;