[6731] | 1 | |
---|
| 2 | {literal} |
---|
| 3 | <script type="text/javascript"> |
---|
| 4 | var processAnalyze = { |
---|
| 5 | step:0, |
---|
| 6 | lists:new Array(), |
---|
| 7 | timeStart:0, |
---|
| 8 | timeEnd:0 |
---|
| 9 | } |
---|
| 10 | |
---|
| 11 | function init() |
---|
| 12 | { |
---|
| 13 | formatNbItemPerRequest({/literal}{$datas.NumberOfItemsPerRequest}{literal}); |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | function formatNbItemPerRequest(nbItems) |
---|
| 17 | { |
---|
| 18 | $("#iamd_NumberOfItemsPerRequest").val(nbItems); |
---|
| 19 | $("#iamd_nb_item_per_request_display").html(nbItems); |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | function doAnalyze() |
---|
| 23 | { |
---|
[7447] | 24 | var mode="all", |
---|
| 25 | modeLabel="", |
---|
| 26 | numOfRandomItems=0, |
---|
| 27 | doAnalyzeDialog="<br><form id='iDialogProgress' class='formtable'>"+ |
---|
| 28 | "<div id='iprogressbar_contener' class='gcBorderInput'>"+ |
---|
| 29 | "<span id='iprogressbar_bg' class='gcBgInput' style='width:0%;'> </span>"+ |
---|
| 30 | "<span id='iprogressbar_fg' class='gcLink'>0%</span>"+ |
---|
| 31 | "</div><p>{/literal}{'g003_analyze_in_progress'|@translate}{literal}"+ |
---|
| 32 | "<br><img src='./plugins/GrumPluginClasses/icons/processing.gif'>"+ |
---|
| 33 | "</p></form>", |
---|
| 34 | re=/^\d+$/; |
---|
[6731] | 35 | |
---|
[7447] | 36 | |
---|
[6731] | 37 | if($("#ianalyze_action0").get(0).checked) |
---|
| 38 | { |
---|
| 39 | mode="notAnalyzed"; |
---|
| 40 | modeLabel="{/literal}{'g003_analyze_not_analyzed_pictures'|@translate}{literal}"; |
---|
| 41 | } |
---|
| 42 | else if($("#ianalyze_action1").get(0).checked) |
---|
| 43 | { |
---|
| 44 | mode="all"; |
---|
| 45 | modeLabel="{/literal}{'g003_analyze_all_pictures'|@translate}{literal}"; |
---|
| 46 | } |
---|
| 47 | else if($("#ianalyze_action2").get(0).checked) |
---|
| 48 | { |
---|
| 49 | mode="caddieAdd"; |
---|
| 50 | modeLabel="{/literal}{'g003_analyze_caddie_add_pictures'|@translate}{literal}"; |
---|
| 51 | } |
---|
| 52 | else if($("#ianalyze_action3").get(0).checked) |
---|
| 53 | { |
---|
| 54 | mode="caddieReplace"; |
---|
| 55 | modeLabel="{/literal}{'g003_analyze_caddie_replace_pictures'|@translate}{literal}"; |
---|
| 56 | } |
---|
| 57 | else if($("#ianalyze_action4").get(0).checked) |
---|
| 58 | { |
---|
| 59 | mode="analyzed"; |
---|
| 60 | modeLabel="{/literal}{'g003_analyze_analyzed_pictures'|@translate}{literal}"; |
---|
| 61 | } |
---|
[7447] | 62 | else if($("#ianalyze_action5").get(0).checked) |
---|
| 63 | { |
---|
| 64 | mode="randomList"; |
---|
| 65 | numOfRandomItems=$("#ianalyze_action6").val(); |
---|
| 66 | if(numOfRandomItems<=0 || re.exec(numOfRandomItems)==null) |
---|
| 67 | { |
---|
| 68 | alert("{/literal}{'g003_invalid_random_number'|@translate}{literal}"); |
---|
| 69 | return(false); |
---|
| 70 | } |
---|
| 71 | modeLabel="{/literal}{'g003_analyze_random_pictures'|@translate|replace:'%s':'"+numOfRandomItems+"'}{literal}"; |
---|
| 72 | } |
---|
[6731] | 73 | |
---|
| 74 | ignoreOptions=[]; |
---|
| 75 | if($('#iFillDataBaseIgnore_magic').get(0).checked) |
---|
| 76 | { |
---|
| 77 | ignoreOptions.push('magic'); |
---|
| 78 | } |
---|
| 79 | if($('#iFillDataBaseIgnore_exif').get(0).checked) |
---|
| 80 | { |
---|
| 81 | ignoreOptions.push('exif'); |
---|
| 82 | } |
---|
| 83 | if($('#iFillDataBaseIgnore_iptc').get(0).checked) |
---|
| 84 | { |
---|
| 85 | ignoreOptions.push('iptc'); |
---|
| 86 | } |
---|
| 87 | if($('#iFillDataBaseIgnore_xmp').get(0).checked) |
---|
| 88 | { |
---|
| 89 | ignoreOptions.push('xmp'); |
---|
| 90 | } |
---|
[7519] | 91 | if($('#iFillDataBaseIgnore_com').get(0).checked) |
---|
| 92 | { |
---|
| 93 | ignoreOptions.push('com'); |
---|
| 94 | } |
---|
[6731] | 95 | |
---|
| 96 | |
---|
| 97 | $("#dialog") |
---|
| 98 | .html("") |
---|
| 99 | .dialog( |
---|
| 100 | { |
---|
| 101 | resizable: false, |
---|
| 102 | width:480, |
---|
[15343] | 103 | height:150, |
---|
[6731] | 104 | modal: true, |
---|
| 105 | draggable:true, |
---|
| 106 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
| 107 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal} ('+modeLabel+')', |
---|
| 108 | } |
---|
| 109 | ).html(doAnalyzeDialog); |
---|
| 110 | |
---|
| 111 | NumberOfItemsPerRequest=$("#iamd_NumberOfItemsPerRequest").val(); |
---|
| 112 | |
---|
| 113 | $.ajax( |
---|
| 114 | { |
---|
| 115 | type: "POST", |
---|
| 116 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 117 | async: true, |
---|
| 118 | data: |
---|
| 119 | { |
---|
| 120 | ajaxfct:"admin.makeStats.getList", |
---|
[16007] | 121 | token:'{/literal}{$token}{literal}', |
---|
[6731] | 122 | selectMode:mode, |
---|
| 123 | numOfItems:NumberOfItemsPerRequest, |
---|
| 124 | ignoreOptions:ignoreOptions, |
---|
[7447] | 125 | numOfRandomItems:numOfRandomItems, |
---|
[6731] | 126 | }, |
---|
| 127 | success: function(msg) |
---|
| 128 | { |
---|
| 129 | processAnalyze.step=0; |
---|
| 130 | processAnalyze.lists=msg.split(";"); |
---|
| 131 | processAnalyze.timeStart=new Date(); |
---|
| 132 | doStep_processList(); |
---|
| 133 | }, |
---|
| 134 | error: function() |
---|
| 135 | { |
---|
| 136 | alert('error'); |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | ); |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | function displayTime(eTime) |
---|
| 144 | { |
---|
| 145 | seconds=(eTime%60).toFixed(2); |
---|
| 146 | minutes=((eTime-seconds)/60).toFixed(0); |
---|
| 147 | returned=seconds+"s"; |
---|
| 148 | if(minutes>0) returned=minutes+"m"+returned; |
---|
| 149 | return(returned); |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | function doStep_processList() |
---|
| 153 | { |
---|
| 154 | if(processAnalyze.step < processAnalyze.lists.length) |
---|
| 155 | { |
---|
| 156 | $.ajax({ |
---|
| 157 | type: "POST", |
---|
| 158 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 159 | async: true, |
---|
[16007] | 160 | data: { ajaxfct:"admin.makeStats.doAnalyze", token:'{/literal}{$token}{literal}', imagesList:processAnalyze.lists[processAnalyze.step] }, |
---|
[6731] | 161 | success: function(msg) |
---|
| 162 | { |
---|
| 163 | processAnalyze.step++; |
---|
| 164 | doStep_processList(); |
---|
| 165 | }, |
---|
| 166 | }); |
---|
| 167 | |
---|
| 168 | pct=100*(processAnalyze.step+1)/processAnalyze.lists.length; |
---|
| 169 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
| 170 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
| 171 | } |
---|
| 172 | else |
---|
| 173 | { |
---|
| 174 | // list completely processed |
---|
| 175 | tmp = $.ajax({ |
---|
| 176 | type: "POST", |
---|
| 177 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 178 | async: false, |
---|
[16007] | 179 | data: { ajaxfct:"admin.makeStats.consolidate", token:'{/literal}{$token}{literal}' } |
---|
[6731] | 180 | }).responseText; |
---|
| 181 | |
---|
| 182 | processAnalyze.timeEnd = new Date(); |
---|
| 183 | timeElapsed=processAnalyze.timeEnd.getTime()-processAnalyze.timeStart.getTime(); |
---|
| 184 | |
---|
| 185 | $("#dialog") |
---|
| 186 | .dialog("destroy") |
---|
| 187 | .html("") |
---|
| 188 | .get(0).removeAttribute('style'); |
---|
| 189 | |
---|
| 190 | $("#dialog") |
---|
| 191 | .dialog( |
---|
| 192 | { |
---|
| 193 | resizable: false, |
---|
| 194 | width:480, |
---|
[15343] | 195 | height:150, |
---|
[6731] | 196 | modal: true, |
---|
| 197 | draggable:true, |
---|
| 198 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
| 199 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal}', |
---|
| 200 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
| 201 | open: function(event, ui) |
---|
| 202 | { |
---|
| 203 | bH=$("div.ui-dialog-buttonpane").get(0).clientHeight; |
---|
| 204 | $("#dialog").css('height', (this.clientHeight-bH)+"px"); |
---|
| 205 | }, |
---|
| 206 | buttons: |
---|
| 207 | { |
---|
| 208 | '{/literal}{"g003_ok"|@translate}{literal}': |
---|
| 209 | function() |
---|
| 210 | { |
---|
| 211 | $(this).dialog('destroy').html("").get(0).removeAttribute('style'); |
---|
| 212 | } |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | ) |
---|
| 216 | .html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal} ("+displayTime(timeElapsed/1000)+")"); |
---|
| 217 | } |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | function updateFillDatabaseOption() |
---|
| 221 | { |
---|
| 222 | $.ajax( |
---|
| 223 | { |
---|
| 224 | type: "POST", |
---|
| 225 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 226 | async: true, |
---|
[16007] | 227 | data: { ajaxfct:"admin.config.setOption", token:'{/literal}{$token}{literal}', id:'amd_FillDataBaseContinuously', value:$('#iamd_FillDataBaseContinuously').get(0).checked?'y':'n' }, |
---|
[6731] | 228 | } |
---|
| 229 | ); |
---|
| 230 | } |
---|
| 231 | |
---|
| 232 | function displayAnalyzedOption() |
---|
| 233 | { |
---|
| 234 | if($('#iAnalyzeAnalyzed').css('display')=='none') |
---|
| 235 | { |
---|
| 236 | $('#iAnalyzeAnalyzed').css('display', 'block'); |
---|
| 237 | $('#ianalyze_action4').get(0).checked=true; |
---|
| 238 | } |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | |
---|
| 243 | </script> |
---|
| 244 | {/literal} |
---|
| 245 | |
---|
| 246 | <h2>{'g003_updating_metadata'|@translate}</h2> |
---|
| 247 | |
---|
| 248 | <div id="dialog"></div> |
---|
| 249 | |
---|
| 250 | <div id='ianalyzearea'> |
---|
| 251 | <form class="formtable"> |
---|
| 252 | <fieldset> |
---|
| 253 | <legend>{'g003_options'|@translate}</legend> |
---|
| 254 | <label><input onclick='updateFillDatabaseOption();' type="checkbox" id='iamd_FillDataBaseContinuously' {if $amdConfig.amd_FillDataBaseContinuously=='y'}checked{/if}> {'g003_fillDatabaseContinuously'|@translate}</label><br> |
---|
| 255 | |
---|
| 256 | {if !(in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 257 | in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 258 | in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
[7519] | 259 | in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 260 | in_array('com', $amdConfig.amd_FillDataBaseExcludeFilters)) } |
---|
[6731] | 261 | <br> |
---|
| 262 | {'g003_ignoreMetadata'|@translate}<br> |
---|
| 263 | <table style='margin-left:0px;'> |
---|
| 264 | <tr style='vertical-align:top;text-align:left;'> |
---|
| 265 | <td width='150px'> |
---|
| 266 | {if !in_array('magic', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 267 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_magic' {if in_array('magic', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> Magic</label><br> |
---|
| 268 | {/if} |
---|
| 269 | {if !in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 270 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_exif' {if in_array('exif', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> EXIF</label><br> |
---|
| 271 | {/if} |
---|
| 272 | {if !in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 273 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_iptc' {if in_array('iptc', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> IPTC</label><br> |
---|
| 274 | {/if} |
---|
| 275 | {if !in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
[7519] | 276 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_xmp' {if in_array('xmp', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> XMP</label><br> |
---|
[6731] | 277 | {/if} |
---|
[7519] | 278 | {if !in_array('com', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 279 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_com' {if in_array('com', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> COM</label> |
---|
| 280 | {/if} |
---|
[6731] | 281 | </td> |
---|
| 282 | <td style='border-left:1px dotted;'><br><span style='font-style:italic;margin-left:8px;'>{'g003_fillDatabaseIgnoreWarning'|@translate}</span></td> |
---|
| 283 | </tr> |
---|
| 284 | </table> |
---|
| 285 | {/if} |
---|
| 286 | </fieldset> |
---|
| 287 | |
---|
| 288 | <fieldset> |
---|
| 289 | <legend>{'g003_update_metadata'|@translate}</legend> |
---|
[7447] | 290 | <div> |
---|
| 291 | <div style='display: inline-block; border-right: 1px dotted; margin-right: 4px; padding-right: 8px;'> |
---|
| 292 | <label> |
---|
| 293 | <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked> |
---|
| 294 | {'g003_analyze_caddie_add_pictures'|@translate} |
---|
| 295 | </label><br> |
---|
[6731] | 296 | |
---|
[7447] | 297 | <label> |
---|
| 298 | <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3"> |
---|
| 299 | {'g003_analyze_caddie_replace_pictures'|@translate} |
---|
| 300 | </label><br> |
---|
| 301 | </div> |
---|
| 302 | <span style='font-style: italic; position: relative; top: -12px;'>{$datas.caddieNbPictures}</span> |
---|
| 303 | </div> |
---|
[6731] | 304 | |
---|
| 305 | <label> |
---|
| 306 | <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0"> |
---|
| 307 | {'g003_analyze_not_analyzed_pictures'|@translate} |
---|
| 308 | </label><br> |
---|
| 309 | |
---|
| 310 | <label> |
---|
| 311 | <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1"> |
---|
| 312 | {'g003_analyze_all_pictures'|@translate} |
---|
| 313 | </label><br> |
---|
| 314 | |
---|
[7447] | 315 | |
---|
| 316 | |
---|
| 317 | <input type="radio" value="randomList" name="fAMD_analyze_action" id="ianalyze_action5"> |
---|
| 318 | {'g003_analyze_random_pictures'|@translate|replace:'%s':"<input type='text' size='4' id='ianalyze_action6' value='500' style='display:inline;' onfocus='$("#ianalyze_action5").attr("checked", true);'>"} |
---|
| 319 | <br> |
---|
| 320 | |
---|
| 321 | |
---|
[6731] | 322 | <span id='iAnalyzeAnalyzed' style='display:none;'> |
---|
| 323 | <label> |
---|
| 324 | <input type="radio" value="analyzed" name="fAMD_analyze_action" id="ianalyze_action4"> |
---|
| 325 | {'g003_analyze_analyzed_pictures'|@translate} |
---|
| 326 | </label><br> |
---|
| 327 | </span> |
---|
| 328 | |
---|
| 329 | {if $amdConfig.amd_DisplayWarningsMessageUpdate=='y'} |
---|
[6950] | 330 | <div class="warnings"> |
---|
[6731] | 331 | <p style="font-size: 120%;">{'g003_warning_on_analyze_0'|@translate}</p> |
---|
| 332 | <p>{'g003_warning_on_analyze_1'|@translate}</p> |
---|
| 333 | <p>{'g003_warning_on_analyze_2'|@translate}</p> |
---|
| 334 | </div> |
---|
| 335 | {/if} |
---|
| 336 | |
---|
| 337 | <br> |
---|
| 338 | <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}"> |
---|
| 339 | <!-- |
---|
| 340 | {'g003_setting_nb_items_per_request'|@translate} |
---|
| 341 | <div id="iamd_nb_item_per_request_slider"></div> |
---|
| 342 | <div id="iamd_nb_item_per_request_display"></div> |
---|
| 343 | <br><br> |
---|
| 344 | --> |
---|
| 345 | <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();"> |
---|
| 346 | </fieldset> |
---|
| 347 | </form> |
---|
| 348 | </div> |
---|
| 349 | |
---|
| 350 | |
---|
| 351 | |
---|
| 352 | |
---|
| 353 | <script type="text/javascript"> |
---|
| 354 | init(); |
---|
| 355 | </script> |
---|