Commit c75057bb authored by Dries's avatar Dries

CHANGES:

- Added improved node scheduler:

   + Automatically post node at date 'xx/xx/xx, xx:xx'.

   + Automatically queue node at date 'xx/xx/xx, xx:xx'.

   + Automatically dump node at date 'xx/xx/xx, xx:xx'.

  Requires a database update, see ./updates/2.00-to-x.xx.sql!

- Refactored the admin interface of node.module.  It is only a start
  but it should show the direction we are going.

   + The new interface is easier to extend with new functionality
     and operations.  New "edit xxx" links can easily be added on
     our way.

   + The new interface tries to cover all content- or node-related
     functions.  Thus making a special admin interface for each new
     node type redundant.  To demonstrate this, I removed the admin
     hook from page.module and forum.module.  This removes quite a
     bit of logic from the invidual modules which is a good sign if
     you ask me.

     A centralized GUI or interface covering all node-related
     administration should make Drupal easier to administer.

TODO:

- All node-related nodes need updating.  This should be trivial and
  I'll hapilly tackle this later tonight.

- There will be bugs, and I'm still working on this but I would like
  to get some feedback (from Natrak et all) on both user-friendliness
  and usability of this new interface.  I'm still working on it as we
  speak ...
parent 2ecc3e4c
......@@ -65,7 +65,7 @@ function node_get_comments($nid) {
function node_save($node, $filter) {
global $user, $status;
$rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, timestamp);
$rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, attribute, timestamp, timestamp_posted, timestamp_queued, timestamp_hidden);
if ($node[nid] > 0) {
$n = node_get_object(array("nid" => $node[nid]));
......
......@@ -13,11 +13,11 @@ function forum_view($node) {
function forum_form($edit = array()) {
global $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_textarea("Body", "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -58,28 +58,4 @@ function forum_page() {
$theme->footer();
}
function forum_overview() {
return node_overview(array(0, "WHERE n.type = 'forum' ORDER BY n.title"));
}
function forum_admin() {
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";
switch ($op) {
case "add":
print forum_form();
break;
case "edit":
print forum_form(node_get_array(array(nid => $id)));
break;
case t("Submit"):
print status(forum_save($edit));
// fall through:
default:
print forum_overview();
}
}
?>
\ No newline at end of file
......@@ -13,11 +13,11 @@ function forum_view($node) {
function forum_form($edit = array()) {
global $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_textarea("Body", "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -58,28 +58,4 @@ function forum_page() {
$theme->footer();
}
function forum_overview() {
return node_overview(array(0, "WHERE n.type = 'forum' ORDER BY n.title"));
}
function forum_admin() {
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";
switch ($op) {
case "add":
print forum_form();
break;
case "edit":
print forum_form(node_get_array(array(nid => $id)));
break;
case t("Submit"):
print status(forum_save($edit));
// fall through:
default:
print forum_overview();
}
}
?>
\ No newline at end of file
......@@ -77,7 +77,7 @@ function index_test_1() {
$form .= index_collection_form($entry->collection);
}
$form .= "Select around and click the button below:<BR>";
$form .= form_submit("Click to test");
$form .= form_submit("Click to test 1");
return form($REQUEST_URI, $form);
}
......@@ -101,11 +101,20 @@ function index_test_2($edit) {
return $output;
}
function index_test_3() {
global $REQUEST_URI;
$form .= "Fill out some meta-tags and search for those articles that matches best:<BR>";
$form .= form_submit("Click to test 2");
return form($REQUEST_URI, $form);
}
function index_entry() {
$result = db_query("SELECT * FROM entry ORDER BY name");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\">\n";
$output .= " <TR><TH>name</TH><TH>collection</TH><TH>keywords string</TH><TH>oparations</TH></TR>\n";
$output .= " <TR><TH>name</TH><TH>collection</TH><TH>meta attributes</TH><TH>oparations</TH></TR>\n";
while ($entry = db_fetch_object($result)) {
$output .= "<TR><TD>". check_output($entry->name) ."</TD><TD>". check_output($entry->collection) ."</TD><TD>". check_output($entry->keyword) ."</TD><TD><A HREF=\"admin.php?mod=index&op=edit&id=$entry->eid\">edit entry</A></TD></TR>\n";
}
......@@ -117,7 +126,7 @@ function index_entry() {
function index_admin() {
global $edit, $op, $id;
print "<SMALL><A HREF=\"admin.php?mod=index&op=add\">add new entry</A> | <A HREF=\"admin.php?mod=index&op=entry\">entries</A> | <A HREF=\"admin.php?mod=index&op=collection\">collections</A> | <A HREF=\"admin.php?mod=index&op=help\">help</A> - <A HREF=\"admin.php?mod=index&op=test\">test</A></SMALL><HR>\n";
print "<SMALL><A HREF=\"admin.php?mod=index&op=add\">add new entry</A> | <A HREF=\"admin.php?mod=index&op=entry\">entries</A> | <A HREF=\"admin.php?mod=index&op=collection\">collections</A> | <A HREF=\"admin.php?mod=index&op=help\">help</A> - <A HREF=\"admin.php?mod=index&op=test1\">test1</A></SMALL><HR>\n";
switch ($op) {
case "add":
......@@ -129,12 +138,18 @@ function index_admin() {
case "help":
print index_help();
break;
case "test":
case "test1":
print index_test_1();
break;
case "Click to test":
case "Click to test 1":
print index_test_2($edit);
break;
case "test2":
print index_test_3();
break;
case "Click to test 2":
print index_test_4($edit);
break;
case "collection":
print index_collection();
break;
......
This diff is collapsed.
This diff is collapsed.
......@@ -26,12 +26,12 @@ function page_status() {
function page_form($edit = array()) {
global $format, $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= structure_form("page", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_textarea("Body", "body", $edit[body], 50, 10);
$form .= form_select("Type", "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -44,39 +44,4 @@ function page_save($edit) {
}
}
function page_query($type = "") {
global $status;
$queries = array(array("recent pages", "WHERE n.type = 'page' ORDER BY n.timestamp DESC"), array("posted pages", "WHERE n.type = 'page' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("dumped pages", "WHERE n.type = 'page' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC"));
return ($queries[$type] ? $queries[$type] : $queries);
}
function page_overview($query = array()) {
return node_overview($query);
}
function page_admin() {
global $id, $op, $edit, $type;
print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page&op=listing\">page listing</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n";
$type = ($type ? $type : 0);
switch ($op) {
case "add":
print page_form();
break;
case "edit":
print page_form(node_get_array(array(nid => $id)));
break;
case "listing":
print node_listing(page_query());
break;
case t("Submit"):
print status(page_save($edit));
// fall through:
default:
print page_overview(page_query($type));
}
}
?>
\ No newline at end of file
......@@ -26,12 +26,12 @@ function page_status() {
function page_form($edit = array()) {
global $format, $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= form_textfield("Subject", "title", $edit[title], 50, 64);
$form .= structure_form("page", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_textarea("Body", "body", $edit[body], 50, 10);
$form .= form_select("Type", "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit(t("Submit"));
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -44,39 +44,4 @@ function page_save($edit) {
}
}
function page_query($type = "") {
global $status;
$queries = array(array("recent pages", "WHERE n.type = 'page' ORDER BY n.timestamp DESC"), array("posted pages", "WHERE n.type = 'page' AND n.status = '$status[posted]' ORDER BY n.timestamp DESC"), array("dumped pages", "WHERE n.type = 'page' AND n.status = '$status[dumped]' ORDER BY n.timestamp DESC"));
return ($queries[$type] ? $queries[$type] : $queries);
}
function page_overview($query = array()) {
return node_overview($query);
}
function page_admin() {
global $id, $op, $edit, $type;
print "<SMALL><A HREF=\"admin.php?mod=page&op=add\">add new page</A> | <A HREF=\"admin.php?mod=page&op=listing\">page listing</A> | <A HREF=\"admin.php?mod=page\">overview</A></SMALL><HR>\n";
$type = ($type ? $type : 0);
switch ($op) {
case "add":
print page_form();
break;
case "edit":
print page_form(node_get_array(array(nid => $id)));
break;
case "listing":
print node_listing(page_query());
break;
case t("Submit"):
print status(page_save($edit));
// fall through:
default:
print page_overview(page_query($type));
}
}
?>
\ No newline at end of file
......@@ -209,3 +209,9 @@ CREATE TABLE poll_choices (
PRIMARY KEY (chid)
);
# 04/06/01
ALTER TABLE node ADD timestamp_posted int(11) NOT NULL;
ALTER TABLE node ADD timestamp_queued int(11) NOT NULL;
ALTER TABLE node ADD timestamp_hidden int(11) NOT NULL;
ALTER TABLE node ADD attribute varchar(255) DEFAULT '' NOT NULL;
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