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