remove ConfigSaveEvent handlers

git-svn-id: file:///home/shish/svn/shimmie2/trunk@265 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-12 08:14:37 +00:00
parent 40eb4699b8
commit 5a4d6f7277
19 changed files with 27 additions and 98 deletions

View file

@ -33,11 +33,6 @@ class Home extends Extension {
$sb->add_label("<br>Note: page accessed via /home");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent'))
{
$event->config->set_string_from_post("home_links");
$event->config->set_string_from_post("home_counter");
}
}
private function get_body()

View file

@ -17,9 +17,6 @@ class LinkImage extends Extension {
$sb->add_text_option("ext_link-img_text-link_format","Text Link Format:");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("ext_link-img_text-link_format");
}
if(is_a($event, 'InitExtEvent')) {
global $config;
//just set default if empty.

View file

@ -39,12 +39,6 @@ class Ratings extends Extension {
$sb->add_label(" recent comments on the index");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool("comment_anon", $_POST['comment_anon']);
$event->config->set_int("comment_limit", $_POST['comment_limit']);
$event->config->set_int("comment_window", $_POST['comment_window']);
$event->config->set_int("comment_count", $_POST['comment_count']);
}
*/
}

View file

@ -23,9 +23,6 @@ class SiteDescription extends Extension {
$sb->add_longtext_option("site_description");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("site_description");
}
}
}
add_event_listener(new SiteDescription());

View file

@ -50,9 +50,6 @@ class Tag_History extends Extension {
$sb->add_label(" entires per image");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_int_from_post("history_limit");
}
if(is_a($event, 'TagSetEvent')) {
$this->add_tag_history($event->image_id);
}

View file

@ -139,10 +139,6 @@ class Wiki extends Extension {
$sb->add_bool_option("wiki_edit_user", "<br>Allow user edits: ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("wiki_edit_anon");
$event->config->set_bool_from_post("wiki_edit_user");
}
}
// }}}
// misc {{{

View file

@ -19,9 +19,6 @@ class WordFilter extends Extension {
$sb->add_label("<br>(each line should be search term and replace term, separated by a comma)");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("word_filter");
}
}
private function filter($text) {

View file

@ -127,13 +127,6 @@ class CommentList extends Extension {
$sb->add_text_option("comment_wordpress_key", "<br>Akismet Key ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("comment_anon");
$event->config->set_int_from_post("comment_limit");
$event->config->set_int_from_post("comment_window");
$event->config->set_int_from_post("comment_count");
$event->config->set_string_from_post("comment_wordpress_key");
}
}
// }}}
// installer {{{

View file

@ -14,10 +14,6 @@ class Downtime extends Extension {
$sb->add_longtext_option("downtime_message", "<br>");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("downtime");
$event->config->set_string_from_post("downtime_message");
}
if(is_a($event, 'PageRequestEvent')) {
global $config;
if($config->get_bool("downtime")) {

View file

@ -49,13 +49,6 @@ class ImageIO extends Extension {
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("thumb_engine");
$event->config->set_int_from_post("thumb_width");
$event->config->set_int_from_post("thumb_height");
$event->config->set_int_from_post("thumb_quality");
$event->config->set_int_from_post("thumb_mem_limit");
}
}
// }}}
// add image {{{

View file

@ -44,11 +44,6 @@ class Index extends Extension {
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_int_from_post("index_width");
$event->config->set_int_from_post("index_height");
$event->config->set_string_from_post("image_tip");
}
}
}
add_event_listener(new Index());

View file

@ -17,9 +17,6 @@ class News extends Extension {
$sb->add_longtext_option("news_text");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("news_text");
}
}
}
add_event_listener(new News());

View file

