[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", |
---|
| 121 | selectMode:mode, |
---|
| 122 | numOfItems:NumberOfItemsPerRequest, |
---|
| 123 | ignoreOptions:ignoreOptions, |
---|
[7447] | 124 | numOfRandomItems:numOfRandomItems, |
---|
[6731] | 125 | }, |
---|
| 126 | success: function(msg) |
---|
| 127 | { |
---|
| 128 | processAnalyze.step=0; |
---|
| 129 | processAnalyze.lists=msg.split(";"); |
---|
| 130 | processAnalyze.timeStart=new Date(); |
---|
| 131 | doStep_processList(); |
---|
| 132 | }, |
---|
| 133 | error: function() |
---|
| 134 | { |
---|
| 135 | alert('error'); |
---|
| 136 | } |
---|
| 137 | } |
---|
| 138 | ); |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | function displayTime(eTime) |
---|
| 143 | { |
---|
| 144 | seconds=(eTime%60).toFixed(2); |
---|
| 145 | minutes=((eTime-seconds)/60).toFixed(0); |
---|
| 146 | returned=seconds+"s"; |
---|
| 147 | if(minutes>0) returned=minutes+"m"+returned; |
---|
| 148 | return(returned); |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | function doStep_processList() |
---|
| 152 | { |
---|
| 153 | if(processAnalyze.step < processAnalyze.lists.length) |
---|
| 154 | { |
---|
| 155 | $.ajax({ |
---|
| 156 | type: "POST", |
---|
| 157 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 158 | async: true, |
---|
| 159 | data: { ajaxfct:"admin.makeStats.doAnalyze", imagesList:processAnalyze.lists[processAnalyze.step] }, |
---|
| 160 | success: function(msg) |
---|
| 161 | { |
---|
| 162 | processAnalyze.step++; |
---|
| 163 | doStep_processList(); |
---|
| 164 | }, |
---|
| 165 | }); |
---|
| 166 | |
---|
| 167 | pct=100*(processAnalyze.step+1)/processAnalyze.lists.length; |
---|
| 168 | $("#iprogressbar_bg").css("width", pct+"%"); |
---|
| 169 | $("#iprogressbar_fg").html(Math.round(pct)+"%"); |
---|
| 170 | } |
---|
| 171 | else |
---|
| 172 | { |
---|
| 173 | // list completely processed |
---|
| 174 | tmp = $.ajax({ |
---|
| 175 | type: "POST", |
---|
| 176 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 177 | async: false, |
---|
| 178 | data: { ajaxfct:"admin.makeStats.consolidate" } |
---|
| 179 | }).responseText; |
---|
| 180 | |
---|
| 181 | processAnalyze.timeEnd = new Date(); |
---|
| 182 | timeElapsed=processAnalyze.timeEnd.getTime()-processAnalyze.timeStart.getTime(); |
---|
| 183 | |
---|
| 184 | $("#dialog") |
---|
| 185 | .dialog("destroy") |
---|
| 186 | .html("") |
---|
| 187 | .get(0).removeAttribute('style'); |
---|
| 188 | |
---|
| 189 | $("#dialog") |
---|
| 190 | .dialog( |
---|
| 191 | { |
---|
| 192 | resizable: false, |
---|
| 193 | width:480, |
---|
[15343] | 194 | height:150, |
---|
[6731] | 195 | modal: true, |
---|
| 196 | draggable:true, |
---|
| 197 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
| 198 | title: '{/literal}{"g003_updating_metadata"|@translate}{literal}', |
---|
| 199 | dialogClass: 'gcBgTabSheet gcBorder', |
---|
| 200 | open: function(event, ui) |
---|
| 201 | { |
---|
| 202 | bH=$("div.ui-dialog-buttonpane").get(0).clientHeight; |
---|
| 203 | $("#dialog").css('height', (this.clientHeight-bH)+"px"); |
---|
| 204 | }, |
---|
| 205 | buttons: |
---|
| 206 | { |
---|
| 207 | '{/literal}{"g003_ok"|@translate}{literal}': |
---|
| 208 | function() |
---|
| 209 | { |
---|
| 210 | $(this).dialog('destroy').html("").get(0).removeAttribute('style'); |
---|
| 211 | } |
---|
| 212 | } |
---|
| 213 | } |
---|
| 214 | ) |
---|
| 215 | .html("<br>{/literal}{'g003_analyze_is_finished'|@translate}{literal} ("+displayTime(timeElapsed/1000)+")"); |
---|
| 216 | } |
---|
| 217 | } |
---|
| 218 | |
---|
| 219 | function updateFillDatabaseOption() |
---|
| 220 | { |
---|
| 221 | $.ajax( |
---|
| 222 | { |
---|
| 223 | type: "POST", |
---|
| 224 | url: "{/literal}{$datas.urlRequest}{literal}", |
---|
| 225 | async: true, |
---|
| 226 | data: { ajaxfct:"admin.config.setOption", id:'amd_FillDataBaseContinuously', value:$('#iamd_FillDataBaseContinuously').get(0).checked?'y':'n' }, |
---|
| 227 | } |
---|
| 228 | ); |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | function displayAnalyzedOption() |
---|
| 232 | { |
---|
| 233 | if($('#iAnalyzeAnalyzed').css('display')=='none') |
---|
| 234 | { |
---|
| 235 | $('#iAnalyzeAnalyzed').css('display', 'block'); |
---|
| 236 | $('#ianalyze_action4').get(0).checked=true; |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | |
---|
| 241 | |
---|
| 242 | </script> |
---|
| 243 | {/literal} |
---|
| 244 | |
---|
| 245 | <h2>{'g003_updating_metadata'|@translate}</h2> |
---|
| 246 | |
---|
| 247 | <div id="dialog"></div> |
---|
| 248 | |
---|
| 249 | <div id='ianalyzearea'> |
---|
| 250 | <form class="formtable"> |
---|
| 251 | <fieldset> |
---|
| 252 | <legend>{'g003_options'|@translate}</legend> |
---|
| 253 | <label><input onclick='updateFillDatabaseOption();' type="checkbox" id='iamd_FillDataBaseContinuously' {if $amdConfig.amd_FillDataBaseContinuously=='y'}checked{/if}> {'g003_fillDatabaseContinuously'|@translate}</label><br> |
---|
| 254 | |
---|
| 255 | {if !(in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 256 | in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 257 | in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
[7519] | 258 | in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters) and |
---|
| 259 | in_array('com', $amdConfig.amd_FillDataBaseExcludeFilters)) } |
---|
[6731] | 260 | <br> |
---|
| 261 | {'g003_ignoreMetadata'|@translate}<br> |
---|
| 262 | <table style='margin-left:0px;'> |
---|
| 263 | <tr style='vertical-align:top;text-align:left;'> |
---|
| 264 | <td width='150px'> |
---|
| 265 | {if !in_array('magic', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 266 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_magic' {if in_array('magic', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> Magic</label><br> |
---|
| 267 | {/if} |
---|
| 268 | {if !in_array('exif', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 269 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_exif' {if in_array('exif', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> EXIF</label><br> |
---|
| 270 | {/if} |
---|
| 271 | {if !in_array('iptc', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 272 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_iptc' {if in_array('iptc', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> IPTC</label><br> |
---|
| 273 | {/if} |
---|
| 274 | {if !in_array('xmp', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
[7519] | 275 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_xmp' {if in_array('xmp', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> XMP</label><br> |
---|
[6731] | 276 | {/if} |
---|
[7519] | 277 | {if !in_array('com', $amdConfig.amd_FillDataBaseExcludeFilters)} |
---|
| 278 | <label><input onclick='displayAnalyzedOption();' type="checkbox" id='iFillDataBaseIgnore_com' {if in_array('com', $amdConfig.amd_FillDataBaseIgnoreSchemas)}checked{/if}> COM</label> |
---|
| 279 | {/if} |
---|
[6731] | 280 | </td> |
---|
| 281 | <td style='border-left:1px dotted;'><br><span style='font-style:italic;margin-left:8px;'>{'g003_fillDatabaseIgnoreWarning'|@translate}</span></td> |
---|
| 282 | </tr> |
---|
| 283 | </table> |
---|
| 284 | {/if} |
---|
| 285 | </fieldset> |
---|
| 286 | |
---|
| 287 | <fieldset> |
---|
| 288 | <legend>{'g003_update_metadata'|@translate}</legend> |
---|
[7447] | 289 | <div> |
---|
| 290 | <div style='display: inline-block; border-right: 1px dotted; margin-right: 4px; padding-right: 8px;'> |
---|
| 291 | <label> |
---|
| 292 | <input type="radio" value="caddieAdd" name="fAMD_analyze_action" id="ianalyze_action2" checked> |
---|
| 293 | {'g003_analyze_caddie_add_pictures'|@translate} |
---|
| 294 | </label><br> |
---|
[6731] | 295 | |
---|
[7447] | 296 | <label> |
---|
| 297 | <input type="radio" value="caddieReplace" name="fAMD_analyze_action" id="ianalyze_action3"> |
---|
| 298 | {'g003_analyze_caddie_replace_pictures'|@translate} |
---|
| 299 | </label><br> |
---|
| 300 | </div> |
---|
| 301 | <span style='font-style: italic; position: relative; top: -12px;'>{$datas.caddieNbPictures}</span> |
---|
| 302 | </div> |
---|
[6731] | 303 | |
---|
| 304 | <label> |
---|
| 305 | <input type="radio" value="notAnalayzed" name="fAMD_analyze_action" id="ianalyze_action0"> |
---|
| 306 | {'g003_analyze_not_analyzed_pictures'|@translate} |
---|
| 307 | </label><br> |
---|
| 308 | |
---|
| 309 | <label> |
---|
| 310 | <input type="radio" value="all" name="fAMD_analyze_action" id="ianalyze_action1"> |
---|
| 311 | {'g003_analyze_all_pictures'|@translate} |
---|
| 312 | </label><br> |
---|
| 313 | |
---|
[7447] | 314 | |
---|
| 315 | |
---|
| 316 | <input type="radio" value="randomList" name="fAMD_analyze_action" id="ianalyze_action5"> |
---|
| 317 | {'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);'>"} |
---|
| 318 | <br> |
---|
| 319 | |
---|
| 320 | |
---|
[6731] | 321 | <span id='iAnalyzeAnalyzed' style='display:none;'> |
---|
| 322 | <label> |
---|
| 323 | <input type="radio" value="analyzed" name="fAMD_analyze_action" id="ianalyze_action4"> |
---|
| 324 | {'g003_analyze_analyzed_pictures'|@translate} |
---|
| 325 | </label><br> |
---|
| 326 | </span> |
---|
| 327 | |
---|
| 328 | {if $amdConfig.amd_DisplayWarningsMessageUpdate=='y'} |
---|
[6950] | 329 | <div class="warnings"> |
---|
[6731] | 330 | <p style="font-size: 120%;">{'g003_warning_on_analyze_0'|@translate}</p> |
---|
| 331 | <p>{'g003_warning_on_analyze_1'|@translate}</p> |
---|
| 332 | <p>{'g003_warning_on_analyze_2'|@translate}</p> |
---|
| 333 | </div> |
---|
| 334 | {/if} |
---|
| 335 | |
---|
| 336 | <br> |
---|
| 337 | <input type="hidden" id="iamd_NumberOfItemsPerRequest" value="{$datas.NumberOfItemsPerRequest}"> |
---|
| 338 | <!-- |
---|
| 339 | {'g003_setting_nb_items_per_request'|@translate} |
---|
| 340 | <div id="iamd_nb_item_per_request_slider"></div> |
---|
| 341 | <div id="iamd_nb_item_per_request_display"></div> |
---|
| 342 | <br><br> |
---|
| 343 | --> |
---|
| 344 | <input type="button" value="{'g003_analyze'|@translate}" onclick="doAnalyze();"> |
---|
| 345 | </fieldset> |
---|
| 346 | </form> |
---|
| 347 | </div> |
---|
| 348 | |
---|
| 349 | |
---|
| 350 | |
---|
| 351 | |
---|
| 352 | <script type="text/javascript"> |
---|
| 353 | init(); |
---|
| 354 | </script> |
---|