X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fplugins%2Fauto%2Fjquery_ui%2Fjqueryui_pipelines.php;fp=www%2Fplugins%2Fauto%2Fjquery_ui%2Fjqueryui_pipelines.php;h=ac9c23126ade3ca12bf8fad0fb4fd259a82aebfb;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/plugins/auto/jquery_ui/jqueryui_pipelines.php b/www/plugins/auto/jquery_ui/jqueryui_pipelines.php new file mode 100644 index 0000000..ac9c231 --- /dev/null +++ b/www/plugins/auto/jquery_ui/jqueryui_pipelines.php @@ -0,0 +1,176 @@ + 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.ui.draggable"); + } + if(count($intersect = array_intersect($config['plugins'],$dependance_position)) > 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.ui.position"); + } + if(count($intersect = array_intersect($config['plugins'],$dependance_mouse)) > 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.ui.mouse"); + } + if(count($intersect = array_intersect($config['plugins'],$dependance_widget)) > 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.ui.widget"); + } + if(count($intersect = array_intersect($config['plugins'],$dependance_core)) > 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.ui.core"); + } + if(count($intersect = array_intersect($config['plugins'],$dependance_effects)) > 0){ + $keys = array_keys($intersect); + array_splice($config['plugins'],$keys[0], 0, "jquery.effects.core"); + } + $config['plugins'] = array_unique($config['plugins']); + foreach ($config['plugins'] as $val) { + $plugins[] = _DIR_JQUERYUI_JS.$val.".js"; + } + + // si pas de config en base, on enregistre les scripts issu du pipeline jqueryui_forcer + leurs dépendances + if ($ecrire_meta == 'oui') { + include_spip('inc/meta'); + ecrire_meta('jqueryui',serialize($config)); + } + + return $plugins; +} + +/** + * jqueryui_insert_head : ajout des CSS de jQuery-UI pour les pages publiques et privées + * avec gestion du theme et des UI utilises + * + * @param: $flux + * @return: $flux + */ +function jqueryui_insert_head($flux) { + $config = @unserialize($GLOBALS['meta']['jqueryui']); + + // recuperer le repertoire du theme + $theme = 'base/'; + if (isset($config['theme']) AND $config['theme'] != '') + $theme = $config['theme'].'/'; + if ($theme == 'no_css/' && !defined('_JQUERYUI_FORCER_CSS')) + return $flux; + + // ajouter core tout le temps et en debut de tableau, array_unique supprimera les occurrences suivantes + array_unshift($config['plugins'],'jquery.ui.core'); + + // recuperer la liste des plugins jquery actives ou issus du pipeline jqueryui_forcer + // Attention, l'ordre du merge est important, le css du core doit est charge avant le reste + $config['plugins'] = array_unique(array_merge($config['plugins'],sinon(pipeline('jqueryui_forcer'),array()))); + + // ajouter theme si necessaire + if (!in_array('jquery.ui.theme', $config['plugins'])) + $config['plugins'][] = 'jquery.ui.theme'; + + // les CSS correspondantes aux plugins + $Tjquery_css = array( + 'jquery.ui.accordion', + 'jquery.ui.autocomplete', + 'jquery.ui.button', + 'jquery.ui.core', + 'jquery.ui.datepicker', + 'jquery.ui.dialog', + 'jquery.ui.progressbar', + 'jquery.ui.resizable', + 'jquery.ui.selectable', + 'jquery.ui.slider', + 'jquery.ui.tabs', + 'jquery.ui.theme' + ); + + // appeler les CSS necessaires + foreach ($config['plugins'] as $plug) { + if (in_array($plug, $Tjquery_css)) { + $flux .= "\n"; + } + } + + return $flux; +} + +?>