summaryrefslogtreecommitdiff
path: root/modules/structure.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/structure.module')
-rw-r--r--modules/structure.module157
1 files changed, 0 insertions, 157 deletions
diff --git a/modules/structure.module b/modules/structure.module
deleted file mode 100644
index 823da5254..000000000
--- a/modules/structure.module
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php
-
-function content_types($name) {
- global $types;
- if (function_exists($name ."_status")) $types[$name] = $name;
-}
-
-function category_form($edit = array()) {
- global $types;
-
- $threshold_post = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90, 100 => 100);
- $threshold_dump = array(-1 => -1, -2 => -2, -3 => -3, -4 => -4, -5 => -5, -6 => -6, -7 => -7, -8 => -8, -9 => -9, -10 => -10, -11 => -11, -12 => -12, -13 => -13, -14 => -14, -15 => -15, -20 => -20, -25 => -25, -30 => -30);
- $threshold_expire = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90, 100 => 100);
-
- module_iterate("content_types");
-
- $form .= form_textfield(t("Name"), "name", $edit[name], 30, 55, t("A unique name for this category like 'announcement', 'article', 'column', 'review', etc."));
- $form .= form_select(t("Content type"), "type", $edit[type], $types, t("The content type to bind or associate this category with."));
- $form .= form_select(t("Comment"), "comment", $edit[comment], node_comment_status(), t("By default, allow or dissallow users to post comments in this category."));
- $form .= form_select(t("Promote"), "promote", $edit[promote], node_promote_status(), t("By default, promote new submissions in this category to the front page."));
-
- $form .= form_select(t("Submission"), "submission", $edit[submission], node_submission_status(), t("What to do with new submissions in this category?"));
- $form .= form_select(t("Post threshold"), "post", $edit[post], $threshold_post, t("If new submissions are subject to moderation, select a post threshold."));
- $form .= form_select(t("Dump threshold"), "dump", $edit[dump], $threshold_dump, t("If new submissions are subject to moderation, select a dump threshold."));
- $form .= form_select(t("Expiration threshold"), "expire", $edit[expire], $threshold_expire, t("If new submissions are subject to moderation, select a expiration threshold."));
-
- if ($edit[cid]) {
- $form .= form_hidden("cid", $edit[cid]);
- $form .= form_submit(t("Save category"));
- $form .= form_submit(t("Delete category"));
- }
- else {
- $form .= form_submit(t("Save category"));
- }
-
- return form("admin.php?mod=structure&type=category", $form);
-}
-
-function category_overview() {
- $result = db_query("SELECT * FROM category ORDER BY name");
-
- $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TH>name</TH><TH>type</TH><TH>comment</TH><TH>promote</TH><TH>submissions</TH><TH>operations</TH></TR>\n";
- while ($category = db_fetch_object($result)) {
- $output .= " <TR><TD>". check_output($category->name) ."</TD><TD>". check_output($category->type) ."</TD><TD>". node_comment_status($category->comment) ."</TD><TD>". node_promote_status($category->promote) ."</TD><TD>". node_submission_status($category->submission) ."". ($category->submission ? "<BR><SMALL>post: $category->post, dump: $category->dump, expire: $category->expire</SMALL>" : "") ."</TD><TD><A HREF=\"admin.php?mod=structure&type=category&op=edit&id=$category->cid\">edit category</A></TD></TR>\n";
- }
- $output .= "</TABLE>\n";
- return $output;
-}
-
-// ---- topic ----
-
-function topic_form($edit = array()) {
-
- $result = db_query("SELECT * FROM topic WHERE name != '$edit[name]' ORDER BY name DESC");
- while ($topic = db_fetch_object($result)) {
- $topics[$topic->tid] = $topic->name;
- }
- $topics[0] = " ";
-
- $form .= form_textfield(t("Name"), "name", $edit[name], 30, 55, t("A unique name for this topic like 'science', 'internet', 'culture', etc."));
- $form .= form_select(t("Parent"), "pid", $edit[pid], $topics, t("The parent topic this topic belongs in."));
- $form .= form_textfield("Moderate", "moderate", $edit[moderate], 35, 255, t("Provide a comma-seperated list of the moderators' usernames."));
-
- if ($edit[tid]) {
- $form .= form_hidden("tid", $edit[tid]);
- $form .= form_submit(t("Save topic"));
- $form .= form_submit(t("Delete topic"));
- }
- else {
- $form .= form_submit(t("Save topic"));
- }
-
- return form("admin.php?mod=structure&type=topic", $form);
-}
-
-function topic_overview() {
- $tree = topic_tree();
-
- $output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
- $output .= " <TR><TH>name</TH><TH>moderators</TH><TH>operations</TH></TR>\n";
- foreach ($tree as $id=>$name) {
- $topic = topic_get_object("tid", $id);
- $output .= " <TR><TD>". check_output($name) ."</TD><TD>". check_output($topic->moderate) ."</TD><TD><A HREF=\"admin.php?mod=structure&type=topic&op=edit&id=$topic->tid\">edit topic</A></TD></TR>\n";
- }
- $output .= "</TABLE>\n";
- return $output;
-}
-
-// ----- structure -----
-
-function structure_overview() {
- $output .= "<H3>Categories</H3>\n";
- $output .= category_overview();
- $output .= "<H3>Topics</H3>\n";
- $output .= topic_overview();
- return $output;
-}
-
-function structure_admin() {
- global $id, $op, $type, $edit;
-
- print "<SMALL><A HREF=\"admin.php?mod=structure&type=category&op=add\">add new category</A> | <A HREF=\"admin.php?mod=structure&type=topic&op=add\">add new topic</A> | <A HREF=\"admin.php?mod=structure\">overview</A></SMALL><HR>\n";
-
- switch ($type) {
- case "category":
- switch ($op) {
- case "add":
- print category_form();
- break;
- case "edit":
- print category_form(category_get_array("cid", $id));
- break;
- case "view":
- print category_view($id);
- break;
- case "Delete category":
- print status(category_del($edit[cid]));
- print structure_overview();
- break;
- case "Save category":
- print status(category_save($edit));
- print structure_overview();
- break;
- default:
- print structure_overview();
- }
- break;
- case "topic":
- switch ($op) {
- case "add":
- print topic_form();
- break;
- case "edit":
- print topic_form(topic_get_array("tid", $id));
- break;
- case "view":
- print topic_view($id);
- break;
- case "Delete topic":
- print status(topic_del($edit[tid]));
- print structure_overview();
- break;
- case "Save topic":
- print status(topic_save($edit));
- print structure_overview();
- break;
- default:
- print structure_overview();
- }
- break;
- default:
- print structure_overview();
- }
-}
-
-?> \ No newline at end of file