Changeset 10454
- Timestamp:
- Apr 17, 2011, 9:08:06 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/batch_manager_global.php
r10389 r10454 44 44 } 45 45 46 // User cache must not be regenerated during simultaneous ajax requests 47 if (!isset($user['need_update']) or !$user['need_update']) 48 { 49 getuserdata($user['id'], true); 50 } 51 46 52 // +-----------------------------------------------------------------------+ 47 53 // | Check Access and exit when user status is not ok | … … 410 416 411 417 if ($_POST['regenerateError'] != '0') 412 array_push($page['warnings'], sprintf(l10n('%s thumbnails have been regenerated'), $_POST['regenerateError'])); 413 418 array_push($page['warnings'], sprintf(l10n('%s thumbnails can not be regenerated'), $_POST['regenerateError'])); 419 420 $update_fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality'); 421 } 422 423 if ('regenerateWebsize' == $action) 424 { 425 if ($_POST['regenerateSuccess'] != '0') 426 array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess'])); 427 428 if ($_POST['regenerateError'] != '0') 429 array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError'])); 430 431 $update_fields = array('websize_maxwidth', 'websize_maxheight', 'websize_quality'); 432 } 433 434 if (!empty($update_fields)) 435 { 414 436 // Update configuration 415 $fields = array('thumb_maxwidth', 'thumb_maxheight', 'thumb_quality');416 437 $updates = array(); 417 foreach ($ fields as $field)438 foreach ($update_fields as $field) 418 439 { 419 440 $value = null; … … 451 472 ); 452 473 } 453 function regenerateThumbnails_prefilter($content, $smarty)454 {455 return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content);456 }457 $template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter');458 474 $template->delete_compiled_templates(); 459 475 } … … 784 800 ); 785 801 802 function regenerateThumbnails_prefilter($content, $smarty) 803 { 804 return str_replace('{$thumbnail.TN_SRC}', '{$thumbnail.TN_SRC}?rand='.md5(uniqid(rand(), true)), $content); 805 } 806 $template->set_prefilter('batch_manager_global', 'regenerateThumbnails_prefilter'); 807 786 808 trigger_action('loc_end_element_set_global'); 787 809 -
trunk/admin/themes/default/template/batch_manager_global.tpl
r10422 r10454 36 36 var selectedMessage_all = "{'All %d photos are selected'|@translate}"; 37 37 var regenerateThumbnailsMessage = "{'Thumbnails generation in progress...'|@translate}"; 38 var regenerateWebsizeMessage = "{'Photos generation in progress...'|@translate}"; 38 39 {literal} 39 var queuedManagerThumbnails = $.manageAjax.create('queued', {40 queue: true,41 cacheResponse: false,42 maxRequests: 343 });44 45 40 function str_repeat(i, m) { 46 41 for (var o = []; m > 0; o[--m] = i); … … 328 323 329 324 jQuery('#applyAction').click(function() { 330 if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') { 331 if (elements.length != 0) 332 return true; 333 334 if (jQuery('input[name="setSelected"]').attr('checked')) 335 elements = all_elements; 336 else 337 jQuery('input[name="selection[]"]').each(function() { 338 if (jQuery(this).attr('checked')) { 339 elements.push(jQuery(this).val()); 340 } 341 }); 342 325 if (elements.length != 0) 326 { 327 return true; 328 } 329 else if (jQuery('[name="selectAction"]').val() == 'regenerateThumbnails') 330 { 331 type = 'thumbnail'; 332 maxRequests = 3; 343 333 maxwidth = jQuery('input[name="thumb_maxwidth"]').val(); 344 334 maxheight = jQuery('input[name="thumb_maxheight"]').val(); 345 progressBar_max = elements.length; 346 todo = 0; 347 348 jQuery('#thumb_config').hide(); 349 jQuery('#applyActionBlock').hide(); 350 jQuery('select[name="selectAction"]').hide(); 351 jQuery('#regenerationMsg').show(); 352 jQuery('#regenerationText').html(regenerateThumbnailsMessage); 353 jQuery('#progressBar').progressBar(0, { 354 max: progressBar_max, 355 textFormat: 'fraction', 356 boxImage: 'themes/default/images/progressbar.gif', 357 barImage: 'themes/default/images/progressbg_orange.gif' 335 regenerationText = regenerateThumbnailsMessage; 336 } 337 else if(jQuery('[name="selectAction"]').val() == 'regenerateWebsize') 338 { 339 type = 'websize'; 340 maxRequests = 1; 341 maxwidth = jQuery('input[name="websize_maxwidth"]').val(); 342 maxheight = jQuery('input[name="websize_maxheight"]').val(); 343 regenerationText = regenerateWebsizeMessage; 344 } 345 else return true; 346 347 jQuery('.bulkAction').hide(); 348 jQuery('#regenerationText').html(regenerationText); 349 350 var queuedManager = jQuery.manageAjax.create('queued', { 351 queue: true, 352 cacheResponse: false, 353 maxRequests: maxRequests 354 }); 355 356 if (jQuery('input[name="setSelected"]').attr('checked')) 357 elements = all_elements; 358 else 359 jQuery('input[name="selection[]"]').each(function() { 360 if (jQuery(this).attr('checked')) { 361 elements.push(jQuery(this).val()); 362 } 358 363 }); 359 364 360 for (i=0;i<elements.length;i++) { 361 queuedManagerThumbnails.add({ 362 type: 'GET', 363 url: 'ws.php', 364 data: { 365 method: 'pwg.images.resize', 366 type: 'thumbnail', 367 maxwidth: maxwidth, 368 maxheight: maxheight, 369 image_id: elements[i], 370 format: 'json' 371 }, 372 dataType: 'json', 373 success: ( function(data) { progress(++todo, progressBar_max, data['result']) }), 374 error: ( function(data) { progress(++todo, progressBar_max, false) }) 375 }); 376 } 377 return false; 378 } 365 progressBar_max = elements.length; 366 todo = 0; 367 368 jQuery('#applyActionBlock').hide(); 369 jQuery('select[name="selectAction"]').hide(); 370 jQuery('#regenerationMsg').show(); 371 372 jQuery('#progressBar').progressBar(0, { 373 max: progressBar_max, 374 textFormat: 'fraction', 375 boxImage: 'themes/default/images/progressbar.gif', 376 barImage: 'themes/default/images/progressbg_orange.gif' 377 }); 378 379 for (i=0;i<elements.length;i++) { 380 queuedManager.add({ 381 type: 'GET', 382 url: 'ws.php', 383 data: { 384 method: 'pwg.images.resize', 385 type: type, 386 maxwidth: maxwidth, 387 maxheight: maxheight, 388 image_id: elements[i], 389 format: 'json' 390 }, 391 dataType: 'json', 392 success: ( function(data) { progress(++todo, progressBar_max, data['result']) }), 393 error: ( function(data) { progress(++todo, progressBar_max, false) }) 394 }); 395 } 396 return false; 379 397 }); 380 398 … … 553 571 {/if} 554 572 <option value="regenerateThumbnails">{'Regenerate Thumbnails'|@translate}</option> 573 <option value="regenerateWebsize">{'Regenerate Websize Photos'|@translate}</option> 555 574 {if !empty($element_set_global_plugins_actions)} 556 575 {foreach from=$element_set_global_plugins_actions item=action} … … 641 660 <!-- regenerate thumbnails --> 642 661 <div id="action_regenerateThumbnails" class="bulkAction"> 643 <table style="margin-left:20px;" id="thumb_config">662 <table style="margin-left:20px;"> 644 663 <tr> 645 664 <th>{'Maximum Width'|@translate}</th> … … 657 676 </div> 658 677 678 <!-- regenerate websize --> 679 <div id="action_regenerateWebsize" class="bulkAction"> 680 <p> 681 <img src="admin/themes/default/icon/warning.png" alt="!" style="vertical-align:middle;"> 682 {'Only photos with HD can be regenerated!'|@translate} 683 </p> 684 685 <table style="margin:10px 20px;"> 686 <tr> 687 <th>{'Maximum Width'|@translate}</th> 688 <td><input type="text" name="websize_maxwidth" value="{$upload_form_settings.websize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td> 689 </tr> 690 <tr> 691 <th>{'Maximum Height'|@translate}</th> 692 <td><input type="text" name="websize_maxheight" value="{$upload_form_settings.websize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td> 693 </tr> 694 <tr> 695 <th>{'Image Quality'|@translate}</th> 696 <td><input type="text" name="websize_quality" value="{$upload_form_settings.websize_quality}" size="3" maxlength="3"> %</td> 697 </tr> 698 </table> 699 </div> 700 659 701 <!-- progress bar --> 660 <div id="regenerationMsg" style="display:none;">702 <div id="regenerationMsg" class="bulkAction"> 661 703 <p id="regenerationText" style="margin-bottom:10px;"></p> 662 704 <span class="progressBar" id="progressBar"></span> -
trunk/include/ws_functions.inc.php
r10235 r10454 2727 2727 false 2728 2728 ); 2729 2730 $conf['use_exif'] = false; 2731 $conf['use_iptc'] = false; 2732 update_metadata(array($image['id'] => $image['path'])); 2733 2729 2734 return true; 2730 2735 }
Note: See TracChangeset
for help on using the changeset viewer.