changeset 13:134d4b2e75f6

updated quicktabs and google analytics modules
author danieleb <danielebarchiesi@me.com>
date Tue, 29 Oct 2013 13:48:59 +0000
parents a8522bbbfcb0
children d1d0367e0658
files sites/all/modules/google_analytics/googleanalytics.admin.inc sites/all/modules/google_analytics/googleanalytics.info sites/all/modules/google_analytics/googleanalytics.install sites/all/modules/google_analytics/googleanalytics.js sites/all/modules/google_analytics/googleanalytics.module sites/all/modules/google_analytics/googleanalytics.test sites/all/modules/google_analytics/googleanalytics.variable.inc sites/all/modules/quicktabs/js/quicktabs.js sites/all/modules/quicktabs/plugins/QuickAccordion.inc sites/all/modules/quicktabs/plugins/QuickBlockContent.inc sites/all/modules/quicktabs/plugins/QuickQuicktabs.inc sites/all/modules/quicktabs/plugins/QuickUiTabs.inc sites/all/modules/quicktabs/plugins/QuickViewContent.inc sites/all/modules/quicktabs/quicktabs.admin.inc sites/all/modules/quicktabs/quicktabs.classes.inc sites/all/modules/quicktabs/quicktabs.info sites/all/modules/quicktabs/quicktabs.install sites/all/modules/quicktabs/quicktabs.module sites/all/modules/quicktabs/quicktabs_tabstyles/quicktabs_tabstyles.info sites/all/modules/quicktabs/tests/quicktabs.test
diffstat 20 files changed, 178 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/sites/all/modules/google_analytics/googleanalytics.admin.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.admin.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -211,7 +211,7 @@
     '#type' => 'checkboxes',
     '#title' => t('Track messages of type'),
     '#default_value' => variable_get('googleanalytics_trackmessages', array()),
-    '#description' => t('This will track the selected message types shown to users. Tracking of form validation errors may help you identifying usability issues in your site. Keep in mind that Google allows a maximum of 500 events per session only and every message is tracked as one individual event. If the limit has been exceeded no further events are tracked, but normal page tracking is not effected. Messages from excluded pages cannot tracked.'),
+    '#description' => t('This will track the selected message types shown to users. Tracking of form validation errors may help you identifying usability issues in your site. For each visit (user session), a maximum of approximately 500 combined GATC requests (both events and page views) can be tracked. Every message is tracked as one individual event. Note that - as the number of events in a session approaches the limit - additional events might not be tracked. Messages from excluded pages cannot tracked.'),
     '#options' => array(
       'status' => t('Status message'),
       'warning' => t('Warning message'),
@@ -226,8 +226,8 @@
     '#title' => t('Search and Advertising'),
   );
 
