[12409] | 1 | {footer_script} |
---|
| 2 | var rotateImagesMessage = "{'Images rotation in progress...'|@translate}"; |
---|
| 3 | |
---|
| 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 | { |
---|
| 12 | angle = jQuery('input[name="rotate_angle"]:checked').val(); |
---|
| 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, |
---|
| 57 | image_id: elements[i] |
---|
| 58 | }, |
---|
| 59 | dataType: 'json', |
---|
| 60 | success: ( function(data) { progress(++todo, progressBar_max, data['result']) }), |
---|
| 61 | error: ( function(data) { progress(++todo, progressBar_max, false) }) |
---|
| 62 | }); |
---|
| 63 | } |
---|
| 64 | return false; |
---|
| 65 | }); |
---|
| 66 | |
---|
| 67 | {/literal}{/footer_script} |
---|
| 68 | |
---|
| 69 | <div id="rotate_image" class="bulkAction"> |
---|
| 70 | <p>{'Select angle :'|@translate}</p> |
---|
| 71 | <label><input type="radio" name="rotate_angle" value="90" checked="checked"> {'Rotate 90° left'|@translate}</label> |
---|
| 72 | <label><input type="radio" name="rotate_angle" value="270"> {'Rotate 90° right'|@translate}</label> |
---|
| 73 | <label><input type="radio" name="rotate_angle" value="180"> {'Rotate 180°'|@translate}</label> |
---|
| 74 | </div> |
---|