diff options
| author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
| commit | 691ce806dc9aefac596a692ff2ba927a81a65440 (patch) | |
| tree | 410f64288ef1d8bbc8455509af74d0e7582dc48e /modules/watermark/controllers | |
| parent | c83650d83ad8b1f4bda30cac2ae8efa6e1c97287 (diff) | |
| parent | 8559cdb5b6bfa87864941f726521660023779fa7 (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/watermark/controllers')
| -rw-r--r-- | modules/watermark/controllers/admin_watermarks.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index 18b463ca..a2cafee0 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -49,11 +49,11 @@ class Admin_Watermarks_Controller extends Admin_Controller { log::success("watermark", t("Watermark changed")); message::success(t("Watermark changed")); - print json_encode( + json::reply( array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => (string) $form)); + json::reply(array("result" => "error", "html" => (string)$form)); } } @@ -79,11 +79,9 @@ class Admin_Watermarks_Controller extends Admin_Controller { log::success("watermark", t("Watermark deleted")); message::success(t("Watermark deleted")); } - print json_encode( - array("result" => "success", - "location" => url::site("admin/watermarks"))); + json::reply(array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => (string) $form)); + json::reply(array("result" => "error", "html" => (string)$form)); } } @@ -120,12 +118,20 @@ class Admin_Watermarks_Controller extends Admin_Controller { message::success(t("Watermark saved")); log::success("watermark", t("Watermark saved")); - print json_encode( - array("result" => "success", - "location" => url::site("admin/watermarks"))); + json::reply(array("result" => "success", "location" => url::site("admin/watermarks"))); } else { - print json_encode(array("result" => "error", "form" => rawurlencode((string) $form))); + // rawurlencode the results because the JS code that uploads the file buffers it in an + // iframe which entitizes the HTML and makes it difficult for the JS to process. If we url + // encode it now, it passes through cleanly. See ticket #797. + json::reply(array("result" => "error", "html" => rawurlencode((string)$form))); } + + // Override the application/json mime type. The dialog based HTML uploader uses an iframe to + // buffer the reply, and on some browsers (Firefox 3.6) it does not know what to do with the + // JSON that it gets back so it puts up a dialog asking the user what to do with it. So force + // the encoding type back to HTML for the iframe. + // See: http://jquery.malsup.com/form/#file-upload + header("Content-Type: text/html; charset=" . Kohana::CHARSET); } private function _update_graphics_rules() { |
