From 47aa65143060ff376d95ca182c55132d821917fb Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 13 Jun 2010 17:58:50 -0700 Subject: Fix problems ith IE and flex initialization when one of the flashvars contains a json encoded string. Also address the problem that IE returns the color values differently that Firefox and Chrome --- modules/organize/controllers/organize.php | 11 +-- modules/organize/lib/Gallery3WebClient.swf | Bin 145339 -> 142627 bytes modules/organize/views/organize_dialog.html.php | 104 ++++++++++++------------ 3 files changed, 60 insertions(+), 55 deletions(-) (limited to 'modules') diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index d2c273b6..b5a25400 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -28,23 +28,24 @@ class Organize_Controller extends Controller { $v = new View("organize_dialog.html"); $v->album = $album; // @todo turn this into an api call. - $v->file_filter = json_encode( + $v->file_filter = addslashes(json_encode( array("photo" => array("label" => "Images", "types" => array("*.jpg", "*.jpeg", "*.png", "*.gif")), - "movie" => array("label" => "Movies", "types" => array("*.flv", "*.mp4")))); + "movie" => array("label" => "Movies", "types" => array("*.flv", "*.mp4"))))); $v->domain = $input->server("SERVER_NAME"); // @todo figure out how to connect this w/o a dependency $v->base_url = url::abs_site("rest") . "/"; - $v->sort_order = json_encode(array("ASC" => (string)t("Ascending"), "DESC" => (string)t("Descending"))); + $v->sort_order = addslashes(json_encode(array("ASC" => (string)t("Ascending"), "DESC" => (string)t("Descending")))); $sort_fields = array(); foreach (album::get_sort_order_options() as $field => $description) { $sort_fields[$field] = (string)$description; } - $v->sort_fields = json_encode($sort_fields); + $v->sort_fields = addslashes(json_encode($sort_fields)); $user = identity::active_user(); - $v->api_key = rest::get_access_key($user->id)->access_key; + $v->access_key = rest::get_access_key($user->id)->access_key; + Kohana_Log::add("error", $v->__toString()); print $v; } diff --git a/modules/organize/lib/Gallery3WebClient.swf b/modules/organize/lib/Gallery3WebClient.swf index 6ff0d5ba..879a4fec 100644 Binary files a/modules/organize/lib/Gallery3WebClient.swf and b/modules/organize/lib/Gallery3WebClient.swf differ diff --git a/modules/organize/views/organize_dialog.html.php b/modules/organize/views/organize_dialog.html.php index 2d340f13..8c5ba133 100644 --- a/modules/organize/views/organize_dialog.html.php +++ b/modules/organize/views/organize_dialog.html.php @@ -27,63 +27,76 @@ }); function closeOrganizeDialog() { - console.log("closeOrganizeDialog"); $("#g-dialog").dialog("close"); } function setTitle(title) { - $("#ui-dialog-title-g-dialog").text(for_js() ?> + title); + $("#ui-dialog-title-g-dialog").text(for_js() ?> + title); } function getOrganizeStyles() { - var styles = { - "color": colorToHex($("#g-organize").css("color")), - "backgroundColor": colorToHex($("#g-organize").css("backgroundColor")), - "borderColor": colorToHex($("#g-organize").css("borderLeftColor")), - "rollOverColor": colorToHex($("#g-organize-hover").css("backgroundColor")), - "selectionColor": colorToHex($("#g-organize-active").css("backgroundColor")) + return { + color: colorToHex($("#g-organize").css("color")), + backgroundColor: colorToHex($("#g-organize").css("backgroundColor")), + borderColor: colorToHex($("#g-organize").css("borderLeftColor")), + rollOverColor: colorToHex($("#g-organize-hover").css("backgroundColor")), + selectionColor: colorToHex($("#g-organize-active").css("backgroundColor")) }; - return styles; } function colorToHex(color) { - var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color); + // Surprising no one, the color extracted from the css is in a different format + // in IE than it is when extracted from FF or Chrome. FF and Chrome return + // the of "rgb(nn,nn,nn)". Where as IE returns it as #hhhhhh. - var red = parseInt(digits[2]); - var green = parseInt(digits[3]); - var blue = parseInt(digits[4]); + if (color.indexOf("#") === 0) { + return '0x' + color.substring(1); + } else { + var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color); - var rgb = blue | (green << 8) | (red << 16); - return digits[1] + '0x' + rgb.toString(16); + var red = parseInt(digits[2]); + var green = parseInt(digits[3]); + var blue = parseInt(digits[4]); + + var rgb = blue | (green << 8) | (red << 16); + return digits[1] + '0x' + rgb.toString(16); + } } function getTextStrings() { - var strings = { - "statusText": for_js() ?>, - "remoteError": + return { + statusText: for_js() ?>, + remoteError: for_js() ?>, - "addAlbumError": for_js() ?>, - "errorOccurred": for_js() ?>, - "addAlbum": for_js() ?>, - "addImages": for_js() ?>, - "deleteSelected": for_js() ?>, - "uploadedText": for_js() ?>, - "removeFileText": for_js() ?>, - "bytes": for_js() ?>, - "kilobytes": for_js() ?>, - "megabytes": for_js() ?>, - "gigabytes": for_js() ?>, - "progressLabel": for_js() ?>, - "uploadLabel": for_js() ?>, - "moveTitle": for_js() ?>, - "deleteTitle": for_js() ?>, - "uploadTitle": for_js() ?>, - "cancel": for_js() ?>, - "close": for_js() ?> + addAlbumError: for_js() ?>, + errorOccurred: for_js() ?>, + addAlbum: for_js() ?>, + addImages: for_js() ?>, + deleteSelected: for_js() ?>, + uploadedText: for_js() ?>, + removeFileText: for_js() ?>, + progressLabel: for_js() ?>, + uploadLabel: for_js() ?>, + moveTitle: for_js() ?>, + deleteTitle: for_js() ?>, + uploadTitle: for_js() ?>, + cancel: for_js() ?>, + close: for_js() ?> }; - return strings; } + function getGalleryParameters() { + return { + fileFilter: "", + domain: "", + sortOrder: "", + sortFields: "", + baseUrl: "", + accessKey: "", + albumId: "id ?>", + controller: "/" + }; + }; /* For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. @@ -91,16 +104,7 @@ var swfVersionStr = "0.0.0"; /* To use express install, set to playerProductInstall.swf, otherwise the empty string.*/ var xiSwfUrlStr = ""; - var flashvars = { - fileFilter: '', - domains: '[""]', - sortOrder: '', - sortFields: '', - baseUrl: '', - apiKey: '', - albumId: "id ?>", - controller: '/' - }; + var flashvars = {}; var size = $.gallery_get_viewport_size(); @@ -111,8 +115,8 @@ params.allowscriptaccess = "sameDomain"; params.allowfullscreen = "true"; var attributes = {}; - attributes.id = "g-organize-object"; - attributes.name = "organize"; + attributes.id = "Gallery3WebClient"; + attributes.name = "Gallery3WebClient"; attributes.align = "middle"; swfobject.embedSWF("", "flashContent", size.width() - 100, size.height() - 135, @@ -121,6 +125,6 @@
-

html::purify($album->title))) ?>

+

html::purify($album->title))) ?>

 
-- cgit v1.2.3