# HG changeset patch # User Franck Deroche # Date 1293799572 -3600 # Node ID c076d54409cbbf2a29965e0d2829cc56104c7f54 # Parent 76f9b43738f20ad14c371d05b42ba8c391f4ab62 Popus: Version RF diff -r 76f9b43738f2 -r c076d54409cb .cvsignore --- a/.cvsignore Fri Dec 31 13:41:08 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -.project diff -r 76f9b43738f2 -r c076d54409cb .project --- a/.project Fri Dec 31 13:41:08 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ - - - popups62 - - - - - - - - diff -r 76f9b43738f2 -r c076d54409cb patches/10-play_nice_with_views_exposed_filters.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/10-play_nice_with_views_exposed_filters.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,14 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 2378) ++++ popups.js (copie de travail) +@@ -805,6 +805,9 @@ + * Do before the form in the popups is submitted. + */ + Popups.beforeSubmit = function(formData, $form, options) { ++ if ($form.hasClass('views-processed') && $form.parents('div.view-filters').size()) { ++ return false; ++ } + Popups.removePopup(); // Remove just the dialog, but not the overlay. + Popups.addLoading(); + }; diff -r 76f9b43738f2 -r c076d54409cb patches/2-careful-with-ahah.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/2-careful-with-ahah.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,24 @@ +Index: popups.module +=================================================================== +--- popups.module (révision 337) ++++ popups.module (copie de travail) +@@ -192,6 +192,10 @@ + */ + function popups_add_popups($rules=NULL) { + static $added = FALSE; ++ static $shouldAdd = NULL; ++ if (is_null($shouldAdd)) { ++ $shouldAdd = $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' || $_SESSION['page_override']; ++ } + $settings = array('popups' => array()); + + if (is_array($rules)) { +@@ -224,7 +228,7 @@ + drupal_add_js( $settings, 'setting' ); + } + } +- if (!$added) { ++ if (!$added && $shouldAdd) { + drupal_add_css(drupal_get_path('module', 'popups') .'/popups.css'); + drupal_add_css(drupal_get_path('module', 'popups') .'/popups-skin.css'); + drupal_add_js(drupal_get_path('module', 'popups') .'/popups.js'); diff -r 76f9b43738f2 -r c076d54409cb patches/3-allow-drupal-alter.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/3-allow-drupal-alter.diff Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,13 @@ +Index: popups.module +=================================================================== +--- popups.module (révision 1196) ++++ popups.module (copie de travail) +@@ -153,6 +153,8 @@ + + $popup_js = array(); + ++ // Allow modules to specifically alter the JS used in a popup. ++ drupal_alter('popups_js', $js); + if (module_exists('jquery_update')) { + $replacements = jquery_update_get_replacements(); + $path = drupal_get_path('module', 'jquery_update') .'/replace/'; diff -r 76f9b43738f2 -r c076d54409cb patches/4-allow-form-to-opt-out-of-ajaxform.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/4-allow-form-to-opt-out-of-ajaxform.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,13 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 549) ++++ popups.js (copie de travail) +@@ -922,7 +922,7 @@ + popup.refocus(); + + // If the popups contains a form, capture submits. +- var $form = $('form', popup.$popupBody()); ++ var $form = $('form:not(.no-popup)', popup.$popupBody()); + if ($form.length) { + $form.ajaxForm({ + dataType: 'json', diff -r 76f9b43738f2 -r c076d54409cb patches/5-ie7-compatibility.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/5-ie7-compatibility.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,14 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 555) ++++ popups.js (copie de travail) +@@ -604,7 +604,8 @@ + if (popup) { + // console.log('removing '+popup.id); + popup.$popup().remove(); +- Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() ++// Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() ++ Popups.popupStack.pop(); + } + // else { + // console.log("Popups.removePopup - there is no popup to remove."); diff -r 76f9b43738f2 -r c076d54409cb patches/6-deal-with-onUpdate-correctly.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/6-deal-with-onUpdate-correctly.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,23 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 638) ++++ popups.js (copie de travail) +@@ -77,7 +77,7 @@ + */ + Popups.defaultOptions = { + doneTest: null, // null, *path*, *regexp*. how do we know when a multiform flow is done? +- updateMethod: 'ajax', // none, ajax, reload, *callback* ++ updateMethod: 'ajax', // none, ajax, reload, callback + updateSource: 'initial', // initial, final. Only used if updateMethod != none. + href: null, + width: null, // Override the width specified in the css. +@@ -86,7 +86,8 @@ + reloadOnError: false, // Force the entire page to reload if the popup href is unaccessable. + noMessage: false, // Don't show drupal_set_message messages. + skipDirtyCheck: false, // If true, this popup will not check for edits on the originating page. +- hijackDestination: true // Use the destiination param to force a form submit to return to the originating page. ++ hijackDestination: true, // Use the destiination param to force a form submit to return to the originating page. ++ onUpdate: null // Callback used for the updateMethod: 'callback' type + }; + + // *************************************************************************** diff -r 76f9b43738f2 -r c076d54409cb patches/7-allow-bad-response-message-translation.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/7-allow-bad-response-message-translation.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,13 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 1439) ++++ popups.js (copie de travail) +@@ -934,7 +934,7 @@ + Popups.formSuccess(popup, json); + }, + error: function() { +- Popups.message("Bad Response form submission"); ++ Popups.message(Drupal.t("Bad Response form submission")); + } + }); + } diff -r 76f9b43738f2 -r c076d54409cb patches/8-facebook-skin-no-firebug-logging.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/8-facebook-skin-no-firebug-logging.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,27 @@ +Index: skins/facebook/facebook.js +=================================================================== +--- skins/facebook/facebook.js (révision 2066) ++++ skins/facebook/facebook.js (copie de travail) +@@ -3,7 +3,6 @@ + * Custom theming for the popupsLoading. + */ + Drupal.theme.popupLoading = function() { +-console.log("Drupal.theme.popupLoading: Facebook"); + var loading; + loading += '
'; + loading += ' '; +@@ -30,7 +29,6 @@ + }; + + Drupal.theme.popupTemplate = function (popupId) { +-console.log("Drupal.theme.popupTemplate: Facebook"); + var template; + template += '
'; + template += '
'; +@@ -85,4 +83,4 @@ + $popup.height($popup.height() + 20); + } + } +-}; +\ No newline at end of file ++}; diff -r 76f9b43738f2 -r c076d54409cb patches/9-fix_warnings_php_fgm.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/9-fix_warnings_php_fgm.patch Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,13 @@ +Index: popups.module +=================================================================== +--- popups.module (révision 2370) ++++ popups.module (copie de travail) +@@ -295,7 +295,7 @@ + static $added = FALSE; + static $shouldAdd = NULL; + if (is_null($shouldAdd)) { +- $shouldAdd = $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' || $_SESSION['page_override']; ++ $shouldAdd = !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' || $_SESSION['page_override']; + } + $settings = array('popups' => array()); + diff -r 76f9b43738f2 -r c076d54409cb patches/check-data-messages.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/check-data-messages.diff Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,13 @@ +Index: popups.js +=================================================================== +--- popups.js (révision 182) ++++ popups.js (copie de travail) +@@ -437,7 +437,7 @@ + } + else { // Normal, targeted ajax, reload behavior. + // show messages in dialog and embed the results in the original page. +- var showMessage = data.messages.length && !options.noMessage; ++ var showMessage = data.messages && data.messages.length && !options.noMessage; + if (showMessage) { + Drupal.popups.message(data.messages); + if (!Drupal.settings.popups.popupFinalMessage) { diff -r 76f9b43738f2 -r c076d54409cb popups-popup.tpl.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/popups-popup.tpl.php Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,16 @@ + +
+
+
+
%title
+
+
+
%body
+
%buttons
+ +
diff -r 76f9b43738f2 -r c076d54409cb popups-skin.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/popups-skin.css Fri Dec 31 13:46:12 2010 +0100 @@ -0,0 +1,30 @@ +#popups { + border: 2px solid #EDF5FA; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + opacity: 0.9; +} +#popups-title { + border-bottom: 1px solid #b4d7f0; + background-color: #d4e7f3; + color: #455067; + margin-bottom: 0.25em; + padding: 0.25em; + -moz-border-radius-topleft: 5px; + -webkit-border-radius-topleft: 5px; +} +#popups-title #popups-close a { + color: red; +} +#popups input { + margin: 0.1em; +} +#popups input[type="text"]:focus, #popups input[type="password"]:focus, #popups textarea:focus { + background-color: #FFA; + outline: thin solid grey; +} +a.popups-processed:after { + content: "\25A1"; + vertical-align: super; + font-size: smaller; +} \ No newline at end of file diff -r 76f9b43738f2 -r c076d54409cb popups.js --- a/popups.js Fri Dec 31 13:41:08 2010 +0100 +++ b/popups.js Fri Dec 31 13:46:12 2010 +0100 @@ -77,7 +77,7 @@ */ Popups.defaultOptions = { doneTest: null, // null, *path*, *regexp*. how do we know when a multiform flow is done? - updateMethod: 'ajax', // none, ajax, reload, *callback* + updateMethod: 'ajax', // none, ajax, reload, callback updateSource: 'initial', // initial, final. Only used if updateMethod != none. href: null, width: null, // Override the width specified in the css. @@ -86,7 +86,8 @@ reloadOnError: false, // Force the entire page to reload if the popup href is unaccessable. noMessage: false, // Don't show drupal_set_message messages. skipDirtyCheck: false, // If true, this popup will not check for edits on the originating page. - hijackDestination: true // Use the destiination param to force a form submit to return to the originating page. + hijackDestination: true, // Use the destiination param to force a form submit to return to the originating page. + onUpdate: null // Callback used for the updateMethod: 'callback' type }; // *************************************************************************** @@ -604,7 +605,8 @@ if (popup) { // console.log('removing '+popup.id); popup.$popup().remove(); - Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() +// Popups.popupStack.splice(Popups.popupStack.indexOf(popup), 1); // Remove popup from stack. Probably should rework into .pop() + Popups.popupStack.pop(); } // else { // console.log("Popups.removePopup - there is no popup to remove."); @@ -759,7 +761,7 @@ for (var i in scripts) { var src = scripts[i]; - if (!$('script[src='+ src + ']').length && !Popups.addedJS[src]) { + if (!$("script[src='"+ src + "']").length && !Popups.addedJS[src]) { // Get the script from the server and execute it. $.ajax({ type: 'GET', @@ -803,6 +805,9 @@ * Do before the form in the popups is submitted. */ Popups.beforeSubmit = function(formData, $form, options) { + if ($form.hasClass('views-processed') && $form.parents('div.view-filters').size()) { + return false; + } Popups.removePopup(); // Remove just the dialog, but not the overlay. Popups.addLoading(); }; @@ -922,17 +927,18 @@ popup.refocus(); // If the popups contains a form, capture submits. - var $form = $('form', popup.$popupBody()); + var $form = $('form:not(.no-popup)', popup.$popupBody()); if ($form.length) { $form.ajaxForm({ dataType: 'json', + iframe: false, beforeSubmit: Popups.beforeSubmit, beforeSend: Popups.beforeSend, success: function(json, status) { Popups.formSuccess(popup, json); }, error: function() { - Popups.message("Bad Response form submission"); + Popups.message(Drupal.t("Bad Response form submission")); } }); } diff -r 76f9b43738f2 -r c076d54409cb popups.module --- a/popups.module Fri Dec 31 13:41:08 2010 +0100 +++ b/popups.module Fri Dec 31 13:46:12 2010 +0100 @@ -153,6 +153,25 @@ $popup_js = array(); + // Allow modules to specifically alter the JS used in a popup. + drupal_alter('popups_js', $js); + if (module_exists('jquery_update')) { + $replacements = jquery_update_get_replacements(); + $path = drupal_get_path('module', 'jquery_update') .'/replace/'; + foreach($replacements as $type => $data) { + foreach($data as $src => $dst) { + $replacements[$type][$src] = $path . $dst; + } + } + // The behavior got called, so we're pretty sure that jQuery is already + // loaded. + unset($js['core']['misc/jquery.js']); + unset($js['core']['misc/drupal.js']); + } + else { + $replacements = array(); + } + foreach ($js as $type => $data) { if (!$data) continue; switch ($type) { @@ -167,6 +186,7 @@ break; default: foreach ($data as $path => $info) { + $path = isset($replacements[$type][$path]) ? $replacements[$type][$path] : $path; $popup_js[$type][$path] = '\n"; } break; @@ -273,6 +293,10 @@ */ function popups_add_popups($rules=NULL) { static $added = FALSE; + static $shouldAdd = NULL; + if (is_null($shouldAdd)) { + $shouldAdd = !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest' || $_SESSION['page_override']; + } $settings = array('popups' => array()); if (is_array($rules)) { @@ -289,7 +313,7 @@ drupal_add_js( $settings, 'setting' ); } } - if (!$added) { + if (!$added && $shouldAdd) { // Determing if we are showing the default theme or a custom theme. global $custom_theme; $theme = $custom_theme; diff -r 76f9b43738f2 -r c076d54409cb skins/facebook/facebook.js --- a/skins/facebook/facebook.js Fri Dec 31 13:41:08 2010 +0100 +++ b/skins/facebook/facebook.js Fri Dec 31 13:46:12 2010 +0100 @@ -3,7 +3,6 @@ * Custom theming for the popupsLoading. */ Drupal.theme.popupLoading = function() { -console.log("Drupal.theme.popupLoading: Facebook"); var loading; loading += '
'; loading += '
'; @@ -30,7 +29,6 @@ }; Drupal.theme.popupTemplate = function (popupId) { -console.log("Drupal.theme.popupTemplate: Facebook"); var template; template += '
'; template += '
'; @@ -85,4 +83,4 @@ $popup.height($popup.height() + 20); } } -}; \ No newline at end of file +};