summaryrefslogtreecommitdiff
path: root/modules/book.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/book.module')
-rw-r--r--modules/book.module42
1 files changed, 25 insertions, 17 deletions
diff --git a/modules/book.module b/modules/book.module
index fa9c80e01..679b046b4 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -149,7 +149,10 @@ function book_form($edit = array()) {
$form .= form_hidden("pid", $edit[pid]);
}
- if ($edit && !$edit[title]) {
+ if (!$edit) {
+ $form .= form_submit(t("Preview"));
+ }
+ else if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
@@ -227,19 +230,32 @@ function book_admin() {
}
}
-function book_page() {
+function book_render() {
global $status, $theme;
+ $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight");
+
+ while ($node = db_fetch_object($result)) {
+ $output .= "<DT><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></DT><DD>". check_output($node->body, 1) ."<BR><BR></DD>";
+ }
+
+ $theme->header();
+ $theme->box(t("Handbook"), "<DL>$output</DL>");
+ $theme->footer();
+}
+
+function book_page() {
+ global $op, $id, $theme;
+
if (user_access("access content")) {
- $result = db_query("SELECT n.*, b.* FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = 0 AND n.status = $status[posted] ORDER BY b.weight");
- while ($node = db_fetch_object($result)) {
- $output .= "<DT><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></DT><DD>". check_output($node->body, 1) ."<BR><BR></DD>";
+ switch ($op) {
+ case "feed":
+ print book_export_html($i, $depth = 1);
+ break;
+ default:
+ book_render();
}
-
- $theme->header();
- $theme->box(t("Handbook"), "<DL>$output</DL>");
- $theme->footer();
}
else {
$theme->header();
@@ -300,12 +316,4 @@ function book_export_html($parent = "", $depth = 0) {
return $output;
}
-function book_export($query) {
- global $book;
-
- if ($book) {
- print book_export_html($book, $depth = 1);
- }
-}
-
?>