diff options
author | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-10 22:04:49 +0000 |
---|---|---|
committer | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-10 22:04:49 +0000 |
commit | 705c55fb798c97dfb398cad23670fce2f5e16fb4 (patch) | |
tree | 8b0c7128f53adcb1633f8f3c7888458cbbc98905 | |
parent | 144f8c342b35b8940b93e5934f0c149266f5c313 (diff) |
Submit theme values
-rw-r--r-- | core/controllers/admin_themes.php | 8 | ||||
-rw-r--r-- | core/helpers/theme.php | 3 | ||||
-rw-r--r-- | core/views/admin_themes.html.php | 1 | ||||
-rw-r--r-- | themes/admin_default/js/ui.init.js | 10 |
4 files changed, 19 insertions, 3 deletions
diff --git a/core/controllers/admin_themes.php b/core/controllers/admin_themes.php index 9896ce50..278fb8f9 100644 --- a/core/controllers/admin_themes.php +++ b/core/controllers/admin_themes.php @@ -28,8 +28,8 @@ 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; + $details = theme::get_edit_form_admin($theme_info); $theme_info['details'] = $details; if ($theme_info->admin) { $admin_themes[$theme_name] = $theme_info; @@ -61,7 +61,11 @@ class Admin_Themes_Controller extends Admin_Controller { $form = theme::get_edit_form_admin($theme_info); $valid = $form->validate(); if ($valid) { - ; + print json_encode(array("result" => "success", + "message" => t("Theme was successfully updated"))); + } else { + print json_encode(array("result" => "error", + "message" => t("Error saving theme values"))); } } diff --git a/core/helpers/theme.php b/core/helpers/theme.php index 65e1eb20..1d3e4a8f 100644 --- a/core/helpers/theme.php +++ b/core/helpers/theme.php @@ -39,7 +39,8 @@ class theme_Core { } public static function get_edit_form_admin($theme) { - $form = new Forge("admin/themes/edit/{$theme->id}/bogus"); + $form = new Forge("admin/themes/edit/{$theme->id}", + '', 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)); diff --git a/core/views/admin_themes.html.php b/core/views/admin_themes.html.php index fffd23da..64df7608 100644 --- a/core/views/admin_themes.html.php +++ b/core/views/admin_themes.html.php @@ -75,5 +75,6 @@ </form> </div> <div id="gThemeDetails"> + <p id="gMessage"></p> <?= $themes[$active]->details ?> </div> diff --git a/themes/admin_default/js/ui.init.js b/themes/admin_default/js/ui.init.js index 8e9da933..95d516fe 100644 --- a/themes/admin_default/js/ui.init.js +++ b/themes/admin_default/js/ui.init.js @@ -28,6 +28,16 @@ $(document).ready(function(){ }); $("#gThemeTabs > ul").tabs({ select: updateThemeDetails }); + + $("#gThemeDetailsForm").ajaxForm( { + dataType: "json", + success: function(body, result, set) { + if (body.result == "success") { + $("#gMessage").append("<span class='gSuccess'>" + body.message + "</span>"); + } else { + $("#gMessage").append("<span class='gError'>" + body.message + "</span>"); + } + }}); }); function updateThemeDetails(evt, ui) { |