Index: popups.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/popups.info,v
retrieving revision 1.4.8.2
diff -u -p -r1.4.8.2 popups.info
--- popups.info 5 Mar 2009 19:52:48 -0000 1.4.8.2
+++ popups.info 31 May 2009 18:17:57 -0000
@@ -2,5 +2,5 @@
name = Popups API
description = General dialog creation utilities
package = User interface
-core = 6.x
-
+core = 7.x
+files[] = popups.module
Index: popups.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/popups.js,v
retrieving revision 1.9.8.15
diff -u -p -r1.9.8.15 popups.js
--- popups.js 26 Mar 2009 17:30:54 -0000 1.9.8.15
+++ popups.js 31 May 2009 18:17:58 -0000
@@ -18,6 +18,8 @@
// DRUPAL Namespace
// ***************************************************************************
+(function ($) {
+
/**
* Attach the popups bevior to the all the requested links on the page.
*
@@ -25,32 +27,33 @@
* The jQuery object to apply the behaviors to.
*/
-Drupal.behaviors.popups = function(context) {
- Popups.saveSettings();
+Drupal.behaviors.popups = {
+ attach: function(context) {
+ Popups.saveSettings();
- var $body = $('body');
- if(!$body.hasClass('popups-processed')) {
- $body.addClass('popups-processed');
- $(document).bind('keydown', Popups.keyHandle);
- var $popit = $('#popit');
- if ($popit.length) {
- $popit.remove();
- Popups.message($popit.html());
+ var $body = $('body');
+ if(!$body.hasClass('popups-processed')) {
+ $body.addClass('popups-processed');
+ $(document).bind('keydown', Popups.keyHandle);
+ var $popit = $('#popit');
+ if ($popit.length) {
+ $popit.remove();
+ Popups.message($popit.html());
+ }
}
- }
- // Add the popups-link-in-dialog behavior to links defined in Drupal.settings.popups.links array.
- // Get these from current Drupal.settings, not Popups.originalSettings, as each page has it's own hooks.
- if (Drupal.settings.popups && Drupal.settings.popups.links) {
- jQuery.each(Drupal.settings.popups.links, function (link, options) {
- Popups.attach(context, link, Popups.options(options));
- });
+ // Add the popups-link-in-dialog behavior to links defined in Drupal.settings.popups.links array.
+ // Get these from current Drupal.settings, not Popups.originalSettings, as each page has it's own hooks.
+ if (Drupal.settings.popups && Drupal.settings.popups.links) {
+ jQuery.each(Drupal.settings.popups.links, function (link, options) {
+ Popups.attach(context, link, Popups.options(options));
+ });
+ }
+ Popups.attach(context, '.popups', Popups.options({updateMethod: 'none'}));
+ Popups.attach(context, '.popups-form', Popups.options({updateMethod: 'ajax'})); // ajax reload.
+ Popups.attach(context, '.popups-form-reload', Popups.options({updateMethod: 'reload'})); // whole page reload.
+ Popups.attach(context, '.popups-form-noupdate', Popups.options({updateMethod: 'none'})); // no reload at all.
}
-
- Popups.attach(context, '.popups', Popups.options({updateMethod: 'none'}));
- Popups.attach(context, '.popups-form', Popups.options({updateMethod: 'ajax'})); // ajax reload.
- Popups.attach(context, '.popups-form-reload', Popups.options({updateMethod: 'reload'})); // whole page reload.
- Popups.attach(context, '.popups-form-noupdate', Popups.options({updateMethod: 'none'})); // no reload at all.
};
// ***************************************************************************
@@ -748,7 +751,7 @@ Popups.addJS = function(js) {
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',
@@ -1138,7 +1141,7 @@ Drupal.theme.prototype.popupTemplate = f
template += '
';
template += ' %body
';
template += ' ';
@@ -1147,3 +1150,4 @@ Drupal.theme.prototype.popupTemplate = f
return template;
};
+})(jQuery);
\ No newline at end of file
Index: popups.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/popups.module,v
retrieving revision 1.11.8.11
diff -u -p -r1.11.8.11 popups.module
--- popups.module 26 Mar 2009 17:25:19 -0000 1.11.8.11
+++ popups.module 31 May 2009 18:17:59 -0000
@@ -76,6 +76,22 @@ function popups_init() {
// Menu status constants are integers; page content is a string.
if (isset($content) && !is_int($content) && isset($override)) {
+
+ if (is_array($content)) {
+ if (!isset($page['#type']) || ($page['#type'] != 'page')) {
+ // Not a page structure array.
+ $content = drupal_render($content);
+ }
+ else {
+ // Was a page structure array. Get actual
+ // page contents and use/render that.
+ $content = drupal_set_page_content();
+ if (is_array($content)) {
+ $content = drupal_render($content);
+ }
+ }
+ }
+
print popups_render_as_json($content);
exit; // Do not continue processing request in index.html.
}
@@ -147,28 +163,32 @@ function popups_render_as_json($content)
* Get the added JS in a format that is readable by popups.js.
*/
function popups_get_js() {
- $js = array_merge_recursive(drupal_add_js(), drupal_add_js(NULL, NULL, 'footer'));
+
+ $javascript = drupal_add_js();
+ drupal_alter('js', $javascript);
+ uasort($javascript, 'drupal_sort_weight');
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1);
$popup_js = array();
- foreach ($js as $type => $data) {
- if (!$data) continue;
- switch ($type) {
+ foreach ($javascript as $item) {
+ switch ($item['type']) {
case 'setting':
- // Why not just array_merge_recursive($data);
- $popup_js['setting'] = call_user_func_array('array_merge_recursive', $data);
+ $popup_js['setting'] = array_merge_recursive($item);
break;
+
case 'inline':
- foreach ($data as $info) {
- $popup_js['inline'][] = '\n";
- }
+ $popup_js['inline'][] = '\n";
break;
- default:
- foreach ($data as $path => $info) {
- $popup_js[$type][$path] = '\n";
- }
+
+ case 'file':
+ $popup_js[$item['type']][$item['data']] = '\n";
break;
+
+ /*case 'external':
+ // Preprocessing for external JavaScript files is ignored.
+ $output .= '\n";
+ break;*/
}
}
@@ -186,7 +206,7 @@ function popups_get_css() {
// Only process styles added to "all".
$media = 'all';
- foreach ($css[$media] as $type => $files) {
+ foreach ($css[$media] as $type => $information) {
if ($type == 'module') {
// Setup theme overrides for module styles.
$theme_styles = array();
@@ -194,28 +214,28 @@ function popups_get_css() {
$theme_styles[] = basename($theme_style);
}
}
- foreach($css[$media][$type] as $file => $preprocess) {
+ foreach($css[$media][$type] as $data => $preprocess) {
// If the theme supplies its own style using the name of the module style, skip its inclusion.
// This includes any RTL styles associated with its main LTR counterpart.
- if ($type == 'module' && in_array(str_replace('-rtl.css', '.css', basename($file)), $theme_styles)) {
+ if ($type == 'module' && in_array(str_replace('-rtl.css', '.css', basename($data)), $theme_styles)) {
// Unset the file to prevent its inclusion when CSS aggregation is enabled.
- unset($css[$media][$type][$file]);
+ unset($css[$media][$type][$data]);
continue;
}
// Only include the stylesheet if it exists.
- if (file_exists($file)) {
+ if (file_exists($data)) {
// If a CSS file is not to be preprocessed and it's a module CSS file, it needs to *always* appear at the *top*,
// regardless of whether preprocessing is on or off.
if ($type == 'module') {
- $popup_css['module'][$file] = ''."\n";
+ $popup_css['module'][$data] = ''."\n";
}
// If a CSS file is not to be preprocessed and it's a theme CSS file, it needs to *always* appear at the *bottom*,
// regardless of whether preprocessing is on or off.
else if ($type == 'theme') {
- $popup_css['theme'][$file] = ''."\n";
+ $popup_css['theme'][$data] = ''."\n";
}
else {
- $popup_css['unknown'][$file] = ''."\n";
+ $popup_css['unknown'][$data] = ''."\n";
}
}
}
@@ -299,9 +319,11 @@ function popups_add_popups($rules=NULL)
// Allow skinning of the popup.
$skin = variable_get('popups_skin', 'Basic');
$skins = popups_skins();
- if (!$skins[$skin]['css']) { // $skin == 'Unskinned'
+ if (empty($skins[$skin]['css'])) { // $skin == 'Unskinned'
// Look in the current theme for popups-skin.js
- drupal_add_js(drupal_get_path('theme', $theme) . '/popups-skin.js');
+ if (file_exists(drupal_get_path('theme', $theme) . '/popups-skin.js')) {
+ drupal_add_js(drupal_get_path('theme', $theme) . '/popups-skin.js');
+ }
}
else { // Get css and js from selected skin.
drupal_add_css($skins[$skin]['css']);
@@ -359,12 +381,12 @@ function popups_skins($reset = FALSE) {
function popups_popups_skins() {
$skins = array();
$skins_directory = drupal_get_path('module', 'popups') .'/skins';
- $files = file_scan_directory($skins_directory, '\.css$');
+ $files = file_scan_directory($skins_directory, '!\.css$!');
foreach ($files as $file) {
$name = drupal_ucfirst($file->name);
- $skins[$name]['css'] = $file->filename;
- $js = substr_replace($file->filename, '.js', -4);
+ $skins[$name]['css'] = $file->filepath;
+ $js = substr_replace($file->filepath, '.js', -4);
if (file_exists($js)) {
$skins[$name]['js'] = $js;
}
@@ -379,7 +401,7 @@ function popups_popups_skins() {
* Sometime in the future I will change this to '#content' or '#content-content'.
*/
function _popups_default_content_selector() {
- return 'div.left-corner > div.clear-block:last'; // Garland in Drupal 6.
+ return 'div.left-corner > div.clearfix:last'; // Garland in Drupal 6.
}
// **************************************************************************
Index: popups_admin.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/Attic/popups_admin.info,v
retrieving revision 1.1.6.3
diff -u -p -r1.1.6.3 popups_admin.info
--- popups_admin.info 5 Mar 2009 19:52:48 -0000 1.1.6.3
+++ popups_admin.info 31 May 2009 18:17:59 -0000
@@ -2,6 +2,6 @@
name = Popups: Administration Links
description = Uses the Popups API to add popups to various administration pages.
package = User interface
-core = 6.x
+core = 7.x
dependencies[] = popups
-
+files[] = popups_admin.module
Index: popups_test.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/Attic/popups_test.info,v
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.3 popups_test.info
--- popups_test.info 5 Mar 2009 19:52:49 -0000 1.1.4.3
+++ popups_test.info 31 May 2009 18:17:59 -0000
@@ -2,6 +2,6 @@
name = Popups: Test Page
description = Test the Popups API.
package = User interface
-core = 6.x
+core = 7.x
dependencies[] = popups
-
+files[] = popups_test.module
\ No newline at end of file
Index: skins/facebook/facebook.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/popups/skins/facebook/Attic/facebook.js,v
retrieving revision 1.1.4.5
diff -u -p -r1.1.4.5 facebook.js
--- skins/facebook/facebook.js 26 Mar 2009 22:41:26 -0000 1.1.4.5
+++ skins/facebook/facebook.js 31 May 2009 18:17:59 -0000
@@ -44,7 +44,7 @@ Drupal.theme.popupTemplate = function (p
template += ' ';
template += ' %body
';
template += ' ';