Commit 16818777 authored by Dries's avatar Dries

CHANGES:

- Added moderator information to forum.module.

- Simplified story.module, page.module, forum.module and book.module
  by removing redundant code, and by doing other small house-keeping
  tasks.
parent 97ec8e0c
<?php
$module = array("find" => "book_find",
"type" => "book_type",
"page" => "book_page",
"user" => "book_user",
"admin" => "book_admin",
......@@ -32,10 +31,6 @@ function book_location($node, $nodes = array()) {
return $nodes;
}
function book_type() {
return array("book", t("book page"));
}
function book_view($node, $main = 0) {
global $theme;
......
<?php
$module = array("find" => "book_find",
"type" => "book_type",
"page" => "book_page",
"user" => "book_user",
"admin" => "book_admin",
......@@ -32,10 +31,6 @@ function book_location($node, $nodes = array()) {
return $nodes;
}
function book_type() {
return array("book", t("book page"));
}
function book_view($node, $main = 0) {
global $theme;
......
......@@ -22,7 +22,7 @@ function comment_edit($id) {
$form .= form_item(t("Author"), format_username($comment->userid));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -58,7 +58,7 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "Submit":
case t("Submit"):
print status(comment_save(check_input($id), $edit));
print comment_overview();
break;
......
......@@ -22,7 +22,7 @@ function comment_edit($id) {
$form .= form_item(t("Author"), format_username($comment->userid));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -58,7 +58,7 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "Submit":
case t("Submit"):
print status(comment_save(check_input($id), $edit));
print comment_overview();
break;
......
<?php
$module = array("type" => "forum_type",
"page" => "forum_page",
$module = array("page" => "forum_page",
"admin" => "forum_admin");
$format = array(0 => HTML, 1 => PHP, 2 => text);
function forum_type() {
return array("forum", "forum");
}
function forum_status() {
return array(dumped, posted);
}
function forum_view($node) {
global $theme;
$output .= "<P><A HREF=\"module.php?mod=forum\">Forum</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
$output .= "<P><A HREF=\"module.php?mod=forum\">". t("Forum") ."</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
$theme->box(t("Discussion forum"), $output);
}
......@@ -27,7 +22,7 @@ function forum_form($edit = array()) {
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -53,10 +48,10 @@ function forum_page() {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH></TR>";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH><TH>". t("Moderators") ."</TH></TR>";
while ($node = db_fetch_object($result)) {
$node = node_get_object("nid", $node->nid);
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD></TR>";
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD><TD ALIGN=\"center\"><SMALL>". check_output($node->moderate) ."</SMALL></TD></TR>";
}
$output .= "</TABLE>\n";
......@@ -70,12 +65,10 @@ function forum_overview() {
}
function forum_admin() {
global $id, $op, $edit, $type;
global $id, $op, $edit;
print "<SMALL><A HREF=\"admin.php?mod=forum&op=add\">add new forum</A> | <A HREF=\"admin.php?mod=forum\">overview</A></SMALL><HR>\n";
$type = ($type ? $type : 0);
switch ($op) {
case "add":
print forum_form();
......@@ -83,7 +76,7 @@ function forum_admin() {
case "edit":
print forum_form(node_get_array(nid, $id));
break;
case "Submit":
case t("Submit"):
print status(forum_save($edit));
// fall through:
default:
......
<?php
$module = array("type" => "forum_type",
"page" => "forum_page",
$module = array("page" => "forum_page",
"admin" => "forum_admin");
$format = array(0 => HTML, 1 => PHP, 2 => text);
function forum_type() {
return array("forum", "forum");
}
function forum_status() {
return array(dumped, posted);
}
function forum_view($node) {
global $theme;
$output .= "<P><A HREF=\"module.php?mod=forum\">Forum</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
$output .= "<P><A HREF=\"module.php?mod=forum\">". t("Forum") ."</A> / <B><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></B>:</P><P>". check_output($node->body) ."</P>";
$theme->box(t("Discussion forum"), $output);
}
......@@ -27,7 +22,7 @@ function forum_form($edit = array()) {
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -53,10 +48,10 @@ function forum_page() {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH></TR>";
$output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH><TH>". t("Moderators") ."</TH></TR>";
while ($node = db_fetch_object($result)) {
$node = node_get_object("nid", $node->nid);
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD></TR>";
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD><TD ALIGN=\"center\"><SMALL>". check_output($node->moderate) ."</SMALL></TD></TR>";
}
$output .= "</TABLE>\n";
......@@ -70,12 +65,10 @@ function forum_overview() {
}
function forum_admin() {
global $id, $op, $edit, $type;
global $id, $op, $edit;
print "<SMALL><A HREF=\"admin.php?mod=forum&op=add\">add new forum</A> | <A HREF=\"admin.php?mod=forum\">overview</A></SMALL><HR>\n";
$type = ($type ? $type : 0);
switch ($op) {
case "add":
print forum_form();
......@@ -83,7 +76,7 @@ function forum_admin() {
case "edit":
print forum_form(node_get_array(nid, $id));
break;
case "Submit":
case t("Submit"):
print status(forum_save($edit));
// fall through:
default:
......
......@@ -82,7 +82,7 @@ function moderate_admin() {
case "edit":
print moderate_comment_edit($id);
break;
case "Submit":
case t("Submit"):
print status(moderate_comment_save($id, $edit));
// fall through:
default:
......@@ -94,7 +94,7 @@ function moderate_admin() {
case "edit":
print moderate_node_edit($id);
break;
case "Submit":
case t("Submit"):
print status(moderate_node_save($edit));
// fall through:
default:
......
<?php
$module = array("type" => "page_type",
"admin" => "page_admin");
$module = array("admin" => "page_admin");
$format = array(0 => HTML, 1 => PHP, 2 => text);
function page_type() {
return array("page", "static page");
}
function page_view($node, $main = 0) {
global $format, $theme;
......@@ -38,7 +33,7 @@ function page_form($edit = array()) {
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -75,7 +70,7 @@ function page_admin() {
case "listing":
print node_listing(page_query());
break;
case "Submit":
case t("Submit"):
print status(page_save($edit));
// fall through:
default:
......
<?php
$module = array("type" => "page_type",
"admin" => "page_admin");
$module = array("admin" => "page_admin");
$format = array(0 => HTML, 1 => PHP, 2 => text);
function page_type() {
return array("page", "static page");
}
function page_view($node, $main = 0) {
global $format, $theme;
......@@ -38,7 +33,7 @@ function page_form($edit = array()) {
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Submit");
$form .= form_submit(t("Submit"));
return form($REQUEST_URI, $form);
}
......@@ -75,7 +70,7 @@ function page_admin() {
case "listing":
print node_listing(page_query());
break;
case "Submit":
case t("Submit"):
print status(page_save($edit));
// fall through:
default:
......
......@@ -2,7 +2,6 @@
$module = array("help" => "story_help",
"find" => "story_find",
"type" => "story_type",
"user" => "story_user",
"queue" => "story_queue",
"admin" => "story_admin",
......@@ -43,10 +42,6 @@ function story_help() {
<?php
}
function story_type() {
return array("story", t("story"));
}
function story_view($node, $main = 0) {
global $theme;
$theme->story($node, $main);
......
......@@ -2,7 +2,6 @@
$module = array("help" => "story_help",
"find" => "story_find",
"type" => "story_type",
"user" => "story_user",
"queue" => "story_queue",
"admin" => "story_admin",
......@@ -43,10 +42,6 @@ function story_help() {
<?php
}
function story_type() {
return array("story", t("story"));
}
function story_view($node, $main = 0) {
global $theme;
$theme->story($node, $main);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment