From d397bbe93587f015cd8db0dbf16ef6d1c1aef78b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 10 Jun 2001 15:01:20 +0000 Subject: 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 --- modules/page/page.module | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'modules/page/page.module') diff --git a/modules/page/page.module b/modules/page/page.module index 946798d1b..88739cbb4 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -2,8 +2,16 @@ $GLOBALS[format] = array(0 => "HTML", 1 => "PHP", 2 => "text"); +class Page { + function Page($page) { + $this = new Node($page); + $this->body = $page[body]; + $this->format = $page[format]; + } +} + function page_view($node, $main = 0) { - global $format, $theme; + global $format; switch ($format[$node->format]) { case "PHP": @@ -24,13 +32,24 @@ function page_status() { } function page_form($edit = array()) { - global $format, $REQUEST_URI; + global $REQUEST_URI, $format; + + if ($edit[title]) { + $form = page_view(new Page(node_preview($edit))); + } $form .= form_textfield("Subject", "title", $edit[title], 50, 64); - $form .= form_textarea("Body", "body", $edit[body], 80, 30); + $form .= form_textarea("Body", "body", $edit[body], 70, 30); $form .= form_select("Type", "format", $edit[format], $format); $form .= form_hidden("nid", $edit[nid]); - $form .= form_submit("Submit"); + + if ($edit[title]) { + $form .= form_submit(t("Preview")); + $form .= form_submit("Submit"); + } + else { + $form .= form_submit(t("Preview")); + } return form($REQUEST_URI, $form); } -- cgit v1.2.3