-  $site_search_dependencies = '<div class="admin-dependencies">';
-  $site_search_dependencies .= t('Depends on: !dependencies', array('!dependencies' => (module_exists('search') ? t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => 'Search')) : t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => 'Search')))));
+  $site_search_dependencies = '<div class="admin-requirements">';
+  $site_search_dependencies .= t('Requires: !module-list', array('!module-list' => (module_exists('search') ? t('@module (<span class="admin-enabled">enabled</span>)', array('@module' => 'Search')) : t('@module (<span class="admin-disabled">disabled</span>)', array('@module' => 'Search')))));
   $site_search_dependencies .= '</div>';
 
   $form['tracking']['search_and_advertising']['googleanalytics_site_search'] = array(
--- a/sites/all/modules/google_analytics/googleanalytics.info	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.info	Tue Oct 29 13:48:59 2013 +0000
@@ -4,10 +4,10 @@
 package = Statistics
 configure = admin/config/system/googleanalytics
 files[] = googleanalytics.test
-
-; Information added by drupal.org packaging script on 2012-11-01
-version = "7.x-1.3"
+test_dependencies[] = token
+; Information added by drupal.org packaging script on 2013-10-17
+version = "7.x-1.4"
 core = "7.x"
 project = "google_analytics"
-datestamp = "1351810914"
+datestamp = "1382021586"
 
--- a/sites/all/modules/google_analytics/googleanalytics.install	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.install	Tue Oct 29 13:48:59 2013 +0000
@@ -42,15 +42,17 @@
   variable_del('googleanalytics_trackfiles');
   variable_del('googleanalytics_trackfiles_extensions');
   variable_del('googleanalytics_trackmailto');
+  variable_del('googleanalytics_trackmessages');
   variable_del('googleanalytics_trackoutbound');
   variable_del('googleanalytics_translation_set');
   variable_del('googleanalytics_visibility_pages');
   variable_del('googleanalytics_visibility_roles');
+  variable_del('googleanalytics_privacy_donottrack');
 
   // Remove backup variables if exist. Remove this code in D8.
   variable_del('googleanalytics_codesnippet_after_backup_6300');
   variable_del('googleanalytics_codesnippet_before_backup_6300');
-  variable_del('googleanalytics_segmentation');
+  variable_del('googleanalytics_segmentation');
 }
 
 /**
--- a/sites/all/modules/google_analytics/googleanalytics.js	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.js	Tue Oct 29 13:48:59 2013 +0000
@@ -39,7 +39,7 @@
           _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
         }
         else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) {
-          if (ga.trackDomainMode == 2 && isCrossDomain($(this).attr('hostname'), ga.trackCrossDomains)) {
+          if (ga.trackDomainMode == 2 && isCrossDomain(this.hostname, ga.trackCrossDomains)) {
             // Top-level cross domain clicked. document.location is handled by _link internally.
             event.preventDefault();
             _gaq.push(["_link", this.href]);
--- a/sites/all/modules/google_analytics/googleanalytics.module	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.module	Tue Oct 29 13:48:59 2013 +0000
@@ -1,17 +1,24 @@
 <?php
 
-/*
+/**
  * @file
- * Drupal Module: GoogleAnalytics
- * Adds the required Javascript to the bottom of all your Drupal pages
- * to allow tracking by the Google Analytics statistics package.
+ * Drupal Module: Google Analytics
+ *
+ * Adds the required Javascript to all your Drupal pages to allow tracking by
+ * the Google Analytics statistics package.
  *
  * @author: Alexander Hass <http://drupal.org/user/85918>
  */
 
+/**
+ * Define the default file extension list that should be tracked as download.
+ */
 define('GOOGLEANALYTICS_TRACKFILES_EXTENSIONS', '7z|aac|arc|arj|asf|asx|avi|bin|csv|doc|exe|flv|gif|gz|gzip|hqx|jar|jpe?g|js|mp(2|3|4|e?g)|mov(ie)?|msi|msp|pdf|phps|png|ppt|qtm?|ra(m|r)?|sea|sit|tar|tgz|torrent|txt|wav|wma|wmv|wpd|xls|xml|z|zip');
 
