source: extensions/rotateImage/rotate_image.tpl @ 13314

Last change on this file since 13314 was 13314, checked in by plg, 9 years ago

bug fixed: rotate HD was never called even if checkbox was checked

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