From 96cfda4a936ad0f94160f04dcba1507bbd9a2e5e Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 10 Mar 2012 13:48:56 +0000 Subject: [PATCH] admin buttons --- contrib/admin/style.css | 18 +++++++++++++++++ contrib/admin/theme.php | 45 ++++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 contrib/admin/style.css diff --git a/contrib/admin/style.css b/contrib/admin/style.css new file mode 100644 index 00000000..996054c5 --- /dev/null +++ b/contrib/admin/style.css @@ -0,0 +1,18 @@ +.admin { + padding: 4px; + border-radius: 4px; + background: green; + margin: 6px; + width: 200px; + display: inline-block; +} +.admin.protected { + background: red; +} +.admin INPUT[type="submit"] { + width: 100%; +} +.admin.protected INPUT[type="submit"] { + width: 90%; +} + diff --git a/contrib/admin/theme.php b/contrib/admin/theme.php index b52dbf77..0b6ebd6e 100644 --- a/contrib/admin/theme.php +++ b/contrib/admin/theme.php @@ -10,6 +10,23 @@ class AdminPageTheme extends Themelet { $page->add_block(new NavBlock()); } + protected function button(/*string*/ $name, /*string*/ $action, /*boolean*/ $protected=false) { + $c_protected = $protected ? " protected" : ""; + $html = make_form(make_link("admin_utils"), "POST", false, false, false, "admin$c_protected"); + if($protected) { + $html .= ""; + } + $html .= ""; + if($protected) { + $html .= ""; + } + else { + $html .= ""; + } + $html .= "\n"; + return $html; + } + /* * Show a form which links to admin_utils with POST[action] set to one of: * 'lowercase all tags' @@ -19,27 +36,13 @@ class AdminPageTheme extends Themelet { public function display_form(Page $page) { global $user; - $html = ' - - '.make_form(make_link("admin_utils"),"post", false, false, "return imgidconfirm()")." - - - - "; + $html = ""; + $html .= $this->button("All tags to lowercase", "lowercase_all_tags", true); + $html .= $this->button("Recount tag use", "recount_tag_user", false); + $html .= $this->button("Purge unused tags", "purge_unused_tags", true); + $html .= $this->button("Download database contents", "database_dump", false); + $html .= $this->button("Reset image IDs", "reset_image_ids", true); + $html .= $this->button("Download all images", "image_dump", false); $page->add_block(new Block("Misc Admin Tools", $html)); /* First check