diff options
-rw-r--r-- | core/controllers/admin_themes.php | 17 | ||||
-rw-r--r-- | core/helpers/theme.php | 13 | ||||
-rw-r--r-- | themes/admin_default/js/ui.init.js | 4 |
3 files changed, 28 insertions, 6 deletions
diff --git a/core/controllers/admin_themes.php b/core/controllers/admin_themes.php index 26ed86a6..9896ce50 100644 --- a/core/controllers/admin_themes.php +++ b/core/controllers/admin_themes.php @@ -29,6 +29,7 @@ class Admin_Themes_Controller extends Admin_Controller { $file = THEMEPATH . $theme_name . "/theme.info"; $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); $details = theme::get_edit_form_admin($theme_info); + $theme_info['id'] = $theme_name; $theme_info['details'] = $details; if ($theme_info->admin) { $admin_themes[$theme_name] = $theme_info; @@ -46,12 +47,24 @@ class Admin_Themes_Controller extends Admin_Controller { print $view; } - public function edit($theme_name) { + public function edit_form($theme_name) { $file = THEMEPATH . $theme_name . "/theme.info"; $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); + $theme_info['id'] = $theme_name; print theme::get_edit_form_admin($theme_info); } + public function edit($theme_name) { + $file = THEMEPATH . $theme_name . "/theme.info"; + $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); + $theme_info['id'] = $theme_name; + $form = theme::get_edit_form_admin($theme_info); + $valid = $form->validate(); + if ($valid) { + ; + } + } + public function save() { access::verify_csrf(); $theme = $this->input->post("themes"); @@ -61,6 +74,6 @@ class Admin_Themes_Controller extends Admin_Controller { log::success("graphics", t("Changed theme to {{theme_name}}", array("theme_name" => $theme))); } url::redirect("admin/themes"); - } + } } diff --git a/core/helpers/theme.php b/core/helpers/theme.php index 20e9a9d8..65e1eb20 100644 --- a/core/helpers/theme.php +++ b/core/helpers/theme.php @@ -39,9 +39,14 @@ class theme_Core { } public static function get_edit_form_admin($theme) { - $form = new Forge("admin/themes/edit/$theme->name"); + $form = new Forge("admin/themes/edit/{$theme->id}/bogus"); $group = $form->group("edit_theme")->label($theme->description); - $group->input("name")->label(t("Name"))->id("gName")->value($theme->name); + $group->input("page_size")->label(t("Items per page"))->id("gPageSize")-> + 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)); + $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("gResizeSize")-> + value(self::_get_var($theme->id, "resize_size", 600)); $group->submit(t("Modify Theme")); return $form; } @@ -50,5 +55,9 @@ class theme_Core { $file = THEMEPATH . $theme_name . "/theme.info"; $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); } + + 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)); + } } diff --git a/themes/admin_default/js/ui.init.js b/themes/admin_default/js/ui.init.js index b662ce80..8e9da933 100644 --- a/themes/admin_default/js/ui.init.js +++ b/themes/admin_default/js/ui.init.js @@ -24,7 +24,7 @@ $(document).ready(function(){ }; $("#gThemeAdmin :radio").click(function(event) { - $("#gThemeDetails").load("themes/edit/" + event.target.value); + $("#gThemeDetails").load("themes/edit_form/" + event.target.value); }); $("#gThemeTabs > ul").tabs({ select: updateThemeDetails }); @@ -37,5 +37,5 @@ function updateThemeDetails(evt, ui) { } else { themeName = $("#gtAdmin :checked").val(); } - $("#gThemeDetails").load("themes/edit/" + themeName); + $("#gThemeDetails").load("themes/edit_form/" + themeName); } |