From 6fdef1725780711d1f52a9943e0048f291213e0c Mon Sep 17 00:00:00 2001 From: Kjartan Mannes Date: Tue, 17 Jul 2001 20:08:05 +0000 Subject: page.module - added a links option so pages can be displayed on the links of the site in an easy way. (Requires an SQL update.) - made HTML and text type pages be $theme->box()ed again. - made the page body hidden in a comment during editing, in case things crash you should still be able to retrieve your code. Will keep working on a better solution. node.module - made all node types be listed in the node listings. --- modules/page/page.module | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'modules/page/page.module') diff --git a/modules/page/page.module b/modules/page/page.module index bdb6c7ba2..42d409f34 100644 --- a/modules/page/page.module +++ b/modules/page/page.module @@ -10,21 +10,31 @@ class Page { } } +function page_link($type) { + if ($type == "page" && user_access("access content")) { + $result = db_query("SELECT nid,link FROM page WHERE link != '' ORDER BY link"); + while ($page = db_fetch_object($result)) { + $links[] = "nid\">$page->link"; + } + } + + return $links ? $links : array(); +} + function page_view($node, $main = 0) { - global $format; + global $format, $theme; switch ($format[$node->format]) { case "PHP": - $output = eval($node->body); + print eval($node->body); break; case "text": - $output = nl2br(htmlentities($node->body)); + $theme->box($node->title, nl2br(htmlentities($node->body))); break; default: - $output = check_output($node->body, 1); + $theme->box($node->title, check_output($node->body, 1)); } - print $output; } function page_status() { @@ -39,10 +49,12 @@ function page_form($edit = array()) { } if ($edit[title]) { + print "\n"; $form = page_view(new Page(node_preview($edit))); } $form .= form_textfield("Subject", "title", $edit[title], 50, 64); + $form .= form_textfield("Link", "link", $edit[link], 50, 64); $form .= form_textarea("Body", "body", $edit[body], 70, 30); $form .= form_select("Type", "format", $edit[format], $format); $form .= form_hidden("nid", $edit[nid]); @@ -61,7 +73,7 @@ function page_form($edit = array()) { function page_save($edit) { global $status, $user; - node_save($edit, array(author => $user->id, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "page", votes => 0)); + node_save($edit, array(author => $user->id, link, body, comment => variable_get("page_comment", 0), format, moderate => variable_get("page_moderate", ""), promote => variable_get("page_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "page", votes => 0)); } ?> \ No newline at end of file -- cgit v1.2.3