diff options
author | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-10 22:36:06 +0000 |
---|---|---|
committer | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-10 22:36:06 +0000 |
commit | 5ee03eb9c80188a6f4397eba14e1ce5e23c49cac (patch) | |
tree | df9dc16e15b461ad31230143a9651ebca172068d | |
parent | 705c55fb798c97dfb398cad23670fce2f5e16fb4 (diff) |
Save individual theme values
-rw-r--r-- | core/controllers/admin_themes.php | 7 | ||||
-rw-r--r-- | core/helpers/theme.php | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/core/controllers/admin_themes.php b/core/controllers/admin_themes.php index 278fb8f9..6d5d3d45 100644 --- a/core/controllers/admin_themes.php +++ b/core/controllers/admin_themes.php @@ -61,6 +61,13 @@ class Admin_Themes_Controller extends Admin_Controller { $form = theme::get_edit_form_admin($theme_info); $valid = $form->validate(); if ($valid) { + foreach (array("page_size", "thumb_size", "resize_size") as $param) { + $val = theme::get_var($theme_name, $param); + $input_val = $form->edit_theme->{$param}->value; + if ($val != $input_val) { + module::set_var($theme_name, $param, $input_val); + } + } print json_encode(array("result" => "success", "message" => t("Theme was successfully updated"))); } else { diff --git a/core/helpers/theme.php b/core/helpers/theme.php index 1d3e4a8f..fac2de33 100644 --- a/core/helpers/theme.php +++ b/core/helpers/theme.php @@ -43,11 +43,14 @@ class theme_Core { '', null, array("id" =>"gThemeDetailsForm")); $group = $form->group("edit_theme")->label($theme->description); $group->input("page_size")->label(t("Items per page"))->id("gPageSize")-> - value(self::_get_var($theme->id, "page_size", 90)); + rules('required|valid_digit')-> + value(self::get_var($theme->id, "page_size", 90)); $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("gThumbSize")-> - value(self::_get_var($theme->id, "thumb_size", 300)); + rules('required|valid_digit')-> + value(self::get_var($theme->id, "thumb_size", 300)); $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("gResizeSize")-> - value(self::_get_var($theme->id, "resize_size", 600)); + rules('required|valid_digit')-> + value(self::get_var($theme->id, "resize_size", 600)); $group->submit(t("Modify Theme")); return $form; } @@ -57,7 +60,7 @@ class theme_Core { $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); } - public static function _get_var($theme_id, $name, $default_value = null) { + public static function get_var($theme_id, $name, $default_value = null) { return module::get_var($theme_id, $name, module::get_var("core", $name, $default_value)); } } |