[5080] | 1 | {literal} |
---|
| 2 | <script type="text/javascript"> |
---|
[5959] | 3 | var processAnalyze = { |
---|
| 4 | step:0, |
---|
| 5 | lists:new Array(), |
---|
| 6 | timeStart:0, |
---|
| 7 | timeEnd:0 |
---|
| 8 | } |
---|
[5080] | 9 | |
---|
| 10 | function init() |
---|
| 11 | { |
---|
| 12 | formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal}); |
---|
[5191] | 13 | /*$("#iamd_nb_item_per_request_slider").slider( |
---|
[5080] | 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 | } |
---|
[5191] | 21 | );*/ |
---|
[5080] | 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 | { |
---|
[6722] | 33 | $.ajax( |
---|
[5080] | 34 | { |
---|
| 35 | type: "POST", |
---|
| 36 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
[6722] | 37 | async: true, |
---|
[16007] | 38 | data: { ajaxfct:"admin.makeStats.getStatus", token:'{/literal}{$token}{literal}' }, |
---|
[6722] | 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 | } |
---|
[5080] | 43 | } |
---|
[6722] | 44 | ); |
---|
[5080] | 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 | |
---|
[5959] | 74 | doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+ |
---|
[5935] | 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>"; |
---|
[5080] | 81 | |
---|
| 82 | $("#dialog") |
---|
| 83 | .html("") |
---|
| 84 | .dialog( |
---|
| 85 | { |
---|
| 86 | resizable: false, |
---|
| 87 | width:480, |
---|
| 88 | height:120, |
---|
| 89 | modal: true, |
---|
[5935] | 90 | draggable:true, |
---|
| 91 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
[5080] | 92 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal} ('+modeLabel+')', |
---|
| 93 | } |
---|
[5959] | 94 | ).html(doAnalyzeDialog); |
---|
[5080] | 95 | |
---|
| 96 | NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val(); |
---|
| 97 | |
---|
| 98 | $.ajax( |
---|
| 99 | { |
---|
| 100 | type: "POST", |
---|
| 101 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
[5959] | 102 | async: true, |
---|
[16007] | 103 | data: { ajaxfct:"admin.makeStats.getList", token:'{/literal}{$token}{literal}', selectMode:mode, numOfItems:NumberOfItemsPerRequest }, |
---|
[5080] | 104 | success: function(msg) |
---|
| 105 | { |
---|
[5959] | 106 | processAnalyze.step=0; |
---|
| 107 | processAnalyze.lists=msg.split(";"); |
---|
| 108 | processAnalyze.timeStart=new Date(); |
---|
| 109 | doStep_processList(); |
---|
[5080] | 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 | |
---|
[5959] | 129 | function doStep_processList() |
---|
[5080] | 130 | { |
---|
[5959] | 131 | if(processAnalyze.step < processAnalyze.lists.length) |
---|
[5080] | 132 | { |
---|
[6722] | 133 | $.ajax({ |
---|
[5080] | 134 | type: "POST", |
---|
| 135 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
[5959] | 136 | async: true, |
---|
[16007] | 137 | data: { ajaxfct:"admin.makeStats.doAnalyze", token:'{/literal}{$token}{literal}', imagesList:processAnalyze.lists[processAnalyze.step] }, |
---|
[5959] | 138 | success: function(msg) |
---|
| 139 | { |
---|
| 140 | processAnalyze.step++; |
---|
| 141 | doStep_processList(); |
---|
| 142 | }, |
---|
| 143 | }); |
---|
[5080] | 144 | |
---|
[5959] | 145 | pct=100*(processAnalyze.step+1)/processAnalyze.lists.length; |
---|
[5080] | 146 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
| 147 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
| 148 | } |
---|
[5959] | 149 | else |
---|
| 150 | { |
---|
| 151 | // list completely processed |
---|
| 152 | tmp = $.ajax({ |
---|
| 153 | type: "POST", |
---|
| 154 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 155 | async: false, |
---|
[16007] | 156 | data: { ajaxfct:"admin.makeStats.consolidate", token:'{/literal}{$token}{literal}' } |
---|
[5959] | 157 | }).responseText; |
---|
[5080] | 158 | |
---|
[5959] | 159 | processAnalyze.timeEnd = new Date(); |
---|
| 160 | timeElapsed=processAnalyze.timeEnd.getTime()-processAnalyze.timeStart.getTime(); |
---|
[5080] | 161 | |
---|
[5959] | 162 | $("#dialog") |
---|
| 163 | .dialog("destroy") |
---|
| 164 | .html("") |
---|
| 165 | .get(0).removeAttribute('style'); |
---|
[5080] | 166 | |
---|
[5959] | 167 | $("#dialog") |
---|
| 168 | .dialog( |
---|
[5080] | 169 | { |
---|
[5959] | 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 | } |
---|
[5080] | 191 | } |
---|
[5959] | 192 | ) |
---|
| 193 | .html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal} ("+displayTime(timeElapsed/1000)+")"); |
---|
[5080] | 194 | |
---|
[5959] | 195 | getStatus(); |
---|
| 196 | } |
---|
[5080] | 197 | } |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | |
---|
| 201 | </script> |
---|
| 202 | {/literal} |
---|
| 203 | |
---|
[5959] | 204 | <h2>{'g003_status_of_database'|@translate}</h2> |
---|
[5080] | 205 | |
---|
| 206 | <div id="dialog"></div> |
---|
| 207 | |
---|
[5191] | 208 | |
---|
[5080] | 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 | |
---|
[5191] | 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 | |
---|
[5080] | 225 | <div id='ianalyzearea'> |
---|
| 226 | <fieldset> |
---|
| 227 | <legend>{'g003_update_metadata'|@translate}</legend> |
---|
| 228 | <form class="formtable"> |
---|
[5191] | 229 | <div class="nfo"> |
---|
[5080] | 230 | <p>{'g003_warning_on_analyze_3'|@translate}</p> |
---|
[5191] | 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> |
---|
[5080] | 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 | |
---|
[5191] | 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 | |
---|
[5080] | 267 | <br> |
---|
[5191] | 268 | <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}"> |
---|
| 269 | <!-- |
---|
[5080] | 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> |
---|
[5191] | 274 | --> |
---|
[5080] | 275 | |
---|
| 276 | <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();"> |
---|
| 277 | |
---|
| 278 | </form> |
---|
| 279 | </fieldset> |
---|
[5183] | 280 | |
---|
[5080] | 281 | </div> |
---|
| 282 | |
---|
| 283 | |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | <script type="text/javascript"> |
---|
| 287 | init(); |
---|
| 288 | </script> |
---|