summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-23 08:33:22 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-23 08:33:22 +0000
commitf75a803cd67283c24cc54a001163f9ee47210010 (patch)
treec3b4147886971d325a9600805cd7a86d38054e9a
parent0a025c984d44098bb053621fdb217185734b0c1a (diff)
Simplify this code. We know what the fields are, pull them by name so that we're clear about what actions we're taking. Return the form itself on validation failure, coupled with de-ajaxifying the form makes it render properly as an error when you enter bogus data.
-rw-r--r--core/controllers/admin_themedetails.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/core/controllers/admin_themedetails.php b/core/controllers/admin_themedetails.php
index 4efcc77b..347c0911 100644
--- a/core/controllers/admin_themedetails.php
+++ b/core/controllers/admin_themedetails.php
@@ -26,20 +26,17 @@ class Admin_Themedetails_Controller extends Admin_Controller {
public function save() {
$form = theme::get_edit_form_admin();
- $init_array = $form->as_array();
if ($form->validate()) {
- $form_array = $form->as_array();
- $intersect = array_diff_key($form_array, array('csrf' => 0));
- foreach ($intersect as $key => $value) {
- if ($init_array[$key] != $value) {
- module::set_var("core", $key, $value);
- }
- }
+ module::set_var("core", "page_size", $form->edit_theme->page_size->value);
+ module::set_var("core", "thumb_size", $form->edit_theme->thumb_size->value);
+ module::set_var("core", "resize_size", $form->edit_theme->resize_size->value);
message::success(t("Updated theme details"));
+ url::redirect("admin/themedetails");
} else {
- message::error(t("Error updating theme details"));
+ $view = new Admin_View("admin.html");
+ $view->content = $form;
+ print $view;
}
- url::redirect("admin/themedetails");
}
}