-// Remove tracking from all administrative pages, see http://drupal.org/node/34970.
+/**
+ * Define default path exclusion list to remove tracking from admin pages,
+ * see http://drupal.org/node/34970 for more information.
+ */
 define('GOOGLEANALYTICS_PAGES', "admin\nadmin/*\nbatch\nnode/add*\nnode/*/*\nuser/*/*");
 
 /**
@@ -97,11 +104,6 @@
     // We allow different scopes. Default to 'header' but allow user to override if they really need to.
     $scope = variable_get('googleanalytics_js_scope', 'header');
 
-    if (variable_get('googleanalytics_trackadsense', FALSE)) {
-      // Custom tracking. Prepend before all other JavaScript.
-      drupal_add_js('window.google_analytics_uacct = ' . drupal_json_encode($id) . ';', array('type' => 'inline', 'group' => JS_LIBRARY-1));
-    }
-
     // Add link tracking.
     $link_settings = array();
     if ($track_outbound = variable_get('googleanalytics_trackoutbound', 1)) {
@@ -149,6 +151,8 @@
     // Site search tracking support.
     $url_custom = '';
     if (module_exists('search') && variable_get('googleanalytics_site_search', FALSE) && arg(0) == 'search' && $keys = googleanalytics_search_get_keys()) {
+      // hook_preprocess_search_results() is not executed if search result is
+      // empty. Make sure the counter is set to 0 if there are no results.
       $url_custom = '(window.googleanalytics_search_results) ? ' . drupal_json_encode(url('search/' . arg(1), array('query' => array('search' => $keys)))) . ' : ' . drupal_json_encode(url('search/' . arg(1), array('query' => array('search' => 'no-results:' . $keys, 'cat' => 'no-results'))));
     }
 
@@ -226,6 +230,9 @@
       $script .= '_gaq.push(["_gat._anonymizeIp"]);';
     }
 
+    // Prepare Adsense tracking.
+    $googleanalytics_adsense_script = 'window.google_analytics_uacct = ' . drupal_json_encode($id) . ';';
+
     // Domain tracking type.
     global $cookie_domain;
     $domain_mode = variable_get('googleanalytics_domain_mode', 0);
@@ -234,10 +241,12 @@
     // first. For hosts such as 'localhost' or IP Addresses we don't set a cookie domain.
     if ($domain_mode == 1 && count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) {
       $script .= '_gaq.push(["_setDomainName", ' . drupal_json_encode($cookie_domain) . ']);';
+      $googleanalytics_adsense_script .= 'window.google_analytics_domain_name = ' . drupal_json_encode($cookie_domain) . ';';
     }
     elseif ($domain_mode == 2) {
       $script .= '_gaq.push(["_setDomainName", "none"]);';
       $script .= '_gaq.push(["_setAllowLinker", true]);';
+      $googleanalytics_adsense_script .= 'window.google_analytics_domain_name = "none";';
     }
 
     if (!empty($custom_var)) {
@@ -297,6 +306,13 @@
     $script .= 's.parentNode.insertBefore(ga, s);';
     $script .= '})();';
 
+    if (variable_get('googleanalytics_trackadsense', FALSE)) {
+      // Custom tracking. Prepend before all other JavaScript.
+      // @TODO: http://support.google.com/adsense/bin/answer.py?answer=98142
+      // sounds like it could be appended to $script.
+      drupal_add_js($googleanalytics_adsense_script, array('type' => 'inline', 'group' => JS_LIBRARY-1));
+    }
+
     drupal_add_js($script, array('scope' => $scope, 'type' => 'inline'));
   }
 }
--- a/sites/all/modules/google_analytics/googleanalytics.test	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.test	Tue Oct 29 13:48:59 2013 +0000
@@ -8,8 +8,8 @@
 
   public static function getInfo() {
     return array(
-      'name' => t('Google Analytics basic tests'),
-      'description' => t('Test basic functionality of Google Analytics module.'),
+      'name' => 'Google Analytics basic tests',
+      'description' => 'Test basic functionality of Google Analytics module.',
       'group' => 'Google Analytics',
     );
   }
@@ -34,7 +34,7 @@
 
     // Check for account code validation.
     $edit['googleanalytics_account'] = $this->randomName(2);
-    $this->drupalPost('admin/config/system/googleanalytics', $edit, 'Save configuration');
+    $this->drupalPost('admin/config/system/googleanalytics', $edit, t('Save configuration'));
     $this->assertRaw(t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.'), '[testGoogleAnalyticsConfiguration]: Invalid Web Property ID number validated.');
   }
 
@@ -189,8 +189,8 @@
 
   public static function getInfo() {
     return array(
-      'name' => t('Google Analytics Custom Variables tests'),
-      'description' => t('Test custom variables functionality of Google Analytics module.'),
+      'name' => 'Google Analytics Custom Variables tests',
+      'description' => 'Test custom variables functionality of Google Analytics module.',
       'group' => 'Google Analytics',
       'dependencies' => array('token'),
     );
@@ -308,8 +308,8 @@
 
   public static function getInfo() {
     return array(
-      'name' => t('Google Analytics status messages tests'),
-      'description' => t('Test status messages functionality of Google Analytics module.'),
+      'name' => 'Google Analytics status messages tests',
+      'description' => 'Test status messages functionality of Google Analytics module.',
       'group' => 'Google Analytics',
     );
   }
@@ -333,7 +333,7 @@
     // Enable logging of errors only.
     variable_set('googleanalytics_trackmessages', array('error' => 'error'));
 
-    $this->drupalPost('user/login', array(), 'Log in');
+    $this->drupalPost('user/login', array(), t('Log in'));
     $this->assertRaw('_gaq.push(["_trackEvent", "Messages", "Error message", "Username field is required."]);', '[testGoogleAnalyticsStatusMessages]: _trackEvent "Username field is required." is shown.');
     $this->assertRaw('_gaq.push(["_trackEvent", "Messages", "Error message", "Password field is required."]);', '[testGoogleAnalyticsStatusMessages]: _trackEvent "Password field is required." is shown.');
 
@@ -354,8 +354,8 @@
 
   public static function getInfo() {
     return array(
-      'name' => t('Google Analytics role tests'),
-      'description' => t('Test roles functionality of Google Analytics module.'),
+      'name' => 'Google Analytics role tests',
+      'description' => 'Test roles functionality of Google Analytics module.',
       'group' => 'Google Analytics',
     );
   }
--- a/sites/all/modules/google_analytics/googleanalytics.variable.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/google_analytics/googleanalytics.variable.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -17,6 +17,7 @@
     'required' => TRUE,
     'group' => 'googleanalytics',
     'localize' => TRUE,
+    'multidomain' => TRUE,
     'validate callback' => 'googleanalytics_validate_googleanalytics_account',
   );
 
--- a/sites/all/modules/quicktabs/js/quicktabs.js	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/js/quicktabs.js	Tue Oct 29 13:48:59 2013 +0000
@@ -57,12 +57,11 @@
   this.tabIndex = el.myTabIndex;
   var qtKey = 'qt_' + el.qt_name;
   var i = 0;
-  for (var key in Drupal.settings.quicktabs[qtKey].tabs) {
+  for (var i = 0; i < Drupal.settings.quicktabs[qtKey].tabs.length; i++) {
     if (i == this.tabIndex) {
-      this.tabObj = Drupal.settings.quicktabs[qtKey].tabs[key];
-      this.tabKey = key;
+      this.tabObj = Drupal.settings.quicktabs[qtKey].tabs[i];
+      this.tabKey = i;
     }
-    i++;
   }
   this.tabpage_id = 'quicktabs-tabpage-' + el.qt_name + '-' + this.tabKey;
   this.container = $('#quicktabs-container-' + el.qt_name);
--- a/sites/all/modules/quicktabs/plugins/QuickAccordion.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/plugins/QuickAccordion.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -4,7 +4,7 @@
  * Renders the content using the jQuery UI Accordion widget.
  */
 class QuickAccordion extends QuickRenderer {
-  
+
   public static function optionsForm($qt) {
     $form = array();
     $form['history'] = array(
@@ -29,7 +29,7 @@
     );
     return $form;
   }
-  
+
   public function render() {
     $quickset = $this->quickset;
     $qsid = 'quickset-' . $quickset->getName();
@@ -57,7 +57,7 @@
     }
     return $render_array;
   }
