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 | $(document).ready( |
---|
48 | function() { |
---|
49 | acs_ecrire_init(); |
---|
50 | acs_ecrire_init_ajax(false); |
---|
51 | onAjaxLoad(acs_ecrire_init_ajax); |
---|
52 | } |
---|
53 | ); |
---|
54 | |
---|
55 | function acs_ecrire_init() { |
---|
56 | if (detail() == "") { |
---|
57 | $(".pliable").each( |
---|
58 | function(i) { |
---|
59 | $(this).hide(); |
---|
60 | } |
---|
61 | ); |
---|
62 | } |
---|
63 | |
---|
64 | // Retourne les infos sur la page avec le niveau de détail défini par le plieur |
---|
65 | // get page infos with detail level setted by plieur |
---|
66 | $(".page_lien").each( |
---|
67 | function(i,link) { |
---|
68 | link.onclick = function(e) { |
---|
69 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + mode_source(), "page_infos"); |
---|
70 | document.location.href = "#page_infos"; |
---|
71 | return false; |
---|
72 | } |
---|
73 | } |
---|
74 | ); |
---|
75 | |
---|
76 | [(#ENV{jquery_version}|=={1}|?{ |
---|
77 | [(#INCLURE{javascript/acs_dragdrop.js})], |
---|
78 | [(#INCLURE{javascript/acs_dragdrop_for_older_jquery.js})] |
---|
79 | })] |
---|
80 | |
---|
81 | } |
---|
82 | |
---|
83 | function acs_ecrire_init_ajax(ajax) { |
---|
84 | if (ajax == null) |
---|
85 | ajax=true; |
---|
86 | |
---|
87 | acs_ecrire_init() |
---|
88 | |
---|
89 | draw_ctlWidgets(); |
---|
90 | |
---|
91 | [(#REM) Donne leur fonction onclick aux plieurs (générique)] |
---|
92 | $(".acs_plieur").each( |
---|
93 | function(i, plieur) { |
---|
94 | var cap = plieur.name.substr(7); //classe à plier |
---|
95 | if ((typeof plieur.onclick) != "undefined") { |
---|
96 | plieur.clic = plieur.onclick.toString(); |
---|
97 | } |
---|
98 | plieur.onclick = function(e) { |
---|
99 | e.preventDefault(); |
---|
100 | imgp = $(".imgp_" + cap).attr("src"); |
---|
101 | ploff = $(".imgoff_" + cap).attr("src"); |
---|
102 | plon = $(".imgon_" + cap).attr("src"); |
---|
103 | if (imgp == ploff) |
---|
104 | $(".imgp_" + cap).attr("src", plon) |
---|
105 | else |
---|
106 | $(".imgp_" + cap).attr("src", ploff) |
---|
107 | $("." + cap).each( |
---|
108 | function(i, cap) { |
---|
109 | $(cap).slideToggle("slow"); |
---|
110 | } |
---|
111 | ); |
---|
112 | if ((typeof plieur.clic) != "undefined") { |
---|
113 | if (!ajax) |
---|
114 | eval(plieur.clic + ";onclick(e);"); |
---|
115 | } |
---|
116 | return false; |
---|
117 | } |
---|
118 | } |
---|
119 | ); |
---|
120 | |
---|
121 | $("#mode_source").each( |
---|
122 | function(i, link) { |
---|
123 | link.onclick = function(e) { |
---|
124 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + "&mode=source", "page_infos"); |
---|
125 | document.location.href = "#page_infos"; |
---|
126 | return false; |
---|
127 | } |
---|
128 | } |
---|
129 | ); |
---|
130 | |
---|
131 | $("#mode_schema").each( |
---|
132 | function(i, link) { |
---|
133 | link.onclick = function(e) { |
---|
134 | AjaxSqueeze("?exec=acs_page_get_infos&pg=" + link.title + detail() + "&mode=schema", "page_infos"); |
---|
135 | document.location.href = "#page_infos"; |
---|
136 | return false; |
---|
137 | } |
---|
138 | } |
---|
139 | ); |
---|
140 | } |
---|
141 | |
---|