diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 13 | ||||
-rw-r--r-- | modules/book/book.module | 13 | ||||
-rw-r--r-- | modules/headline.module | 2 | ||||
-rw-r--r-- | modules/moderation.module | 2 |
4 files changed, 24 insertions, 6 deletions
diff --git a/modules/book.module b/modules/book.module index 66bedfec9..78199557f 100644 --- a/modules/book.module +++ b/modules/book.module @@ -75,6 +75,16 @@ function book_search() { print search_data($keys, $mod); } +function book_toc($parent = 0, $offset = 0, $toc = array()) { + global $status; + $result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + while ($node = db_fetch_object($result)) { + $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title"; + $toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc); + } + return $toc; +} + function book_form($edit = array()) { global $allowed_html, $PHP_SELF, $REQUEST_URI, $status, $theme, $user; @@ -92,8 +102,7 @@ function book_form($edit = array()) { } else { $output .= "<B>". t("Parent") .":</B><BR>\n"; - $result = db_query("SELECT nid, title FROM nodes WHERE type = 'book' AND status = '$status[posted]'"); - while ($node = db_fetch_object($result)) $options2 .= "<OPTION VALUE=\"$node->nid\"". ($edit[parent] == $node->nid ? " SELECTED" : "") .">". check_select($node->title) ."</OPTION>"; + foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") ."> </OPTION>"; $output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n"; $output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n"; diff --git a/modules/book/book.module b/modules/book/book.module index 66bedfec9..78199557f 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -75,6 +75,16 @@ function book_search() { print search_data($keys, $mod); } +function book_toc($parent = 0, $offset = 0, $toc = array()) { + global $status; + $result = db_query("SELECT n.*, b.* FROM nodes n LEFT JOIN book b ON n.nid = b.node WHERE n.type = 'book' AND n.status = '$status[posted]' AND b.parent = '$parent' ORDER BY b.weight"); + while ($node = db_fetch_object($result)) { + $toc[$node->nid] = ($offset ? $offset : "") ."". ++$number .". $node->title"; + $toc = book_toc($node->nid, ($offset ? "$offset." : "") ."$number.", $toc); + } + return $toc; +} + function book_form($edit = array()) { global $allowed_html, $PHP_SELF, $REQUEST_URI, $status, $theme, $user; @@ -92,8 +102,7 @@ function book_form($edit = array()) { } else { $output .= "<B>". t("Parent") .":</B><BR>\n"; - $result = db_query("SELECT nid, title FROM nodes WHERE type = 'book' AND status = '$status[posted]'"); - while ($node = db_fetch_object($result)) $options2 .= "<OPTION VALUE=\"$node->nid\"". ($edit[parent] == $node->nid ? " SELECTED" : "") .">". check_select($node->title) ."</OPTION>"; + foreach (book_toc() as $key=>$value) $options2 .= "<OPTION VALUE=\"$key\"". ($edit[parent] == $key ? " SELECTED" : "") .">". check_select($value) ."</OPTION>"; if (user_access($user, "book")) $options2 .= "<OPTION VALUE=\"0\"". ($edit[parent] == 0 ? " SELECTED" : "") ."> </OPTION>"; $output .= "<SELECT NAME=\"edit[parent]\">$options2</SELECT><BR>\n"; $output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n"; diff --git a/modules/headline.module b/modules/headline.module index 4234d33ef..e4393195b 100644 --- a/modules/headline.module +++ b/modules/headline.module @@ -212,7 +212,7 @@ function headline_export($uri) { while ($node = db_fetch_object($result)) { print "<item>\n"; print " <title>". check_export($node->title) ."</title>\n"; - print " <link>". $site_url ."node.php?id=$node->id</link>\n"; + print " <link>". $site_url ."node.php?id=$node->nid</link>\n"; print "</item>\n"; } diff --git a/modules/moderation.module b/modules/moderation.module index e9380db5f..4b63f0274 100644 --- a/modules/moderation.module +++ b/modules/moderation.module @@ -77,7 +77,7 @@ function moderation_node($id) { else { if ($node->pid && $n = node_get_object("nid", $node->pid)) { if ($node->pid) $output .= " ". t("The above node is a suggested update for an existing node:") ." \"<A HREF=\"node.php?id=$n->nid\">". check_output($n->title) ."</A>\"."; - if ($node->log) $output .= " ". t("The log message to accompany this update is given below:") ."<P>". check_output($node->log, 1) ."</P>"; + if ($node->log) $output .= " ". t("The log message to accompany this update is given below:") ."<P><I>". check_output($node->log, 1) ."</I></P>"; } // moderation form: |