@ -50,7 +50,8 @@ class SetupBlock extends Block {
if(!is_null($label)) {
$this->body .= "<label for='$name'>$label</label>";
}
$this->body .= "<input type='text' id='$name' name='$name' value='$val'>\n";
$this->body .= "<input type='text' id='$name' name='_config_$name' value='$val'>\n";
$this->body .= "<input type='hidden' name='_type_$name' value='string'>\n";
}
public function add_longtext_option($name, $label=null) {
@ -59,8 +60,9 @@ class SetupBlock extends Block {
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 .= "<textarea rows='5' cols='40' id='_config_$name' name='$name'>$val</textarea>\n";
$this->body .= "<!--<br><br><br><br>-->\n"; // setup page auto-layout counts <br> tags
$this->body .= "<input type='hidden' name='_type_$name' value='string'>\n";
}
public function add_bool_option($name, $label=null) {
@ -69,14 +71,15 @@ class SetupBlock extends Block {
if(!is_null($label)) {
$this->body .= "<label for='$name'>$label</label>";
}
$this->body .= "<input type='checkbox' id='$name' name='$name'$checked>\n";
$this->body .= "<input type='checkbox' id='_config_$name' name='$name'$checked>\n";
$this->body .= "<input type='hidden' name='_type_$name' value='bool'>\n";
}
public function add_hidden_option($name, $label=null) {
global $config;
$val = $config->get_string($name);
$this->body .= "<input type='hidden' id='$name' name='$name' value='$val'>";
}
// public function add_hidden_option($name, $label=null) {
// global $config;
// $val = $config->get_string($name);
// $this->body .= "<input type='hidden' id='$name' name='$name' value='$val'>";
// }
public function add_int_option($name, $label=null) {
global $config;
@ -84,7 +87,8 @@ class SetupBlock extends Block {
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";
$this->body .= "<input type='text' id='$name' name='_config_$name' value='$val' size='4' style='text-align: center;'>\n";
$this->body .= "<input type='hidden' name='_type_$name' value='int'>\n";
}
public function add_shorthand_int_option($name, $label=null) {
@ -93,7 +97,8 @@ class SetupBlock extends Block {
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";
$this->body .= "<input type='text' id='$name' name='_config_$name' value='$val' size='6' style='text-align: center;'>\n";
$this->body .= "<input type='hidden' name='_type_$name' value='int'>\n";
}
public function add_choice_option($name, $options, $label=null) {
@ -103,13 +108,14 @@ class SetupBlock extends Block {
if(!is_null($label)) {
$this->body .= "<label for='$name'>$label</label>";
}
$html = "<select id='$name' name='$name'>";
$html = "<select id='_config_$name' name='$name'>";
foreach($options as $optname => $optval) {
if($optval == $current) $selected=" selected";
else $selected="";
$html .= "<option value='$optval'$selected>$optname</option>\n";
}
$html .= "</select>";
$this->body .= "<input type='hidden' name='_type_$name' value='string'>\n";
$this->body .= $html;
}
@ -166,13 +172,16 @@ class Setup extends Extension {
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("title");
$event->config->set_string_from_post("front_page");
$event->config->set_string_from_post("base_href");
$event->config->set_string_from_post("data_href");
$event->config->set_string_from_post("contact_link");
$event->config->set_string_from_post("theme");
$event->config->set_int_from_post("anon_id");
foreach($_POST as $name => $value) {
if(substr($name, 0, 8) == "_config_") {
$name = substr($name, 8);
switch($_POST["_type_$name"]) {
case "string": $event->config->set_string($name, $value); break;
case "int": $event->config->set_int($name, $value); break;
case "bool": $event->config->set_bool($name, $value); break;
}
}
}
}
if(is_a($event, 'UserBlockBuildingEvent')) {

View file

@ -61,9 +61,6 @@ class TagEdit extends Extension {
$sb->add_bool_option("tag_edit_anon", "Allow anonymous editing: ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("tag_edit_anon");
}
}
// }}}
// do things {{{

View file

@ -59,13 +59,6 @@ class TagList extends Extension {
$sb->add_bool_option("tag_list_numbers", "<br>Show tag counts: ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_int_from_post("tags_min");
$event->config->set_int_from_post("tag_list_length");
$event->config->set_string_from_post("info_link");
$event->config->set_bool_from_post("tag_list_numbers");
}
}
// }}}
// misc {{{

View file

@ -38,11 +38,6 @@ class Upload extends Extension {
$sb->add_bool_option("upload_anon", "<br>Allow anonymous uploads: ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_int_from_post("upload_count");
$event->config->set_int_from_post("upload_size");
$event->config->set_bool_from_post("upload_anon");
}
}
// }}}
// do things {{{

View file

@ -74,10 +74,6 @@ class UserPage extends Extension {
$sb->add_longtext_option("login_tac", "<br>Terms &amp; Conditions:<br>");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("login_signup_enabled");
$event->config->set_string_from_post("login_tac");
}
if(is_a($event, 'UserBlockBuildingEvent')) {
$event->add_link("User Config", make_link("user"));

View file

@ -41,11 +41,6 @@ class ViewImage extends Extension {
$sb->add_text_option("image_tlink", "<br>Thumbnail link ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string_from_post("image_ilink");
$event->config->set_string_from_post("image_slink");
$event->config->set_string_from_post("image_tlink");
}
}
// }}}
// HTML {{{

View file

@ -16,9 +16,6 @@ class Zoom extends Extension {
$sb->add_bool_option("image_zoom", "Zoom by default: ");
$event->panel->add_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_bool_from_post("image_zoom");
}
}
}