diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-03-28 21:29:44 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-03-28 21:29:44 +0000 |
commit | a0d83fc0e81f62b2ff8d655bb881ae36acb6ce8f (patch) | |
tree | f4c96911b5aaaa582f1134d0cafd94e3c54d7bcf /modules | |
parent | a53d198cac4e902436fdc6555f66b006a6630776 (diff) | |
download | brdo-a0d83fc0e81f62b2ff8d655bb881ae36acb6ce8f.tar.gz brdo-a0d83fc0e81f62b2ff8d655bb881ae36acb6ce8f.tar.bz2 |
- streamlined the book and story module
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 5 | ||||
-rw-r--r-- | modules/book/book.module | 5 | ||||
-rw-r--r-- | modules/story.module | 20 | ||||
-rw-r--r-- | modules/story/story.module | 20 |
4 files changed, 24 insertions, 26 deletions
diff --git a/modules/book.module b/modules/book.module index ca0aa9751..4be40e670 100644 --- a/modules/book.module +++ b/modules/book.module @@ -44,7 +44,7 @@ function theme_book($node) { $output .= "<P>". check_output($node->body, 1) ."</P>"; } - $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 ca0aa9751..4be40e670 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -44,7 +44,7 @@ function theme_book($node) { $output .= "<P>". check_output($node->body, 1) ."</P>"; } - $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 dc557a4c5..db2166d15 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 .= "<B>". t("Status") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == 3 ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == 2 ? " CHECKED" : "") ."> posted<BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == 1 ? " CHECKED" : "") ."> queued<BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == 0 ? " CHECKED" : "") ."> dumped<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == $status[scheduled] ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == $status[dumped] ? " CHECKED" : "") ."> dumped<BR>\n"; $output .= "<SMALL><I>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") ."', ...</I></SMALL><P>\n"; + + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[timestamp]\" VALUE=\"$edit[timestamp]\">\n"; + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; } $duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'")); @@ -164,8 +167,6 @@ function story_form($edit = array()) { $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Submit") ."\">\n"; } - - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; $output .= "</FORM>\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 dc557a4c5..db2166d15 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 .= "<B>". t("Status") .":</B><BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == 3 ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == 2 ? " CHECKED" : "") ."> posted<BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == 1 ? " CHECKED" : "") ."> queued<BR>\n"; - $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == 0 ? " CHECKED" : "") ."> dumped<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[scheduled]\"". ($edit[status] == $status[scheduled] ? " CHECKED" : "") ."> scheduled for <INPUT TYPE=\"text\" NAME=\"edit[timestamp]\" SIZE=\"30\" VALUE=\"". date("j F Y G:i", ($edit[timetsamp] ? $edit[timestamp] : time())) ."\"><BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[posted]\"". ($edit[status] == $status[posted] ? " CHECKED" : "") ."> posted<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[queued]\"". ($edit[status] == $status[queued] ? " CHECKED" : "") ."> queued<BR>\n"; + $output .= "<INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"$status[dumped]\"". ($edit[status] == $status[dumped] ? " CHECKED" : "") ."> dumped<BR>\n"; $output .= "<SMALL><I>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") ."', ...</I></SMALL><P>\n"; + + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[timestamp]\" VALUE=\"$edit[timestamp]\">\n"; + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; } $duplicate = db_result(db_query("SELECT COUNT(nid) FROM nodes WHERE title = '$title'")); @@ -164,8 +167,6 @@ function story_form($edit = array()) { $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Preview") ."\">\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"". t("Submit") ."\">\n"; } - - $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[nid]\" VALUE=\"$edit[nid]\">\n"; $output .= "</FORM>\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) { |