From a0d83fc0e81f62b2ff8d655bb881ae36acb6ce8f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Wed, 28 Mar 2001 21:29:44 +0000 Subject: [PATCH] - streamlined the book and story module --- modules/book.module | 5 ++--- modules/book/book.module | 5 ++--- modules/story.module | 20 ++++++++++---------- modules/story/story.module | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/modules/book.module b/modules/book.module index ca0aa9751e9..4be40e6703b 100644 --- a/modules/book.module +++ b/modules/book.module @@ -44,7 +44,7 @@ function theme_book($node) { $output .= "

". check_output($node->body, 1) ."

"; } - $theme->box(t("Documentation book"), $output ."". book_overview($node->nid) ."". book_navigation($node)); + $theme->box(t("Handbook"), $output ."". book_overview($node->nid) ."". book_navigation($node)); } function book_view($node, $page = 1) { @@ -155,8 +155,7 @@ function book_form($edit = array()) { } function book_save($edit) { - $node = node_get_object("nid", $edit[nid]); - node_save(array_diff(array_merge($edit, array(nid => $node->nid, type => "book")), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_delete($id) { diff --git a/modules/book/book.module b/modules/book/book.module index ca0aa9751e9..4be40e6703b 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -44,7 +44,7 @@ function theme_book($node) { $output .= "

". check_output($node->body, 1) ."

"; } - $theme->box(t("Documentation book"), $output ."". book_overview($node->nid) ."". book_navigation($node)); + $theme->box(t("Handbook"), $output ."". book_overview($node->nid) ."". book_navigation($node)); } function book_view($node, $page = 1) { @@ -155,8 +155,7 @@ function book_form($edit = array()) { } function book_save($edit) { - $node = node_get_object("nid", $edit[nid]); - node_save(array_diff(array_merge($edit, array(nid => $node->nid, type => "book")), array(userid => $edit[userid]))); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_delete($id) { diff --git a/modules/story.module b/modules/story.module index dc557a4c5f5..db2166d1520 100644 --- a/modules/story.module +++ b/modules/story.module @@ -54,7 +54,7 @@ function story_help() { } function story_view($node, $page = 1) { - global $id, $cid, $op, $pid, $subject, $comment, $theme, $mode, $order, $threshold; + global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold; if ($page == 1) { switch($op) { @@ -132,11 +132,14 @@ function story_form($edit = array()) { if (user_access($user, "story")) { $output .= "". t("Status") .":
\n"; - $output .= " scheduled for
\n"; - $output .= " posted
\n"; - $output .= " queued
\n"; - $output .= " dumped
\n"; + $output .= " scheduled for
\n"; + $output .= " posted
\n"; + $output .= " queued
\n"; + $output .= " dumped
\n"; $output .= "The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...

\n"; + + $output .= "\n"; + $output .= "\n"; } $duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'")); @@ -164,8 +167,6 @@ function story_form($edit = array()) { $output .= "\n"; $output .= "\n"; } - - $output .= "\n"; $output .= "\n"; return $output; @@ -173,9 +174,8 @@ function story_form($edit = array()) { function story_save($edit) { global $status; - $node = ($edit[nid] ? node_get_object("nid", $edit[nid]) : node_get_object("title", $edit[title])); - $edit[timestamp] = ($edit[status] == $status[scheduled] && strtotime($edit[timestamp]) > time()) ? strtotime($edit[timestamp]) : ($node->timestamp ? $node->timestamp : time()); - node_save(array_diff(array_merge($edit, array(nid => $node->nid, type => "story")), array(userid => $edit[userid]))); + $edit[timestamp] = ($edit[status] == $status[scheduled] && strtotime($edit[timestamp]) > time()) ? strtotime($edit[timestamp]) : ($node[timestamp] ? $node[timestamp] : time()); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); } function story_delete($id) { diff --git a/modules/story/story.module b/modules/story/story.module index dc557a4c5f5..db2166d1520 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -54,7 +54,7 @@ function story_help() { } function story_view($node, $page = 1) { - global $id, $cid, $op, $pid, $subject, $comment, $theme, $mode, $order, $threshold; + global $id, $cid, $op, $moderate, $pid, $subject, $comment, $theme, $mode, $order, $threshold; if ($page == 1) { switch($op) { @@ -132,11 +132,14 @@ function story_form($edit = array()) { if (user_access($user, "story")) { $output .= "". t("Status") .":
\n"; - $output .= " scheduled for
\n"; - $output .= " posted
\n"; - $output .= " queued
\n"; - $output .= " dumped
\n"; + $output .= " scheduled for
\n"; + $output .= " posted
\n"; + $output .= " queued
\n"; + $output .= " dumped
\n"; $output .= "The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published. Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...

\n"; + + $output .= "\n"; + $output .= "\n"; } $duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'")); @@ -164,8 +167,6 @@ function story_form($edit = array()) { $output .= "\n"; $output .= "\n"; } - - $output .= "\n"; $output .= "\n"; return $output; @@ -173,9 +174,8 @@ function story_form($edit = array()) { function story_save($edit) { global $status; - $node = ($edit[nid] ? node_get_object("nid", $edit[nid]) : node_get_object("title", $edit[title])); - $edit[timestamp] = ($edit[status] == $status[scheduled] && strtotime($edit[timestamp]) > time()) ? strtotime($edit[timestamp]) : ($node->timestamp ? $node->timestamp : time()); - node_save(array_diff(array_merge($edit, array(nid => $node->nid, type => "story")), array(userid => $edit[userid]))); + $edit[timestamp] = ($edit[status] == $status[scheduled] && strtotime($edit[timestamp]) > time()) ? strtotime($edit[timestamp]) : ($node[timestamp] ? $node[timestamp] : time()); + node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "story")), array(userid => $edit[userid]))); } function story_delete($id) {