summaryrefslogtreecommitdiff
path: root/modules/book/book.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-06-10 15:01:20 +0000
committerDries Buytaert <dries@buytaert.net>2001-06-10 15:01:20 +0000
commitd397bbe93587f015cd8db0dbf16ef6d1c1aef78b (patch)
tree82b3b8dc63b04c11aeadd5b18cee796e4da43144 /modules/book/book.module
parent6b34310626b960a18646259d8d7caa1b6b2da1da (diff)
downloadbrdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.gz
brdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.bz2
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure to index.module: so this can be considered an intermediate commit. If you upgrade, and you are welcome to, just create a collection called "section" (for now) and assign your nodes some attributes in the described format. Feedback and bugreports are welcomed. Questions will be answered. CHANGES: - comment system: + when replying to a node (rather then to a comment), that node is displayed above the reply form. + when replying to a comment (rather then to a node), that comment is displayd above the reply form. - removed structure.inc, removed structure.module. - node.inc: + added 2 new node functions called 'node_attribute_edit()' and 'node_attribute_save()' used to 'hook in' any indexing system including your home-brewed stuff if you'd want to. Currently, index.module is the facto default index system. See story.module for usage. - book.module, story.module, poll.module, page.module, forum.module: + added preview functionality to administration section (via node module). + removed all references to structure.inc (category, topic). - moderate.module: + removed all references to structure.inc (category, topic). - book.module, story.module, page.module, forum.module: + increased the sizes of some textareas. - submit.php: + removed all references to structure.inc (category, topic). - marvin.theme: + removed dead code: function story() was depricated. - unconed.theme: + removed hardcoded references to drop.org. - marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme: + removed all references to structure.inc (category, topic). TODO: - file.module, trip_link.module: + update preview functionality: see story.module for example. + remove references to 'cid' and 'tid', use 'attribute' instead: see story.module for example. - extend and build upon index.module as well as making it configurable
Diffstat (limited to 'modules/book/book.module')
-rw-r--r--modules/book/book.module19
1 files changed, 9 insertions, 10 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index 319165c97..522dcdeff 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -108,10 +108,13 @@ function book_toc($parent = "", $indent = "", $toc = array()) {
function book_form($edit = array()) {
global $REQUEST_URI, $user;
+ if ($edit[title]) {
+ $form .= book_view(new Book(node_preview($edit)));
+ }
+
$form .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid)));
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
- $form .= form_item(t("Category"), category_form_select("book", $edit));
if ($edit[pid]) {
$node = node_get_object(array("nid" => $edit[pid]));
@@ -122,8 +125,8 @@ function book_form($edit = array()) {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
}
- $form .= form_textarea(t("Content"), "body", $edit[body], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
- $form .= form_textarea(t("Log message"), "log", $edit[log], 50, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
+ $form .= form_textarea(t("Content"), "body", $edit[body], 70, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
+ $form .= form_textarea(t("Log message"), "log", $edit[log], 70, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
if (user_access($user, "book")) {
$form .= form_select(t("Weight"), "weight", $edit[weight], array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30), t("The heavier nodes will sink and the lighter nodes will be positioned nearer the top."));
@@ -134,10 +137,7 @@ function book_form($edit = array()) {
$form .= form_hidden("nid", $edit[nid]);
}
- if (!$edit) {
- $form .= form_submit(t("Preview"));
- }
- else if (!$edit[title]) {
+ if (!$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
}
@@ -153,10 +153,10 @@ function book_save($edit) {
global $status, $user;
if (!$edit[nid]) {
- node_save($edit, array(author => $user->id, body, cid, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), tid, timestamp => time(), title, type => "book", votes => 0, weight));
+ node_save($edit, array(author => $user->id, body, comment => variable_get("book_comment", 0), log, moderate => variable_get("book_moderate", ""), parent, promote => variable_get("book_promote", 0), score => 0, status => variable_get("book_status", $status[queued]), timestamp => time(), title, type => "book", votes => 0, weight));
}
else if (user_access($user)) {
- node_save($edit, array(body, cid, log, parent, tid, title, type => "book", weight));
+ node_save($edit, array(body, log, parent, title, type => "book", weight));
}
}
@@ -232,7 +232,6 @@ function book_user() {
$theme->box($title, book_update($id));
break;
case t("Preview"):
- book_view(new Book(node_preview($edit)));
$theme->box($title, book_form($edit));
break;
case t("Submit"):