Setup items support labels nicely, as pioneered by Artanis
git-svn-id: file:///home/shish/svn/shimmie2/trunk@78 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
3d4e4f1b8e
commit
ea9da95c7b
11 changed files with 69 additions and 76 deletions
|
@ -27,8 +27,7 @@ class ImageIO extends Extension {
|
|||
$thumbers['ImageMagick'] = "convert";
|
||||
|
||||
$sb = new SetupBlock("Thumbnailing");
|
||||
$sb->add_label("Engine: ");
|
||||
$sb->add_choice_option("thumb_engine", $thumbers);
|
||||
$sb->add_choice_option("thumb_engine", $thumbers, "Engine: ");
|
||||
|
||||
$sb->add_label("<br>Size ");
|
||||
$sb->add_int_option("thumb_width");
|
||||
|
@ -38,9 +37,8 @@ class ImageIO extends Extension {
|
|||
$sb->add_int_option("thumb_quality");
|
||||
$sb->add_label(" % quality ");
|
||||
|
||||
$sb->add_label("<br>Max GD memory use: ");
|
||||
$sb->add_shorthand_int_option("thumb_gd_mem_limit");
|
||||
|
||||
$sb->add_shorthand_int_option("thumb_gd_mem_limit", "<br>Max GD memory use: ");
|
||||
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -62,8 +62,7 @@ class Index extends Extension {
|
|||
$sb->add_int_option("index_height");
|
||||
$sb->add_label(" images");
|
||||
|
||||
$sb->add_label("<br>Image tooltip ");
|
||||
$sb->add_text_option("image_tip");
|
||||
$sb->add_text_option("image_tip", "<br>Image tooltip ");
|
||||
|
||||
$event->panel->add_main_block($sb, 20);
|
||||
}
|
||||
|
|
|
@ -36,42 +36,67 @@ class SetupBlock extends Block {
|
|||
public function add_label($text) {
|
||||
$this->body .= $text;
|
||||
}
|
||||
public function add_text_option($name) {
|
||||
|
||||
public function add_text_option($name, $label=null) {
|
||||
global $config;
|
||||
$val = $config->get_string($name);
|
||||
$this->body .= "<input type='text' name='$name' value='$val'>\n";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$this->body .= "<input type='text' id='$name' name='$name' value='$val'>\n";
|
||||
}
|
||||
public function add_longtext_option($name) {
|
||||
|
||||
public function add_longtext_option($name, $label=null) {
|
||||
global $config;
|
||||
$val = $config->get_string($name);
|
||||
$this->body .= "<textarea rows='5' cols='40' name='$name'>$val</textarea>\n";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$this->body .= "<textarea rows='5' cols='40' id='$name' name='$name'>$val</textarea>\n";
|
||||
$this->body .= "<!--<br><br><br><br>-->\n"; // setup page auto-layout counts <br> tags
|
||||
}
|
||||
public function add_bool_option($name) {
|
||||
|
||||
public function add_bool_option($name, $label=null) {
|
||||
global $config;
|
||||
$checked = $config->get_bool($name) ? " checked" : "";
|
||||
$this->body .= "<input type='checkbox' name='$name'$checked>\n";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$this->body .= "<input type='checkbox' id='$name' name='$name'$checked>\n";
|
||||
}
|
||||
public function add_hidden_option($name) {
|
||||
|
||||
public function add_hidden_option($name, $label=null) {
|
||||
global $config;
|
||||
$val = $config->get_string($name);
|
||||
$this->body .= "<input type='hidden' name='$name' value='$val'>";
|
||||
$this->body .= "<input type='hidden' id='$name' name='$name' value='$val'>";
|
||||
}
|
||||
public function add_int_option($name) {
|
||||
|
||||
public function add_int_option($name, $label=null) {
|
||||
global $config;
|
||||
$val = $config->get_string($name);
|
||||
$this->body .= "<input type='text' name='$name' value='$val' size='4' style='text-align: center;'>\n";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$this->body .= "<input type='text' id='$name' name='$name' value='$val' size='4' style='text-align: center;'>\n";
|
||||
}
|
||||
public function add_shorthand_int_option($name) {
|
||||
|
||||
public function add_shorthand_int_option($name, $label=null) {
|
||||
global $config;
|
||||
$val = to_shorthand_int($config->get_string($name));
|
||||
$this->body .= "<input type='text' name='$name' value='$val' size='6' style='text-align: center;'>\n";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$this->body .= "<input type='text' id='$name' name='$name' value='$val' size='6' style='text-align: center;'>\n";
|
||||
}
|
||||
public function add_choice_option($name, $options) {
|
||||
|
||||
public function add_choice_option($name, $options, $label=null) {
|
||||
global $config;
|
||||
$current = $config->get_string($name);
|
||||
|
||||
$html = "<select name='$name'>";
|
||||
if(!is_null($label)) {
|
||||
$this->body .= "<label for='$name'>$label</label>";
|
||||
}
|
||||
$html = "<select id='$name' name='$name'>";
|
||||
foreach($options as $optname => $optval) {
|
||||
if($optval == $current) $selected=" selected";
|
||||
else $selected="";
|
||||
|
@ -122,20 +147,13 @@ class Setup extends Extension {
|
|||
}
|
||||
|
||||
$sb = new SetupBlock("General");
|
||||
$sb->add_label("Site title: ");
|
||||
$sb->add_text_option("title");
|
||||
$sb->add_label("<br>Front page: ");
|
||||
$sb->add_text_option("front_page");
|
||||
$sb->add_label("<br>Base URL: ");
|
||||
$sb->add_text_option("base_href");
|
||||
$sb->add_label("<br>Data URL: ");
|
||||
$sb->add_text_option("data_href");
|
||||
$sb->add_label("<br>Contact URL: ");
|
||||
$sb->add_text_option("contact_link");
|
||||
$sb->add_label("<br>Theme: ");
|
||||
$sb->add_choice_option("theme", $themes);
|
||||
// $sb->add_label("<br>Anonymous ID: ");
|
||||
// $sb->add_int_option("anon_id", 0, 100000);
|
||||
$sb->add_text_option("title", "Site title: ");
|
||||
$sb->add_text_option("front_page", "<br>Front page: ");
|
||||
$sb->add_text_option("base_href", "<br>Base URL: ");
|
||||
$sb->add_text_option("data_href", "<br>Data URL: ");
|
||||
$sb->add_text_option("contact_link", "<br>Contact URL:");
|
||||
$sb->add_choice_option("theme", $themes, "<br>Theme: ");
|
||||
// $sb->add_int_option("anon_id", "<br>Anonymous ID: "); // FIXME: create advanced options page
|
||||
$sb->add_hidden_option("anon_id");
|
||||
$event->panel->add_main_block($sb, 0);
|
||||
}
|
||||
|
|
|
@ -59,8 +59,7 @@ class TagEdit extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Tag Editing");
|
||||
$sb->add_label("Allow anonymous editing: ");
|
||||
$sb->add_bool_option("tag_edit_anon");
|
||||
$sb->add_bool_option("tag_edit_anon", "Allow anonymous editing: ");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -31,12 +31,9 @@ class Upload extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Upload");
|
||||
$sb->add_label("Max Uploads: ");
|
||||
$sb->add_int_option("upload_count");
|
||||
$sb->add_label("<br>Max size per file: ");
|
||||
$sb->add_shorthand_int_option("upload_size");
|
||||
$sb->add_label("<br>Allow anonymous upoads: ");
|
||||
$sb->add_bool_option("upload_anon");
|
||||
$sb->add_int_option("upload_count", "Max uploads: ");
|
||||
$sb->add_shorthand_int_option("upload_size", "<br>Max size per file: ");
|
||||
$sb->add_bool_option("upload_anon", "<br>Allow anonymous upoads: ");
|
||||
$event->panel->add_main_block($sb, 10);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -56,13 +56,9 @@ class UserPage extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("User Options");
|
||||
$sb->add_label("Login memory: ");
|
||||
$sb->add_int_option("login_memory");
|
||||
$sb->add_label(" days");
|
||||
$sb->add_label("<br>Allow new signups: ");
|
||||
$sb->add_bool_option("login_signup_enabled");
|
||||
$sb->add_label("<br>Terms & Conditions:<br>");
|
||||
$sb->add_longtext_option("login_tac");
|
||||
$sb->add_int_option("login_memory", "Login memory: "); $sb->add_label(" days");
|
||||
$sb->add_bool_option("login_signup_enabled", "<br>Allow new signups: ");
|
||||
$sb->add_longtext_option("login_tac", "<br>Terms & Conditions:<br>");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -35,12 +35,9 @@ class ViewImage extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("View Options");
|
||||
$sb->add_label("Long link ");
|
||||
$sb->add_text_option("image_ilink");
|
||||
$sb->add_label("<br>Short link ");
|
||||
$sb->add_text_option("image_slink");
|
||||
$sb->add_label("<br>Thumbnail link ");
|
||||
$sb->add_text_option("image_tlink");
|
||||
$sb->add_text_option("image_ilink", "Long link ");
|
||||
$sb->add_text_option("image_slink", "<br>Short link ");
|
||||
$sb->add_text_option("image_tlink", "<br>Thumbnail link ");
|
||||
$event->panel->add_main_block($sb, 30);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -103,8 +103,7 @@ class CommentList extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Comment Options");
|
||||
$sb->add_label("Allow anonymous comments ");
|
||||
$sb->add_bool_option("comment_anon");
|
||||
$sb->add_bool_option("comment_anon", "Allow anonymous comments: ");
|
||||
$sb->add_label("<br>Limit to ");
|
||||
$sb->add_int_option("comment_limit");
|
||||
$sb->add_label(" comments per ");
|
||||
|
@ -113,8 +112,7 @@ class CommentList extends Extension {
|
|||
$sb->add_label("<br>Show ");
|
||||
$sb->add_int_option("comment_count");
|
||||
$sb->add_label(" recent comments on the index");
|
||||
$sb->add_label("<br>Akismet Key ");
|
||||
$sb->add_text_option("comment_wordpress_key");
|
||||
$sb->add_text_option("comment_wordpress_key", "<br>Akismet Key ");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -7,10 +7,8 @@ class Downtime extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Downtime");
|
||||
$sb->add_label("Disable non-admin access: ");
|
||||
$sb->add_bool_option("downtime");
|
||||
$sb->add_label("<br>");
|
||||
$sb->add_longtext_option("downtime_message");
|
||||
$sb->add_bool_option("downtime", "Disable non-admin access: ");
|
||||
$sb->add_longtext_option("downtime_message", "<br>");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -44,19 +44,13 @@ class TagList extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Tag Map Options");
|
||||
$sb->add_label("Ignore tags used fewer than ");
|
||||
$sb->add_int_option("tags_min", 0, 99);
|
||||
$sb->add_label(" times");
|
||||
$sb->add_int_option("tags_min", "Ignore tags used fewer than "); $sb->add_label(" times");
|
||||
$event->panel->add_main_block($sb);
|
||||
|
||||
$sb = new SetupBlock("Popular / Related Tag List");
|
||||
$sb->add_label("Show top ");
|
||||
$sb->add_int_option("tag_list_length");
|
||||
$sb->add_label(" tags");
|
||||
$sb->add_label("<br>Tag info link: ");
|
||||
$sb->add_text_option("info_link");
|
||||
$sb->add_label("<br>Show tag counts: ");
|
||||
$sb->add_bool_option("tag_list_numbers");
|
||||
$sb->add_int_option("tag_list_length", "Show top "); $sb->add_label(" tags");
|
||||
$sb->add_text_option("info_link", "<br>Tag info link: ");
|
||||
$sb->add_bool_option("tag_list_numbers", "<br>Show tag counts: ");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
|
@ -9,8 +9,7 @@ class Zoom extends Extension {
|
|||
|
||||
if(is_a($event, 'SetupBuildingEvent')) {
|
||||
$sb = new SetupBlock("Image Zoom");
|
||||
$sb->add_label("Zoom by default: ");
|
||||
$sb->add_bool_option("image_zoom");
|
||||
$sb->add_bool_option("image_zoom", "Zoom by default: ");
|
||||
$event->panel->add_main_block($sb);
|
||||
}
|
||||
if(is_a($event, 'ConfigSaveEvent')) {
|
||||
|
|
Reference in a new issue