Changeset 28909 for trunk/admin
- Timestamp:
- Jul 1, 2014, 9:28:09 PM (10 years ago)
- Location:
- trunk/admin/themes/default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/js/batchManagerGlobal.js
r28821 r28909 94 94 jQuery("a.preview-box").colorbox(); 95 95 96 jQuery('.thumbnails img').tipTip({ 97 'delay' : 0, 98 'fadeIn' : 200, 99 'fadeOut' : 200 100 }); 96 101 97 102 … … 131 136 } 132 137 }); 138 139 var derivatives = { 140 elements: null, 141 done: 0, 142 total: 0, 143 144 finished: function() { 145 return derivatives.done == derivatives.total && derivatives.elements && derivatives.elements.length==0; 146 } 147 }; 148 149 function progress(success) { 150 jQuery('#progressBar').progressBar(derivatives.done, { 151 max: derivatives.total, 152 textFormat: 'fraction', 153 boxImage: 'themes/default/images/progressbar.gif', 154 barImage: 'themes/default/images/progressbg_orange.gif' 155 }); 156 if (success !== undefined) { 157 var type = success ? 'regenerateSuccess': 'regenerateError', 158 s = jQuery('[name="'+type+'"]').val(); 159 jQuery('[name="'+type+'"]').val(++s); 160 } 161 162 if (derivatives.finished()) { 163 jQuery('#applyAction').click(); 164 } 165 } 166 167 function getDerivativeUrls() { 168 var ids = derivatives.elements.splice(0, 500); 169 var params = {max_urls: 100000, ids: ids, types: []}; 170 jQuery("#action_generate_derivatives input").each( function(i, t) { 171 if ($(t).is(":checked")) 172 params.types.push( t.value ); 173 } ); 174 175 jQuery.ajax( { 176 type: "POST", 177 url: 'ws.php?format=json&method=pwg.getMissingDerivatives', 178 data: params, 179 dataType: "json", 180 success: function(data) { 181 if (!data.stat || data.stat != "ok") { 182 return; 183 } 184 derivatives.total += data.result.urls.length; 185 progress(); 186 for (var i=0; i < data.result.urls.length; i++) { 187 jQuery.manageAjax.add("queued", { 188 type: 'GET', 189 url: data.result.urls[i] + "&ajaxload=true", 190 dataType: 'json', 191 success: ( function(data) { derivatives.done++; progress(true) }), 192 error: ( function(data) { derivatives.done++; progress(false) }) 193 }); 194 } 195 if (derivatives.elements.length) 196 setTimeout( getDerivativeUrls, 25 * (derivatives.total-derivatives.done)); 197 } 198 } ); 199 } 200 201 function selectGenerateDerivAll() { 202 $("#action_generate_derivatives input[type=checkbox]").prop("checked", true); 203 } 204 function selectGenerateDerivNone() { 205 $("#action_generate_derivatives input[type=checkbox]").prop("checked", false); 206 } 207 208 function selectDelDerivAll() { 209 $("#action_delete_derivatives input[type=checkbox]").prop("checked", true); 210 } 211 function selectDelDerivNone() { 212 $("#action_delete_derivatives input[type=checkbox]").prop("checked", false); 213 } -
trunk/admin/themes/default/template/batch_manager_global.tpl
r28821 r28909 21 21 {footer_script} 22 22 var lang = { 23 Cancel: '{'Cancel'|translate|escape:'javascript'}' 23 Cancel: '{'Cancel'|translate|escape:'javascript'}', 24 AreYouSure: "{'Are you sure?'|translate|escape:'javascript'}" 24 25 }; 25 26 … … 68 69 var nb_thumbs_page = {$nb_thumbs_page}; 69 70 var nb_thumbs_set = {$nb_thumbs_set}; 70 var are_you_sure = "{'Are you sure?'|@translate|@escape:'javascript'}";71 71 var applyOnDetails_pattern = "{'on the %d selected photos'|@translate}"; 72 72 var all_elements = [{if !empty($all_elements)}{','|@implode:$all_elements}{/if}]; 73 var derivatives = {ldelim}74 elements: null,75 done: 0,76 total: 0,77 78 finished: function() {ldelim}79 return derivatives.done == derivatives.total && derivatives.elements && derivatives.elements.length==0;80 }81 };82 73 83 74 var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}"; 84 75 var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}"; 85 76 var selectedMessage_all = "{'All %d photos are selected'|@translate}"; 86 87 {literal}88 function progress(success) {89 jQuery('#progressBar').progressBar(derivatives.done, {90 max: derivatives.total,91 textFormat: 'fraction',92 boxImage: 'themes/default/images/progressbar.gif',93 barImage: 'themes/default/images/progressbg_orange.gif'94 });95 if (success !== undefined) {96 var type = success ? 'regenerateSuccess': 'regenerateError',97 s = jQuery('[name="'+type+'"]').val();98 jQuery('[name="'+type+'"]').val(++s);99 }100 101 if (derivatives.finished()) {102 jQuery('#applyAction').click();103 }104 }105 77 106 78 $(document).ready(function() { … … 157 129 } 158 130 } 159 160 $('.thumbnails img').tipTip({161 'delay' : 0,162 'fadeIn' : 200,163 'fadeOut' : 200164 });165 131 166 132 $("[id^=action_]").hide(); … … 261 227 , e_count = $('input[name="setSelected"]').is(':checked') ? nb_thumbs_set : $('.thumbnails input[type=checkbox]').filter(':checked').length; 262 228 if (d_count*e_count > 500) 263 return confirm( are_you_sure);229 return confirm(lang.AreYouSure); 264 230 } 265 231 … … 297 263 }); 298 264 299 function getDerivativeUrls() {300 var ids = derivatives.elements.splice(0, 500);301 var params = {max_urls: 100000, ids: ids, types: []};302 jQuery("#action_generate_derivatives input").each( function(i, t) {303 if ($(t).is(":checked"))304 params.types.push( t.value );305 } );306 307 jQuery.ajax( {308 type: "POST",309 url: 'ws.php?format=json&method=pwg.getMissingDerivatives',310 data: params,311 dataType: "json",312 success: function(data) {313 if (!data.stat || data.stat != "ok") {314 return;315 }316 derivatives.total += data.result.urls.length;317 progress();318 for (var i=0; i < data.result.urls.length; i++) {319 jQuery.manageAjax.add("queued", {320 type: 'GET',321 url: data.result.urls[i] + "&ajaxload=true",322 dataType: 'json',323 success: ( function(data) { derivatives.done++; progress(true) }),324 error: ( function(data) { derivatives.done++; progress(false) })325 });326 }327 if (derivatives.elements.length)328 setTimeout( getDerivativeUrls, 25 * (derivatives.total-derivatives.done));329 }330 } );331 }332 333 265 checkPermitAction(); 334 266 335 336 337 338 */ 267 {* /* dimensions sliders */ 268 /** 269 * find the key from a value in the startStopValues array 270 */ *} 339 271 function getSliderKeyFromValue(value, values) { 340 272 for (var key in values) { … … 347 279 } 348 280 349 {/literal} 350 var dimension_values = {ldelim} 351 'width':[{$dimensions.widths}], 352 'height':[{$dimensions.heights}], 353 'ratio':[{$dimensions.ratios}] 281 var dimension_values = { 282 width:[{$dimensions.widths}], 283 height:[{$dimensions.heights}], 284 ratio:[{$dimensions.ratios}] 354 285 }; 355 286 356 $("#filter_dimension_width_slider").slider({ldelim} 287 function onSliderChange(type, ui, pattern) { 288 $("input[name='filter_dimension_min_"+type+"']").val(dimension_values[type][ui.values[0]]); 289 $("input[name='filter_dimension_max_"+type+"']").val(dimension_values[type][ui.values[1]]); 290 291 $("#filter_dimension_"+type+"_info").html(sprintf( 292 pattern, 293 dimension_values[type][ui.values[0]], 294 dimension_values[type][ui.values[1]] 295 )); 296 } 297 298 $("#filter_dimension_width_slider").slider({ 357 299 range: true, 358 300 min: 0, … … 362 304 getSliderKeyFromValue({$dimensions.selected.max_width}, dimension_values['width']) 363 305 ], 364 slide: function(event, ui) {ldelim} 365 $("input[name='filter_dimension_min_width']").val(dimension_values['width'][ui.values[0]]); 366 $("input[name='filter_dimension_max_width']").val(dimension_values['width'][ui.values[1]]); 367 368 $("#filter_dimension_width_info").html(sprintf( 369 "{'between %d and %d pixels'|@translate}", 370 dimension_values['width'][ui.values[0]], 371 dimension_values['width'][ui.values[1]] 372 )); 373 }, 374 change: function(event, ui) {ldelim} 375 $("input[name='filter_dimension_min_width']").val(dimension_values['width'][ui.values[0]]); 376 $("input[name='filter_dimension_max_width']").val(dimension_values['width'][ui.values[1]]); 377 378 $("#filter_dimension_width_info").html(sprintf( 379 "{'between %d and %d pixels'|@translate}", 380 dimension_values['width'][ui.values[0]], 381 dimension_values['width'][ui.values[1]] 382 )); 383 } 384 }); 385 386 $("#filter_dimension_height_slider").slider({ldelim} 306 slide: function(event, ui) { 307 onSliderChange('width', ui, "{'between %d and %d pixels'|translate|escape:'javascript'}"); 308 }, 309 change: function(event, ui) { 310 onSliderChange('width', ui, "{'between %d and %d pixels'|translate|escape:'javascript'}"); 311 } 312 }); 313 314 $("#filter_dimension_height_slider").slider({ 387 315 range: true, 388 316 min: 0, … … 392 320 getSliderKeyFromValue({$dimensions.selected.max_height}, dimension_values['height']) 393 321 ], 394 slide: function(event, ui) {ldelim} 395 $("input[name='filter_dimension_min_height']").val(dimension_values['height'][ui.values[0]]); 396 $("input[name='filter_dimension_max_height']").val(dimension_values['height'][ui.values[1]]); 397 398 $("#filter_dimension_height_info").html(sprintf( 399 "{'between %d and %d pixels'|@translate}", 400 dimension_values['height'][ui.values[0]], 401 dimension_values['height'][ui.values[1]] 402 )); 403 }, 404 change: function(event, ui) {ldelim} 405 $("input[name='filter_dimension_min_height']").val(dimension_values['height'][ui.values[0]]); 406 $("input[name='filter_dimension_max_height']").val(dimension_values['height'][ui.values[1]]); 407 408 $("#filter_dimension_height_info").html(sprintf( 409 "{'between %d and %d pixels'|@translate}", 410 dimension_values['height'][ui.values[0]], 411 dimension_values['height'][ui.values[1]] 412 )); 413 } 414 }); 415 416 $("#filter_dimension_ratio_slider").slider({ldelim} 322 slide: function(event, ui) { 323 onSliderChange('height', ui, "{'between %d and %d pixels'|translate|escape:'javascript'}"); 324 }, 325 change: function(event, ui) { 326 onSliderChange('height', ui, "{'between %d and %d pixels'|translate|escape:'javascript'}"); 327 } 328 }); 329 330 $("#filter_dimension_ratio_slider").slider({ 417 331 range: true, 418 332 min: 0, … … 422 336 getSliderKeyFromValue({$dimensions.selected.max_ratio}, dimension_values['ratio']) 423 337 ], 424 slide: function(event, ui) {ldelim} 425 $("input[name='filter_dimension_min_ratio']").val(dimension_values['ratio'][ui.values[0]]); 426 $("input[name='filter_dimension_max_ratio']").val(dimension_values['ratio'][ui.values[1]]); 427 428 $("#filter_dimension_ratio_info").html(sprintf( 429 "{'between %.2f and %.2f'|@translate}", 430 dimension_values['ratio'][ui.values[0]], 431 dimension_values['ratio'][ui.values[1]] 432 )); 433 }, 434 change: function(event, ui) {ldelim} 435 $("input[name='filter_dimension_min_ratio']").val(dimension_values['ratio'][ui.values[0]]); 436 $("input[name='filter_dimension_max_ratio']").val(dimension_values['ratio'][ui.values[1]]); 437 438 $("#filter_dimension_ratio_info").html(sprintf( 439 "{'between %.2f and %.2f'|@translate}", 440 dimension_values['ratio'][ui.values[0]], 441 dimension_values['ratio'][ui.values[1]] 442 )); 443 } 444 }); 445 446 $("a.dimensions-choice").click(function() {ldelim} 338 slide: function(event, ui) { 339 onSliderChange('ratio', ui, "{'between %.2f and %.2f'|translate|escape:'javascript'}"); 340 }, 341 change: function(event, ui) { 342 onSliderChange('ratio', ui, "{'between %.2f and %.2f'|translate|escape:'javascript'}"); 343 } 344 }); 345 346 $("a.dimensions-choice").click(function() { 447 347 var type = jQuery(this).data("type"); 448 348 var min = jQuery(this).data("min"); 449 349 var max = jQuery(this).data("max"); 450 350 451 $("#filter_dimension_"+ type +"_slider").slider("values", 0, 452 getSliderKeyFromValue(min, dimension_values[type]) 453 ); 454 455 $("#filter_dimension_"+type+"_slider").slider("values", 1, 456 getSliderKeyFromValue(max, dimension_values[type]) 457 ); 351 $("#filter_dimension_"+ type +"_slider") 352 .slider("values", 0, getSliderKeyFromValue(min, dimension_values[type]) ) 353 .slider("values", 1, getSliderKeyFromValue(max, dimension_values[type]) ); 458 354 }); 459 355 }); … … 573 469 <option value="filter_search"{if isset($filter.search)} disabled="disabled"{/if}>{'Search'|@translate}</option> 574 470 </select> 575 <a id="removeFilters" href="">{'Remove all filters'|@translate}</a>471 <a id="removeFilters">{'Remove all filters'|@translate}</a> 576 472 </p> 577 473 … … 780 676 <label><input type="checkbox" name="generate_derivatives_type[]" value="{$type}"> {$disp}</label> 781 677 {/foreach} 782 {footer_script}783 function selectGenerateDerivAll() {ldelim}784 $("#action_generate_derivatives input[type=checkbox]").prop("checked", true);785 }786 function selectGenerateDerivNone() {ldelim}787 $("#action_generate_derivatives input[type=checkbox]").prop("checked", false);788 }789 {/footer_script}790 678 </div> 791 679 … … 798 686 <label><input type="checkbox" name="del_derivatives_type[]" value="{$type}"> {$disp}</label> 799 687 {/foreach} 800 {footer_script}801 function selectDelDerivAll() {ldelim}802 $("#action_delete_derivatives input[type=checkbox]").prop("checked", true);803 }804 function selectDelDerivNone() {ldelim}805 $("#action_delete_derivatives input[type=checkbox]").prop("checked", false);806 }807 {/footer_script}808 688 </div> 809 689
Note: See TracChangeset
for help on using the changeset viewer.