summaryrefslogtreecommitdiff
path: root/modules/page
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2001-07-17 20:08:05 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2001-07-17 20:08:05 +0000
commit6fdef1725780711d1f52a9943e0048f291213e0c (patch)
tree774b075d2f03d2f3fe02b5ccf18b32e7cb6cf25c /modules/page
parent64ce2fb5fba4d399584c3c873b07013eebbff1f8 (diff)
downloadbrdo-6fdef1725780711d1f52a9943e0048f291213e0c.tar.gz
brdo-6fdef1725780711d1f52a9943e0048f291213e0c.tar.bz2
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.
Diffstat (limited to 'modules/page')
-rw-r--r--modules/page/page.module24
1 files changed, 18 insertions, 6 deletions
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[] = "<a href=\"node.php?id=$page->nid\">$page->link</a>";
+ }
+ }
+
+ 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 "<!-- Don't ask:\n$edit[body] -->\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