1 | [(#REM) |
---|
2 | ACS |
---|
3 | (Plugin Spip) |
---|
4 | http://acs.geomaticien.org |
---|
5 | |
---|
6 | Copyright Daniel FAIVRE, 2007-2011 |
---|
7 | Copyleft: licence GPL - Cf. LICENCES.txt |
---|
8 | |
---|
9 | JS interface d'admin d'ACS - ACS admin GUI |
---|
10 | ]#HTTP_HEADER{'Content-Type: text/javascript'} |
---|
11 | [(#INCLURE{fond=javascript/acs_lib.js})] |
---|
12 | |
---|
13 | function detail() { |
---|
14 | imgp = $(".imgp_spip_params").attr("src"); |
---|
15 | if (imgp) { |
---|
16 | plon = $(".imgon_spip_params").attr("src"); |
---|
17 | if (imgp == plon) |
---|
18 | return "&detail=2"; |
---|
19 | } |
---|
20 | return ""; |
---|
21 | } |
---|
22 | |
---|
23 | function mode_source() { |
---|
24 | if ($("#mode_source").attr("name") == "srcon") |
---|
25 | return "&mode=source"; |
---|
26 | return ""; |
---|
27 | } |
---|
28 | |
---|
29 | [(#REM) creation d'une nouvelle instance d'un composant] |
---|
30 | var instance_create_input = false; |
---|
31 | function instance_create(nic) { |
---|
32 | if (instance_create_input == false) { |
---|
33 | $("#form_instance_create").append('<input id="nic" type="text" name="nic" size="4" maxlength="4" value="' + nic + '" />'); |
---|
34 | instance_create_input = true; |
---|
35 | return false; |
---|
36 | } |
---|
37 | return true; |
---|
38 | } |
---|
39 | [(#REM) suppression de l'instance active d'un composant] |
---|
40 | function instance_delete(msg) { |
---|
41 | if (confirm(msg)) |
---|
42 | return true; |
---|
43 | else |
---|
44 | return false; |
---|
45 | } |
---|
46 | |
---|
47 | jQuery(document).ready( |
---|
48 | function() { |
---|
49 | acs_ecrire_init(false); |
---|
50 | onAjaxLoad(acs_ecrire_init); |
---|
51 | } |
---|
52 | ); |
---|
53 | |
---|
54 | function acs_ecrire_init(ajax) { |
---|
55 | if (detail() != "&detail=2") |
---|
56 | jQuery(".pliable").each(function(i) {jQuery(this).hide();}); |
---|
57 | else |
---|
58 | jQuery(".pliable:not(.spip_params)").each(function(i) {jQuery(this).hide();}); |
---|
59 | |
---|
60 | if (ajax == false) { [(#REM) on document ready] |
---|
61 | |
---|
62 | [(#REM) Retourne les infos sur la page avec le niveau de détail défini par le plieur |
---|
63 | get page infos with detail level setted by plieur |
---|
64 | ]jQuery(".page_lien").each( |
---|
65 | function(i,link) { |
---|
66 | link.onclick = function(e) { |
---|
67 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + mode_source(), "page_infos"); |
---|
68 | document.location.href = "#page_infos"; |
---|
69 | return false; |
---|
70 | } |
---|
71 | } |
---|
72 | ); |
---|
73 | |
---|
74 | [(#ENV{jquery_version}|=={1}|?{ |
---|
75 | [(#INCLURE{javascript/acs_dragdrop.js})], |
---|
76 | [(#INCLURE{javascript/acs_dragdrop_for_older_jquery.js})] |
---|
77 | })] |
---|
78 | } |
---|
79 | else { [(#REM) on ajax load] |
---|
80 | draw_ctlWidgets(); |
---|
81 | |
---|
82 | [(#REM) Donne leur fonction onclick aux plieurs (générique)] |
---|
83 | jQuery(".acs_plieur").each( |
---|
84 | function(i, plieur) { |
---|
85 | var cap = plieur.name.substr(7); //classe à plier |
---|
86 | if ((typeof plieur.onclick) != "undefined") { |
---|
87 | plieur.clic = plieur.onclick.toString(); |
---|
88 | } |
---|
89 | plieur.onclick = function(e) { |
---|
90 | e.preventDefault(); |
---|
91 | e.stopPropagation(); |
---|
92 | imgp = jQuery(".imgp_" + cap).attr("src"); |
---|
93 | ploff = jQuery(".imgoff_" + cap).attr("src"); |
---|
94 | plon = jQuery(".imgon_" + cap).attr("src"); |
---|
95 | if (imgp == ploff) |
---|
96 | jQuery(".imgp_" + cap).attr("src", plon) |
---|
97 | else |
---|
98 | jQuery(".imgp_" + cap).attr("src", ploff) |
---|
99 | jQuery("." + cap).each( |
---|
100 | function(i, cap) { |
---|
101 | jQuery(cap).slideToggle("slow"); |
---|
102 | } |
---|
103 | ); |
---|
104 | if ((typeof plieur.clic) != "undefined") { |
---|
105 | eval(plieur.clic + ";onclick(e);"); |
---|
106 | } |
---|
107 | return false; |
---|
108 | } |
---|
109 | } |
---|
110 | ); |
---|
111 | |
---|
112 | $("#mode_source").each( |
---|
113 | function(i, link) { |
---|
114 | link.onclick = function(e) { |
---|
115 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + "&mode=source", "page_infos"); |
---|
116 | document.location.href = "#page_infos"; |
---|
117 | return false; |
---|
118 | } |
---|
119 | } |
---|
120 | ); |
---|
121 | |
---|
122 | $("#mode_schema").each( |
---|
123 | function(i, link) { |
---|
124 | link.onclick = function(e) { |
---|
125 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + "&mode=schema", "page_infos"); |
---|
126 | document.location.href = "#page_infos"; |
---|
127 | return false; |
---|
128 | } |
---|
129 | } |
---|
130 | ); |
---|
131 | } |
---|
132 | } |
---|
133 | |
---|