From 38806b4a39a6bdfc9d4a09f86b7bbaf0173c298d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 7 Apr 2001 15:02:28 +0000 Subject: - fixed bug in common.inc: throttle() - streamlined method invocation in node.inc - added node_status() function to modules - added NEW (mostly static) page module - added NEW settings module --- modules/page.module | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 modules/page.module (limited to 'modules/page.module') diff --git a/modules/page.module b/modules/page.module new file mode 100644 index 000000000..13b3d6d9f --- /dev/null +++ b/modules/page.module @@ -0,0 +1,83 @@ + "page_page", + "admin" => "page_admin"); + +$format = array(0 => HTML, 1 => PHP, 2 => text); + +function page_view($node) { + global $format, $theme; + + switch ($format[$node->format]) { + case "PHP": + $output = eval($node->body); + break; + case "text": + $output = nl2br(htmlentities($node->body)); + break; + default: + $output = check_output($node->body, 1); + } + + $theme->header(); + $theme->box(check_output($node->title), $output); + $theme->footer(); +} + +function page_status() { + return array(dumped, posted); +} + +function page_form($edit = array()) { + global $format; + + $output .= "
\n"; + + $output .= "Name:
\n"; + $output .= "

\n"; + + $output .= "Body:
\n"; + $output .= "

\n"; + + $output .= "Type:
\n"; + foreach ($format as $key=>$value) $options .= "\n"; + $output .= "

\n"; + + $output .= "\n"; + + $output .= "\n"; + $output .= "

\n"; + + return $output; +} + +function page_save($edit) { + global $status; + node_save(array_merge($edit, array(type => "page", status => $status[posted]))); +} + +function page_overview() { + return node_overview("type = 'page'"); +} + +function page_admin() { + global $id, $op, $edit; + + print "add new page | overview | help
\n"; + + switch ($op) { + case "add": + print page_form(); + break; + case "edit": + print page_form(node_get_array(nid, $id)); + break; + case "Save page": + print status(page_save($edit)); + // fall through: + default: + print page_overview(); + } +} + +?> \ No newline at end of file -- cgit v1.2.3