aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.class.php
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-03-07 00:58:34 +0000
committerpatdenice <patdenice@piwigo.org>2011-03-07 00:58:34 +0000
commitac0ba26afc1fe5f7daf1d7f967301470b461772c (patch)
tree5da280ad6cbbae4af8498e4e6d2da517c7d1383f /include/template.class.php
parentd94968f60a8e818fa1c1b18fdc8b83d7affa9b6e (diff)
Update jQuery UI to 1.8.10.
Improve jquery ui management in template class. git-svn-id: http://piwigo.org/svn/trunk@9559 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/template.class.php')
-rw-r--r--include/template.class.php42
1 files changed, 37 insertions, 5 deletions
diff --git a/include/template.class.php b/include/template.class.php
index e7d840117..2d6d7078a 100644
--- a/include/template.class.php
+++ b/include/template.class.php
@@ -902,7 +902,14 @@ class ScriptLoader
private static $known_paths = array(
'core.scripts' => 'themes/default/js/scripts.js',
'jquery' => 'themes/default/js/jquery.min.js',
- 'jquery.ui' => 'themes/default/js/jquery.ui.min.js'
+ 'jquery.ui' => 'themes/default/js/ui/minified/jquery.ui.core.min.js',
+ 'jquery.effects' => 'themes/default/js/ui/minified/jquery.effects.core.min.js',
+ );
+
+ private static $ui_core_dependencies = array(
+ 'jquery.ui.widget' => array('jquery'),
+ 'jquery.ui.position' => array('jquery'),
+ 'jquery.ui.mouse' => array('jquery', 'jquery.ui', 'jquery.ui.widget'),
);
function __construct()
@@ -961,6 +968,12 @@ class ScriptLoader
if ($load_mode < $script->load_mode)
$script->load_mode = $load_mode;
}
+ // Load or modify all UI core files
+ if ($id == 'jquery.ui' and $script->path == self::$known_paths['jquery.ui'])
+ {
+ foreach (self::$ui_core_dependencies as $script_id => $required_ids)
+ $this->add($script_id, $load_mode, $required_ids, null, $version);
+ }
}
function did_head()
@@ -1085,10 +1098,29 @@ class ScriptLoader
}
if ( strncmp($id, 'jquery.', 7)==0 )
{
- if ( !in_array('jquery', $script->precedents ) )
- $script->precedents[] = 'jquery';
- if ( strncmp($id, 'jquery.ui.', 10)==0 && !in_array('jquery.ui', $script->precedents ) )
- $script->precedents[] = 'jquery.ui';
+ $required_ids = array('jquery');
+
+ if ( strncmp($id, 'jquery.ui.', 10)==0 )
+ {
+ if ( !isset(self::$ui_core_dependencies[$id]) )
+ $required_ids = array_merge(array('jquery', 'jquery.ui'), array_keys(self::$ui_core_dependencies));
+
+ if ( empty($script->path) )
+ $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
+ }
+ elseif ( strncmp($id, 'jquery.effects.', 15)==0 )
+ {
+ $required_ids = array('jquery', 'jquery.effects');
+
+ if ( empty($script->path) )
+ $script->path = dirname(self::$known_paths['jquery.ui'])."/$id.min.js";
+ }
+
+ foreach ($required_ids as $required_id)
+ {
+ if ( !in_array($required_id, $script->precedents ) )
+ $script->precedents[] = $required_id;
+ }
}
}