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