[12417] | 1 | {footer_script} |
---|
[12409] | 2 | var rotateImagesMessage = "{'Images rotation in progress...'|@translate}"; |
---|
[12417] | 3 | var ri_pwg_token = '{$RI_PWG_TOKEN}'; |
---|
[12409] | 4 | {literal} |
---|
| 5 | jQuery('#applyAction').click(function(e) { |
---|
| 6 | if (elements.length != 0) |
---|
| 7 | { |
---|
| 8 | return true; |
---|
| 9 | } |
---|
| 10 | else if (jQuery('[name="selectAction"]').val() == 'rotateImg') |
---|
| 11 | { |
---|
[12417] | 12 | angle = jQuery('select[name="rotate_angle"]').val(); |
---|
[12409] | 13 | e.stopPropagation(); |
---|
| 14 | } |
---|
| 15 | else |
---|
| 16 | { |
---|
| 17 | return true; |
---|
| 18 | } |
---|
| 19 | jQuery('.bulkAction').hide(); |
---|
| 20 | jQuery('#regenerationText').html(rotateImagesMessage); |
---|
| 21 | var maxRequests=1; |
---|
| 22 | |
---|
| 23 | var queuedManager = jQuery.manageAjax.create('queued', { |
---|
| 24 | queue: true, |
---|
| 25 | cacheResponse: false, |
---|
| 26 | maxRequests: maxRequests |
---|
| 27 | }); |
---|
| 28 | if (jQuery('input[name="setSelected"]').attr('checked')) |
---|
| 29 | elements = all_elements; |
---|
| 30 | else |
---|
| 31 | jQuery('input[name="selection[]"]').each(function() { |
---|
| 32 | if (jQuery(this).attr('checked')) { |
---|
| 33 | elements.push(jQuery(this).val()); |
---|
| 34 | } |
---|
| 35 | }); |
---|
| 36 | progressBar_max = elements.length; |
---|
| 37 | todo = 0; |
---|
| 38 | |
---|
| 39 | jQuery('#applyActionBlock').hide(); |
---|
| 40 | jQuery('select[name="selectAction"]').hide(); |
---|
| 41 | jQuery('#regenerationMsg').show(); |
---|
| 42 | jQuery('#progressBar').progressBar(0, { |
---|
| 43 | max: progressBar_max, |
---|
| 44 | textFormat: 'fraction', |
---|
| 45 | boxImage: 'themes/default/images/progressbar.gif', |
---|
| 46 | barImage: 'themes/default/images/progressbg_orange.gif' |
---|
| 47 | }); |
---|
| 48 | |
---|
| 49 | for (i=0;i<elements.length;i++) { |
---|
| 50 | queuedManager.add({ |
---|
| 51 | type: 'GET', |
---|
| 52 | url: 'ws.php', |
---|
| 53 | data: { |
---|
| 54 | method: "pwg.image.rotate", |
---|
| 55 | format: 'json', |
---|
| 56 | angle: angle, |
---|
[12417] | 57 | pwg_token: ri_pwg_token, |
---|
[12409] | 58 | image_id: elements[i] |
---|
| 59 | }, |
---|
| 60 | dataType: 'json', |
---|
| 61 | success: ( function(data) { progress(++todo, progressBar_max, data['result']) }), |
---|
| 62 | error: ( function(data) { progress(++todo, progressBar_max, false) }) |
---|
| 63 | }); |
---|
| 64 | } |
---|
| 65 | return false; |
---|
| 66 | }); |
---|
| 67 | |
---|
| 68 | {/literal}{/footer_script} |
---|
| 69 | |
---|
| 70 | <div id="rotate_image" class="bulkAction"> |
---|
[12417] | 71 | <table style="margin-left:20px;"> |
---|
| 72 | <tr> |
---|
| 73 | <th id="thumb_width_th">{'Angle'|@translate}</th> |
---|
| 74 | <td> |
---|
| 75 | <select name="rotate_angle"> |
---|
| 76 | {foreach from=$angles item=angle} |
---|
| 77 | <option value="{$angle.value}" {if $saved_angle eq $angle.value}selected="selected"{/if}>{$angle.name}</option> |
---|
| 78 | {/foreach} |
---|
| 79 | </select> |
---|
| 80 | </td> |
---|
| 81 | </tr> |
---|
| 82 | <tr> |
---|
| 83 | <th><label for="rotate_hd">{'Also rotate HD image'|@translate}</label></th> |
---|
| 84 | <td><input type="checkbox" name="rotate_hd" id="rotate_hd" {if $upload_form_settings.thumb_crop}checked="checked"{/if}></td> |
---|
| 85 | </tr> |
---|
| 86 | </table> |
---|
[12409] | 87 | </div> |
---|