diff options
Diffstat (limited to 'modules/gallery/controllers/admin_theme_options.php')
-rw-r--r-- | modules/gallery/controllers/admin_theme_options.php | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index dc421ee1..27a67bdb 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -21,44 +21,48 @@ class Admin_Theme_Options_Controller extends Admin_Controller { public function index() { $view = new Admin_View("admin.html"); $view->content = new View("admin_theme_options.html"); - - $theme_name = theme::$site; - $info = theme::get_info($theme_name); - - // Don't use the Kohana cascading file system because we don't want to mess up the admin theme - $theme_helper = THEMEPATH . "$theme_name/helpers/{$theme_name}.php"; - @require_once($theme_helper); - $view->content->form = call_user_func_array(array(theme::$site, "get_admin_form"), - array("admin/theme_options/save/")); - - $view->content->title = t("%name options", array("name" => $info->name)); - + $view->content->form = theme::get_edit_form_admin(); print $view; } public function save() { access::verify_csrf(); - // Don't use the Kohana cascading file system because we don't want to mess up the admin theme - $theme_name = theme::$site; - $theme_helper = THEMEPATH . "$theme_name/helpers/{$theme_name}.php"; - @require_once($theme_helper); + $form = theme::get_edit_form_admin(); + if ($form->validate()) { + module::set_var("gallery", "page_size", $form->edit_theme->page_size->value); - $info = theme::get_info($theme_name); + $thumb_size = $form->edit_theme->thumb_size->value; + $thumb_dirty = false; + if (module::get_var("gallery", "thumb_size") != $thumb_size) { + graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize"); + graphics::add_rule( + "gallery", "thumb", "gallery_graphics::resize", + array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), + 100); + module::set_var("gallery", "thumb_size", $thumb_size); + } - $form = call_user_func_array(array(theme::$site, "get_admin_form"), - array("admin/theme_options/save/")); - if ($form->validate()) { + $resize_size = $form->edit_theme->resize_size->value; + $resize_dirty = false; + if (module::get_var("gallery", "resize_size") != $resize_size) { + graphics::remove_rule("gallery", "resize", "gallery_graphics::resize"); + graphics::add_rule( + "gallery", "resize", "gallery_graphics::resize", + array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), + 100); + module::set_var("gallery", "resize_size", $resize_size); + } - $view->content->form = call_user_func_array(array(theme::$site, "update_options"), - array($form)); + module::set_var("gallery", "header_text", $form->edit_theme->header_text->value); + module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); + module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value); - message::success(t("Updated %name options", array("name" => $info->name))); + message::success(t("Updated theme details")); url::redirect("admin/theme_options"); } else { $view = new Admin_View("admin.html"); $view->content = $form; - $view->content->title = t("%name options", array("name" => $info->name)); print $view; } } |