From ac0ba26afc1fe5f7daf1d7f967301470b461772c Mon Sep 17 00:00:00 2001 From: patdenice Date: Mon, 7 Mar 2011 00:58:34 +0000 Subject: 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 --- include/template.class.php | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'include/template.class.php') 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; + } } } -- cgit v1.2.3