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 .= "\n"; $output .= " \n"; while ($category = db_fetch_object($result)) { $output .= " \n"; } $output .= "
nametypecommentpromotesubmissionsoperations
". check_output($category->name) ."". check_output($category->type) ."". node_comment_status($category->comment) ."". node_promote_status($category->promote) ."". node_submission_status($category->submission) ."". ($category->submission ? "
post: $category->post, dump: $category->dump, expire: $category->expire" : "") ."
cid\">edit category
\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 .= "\n"; $output .= " \n"; foreach ($tree as $id=>$name) { $topic = topic_get_object("tid", $id); $output .= " \n"; } $output .= "
namemoderatorsoperations
". check_output($name) ."". check_output($topic->moderate) ."tid\">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 | 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 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(); } } ?>