Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal Core Commits

Commit 339750 by webchick

#674852 follow-up by casey and aspilicious: Fix overlay tab behaviours.

--- <a href="http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-parent.js" title="http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-parent.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-paren...</a>  2010/03/09 20:52:27     1.31
+++ <a href="http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-parent.js" title="http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-parent.js" rel="nofollow">http://drupalcode.org/viewvc/drupal/drupal/modules/overlay/overlay-paren...</a>  2010/03/10 20:34:57     1.32
@@ -273,32 +273,57 @@
 
   self.isLoading = true;
 
-  self.$iframeWindow = null;
-  self.$iframeDocument = null;
-  self.$iframeBody = null;
-
-  // No need to resize while loading.
-  clearTimeout(self.resizeTimeoutID);
-
   // Change the overlay title.
   self.$container.dialog('option', 'title', Drupal.t('Loading...'));
   // Remove any existing shortcut button markup in the title section.
   self.$dialogTitlebar.find('.add-or-remove-shortcuts').remove();
+
   // Remove any existing tabs in the title section, but only if requested url
-  // is not one of those tabs. If the latter, set that tab active.
-  var urlPath = self.getPath(url);
-  var $tabs = self.$dialogTitlebar.find('ul');
-  var $tabsLinks = $tabs.find('> li > a');
-  var $activeLink = $tabsLinks.filter(function () { return self.getPath(this) == urlPath; });
-  if ($activeLink.length) {
-    var active_tab = Drupal.t('(active tab)');
-    $tabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLink);
-    $activeLink.parent().addClass('active');
-  }
-  else {
-    $tabs.remove();
+  // is not one of those tabs. If the latter, set that tab active. Only check
+  // for tabs when the overlay is not empty.
+  if (self.$iframeBody) {
+    var urlPath = self.getPath(url);
+
+    // Get the primary tabs
+    var $tabs = self.$dialogTitlebar.find('ul');
+    var $tabsLinks = $tabs.find('> li > a');
+
+    // Check if clicked on a primary tab
+    var $activeLink = $tabsLinks.filter(function () { return self.getPath(this) == urlPath; });
+
+    if ($activeLink.length) {
+      var active_tab = Drupal.t('(active tab)');
+      $tabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLink);
+      $activeLink.parent().addClass('active');
+      removeTabs = false;
+    }
+    else {
+      // Get the secondary tabs
+      var $secondary = self.$iframeBody.find('ul.secondary');
+      var $secondaryLinks = $secondary.find('> li > a');
+  
+      // Check if clicked on a secondary tab
+      var $activeLinkSecondary = $secondaryLinks.filter(function () { return self.getPath(this) == urlPath; });
+  
+      if ($activeLinkSecondary.length) {
+        var active_tab = Drupal.t('(active tab)');
+        $secondaryLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLinkSecondary);
+        $activeLinkSecondary.parent().addClass('active');
+        removeTabs = false;
+      }
+      else {
+        $tabs.remove();
+      }
+    }
   }
 
+  self.$iframeWindow = null;
+  self.$iframeDocument = null;
+  self.$iframeBody = null;
+
+  // No need to resize while loading.
+  clearTimeout(self.resizeTimeoutID);
+
   // While the overlay is loading, we remove the loaded class from the dialog.
   // After the loading is finished, the loaded class is added back. The loaded
   // class is being used to hide the iframe while loading.

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • Planet Drupal past and current
  • Help! - Cannot access a global variable.
  • Why is my module's update hook not listed on update.php's selection form?
  • How do I add a class to a link generated with l()
  • ZeroDayScan - Full path disclosure bug in Drupal 6.16 (0day)
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF Drupal embed Input Format modx OpenID Performance Planet Drupal rants Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.