From d7fefa2a6b4722e4ecd6f9cde2d8e8832d750d86 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 14 Apr 2001 19:27:44 +0000 Subject: - preliminary section code - does _not_ work yet --- modules/structure.module | 190 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 modules/structure.module (limited to 'modules/structure.module') diff --git a/modules/structure.module b/modules/structure.module new file mode 100644 index 000000000..7404e6b8a --- /dev/null +++ b/modules/structure.module @@ -0,0 +1,190 @@ + "structure_admin"); + +$cstatus = array("disabled", "enabled: incl. anonymous", "enabled: excl. anonymous"); +$mstatus = array("post new submissions", "queue new submissions"); + +include "includes/structure.inc"; + + +function content_types($name, $module) { + global $types; + if ($module[type]) $types[$name] = $name; +} + +function category_form($edit = array()) { + global $types, $cstatus, $mstatus; + + $threshold_post = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100); + $threshold_dump = array(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -20, -25, -30); + $threshold_expire = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100); + + module_iterate("content_types"); + + $output .= "
\n"; + + $output .= "Name:
\n"; + $output .= "
\n"; + $output .= "A unique name for this category like 'announcement', 'article', 'column', 'review', etc.

\n"; + + $output .= "Content type:
\n"; + foreach ($types as $key=>$value) $options1 .= ""; + $output .= "
\n"; + $output .= "The content type to bind or associate this category with.

\n"; + + $output .= "Comment settings:
\n"; + foreach ($cstatus as $key=>$value) $options2 .= ""; + $output .= "
\n"; + $output .= "Allow or dissallow users to post comments in this category.

\n"; + + $output .= "Submission settings:
\n"; + foreach ($mstatus as $key=>$value) $options3 .= ""; + $output .= "
\n"; + $output .= "What to do with new submissions in this category.

\n"; + + $output .= "Post, dump and expiration threshold:
\n"; + foreach ($threshold_post as $value) $options4 .= ""; + $output .= "\n"; + foreach ($threshold_dump as $value) $options5 .= ""; + $output .= "\n"; + foreach ($threshold_expire as $value) $options6 .= ""; + $output .= "
\n"; + + $output .= "Specify the post, dump and expiration threshold for moderation purpose.

\n"; + + if ($edit[cid]) { + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + } + else { + $output .= "\n"; + } + + $output .= "

\n"; + + return $output; +} + +function category_overview() { + global $cstatus, $mstatus; + + $result = db_query("SELECT * FROM category ORDER BY name"); + + $output .= "\n"; + $output .= " \n"; + while ($category = db_fetch_object($result)) { + $output .= " \n"; + } + $output .= "
nametypecommentssubmissionsthresholdsoperations
". check_output($category->name) ."". check_output($category->type) ."". check_output($cstatus[$category->comment]) ."". check_output($mstatus[$category->submission]) ."post: $category->post, dump: $category->dump, expire: $category->expirecid\">edit category
\n"; + return $output; +} + +// ---- topic ---- + +function topic_form($edit = array()) { + + $output .= "
\n"; + + $output .= "Name:
\n"; + $output .= "

\n"; + $output .= "A unique name for this topic like 'science', 'internet', 'culture', etc.

\n"; + + $output .= "Parent:
\n"; + foreach (topic_tree() as $key=>$value) $options .= ""; + $output .= "
\n"; + $output .= "The parent topic this topic belongs in.

\n"; + + if ($edit[tid]) { + $output .= "\n"; + $output .= "\n"; + $output .= "\n"; + } + else { + $output .= "\n"; + } + + return $output; +} + +function topic_overview() { + $tree = topic_tree(); + + $output .= "\n"; + $output .= " \n"; + foreach ($tree as $id=>$name) { + $output .= " \n"; + } + $output .= "
nameoperations
". check_output($name) ."edit topic
\n"; + return $output; +} + +// ----- structure ----- + +function structure_overview() { + $output .= "

Categories

\n"; + $output .= category_overview(); + $output .= "

Topics

\n"; + $output .= topic_overview(); + return $output; +} + +function structure_admin() { + global $id, $op, $type, $edit; + + print "add new category | add new topic | categories | topics | overview
\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 category_overview(); + break; + case "Save category": + print status(category_save($edit)); + print category_overview(); + break; + default: + print category_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 topic_overview(); + break; + case "Save topic": + print status(topic_save($edit)); + print topic_overview(); + break; + default: + print topic_overview(); + } + break; + default: + print structure_overview(); + } +} + +?> \ No newline at end of file -- cgit v1.2.3