-  
+
   /**
    * Add any necessary js, css and libraries for the render array.
    */
@@ -75,10 +75,12 @@
     );
 
     $javascript = drupal_add_js();
-    foreach ($javascript['settings']['data'] as $key => $settings) {
-      if (key($settings) == 'quicktabs') {
-        $qtkey = $key;
-        break;
+    if (isset($javascript['settings']['data'])) {
+      foreach ($javascript['settings']['data'] as $key => $settings) {
+        if (key($settings) == 'quicktabs') {
+          $qtkey = $key;
+          break;
+        }
       }
     }
 
--- a/sites/all/modules/quicktabs/plugins/QuickBlockContent.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/plugins/QuickBlockContent.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -5,7 +5,7 @@
  * content.
  */
 class QuickBlockContent extends QuickContent {
-  
+
   public static function getType() {
     return 'block';
   }
@@ -65,18 +65,25 @@
         $pos = strpos($item['bid'], '_delta_');
         $module = drupal_substr($item['bid'], 0, $pos);
         $delta = drupal_substr($item['bid'], $pos + 7);
-  
-        $block = block_load($module, $delta);
-        $block->region = 'quicktabs_tabpage';
-  
-        if ($block_arr = _block_render_blocks(array($block))) {
-          if ($item['hide_title']) {
-            $block_arr["{$block->module}_{$block->delta}"]->subject = FALSE;
+
+        // Make sure the user can access the block.
+        if ($this->accessBlock($module, $delta)) {
+
+          $block = block_load($module, $delta);
+          $block->region = 'quicktabs_tabpage';
+
+          if ($block_arr = _block_render_blocks(array($block))) {
+            if ($item['hide_title']) {
+              $block_arr["{$block->module}_{$block->delta}"]->subject = FALSE;
+            }
+            if (!empty($block_arr["{$block->module}_{$block->delta}"]->content)) {
+              $build = _block_get_renderable_array($block_arr);
+              $output = $build;
+            }
           }
-          if (!empty($block_arr["{$block->module}_{$block->delta}"]->content)) {
-            $build = _block_get_renderable_array($block_arr);
-            $output = $build;
-          }
+        }
+        elseif (!$hide_empty) {
+          $output['#markup'] = theme('quicktabs_tab_access_denied', $item);
         }
       }
       elseif (!$hide_empty) {
@@ -90,4 +97,28 @@
   public function getAjaxKeys() {
     return array('bid', 'hide_title');
   }
-}
\ No newline at end of file
+
+  /**
+   * Checks if the current user can access a block.
+   */
+  private function accessBlock($module, $delta) {
+    // Get current user's rids.
+    global $user;
+    $rids = array_keys($user->roles);
+
+    // Get authorized rids.
+    $authorized_rids = db_select('block_role', 'br')
+      ->fields('br', array('rid'))
+      ->condition('module', $module, '=')
+      ->condition('delta',  $delta,  '=')
+      ->execute()
+      ->fetchCol('rid');
+
+    // Return whether the user can access the block:
+    // - Either all roles have access - no record in {block_role}
+    // - Or only specific roles have access - in which case rids should match.
+    return (count($authorized_rids) == 0)
+      || (count(array_intersect($authorized_rids, $rids)) != 0);
+  }
+}
+
--- a/sites/all/modules/quicktabs/plugins/QuickQuicktabs.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/plugins/QuickQuicktabs.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -118,10 +118,12 @@
     }
     // Add our JS settings
     $javascript = drupal_add_js();
-    foreach ($javascript['settings']['data'] as $key => $settings) {
-      if (key($settings) == 'quicktabs') {
-        $qtkey = $key;
-        break;
+    if (isset($javascript['settings']['data'])) {
+      foreach ($javascript['settings']['data'] as $key => $settings) {
+        if (key($settings) == 'quicktabs') {
+          $qtkey = $key;
+          break;
+        }
       }
     }
     $name = $this->quickset->getName();
--- a/sites/all/modules/quicktabs/plugins/QuickUiTabs.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/plugins/QuickUiTabs.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -4,7 +4,7 @@
  * Renders the content using the jQuery UI Tabs widget.
  */
 class QuickUiTabs extends QuickRenderer {
-  
+
   public static function optionsForm($qt) {
     $form = array();
     $form['history'] = array(
@@ -49,10 +49,10 @@
     return $render_array;
   }
 
-  
+
   /**
    * Build the actual tab links, with appropriate href, title and attributes.
-   * 
+   *
    * @param $active_tab The index of the active tab.
    */
   protected function build_tablinks($active_tab) {
@@ -91,10 +91,12 @@
     );
 
     $javascript = drupal_add_js();
-    foreach ($javascript['settings']['data'] as $key => $settings) {
-      if (key($settings) == 'quicktabs') {
-        $qtkey = $key;
-        break;
+    if (isset($javascript['settings']['data'])) {
+      foreach ($javascript['settings']['data'] as $key => $settings) {
+        if (key($settings) == 'quicktabs') {
+          $qtkey = $key;
+          break;
+        }
       }
     }
 
--- a/sites/all/modules/quicktabs/plugins/QuickViewContent.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/plugins/QuickViewContent.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -55,6 +55,8 @@
     if (module_exists('views')) views_add_js('ajax_view');
     $this->settings['view_path'] = rawurlencode($_GET['q']);
     $this->settings['view_dom_id'] = self::$view_dom_id++;
+    $args_array = array();
+    $ajax_args = '';
     if (isset($item['args'])) {
       $url_args = arg();
       $args = $item['args'];
@@ -64,15 +66,12 @@
       }
       $args = preg_replace(',/?(%\d),', '', $args);
       if (!empty($args)) {
-        $this->settings['ajax_args'] = rawurlencode($args);
+        $ajax_args = rawurlencode($args);
         $args_array = explode('/', $args);
       }
-      else {
-        $this->settings['ajax_args'] = '';
-        $args_array = array();
-      }
-      $this->settings['actual_args'] = $args_array;
     }
+    $this->settings['ajax_args'] = $ajax_args;
+    $this->settings['actual_args'] = $args_array;
   }
 
   public function render($hide_empty = FALSE, $args = array()) {
@@ -138,4 +137,4 @@
   public function getAjaxKeys() {
     return array('vid', 'display', 'view_dom_id', 'view_path', 'ajax_args');
   }
-}
\ No newline at end of file
+}
--- a/sites/all/modules/quicktabs/quicktabs.admin.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs.admin.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -97,7 +97,10 @@
     $form_state['num_tabs']--;
   }
 
-  $tab_titles = array();
+  $tab_titles = array(
+    QUICKTABS_DELTA_NONE => t('- None -'),
+  );
+
   // Add current tabs to the form.
   foreach ($qt->tabs as $delta => $tab) {
     $tab['delta'] = $delta;
@@ -523,10 +526,7 @@
 function quicktabs_export_form($form, &$form_state, $qt) {
   ctools_include('export');
   // Generate export code
-  $code = '$items = array();' ."\n";
-  $code .= ctools_export_object('quicktabs', $qt, '');
-  $code .= '$items["'. $qt->machine_name .'"] = $quicktabs;' ."\n";
-  $code .= 'return $items;';
+  $code = ctools_export_object('quicktabs', $qt, '');
 
   // Create form
   $form = array();
--- a/sites/all/modules/quicktabs/quicktabs.classes.inc	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs.classes.inc	Tue Oct 29 13:48:59 2013 +0000
@@ -244,7 +244,7 @@
   public function getActiveTab() {
     $active_tab = isset($this->settings['default_tab']) ? $this->settings['default_tab'] : key($this->contents);
     $active_tab = isset($_GET['qt-' . $this->name]) ? $_GET['qt-' . $this->name] : $active_tab;
-    $active_tab = (isset($active_tab) && isset($this->contents[$active_tab])) ? $active_tab : 0;
+    $active_tab = (isset($active_tab) && isset($this->contents[$active_tab])) ? $active_tab : QUICKTABS_DELTA_NONE;
     return $active_tab;
   }
 }
--- a/sites/all/modules/quicktabs/quicktabs.info	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs.info	Tue Oct 29 13:48:59 2013 +0000
@@ -8,9 +8,9 @@
 configure = admin/structure/quicktabs
 dependencies[] = "ctools"
 
-; Information added by drupal.org packaging script on 2013-09-16
-version = "7.x-3.5"
+; Information added by drupal.org packaging script on 2013-10-02
+version = "7.x-3.6"
 core = "7.x"
 project = "quicktabs"
-datestamp = "1379371264"
+datestamp = "1380731929"
 
--- a/sites/all/modules/quicktabs/quicktabs.install	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs.install	Tue Oct 29 13:48:59 2013 +0000
@@ -96,6 +96,21 @@
  */
 function quicktabs_update_7300() {
 
+  $output = array();
+
+  if (!db_field_exists('quicktabs', 'renderer')) {
+    // Add the renderer field
+    $renderer_field = array(
+      'description' => 'The rendering mechanism.',
+      'type' => 'varchar',
+      'length' => 255,
+      'not null' => TRUE,
+      'default' => 'quicktabs',
+    );
+    db_add_field('quicktabs', 'renderer', $renderer_field);
+    $output[] = "Added the renderer field";
+  }
+
   if (!db_field_exists('quicktabs', 'machine_name')) {
     // Pull all existing quicktabs, and then delete existing quicktabs. We will reinsert.
     $result = db_query("SELECT * FROM {quicktabs}");
@@ -113,7 +128,7 @@
     db_add_field('quicktabs', 'machine_name', $name_field);
     db_add_primary_key('quicktabs', array('machine_name'));
   
-    $output = $used = array();
+    $used = array();
     foreach ($result as $qt) {
       $row = (array)$qt;
       // Generate a machine-readable string
@@ -124,7 +139,7 @@
       }
       $row['machine_name'] = $used[] = $i == 0 ? $qt_name : "{$qt_name}_{$i}";
       unset($row['qtid']);
-      unset($row['style']);
+      $row['style'] = '';
       $row['renderer'] = 'tabs';
       $placeholders = implode(', ', array_keys($row));
       $values = array();
@@ -139,18 +154,6 @@
     }
   }
 
-  // Add the renderer field
-  $renderer_field = array(
-    'description' => 'The rendering mechanism.',
-    'type' => 'varchar',
-    'length' => 255,
-    'not null' => TRUE,
-    'default' => 'quicktabs',
-  );
-  db_add_field('quicktabs', 'renderer', $renderer_field);
-  $output[] = "Added the renderer field";
-
-  
   return implode('<br />', $output);
 }
 
--- a/sites/all/modules/quicktabs/quicktabs.module	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs.module	Tue Oct 29 13:48:59 2013 +0000
@@ -1,4 +1,5 @@
 <?php
+define('QUICKTABS_DELTA_NONE', 999999);
 
 /**
  * Implements hook_help().
@@ -134,6 +135,7 @@
   $blocks = array();
   foreach (quicktabs_load_multiple() as $qt_name => $quicktabs) {
     $blocks[$qt_name]['info'] = $quicktabs->title;
+    $blocks[$qt_name]['cache'] = DRUPAL_NO_CACHE;
   }
   return $blocks;
 }
@@ -202,10 +204,13 @@
   }
   $renderer = isset($settings['renderer']) ? $settings['renderer'] : 'quicktabs';
   unset($settings['renderer']);
+  $needs_sorting = FALSE;
+  $weight = 0;
   foreach ($custom_tabs as &$tab) {
+    $needs_sorting = $needs_sorting || isset($tab['weight']);
     $tab += array(
       'type' => 'prerendered',
-      'weight' => 0,
+      'weight' => $weight++,
     );
   }
   $contents = array_merge($custom_tabs, $contents);
@@ -228,8 +233,9 @@
     }
   }
   // Only sort by weight if the tabs haven't already been sorted by some other
-  // mechanism, e.g. Views in the case of the Views style plugin.
-  if (!isset($settings['sorted']) || !$settings['sorted']) {
+  // mechanism, e.g. Views in the case of the Views style plugin and there was
+  // a weight given for one of the tabs.
+  if ($needs_sorting && (!isset($settings['sorted']) || !$settings['sorted'])) {
     array_multisort($weight, SORT_ASC, $contents);
   }
   else {
--- a/sites/all/modules/quicktabs/quicktabs_tabstyles/quicktabs_tabstyles.info	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/quicktabs_tabstyles/quicktabs_tabstyles.info	Tue Oct 29 13:48:59 2013 +0000
@@ -3,9 +3,9 @@
 core = 7.x
 configure=admin/structure/quicktabs/styles
 dependencies[] = "quicktabs"
-; Information added by drupal.org packaging script on 2013-09-16
-version = "7.x-3.5"
+; Information added by drupal.org packaging script on 2013-10-02
+version = "7.x-3.6"
 core = "7.x"
 project = "quicktabs"
-datestamp = "1379371264"
+datestamp = "1380731929"
 
--- a/sites/all/modules/quicktabs/tests/quicktabs.test	Mon Oct 28 16:14:37 2013 +0000
+++ b/sites/all/modules/quicktabs/tests/quicktabs.test	Tue Oct 29 13:48:59 2013 +0000
@@ -5,7 +5,7 @@
   /**
    * Implementation of getInfo().
    */
-  function getInfo() {
+  static function getInfo() {
     return array(
       'name' => t('Quicktabs tests'),
       'description' => t('Add, edit and delete quicktabs.'),
@@ -22,7 +22,7 @@
     // Create and login user
     $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer quicktabs', 'administer nodes'));
     $this->drupalLogin($admin_user);
-    
+
     // Create some nodes that we can populate our tabs with.
     for ($i = 0; $i < 5; $i++) {
       $node = new stdClass();
@@ -46,7 +46,7 @@
       'hide_empty_tabs' => FALSE,
       'renderer' => 'quicktabs',
     );
-    
+
     $saved = $edit;
     // We'll be using the $saved array to compare against the Quicktabs instance
     // that gets created. However, hierarchical form elements are dealt with
@@ -56,34 +56,36 @@
     $edit += array(
       'tabs[0][type]' => 'node',
       'tabs[0][node][nid]' => 1,
+      'tabs[0][node][view_mode]' => 'full',
       'tabs[0][title]' => $tab_title_first,
       'tabs[0][weight]' => 0,
       'tabs[1][type]' => 'node',
       'tabs[1][node][nid]' => 2,
+      'tabs[1][node][view_mode]' => 'full',
       'tabs[1][title]' => $tab_title_second,
       'tabs[1][weight]' => 1,
     );
     // Now add on the tabs info to the $saved array - it's the same as what we
     // put in the edit form but we need it in proper array format.
-    $saved['tabs'] = array(0 => array('type' => 'node', 'nid' => 1, 'title' => $tab_title_first, 'weight' => 0), 1 => array('type' => 'node', 'nid' => 2, 'title' => $tab_title_second, 'weight' => 1));
+    $saved['tabs'] = array(0 => array('type' => 'node', 'nid' => 1, 'view_mode' => 'full', 'title' => $tab_title_first, 'weight' => 0), 1 => array('type' => 'node', 'nid' => 2, 'view_mode' => 'full', 'title' => $tab_title_second, 'weight' => 1));
     $this->drupalPost('admin/structure/quicktabs/add', $edit, t('Save'));
 
     // Check that the quicktabs object is in the database.
     $quicktabs = quicktabs_load($edit['machine_name']);
     $this->assertTrue($quicktabs != FALSE, t('Quicktabs instance found in database'));
-  
+
     // Check each individual property of the quicktabs and make sure it was set.
     foreach ($saved as $property => $value) {
       if ($property == 'tabs') {
         // Add some extra default values that we didn't include on the form, for
         // the sake of comparing the two tabs arrays.
         foreach ($value as &$val) {
-          $val += array('teaser' => 0, 'hide_title' => 1);
+          $val += array('hide_title' => 1);
         }
       }
       $this->assertEqual($quicktabs->$property, $value, t('Quicktabs property %property properly saved.', array('%property' => $property)));
     }
-    
+
     // Edit the Quicktabs instance through the UI.
     $edit = array(
       'title' => $this->randomName(),
@@ -92,7 +94,7 @@
       'renderer' => 'ui_tabs',
       'default_tab' => 1,
     );
-    
+
     $saved = $edit;
     $tab_title_first = $this->randomName();
     $tab_title_second = $this->randomName();
@@ -100,23 +102,23 @@
       'tabs[0][title]' => $tab_title_first,
       'tabs[0][weight]' => 1,
       'tabs[0][node][nid]' => 3,
-      'tabs[0][node][teaser]' => 1,
+      'tabs[0][node][view_mode]' => 'teaser',
       'tabs[0][node][hide_title]' => FALSE,
       'tabs[1][title]' => $tab_title_second,
       'tabs[1][weight]' => 0,
       'tabs[1][node][nid]' => 4,
-      'tabs[1][node][teaser]' => FALSE,
+      'tabs[1][node][view_mode]' => 'teaser',
       'tabs[1][node][hide_title]' => 1,
     );
-    $saved['tabs'] = array(0 => array('type' => 'node', 'nid' => 4, 'title' => $tab_title_second, 'weight' => 0, 'teaser' => 0, 'hide_title' => 1), 1 => array('type' => 'node', 'nid' => 3, 'title' => $tab_title_first, 'weight' => 1, 'teaser' => 1, 'hide_title' => 0));
+    $saved['tabs'] = array(0 => array('type' => 'node', 'nid' => 4, 'title' => $tab_title_second, 'weight' => 0, 'view_mode' => 'teaser', 'hide_title' => 1), 1 => array('type' => 'node', 'nid' => 3, 'title' => $tab_title_first, 'weight' => 1, 'view_mode' => 'teaser', 'hide_title' => 0));
     $this->drupalPost('admin/structure/quicktabs/manage/'. $quicktabs->machine_name .'/edit', $edit, t('Save'));
-    
+
     // Reset static vars because ctools will have cached the original $quicktabs object
     drupal_static_reset();
     // Check that the quicktabs object is in the database.
     $edited_qt = quicktabs_load($quicktabs->machine_name);
     $this->assertTrue($edited_qt != FALSE, t('Quicktabs instance found in database'));
-  
+
     // Check each individual property of the quicktabs and make sure it was set.
     foreach ($saved as $property => $value) {
       $this->assertEqual($edited_qt->$property, $value, t('Quicktabs property %property properly saved.', array('%property' => $property)));