1 | <?php |
---|
2 | /** |
---|
3 | * |
---|
4 | * Fonction de chargement du formulaire de configuration CFG |
---|
5 | * On ajoute aux champs déjà dans la meta ce qui est activé par le pipeline |
---|
6 | * jqueryui_forcer |
---|
7 | * |
---|
8 | */ |
---|
9 | function cfg_config_jqueryui_charger(&$cfg){ |
---|
10 | $valeurs = &$cfg->val['plugins']; |
---|
11 | if(!is_array($valeurs)) |
---|
12 | $valeurs = array(); |
---|
13 | $plugins_pipeline = pipeline('jqueryui_forcer'); |
---|
14 | if(!is_array($plugins_pipeline)) |
---|
15 | $plugins_pipeline = array(); |
---|
16 | $cfg->val['plugins'] = array_unique(array_merge($plugins_pipeline,$valeurs)); |
---|
17 | $cfg->val['plugins_disable'] = $plugins_pipeline; |
---|
18 | } |
---|
19 | |
---|
20 | function cfg_config_jqueryui_pre_traiter(&$cfg){ |
---|
21 | $valeurs = &$cfg->val['plugins']; |
---|
22 | if(!is_array($valeurs)) |
---|
23 | $valeurs = array(); |
---|
24 | $plugins_pipeline = pipeline('jqueryui_forcer'); |
---|
25 | if(!is_array($plugins_pipeline)) |
---|
26 | $plugins_pipeline = array(); |
---|
27 | |
---|
28 | $dependance_core = array( |
---|
29 | 'jquery.ui.mouse', |
---|
30 | 'jquery.ui.widget', |
---|
31 | 'jquery.ui.datepicker' |
---|
32 | ); |
---|
33 | |
---|
34 | /** |
---|
35 | * Dépendances à widget |
---|
36 | * Si un autre plugin est dépendant d'un de ceux là, on ne les ajoute pas |
---|
37 | */ |
---|
38 | $dependance_widget = array( |
---|
39 | 'jquery.ui.mouse', |
---|
40 | 'jquery.ui.accordion', |
---|
41 | 'jquery.ui.autocomplete', |
---|
42 | 'jquery.ui.button', |
---|
43 | 'jquery.ui.dialog', |
---|
44 | 'jquery.ui.tabs', |
---|
45 | 'jquery.ui.progressbar' |
---|
46 | ); |
---|
47 | |
---|
48 | $dependance_mouse = array( |
---|
49 | 'jquery.ui.draggable', |
---|
50 | 'jquery.ui.droppable', |
---|
51 | 'jquery.ui.resizable', |
---|
52 | 'jquery.ui.selectable', |
---|
53 | 'jquery.ui.sortable', |
---|
54 | 'jquery.ui.slider' |
---|
55 | ); |
---|
56 | |
---|
57 | $dependance_position = array( |
---|
58 | 'jquery.ui.autocomplete', |
---|
59 | 'jquery.ui.dialog', |
---|
60 | ); |
---|
61 | |
---|
62 | $dependance_draggable = array( |
---|
63 | 'jquery.ui.droppable' |
---|
64 | ); |
---|
65 | |
---|
66 | $dependance_effects = array( |
---|
67 | 'jquery.effects.blind', |
---|
68 | 'jquery.effects.bounce', |
---|
69 | 'jquery.effects.clip', |
---|
70 | 'jquery.effects.drop', |
---|
71 | 'jquery.effects.explode', |
---|
72 | 'jquery.effects.fold', |
---|
73 | 'jquery.effects.highlight', |
---|
74 | 'jquery.effects.pulsate', |
---|
75 | 'jquery.effects.scale', |
---|
76 | 'jquery.effects.shake', |
---|
77 | 'jquery.effects.slide', |
---|
78 | 'jquery.effects.transfer' |
---|
79 | ); |
---|
80 | |
---|
81 | $valeurs = array_unique(array_merge($plugins_pipeline,$valeurs)); |
---|
82 | |
---|
83 | /** |
---|
84 | * Vérification des dépendances : |
---|
85 | * On commence par le bas de l'échelle : |
---|
86 | * - draggable |
---|
87 | * - position |
---|
88 | * - mouse |
---|
89 | * - widget |
---|
90 | * - core |
---|
91 | * - effects |
---|
92 | */ |
---|
93 | if((count($intersect = array_intersect($valeurs,$dependance_draggable)) > 0) && !in_array('jquery.ui.draggable',$valeurs)){ |
---|
94 | $keys = array_keys($intersect); |
---|
95 | array_splice($valeurs,$keys[0], 0, "jquery.ui.draggable"); |
---|
96 | } |
---|
97 | if((count($intersect = array_intersect($valeurs,$dependance_position)) > 0) && !in_array('jquery.ui.position',$valeurs)){ |
---|
98 | $keys = array_keys($intersect); |
---|
99 | array_splice($valeurs,$keys[0], 0, "jquery.ui.position"); |
---|
100 | } |
---|
101 | if((count($intersect = array_intersect($valeurs,$dependance_mouse)) > 0) && !in_array('jquery.ui.mouse',$valeurs)){ |
---|
102 | $keys = array_keys($intersect); |
---|
103 | array_splice($valeurs,$keys[0], 0, "jquery.ui.mouse"); |
---|
104 | } |
---|
105 | if((count($intersect = array_intersect($valeurs,$dependance_widget)) > 0) && !in_array('jquery.ui.widget',$valeurs)){ |
---|
106 | $keys = array_keys($intersect); |
---|
107 | array_splice($valeurs,$keys[0], 0, "jquery.ui.widget"); |
---|
108 | } |
---|
109 | if((count($intersect = array_intersect($valeurs,$dependance_core)) > 0) && !in_array('jquery.ui.core',$valeurs)){ |
---|
110 | $keys = array_keys($intersect); |
---|
111 | array_splice($valeurs,$keys[0], 0, "jquery.ui.core"); |
---|
112 | } |
---|
113 | if((count($intersect = array_intersect($valeurs,$dependance_effects)) > 0) && !in_array('jquery.effects.core',$valeurs)){ |
---|
114 | $keys = array_keys($intersect); |
---|
115 | array_splice($valeurs,$keys[0], 0, "jquery.effects.core"); |
---|
116 | } |
---|
117 | if((count($intersect = array_intersect($valeurs,$dependance_effects)) > 0) && !in_array('jquery.effects.core',$valeurs)){ |
---|
118 | $keys = array_keys($intersect); |
---|
119 | array_splice($valeurs,$keys[0], 0, "jquery.effects.core"); |
---|
120 | } |
---|
121 | |
---|
122 | set_request('plugins',$valeurs); |
---|
123 | $cfg->val['plugins'] = $valeurs; |
---|
124 | } |
---|
125 | |
---|
126 | ?> |
---|