2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2020-01-26 23:12:48 +00:00
|
|
|
use function MicroHTML\INPUT;
|
2007-07-19 12:08:42 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class AdminPageTheme extends Themelet
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Show the basics of a page, for other extensions to add to
|
|
|
|
*/
|
|
|
|
public function display_page()
|
|
|
|
{
|
|
|
|
global $page;
|
2012-03-10 18:50:10 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->set_title("Admin Tools");
|
|
|
|
$page->set_heading("Admin Tools");
|
|
|
|
$page->add_block(new NavBlock());
|
|
|
|
}
|
2007-07-19 12:08:42 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
protected function button(string $name, string $action, bool $protected=false): string
|
|
|
|
{
|
|
|
|
$c_protected = $protected ? " protected" : "";
|
|
|
|
$html = make_form(make_link("admin/$action"), "POST", false, "admin$c_protected");
|
|
|
|
if ($protected) {
|
|
|
|
$html .= "<input type='submit' id='$action' value='$name' disabled='disabled'>";
|
|
|
|
$html .= "<input type='checkbox' onclick='$(\"#$action\").attr(\"disabled\", !$(this).is(\":checked\"))'>";
|
|
|
|
} else {
|
|
|
|
$html .= "<input type='submit' id='$action' value='$name'>";
|
|
|
|
}
|
|
|
|
$html .= "</form>\n";
|
|
|
|
return $html;
|
|
|
|
}
|
2012-03-10 13:48:56 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
/*
|
|
|
|
* Show a form which links to admin_utils with POST[action] set to one of:
|
|
|
|
* 'lowercase all tags'
|
|
|
|
* 'recount tag use'
|
|
|
|
* etc
|
|
|
|
*/
|
|
|
|
public function display_form()
|
|
|
|
{
|
|
|
|
global $page, $database;
|
2010-05-28 13:26:46 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$html = "";
|
|
|
|
$html .= $this->button("All tags to lowercase", "lowercase_all_tags", true);
|
|
|
|
$html .= $this->button("Recount tag use", "recount_tag_use", false);
|
|
|
|
$page->add_block(new Block("Misc Admin Tools", $html));
|
2012-09-03 11:06:11 +00:00
|
|
|
|
2020-01-26 23:12:48 +00:00
|
|
|
$html = (string)SHM_SIMPLE_FORM(
|
|
|
|
make_link("admin/set_tag_case"),
|
|
|
|
INPUT(["type"=>'text', "name"=>'tag', "placeholder"=>'Enter tag with correct case', "class"=>'autocomplete_tags', "autocomplete"=>'off']),
|
|
|
|
SHM_SUBMIT('Set Tag Case'),
|
|
|
|
);
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block("Set Tag Case", $html));
|
|
|
|
}
|
2007-07-19 12:08:42 +00:00
|
|
|
}
|