Ignore:
Timestamp:
Mar 7, 2011, 1:58:34 AM (13 years ago)
Author:
patdenice
Message:

Update jQuery UI to 1.8.10.
Improve jquery ui management in template class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/template.class.php

    r9172 r9559  
    903903      'core.scripts' => 'themes/default/js/scripts.js',
    904904      'jquery' => 'themes/default/js/jquery.min.js',
    905       'jquery.ui' => 'themes/default/js/jquery.ui.min.js'
     905      'jquery.ui' => 'themes/default/js/ui/minified/jquery.ui.core.min.js',
     906      'jquery.effects' => 'themes/default/js/ui/minified/jquery.effects.core.min.js',
     907    );
     908
     909  private static $ui_core_dependencies = array(
     910      'jquery.ui.widget' => array('jquery'),
     911      'jquery.ui.position' => array('jquery'),
     912      'jquery.ui.mouse' => array('jquery', 'jquery.ui', 'jquery.ui.widget'),
    906913    );
    907914
     
    961968      if ($load_mode < $script->load_mode)
    962969        $script->load_mode = $load_mode;
     970    }
     971    // Load or modify all UI core files
     972    if ($id == 'jquery.ui' and $script->path == self::$known_paths['jquery.ui'])
     973    {
     974      foreach (self::$ui_core_dependencies as $script_id => $required_ids)
     975        $this->add($script_id, $load_mode, $required_ids, null, $version);
    963976    }
    964977  }
     
    10861099    if ( strncmp($id, 'jquery.', 7)==0 )
    10871100    {
    1088       if ( !in_array('jquery', $script->precedents ) )
    1089         $script->precedents[] = 'jquery';
    1090       if ( strncmp($id, 'jquery.ui.', 10)==0 && !in_array('jquery.ui', $script->precedents ) )
    1091         $script->precedents[] = 'jquery.ui';
     1101      $required_ids = array('jquery');
     1102
     1103      if ( strncmp($id, 'jquery.ui.', 10)==0 )
     1104      {
     1105        if ( !isset(self::$ui_core_dependencies[$id]) )
     1106          $required_ids = array_merge(array('jquery', 'jquery.ui'), array_keys(self::$ui_core_dependencies));
     1107
     1108        if ( empty($script->path) )
     1109          $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
     1110      }
     1111      elseif ( strncmp($id, 'jquery.effects.', 15)==0 )
     1112      {
     1113        $required_ids = array('jquery', 'jquery.effects');
     1114
     1115        if ( empty($script->path) )
     1116          $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
     1117      }
     1118
     1119      foreach ($required_ids as $required_id)
     1120      {
     1121        if ( !in_array($required_id, $script->precedents ) )
     1122          $script->precedents[] = $required_id;
     1123      }
    10921124    }
    10931125  }
Note: See TracChangeset for help on using the changeset viewer.