Commit 2fbc7fcf authored by Dries's avatar Dries

- Committed a partial administration page integration patch.
parent e4695fd5
......@@ -574,52 +574,54 @@ function import_admin() {
switch ($op) {
case "add":
if (arg(4) == "bundle") {
print import_form_bundle();
$output = import_form_bundle();
}
else {
print import_form_feed();
$output = import_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
print import_form_bundle(import_get_bundle(arg(5)));
$output = import_form_bundle(import_get_bundle(arg(5)));
}
else {
print import_form_feed(import_get_feed(arg(5)));
$output = import_form_feed(import_get_feed(arg(5)));
}
break;
case "remove":
print status(import_remove(import_get_feed(arg(4))));
print import_view();
$output = status(import_remove(import_get_feed(arg(4))));
$output .= import_view();
break;
case "update":
print status(import_refresh(import_get_feed(arg(4))));
print import_view();
$output = status(import_refresh(import_get_feed(arg(4))));
$output .= import_view();
break;
case "tag":
print import_tag();
$output = import_tag();
break;
case "Save attributes":
print status(import_save_attributes($edit));
print import_tag();
$output = status(import_save_attributes($edit));
$output .= import_tag();
break;
case "Delete":
$edit["title"] = 0;
// fall through:
case "Submit":
if (arg(4) == "bundle") {
print status(import_save_bundle($edit));
$output = status(import_save_bundle($edit));
}
else {
print status(import_save_feed($edit));
$output = status(import_save_feed($edit));
}
// fall through:
default:
print import_view();
$output .= import_view();
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -574,52 +574,54 @@ function import_admin() {
switch ($op) {
case "add":
if (arg(4) == "bundle") {
print import_form_bundle();
$output = import_form_bundle();
}
else {
print import_form_feed();
$output = import_form_feed();
}
break;
case "edit":
if (arg(4) == "bundle") {
print import_form_bundle(import_get_bundle(arg(5)));
$output = import_form_bundle(import_get_bundle(arg(5)));
}
else {
print import_form_feed(import_get_feed(arg(5)));
$output = import_form_feed(import_get_feed(arg(5)));
}
break;
case "remove":
print status(import_remove(import_get_feed(arg(4))));
print import_view();
$output = status(import_remove(import_get_feed(arg(4))));
$output .= import_view();
break;
case "update":
print status(import_refresh(import_get_feed(arg(4))));
print import_view();
$output = status(import_refresh(import_get_feed(arg(4))));
$output .= import_view();
break;
case "tag":
print import_tag();
$output = import_tag();
break;
case "Save attributes":
print status(import_save_attributes($edit));
print import_tag();
$output = status(import_save_attributes($edit));
$output .= import_tag();
break;
case "Delete":
$edit["title"] = 0;
// fall through:
case "Submit":
if (arg(4) == "bundle") {
print status(import_save_bundle($edit));
$output = status(import_save_bundle($edit));
}
else {
print status(import_save_feed($edit));
$output = status(import_save_feed($edit));
}
// fall through:
default:
print import_view();
$output .= import_view();
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -169,13 +169,16 @@ function block_admin_display() {
$delete = "";
}
$rows[] = array($block["info"], array("data" => form_checkbox(NULL, $block["module"]."][".$block["delta"]."][status", 1, $block["status"]), "align" => "center"), array("data" => form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]), "align" => "center"), form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]), form_select(NULL, $block["module"]."][".$block["delta"]."][region", $block["region"], array(t("left"), t("right"))), form_textfield(NULL, $block["module"]."][".$block["delta"]."][path", $block["path"], 10, 255), $edit, $delete);
$status = form_checkbox(NULL, $block["module"]."][".$block["delta"]."][status", 1, $block["status"]);
$custom = form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]);
$rows[] = array($block["info"], array("data" => $status, "align" => "center"), array("data" => $custom, "align" => "center"), form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]), form_select(NULL, $block["module"]."][".$block["delta"]."][region", $block["region"], array(t("left"), t("right"))), form_textfield(NULL, $block["module"]."][".$block["delta"]."][path", $block["path"], 10, 255), $edit, $delete);
}
$output = table($header, $rows);
$output .= form_submit(t("Save blocks"));
print form($output);
return form($output);
}
function block_admin_preview() {
......@@ -228,7 +231,7 @@ function block_admin_preview() {
$output .= " <tr><td colspan=\"2\" style=\"text-align: center;\">". t("footer") ."</td></tr>\n";
$output .= "</table>\n";
print $output;
return $output;
}
function block_box_get($bid) {
......@@ -251,7 +254,7 @@ function block_box_form($edit = array()) {
$form .= form_submit(t("Save block"));
print form($form);
return form($form);
}
function block_box_save($edit) {
......@@ -288,34 +291,36 @@ function block_admin() {
switch ($op) {
case "preview":
block_admin_preview();
$output = block_admin_preview();
break;
case "add":
block_box_form();
$output = block_box_form();
break;
case "edit":
block_box_form(block_box_get(arg(3)));
$output = block_box_form(block_box_get(arg(3)));
break;
case "delete":
print status(block_box_delete(arg(3)));
$output = status(block_box_delete(arg(3)));
cache_clear_all();
block_admin_display();
$output .= block_admin_display();
break;
case t("Save block"):
print status(block_box_save($edit));
$output = status(block_box_save($edit));
cache_clear_all();
block_admin_display();
$output .= block_admin_display();
break;
case t("Save blocks"):
print status(block_admin_save($edit));
$output = status(block_admin_save($edit));
cache_clear_all();
// fall through
default:
block_admin_display();
$output .= block_admin_display();
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -169,13 +169,16 @@ function block_admin_display() {
$delete = "";
}
$rows[] = array($block["info"], array("data" => form_checkbox(NULL, $block["module"]."][".$block["delta"]."][status", 1, $block["status"]), "align" => "center"), array("data" => form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]), "align" => "center"), form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]), form_select(NULL, $block["module"]."][".$block["delta"]."][region", $block["region"], array(t("left"), t("right"))), form_textfield(NULL, $block["module"]."][".$block["delta"]."][path", $block["path"], 10, 255), $edit, $delete);
$status = form_checkbox(NULL, $block["module"]."][".$block["delta"]."][status", 1, $block["status"]);
$custom = form_checkbox(NULL, $block["module"]."][".$block["delta"]."][custom", 1, $block["custom"]);
$rows[] = array($block["info"], array("data" => $status, "align" => "center"), array("data" => $custom, "align" => "center"), form_weight(NULL, $block["module"]."][".$block["delta"]."][weight", $block["weight"]), form_select(NULL, $block["module"]."][".$block["delta"]."][region", $block["region"], array(t("left"), t("right"))), form_textfield(NULL, $block["module"]."][".$block["delta"]."][path", $block["path"], 10, 255), $edit, $delete);
}
$output = table($header, $rows);
$output .= form_submit(t("Save blocks"));
print form($output);
return form($output);
}
function block_admin_preview() {
......@@ -228,7 +231,7 @@ function block_admin_preview() {
$output .= " <tr><td colspan=\"2\" style=\"text-align: center;\">". t("footer") ."</td></tr>\n";
$output .= "</table>\n";
print $output;
return $output;
}
function block_box_get($bid) {
......@@ -251,7 +254,7 @@ function block_box_form($edit = array()) {
$form .= form_submit(t("Save block"));
print form($form);
return form($form);
}
function block_box_save($edit) {
......@@ -288,34 +291,36 @@ function block_admin() {
switch ($op) {
case "preview":
block_admin_preview();
$output = block_admin_preview();
break;
case "add":
block_box_form();
$output = block_box_form();
break;
case "edit":
block_box_form(block_box_get(arg(3)));
$output = block_box_form(block_box_get(arg(3)));
break;
case "delete":
print status(block_box_delete(arg(3)));
$output = status(block_box_delete(arg(3)));
cache_clear_all();
block_admin_display();
$output .= block_admin_display();
break;
case t("Save block"):
print status(block_box_save($edit));
$output = status(block_box_save($edit));
cache_clear_all();
block_admin_display();
$output .= block_admin_display();
break;
case t("Save blocks"):
print status(block_admin_save($edit));
$output = status(block_admin_save($edit));
cache_clear_all();
// fall through
default:
block_admin_display();
$output .= block_admin_display();
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -628,7 +628,7 @@ function book_page() {
theme("footer");
break;
case "print":
print book_print(arg(2), $depth = 1);
return book_print(arg(2), $depth = 1);
break;
default:
book_render();
......@@ -810,18 +810,19 @@ function book_admin() {
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
print book_node_link();
$output = book_node_link();
break;
case "orphan":
print book_admin_orphan();
$output = book_admin_orphan();
break;
case t("Save book pages"):
print status(book_admin_save(arg(3), $edit));
$output = status(book_admin_save(arg(3), $edit));
// fall through:
default:
print book_admin_view(arg(3));
$output .= book_admin_view(arg(3));
break;
}
return $output;
}
}
......
......@@ -628,7 +628,7 @@ function book_page() {
theme("footer");
break;
case "print":
print book_print(arg(2), $depth = 1);
return book_print(arg(2), $depth = 1);
break;
default:
book_render();
......@@ -810,18 +810,19 @@ function book_admin() {
case t("Add to book outline"):
case t("Remove from book outline"):
case t("Update book outline"):
print book_node_link();
$output = book_node_link();
break;
case "orphan":
print book_admin_orphan();
$output = book_admin_orphan();
break;
case t("Save book pages"):
print status(book_admin_save(arg(3), $edit));
$output = status(book_admin_save(arg(3), $edit));
// fall through:
default:
print book_admin_view(arg(3));
$output .= book_admin_view(arg(3));
break;
}
return $output;
}
}
......
......@@ -228,27 +228,28 @@ function cloud_admin() {
if (user_access("administer site cloud")) {
switch ($op) {
case "add":
print cloud_form();
$output = cloud_form();
break;
case "edit":
print cloud_form(cloud_get_site(arg(4)));
$output = cloud_form(cloud_get_site(arg(4)));
break;
case "update":
print status(cloud_update(cloud_get_site(arg(4))));
print cloud_display();
$output = status(cloud_update(cloud_get_site(arg(4))));
$output .= cloud_display();
break;
case "Delete":
$edit["name"] = 0;
// fall through:
case "Submit":
print status(cloud_save($edit));
$output = status(cloud_save($edit));
// fall through:
default:
print cloud_display();
$output .= cloud_display();
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -1174,29 +1174,29 @@ function comment_admin() {
if (user_access("administer comments")) {
switch ($op) {
case "edit":
print comment_admin_edit(arg(3));
$output = comment_admin_edit(arg(3));
break;
case "search":
print search_type("comment", url("admin/comment/search"), $_POST["keys"]);
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
print comment_mod_votes($edit);
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
print comment_mod_roles($edit);
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
print comment_mod_matrix($edit);
$output = comment_mod_matrix($edit);
}
break;
case "filters":
......@@ -1204,31 +1204,32 @@ function comment_admin() {
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
print comment_mod_filters($edit);
$output = comment_mod_filters($edit);
}
break;
case "delete":
print comment_delete(array("cid" => arg(3)));
$output = comment_delete(array("cid" => arg(3)));
break;
case t("Delete"):
print status(comment_delete($edit));
print comment_admin_overview(0);
$output = status(comment_delete($edit));
$output .= comment_admin_overview(0);
break;
case t("Submit"):
print status(comment_save(check_query(arg(3)), $edit));
print comment_admin_overview(0);
$output = status(comment_save(check_query(arg(3)), $edit));
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
print comment_admin_overview(1);
$output = comment_admin_overview(1);
}
else {
print comment_admin_overview(0);
$output = comment_admin_overview(0);
}
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -1174,29 +1174,29 @@ function comment_admin() {
if (user_access("administer comments")) {
switch ($op) {
case "edit":
print comment_admin_edit(arg(3));
$output = comment_admin_edit(arg(3));
break;
case "search":
print search_type("comment", url("admin/comment/search"), $_POST["keys"]);
$output = search_type("comment", url("admin/comment/search"), $_POST["keys"]);
break;
case "votes":
case t("Add new vote"):
case t("Delete vote"):
case t("Save vote"):
if (user_access("administer moderation")) {
print comment_mod_votes($edit);
$output = comment_mod_votes($edit);
}
break;
case "roles":
case t("Save scores"):
if (user_access("administer moderation")) {
print comment_mod_roles($edit);
$output = comment_mod_roles($edit);
}
break;
case "matrix":
case t("Submit votes"):
if (user_access("administer moderation")) {
print comment_mod_matrix($edit);
$output = comment_mod_matrix($edit);
}
break;
case "filters":
......@@ -1204,31 +1204,32 @@ function comment_admin() {
case t("Delete threshold"):
case t("Save threshold"):
if (user_access("administer moderation")) {
print comment_mod_filters($edit);
$output = comment_mod_filters($edit);
}
break;
case "delete":
print comment_delete(array("cid" => arg(3)));
$output = comment_delete(array("cid" => arg(3)));
break;
case t("Delete"):
print status(comment_delete($edit));
print comment_admin_overview(0);
$output = status(comment_delete($edit));
$output .= comment_admin_overview(0);
break;
case t("Submit"):
print status(comment_save(check_query(arg(3)), $edit));
print comment_admin_overview(0);
$output = status(comment_save(check_query(arg(3)), $edit));
$output .= comment_admin_overview(0);
break;
default:
if (arg(3) == 1) {
print comment_admin_overview(1);
$output = comment_admin_overview(1);
}
else {
print comment_admin_overview(0);
$output = comment_admin_overview(0);
}
}
return $output;
}
else {
print message_access();
return message_access();
}
}
......
......@@ -49,8 +49,8 @@ function help_admin() {
}
}
print "<small>". implode(" &middot; ", $links) ."</small><hr />";
print $output;
$output = "<small>". implode(" &middot; ", $links) ."</small><hr />". $output;
return $output;
}
?>
......@@ -49,8 +49,8 @@ function help_admin() {
}
}
print "<small>". implode(" &middot; ", $links) ."</small><hr />";
print $output;
$output = "<small>". implode(" &middot; ", $links) ."</small><hr />". $output;
return $output;
}
?>
......@@ -574,52 +574,54 @@ function import_admin() {
switch ($op) {
case "add":
if (arg(4) == "bundle") {
print import_form_bundle();
$output = import_form_bundle();
}
else {
print import_form_feed();