1 | {literal} |
---|
2 | <script type="text/javascript"> |
---|
3 | var processAnalyze = { |
---|
4 | step:0, |
---|
5 | lists:new Array(), |
---|
6 | timeStart:0, |
---|
7 | timeEnd:0 |
---|
8 | } |
---|
9 | |
---|
10 | function init() |
---|
11 | { |
---|
12 | formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal}); |
---|
13 | /*$("#iamd_nb_item_per_request_slider").slider( |
---|
14 | { |
---|
15 | min:5, |
---|
16 | max:150, |
---|
17 | steps:29, |
---|
18 | startValue:{/literal}{$datas.NumberOfItemsPerRequest}{literal}, |
---|
19 | slide: function(event, ui) { formatNbItemPerRequest(ui.value); } |
---|
20 | } |
---|
21 | );*/ |
---|
22 | getStatus(); |
---|
23 | } |
---|
24 | |
---|
25 | function formatNbItemPerRequest(nbItems) |
---|
26 | { |
---|
27 | $("#iamd_NumberOfItemsPerRequest").val(nbItems); |
---|
28 | $("#iamd_nb_item_per_request_display").html(nbItems); |
---|
29 | } |
---|
30 | |
---|
31 | function getStatus() |
---|
32 | { |
---|
33 | $.ajax( |
---|
34 | { |
---|
35 | type: "POST", |
---|
36 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
37 | async: true, |
---|
38 | data: { ajaxfct:"admin.makeStats.getStatus", token:'{/literal}{$token}{literal}' }, |
---|
39 | success: function (msg) { |
---|
40 | list=msg.split(";"); |
---|
41 | $("#ianalyzestatus").html("<ul><li>"+list[0]+"</li><li>"+list[1]+"</li><li>"+list[2]+"</li></ul>"); |
---|
42 | } |
---|
43 | } |
---|
44 | ); |
---|
45 | } |
---|
46 | |
---|
47 | function doAnalyze() |
---|
48 | { |
---|
49 | mode="all"; |
---|
50 | modeLabel=""; |
---|
51 | |
---|
52 | if($("#ianalyze_action0").get(0).checked) |
---|
53 | { |
---|
54 | mode="notAnalyzed"; |
---|
55 | modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}"; |
---|
56 | } |
---|
57 | else if($("#ianalyze_action1").get(0).checked) |
---|
58 | { |
---|
59 | mode="all"; |
---|
60 | modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}"; |
---|
61 | } |
---|
62 | else if($("#ianalyze_action2").get(0).checked) |
---|
63 | { |
---|
64 | mode="caddieAdd"; |
---|
65 | modeLabel="{/literal}{'g003_analyze_caddie_add_pictures'|@translate}{literal}"; |
---|
66 | } |
---|
67 | else if($("#ianalyze_action3").get(0).checked) |
---|
68 | { |
---|
69 | mode="caddieReplace"; |
---|
70 | modeLabel="{/literal}{'g003_analyze_caddie_replace_pictures'|@translate}{literal}"; |
---|
71 | } |
---|
72 | |
---|
73 | |
---|
74 | doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+ |
---|
75 | "<div id='iprogressbar_contener' class='gcBorderInput'>"+ |
---|
76 | "<span id='iprogressbar_bg' class='gcBgInput' style='width:0%;'> </span>"+ |
---|
77 | "<span id='iprogressbar_fg' class='gcLink'>0%</span>"+ |
---|
78 | "</div><p>{/literal}{'g003_analyze_in_progress'|@translate}{literal}"+ |
---|
79 | "<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>" |
---|
80 | "</p></form>"; |
---|
81 | |
---|
82 | $("#dialog") |
---|
83 | .html("") |
---|
84 | .dialog( |
---|
85 | { |
---|
86 | resizable: false, |
---|
87 | width:480, |
---|
88 | height:120, |
---|
89 | modal: true, |
---|
90 | draggable:true, |
---|
91 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
92 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal} ('+modeLabel+')', |
---|
93 | } |
---|
94 | ).html(doAnalyzeDialog); |
---|
95 | |
---|
96 | NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val(); |
---|
97 | |
---|
98 | $.ajax( |
---|
99 | { |
---|
100 | type: "POST", |
---|
101 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
102 | async: true, |
---|
103 | data: { ajaxfct:"admin.makeStats.getList", token:'{/literal}{$token}{literal}', selectMode:mode, numOfItems:NumberOfItemsPerRequest }, |
---|
104 | success: function(msg) |
---|
105 | { |
---|
106 | processAnalyze.step=0; |
---|
107 | processAnalyze.lists=msg.split(";"); |
---|
108 | processAnalyze.timeStart=new Date(); |
---|
109 | doStep_processList(); |
---|
110 | }, |
---|
111 | error: function() |
---|
112 | { |
---|
113 | alert('error'); |
---|
114 | } |
---|
115 | } |
---|
116 | ); |
---|
117 | } |
---|
118 | |
---|
119 | |
---|
120 | function displayTime(eTime) |
---|
121 | { |
---|
122 | seconds=(eTime%60).toFixed(2); |
---|
123 | minutes=((eTime-seconds)/60).toFixed(0); |
---|
124 | returned=seconds+"s"; |
---|
125 | if(minutes>0) returned=minutes+"m"+returned; |
---|
126 | return(returned); |
---|
127 | } |
---|
128 | |
---|
129 | function doStep_processList() |
---|
130 | { |
---|
131 | if(processAnalyze.step < processAnalyze.lists.length) |
---|
132 | { |
---|
133 | $.ajax({ |
---|
134 | type: "POST", |
---|
135 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
136 | async: true, |
---|
137 | data: { ajaxfct:"admin.makeStats.doAnalyze", token:'{/literal}{$token}{literal}', imagesList:processAnalyze.lists[processAnalyze.step] }, |
---|
138 | success: function(msg) |
---|
139 | { |
---|
140 | processAnalyze.step++; |
---|
141 | doStep_processList(); |
---|
142 | }, |
---|
143 | }); |
---|
144 | |
---|
145 | pct=100*(processAnalyze.step+1)/processAnalyze.lists.length; |
---|
146 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
147 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
148 | } |
---|
149 | else |
---|
150 | { |
---|
151 | // list completely processed |
---|
152 | tmp = $.ajax({ |
---|
153 | type: "POST", |
---|
154 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
155 | async: false, |
---|
156 | data: { ajaxfct:"admin.makeStats.consolidate", token:'{/literal}{$token}{literal}' } |
---|
157 | }).responseText; |
---|
158 | |
---|
159 | processAnalyze.timeEnd = new Date(); |
---|
160 | timeElapsed=processAnalyze.timeEnd.getTime()-processAnalyze.timeStart.getTime(); |
---|
161 | |
---|
162 | $("#dialog") |
---|
163 | .dialog("destroy") |
---|
164 | .html("") |
---|
165 | .get(0).removeAttribute('style'); |
---|
166 | |
---|
167 | $("#dialog") |
---|
168 | .dialog( |
---|
169 | { |
---|
170 | resizable: false, |
---|
171 | width:480, |
---|
172 | height:120, |
---|
173 | modal: true, |
---|
174 | draggable:true, |
---|
175 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
176 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal}', |
---|
177 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
178 | open: function(event, ui) |
---|
179 | { |
---|
180 | bH=$("div.ui-dialog-buttonpane").get(0).clientHeight; |
---|
181 | $("#dialog").css('height', (this.clientHeight-bH)+"px"); |
---|
182 | }, |
---|
183 | buttons: |
---|
184 | { |
---|
185 | '{/literal}{"g003_ok"|@translate}{literal}': |
---|
186 | function() |
---|
187 | { |
---|
188 | $(this).dialog('destroy').html("").get(0).removeAttribute('style'); |
---|
189 | } |
---|
190 | } |
---|
191 | } |
---|
192 | ) |
---|
193 | .html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal} ("+displayTime(timeElapsed/1000)+")"); |
---|
194 | |
---|
195 | getStatus(); |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | </script> |
---|
202 | {/literal} |
---|
203 | |
---|
204 | <h2>{'g003_status_of_database'|@translate}</h2> |
---|
205 | |
---|
206 | <div id="dialog"></div> |
---|
207 | |
---|
208 | |
---|
209 | <div id="ianalyzestatus"> |
---|
210 | <ul> |
---|
211 | <li>{'g003_loading'|@translate}</li> |
---|
212 | <li>{'g003_loading'|@translate}</li> |
---|
213 | <li>{'g003_loading'|@translate}</li> |
---|
214 | </ul> |
---|
215 | </div> |
---|
216 | |
---|
217 | <div class="nfo"> |
---|
218 | <ul> |
---|
219 | <li>{'g003_warning_on_analyze_4a'|@translate}</li> |
---|
220 | <li>{'g003_warning_on_analyze_4b'|@translate}</li> |
---|
221 | </ul> |
---|
222 | </div> |
---|
223 | |
---|
224 | |
---|
225 | <div id='ianalyzearea'> |
---|
226 | <fieldset> |
---|
227 | <legend>{'g003_update_metadata'|@translate}</legend> |
---|
228 | <form class="formtable"> |
---|
229 | <div class="nfo"> |
---|
230 | <p>{'g003_warning_on_analyze_3'|@translate}</p> |
---|
231 | <ul> |
---|
232 | <li>{'g003_warning_on_analyze_3a'|@translate}</li> |
---|
233 | <li>{'g003_warning_on_analyze_3b'|@translate}</li> |
---|
234 | </ul> |
---|
235 | |
---|
236 | <p>{'g003_warning_on_analyze_5'|@translate}</p> |
---|
237 | </div> |
---|
238 | |
---|
239 | <label> |
---|
240 | <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked> |
---|
241 | {'g003_analyze_caddie_add_pictures'|@translate} |
---|
242 | </label><br> |
---|
243 | |
---|
244 | <label> |
---|
245 | <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3"> |
---|
246 | {'g003_analyze_caddie_replace_pictures'|@translate} |
---|
247 | </label><br> |
---|
248 | |
---|
249 | |
---|
250 | <label> |
---|
251 | <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0"> |
---|
252 | {'g003_analyze_not_analyzed_pictures'|@translate} |
---|
253 | </label><br> |
---|
254 | |
---|
255 | <label> |
---|
256 | <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1"> |
---|
257 | {'g003_analyze_all_pictures'|@translate} |
---|
258 | </label><br> |
---|
259 | |
---|
260 | <div class="warning"> |
---|
261 | <p style="font-weight:bold; font-size:+2;">{'g003_warning_on_analyze_0'|@translate}</p> |
---|
262 | <p>{'g003_warning_on_analyze_1'|@translate}</p> |
---|
263 | <p style="font-weight:bold;">{'g003_warning_on_analyze_2'|@translate}</p> |
---|
264 | </div> |
---|
265 | |
---|
266 | |
---|
267 | <br> |
---|
268 | <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}"> |
---|
269 | <!-- |
---|
270 | {'g003_setting_nb_items_per_request'|@translate} |
---|
271 | <div id="iamd_nb_item_per_request_slider"></div> |
---|
272 | <div id="iamd_nb_item_per_request_display"></div> |
---|
273 | <br><br> |
---|
274 | --> |
---|
275 | |
---|
276 | <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();"> |
---|
277 | |
---|
278 | </form> |
---|
279 | </fieldset> |
---|
280 | |
---|
281 | </div> |
---|
282 | |
---|
283 | |
---|
284 | |
---|
285 | |
---|
286 | <script type="text/javascript"> |
---|
287 | init(); |
---|
288 | </script> |
---|