source: extensions/regenerateWebsize/element_set_global_action.tpl @ 19437

Last change on this file since 19437 was 10358, checked in by patdenice, 14 years ago

Add Websize Renegeration plugin.

File size: 4.0 KB
Line 
1{combine_script id='jquery.progressBar' path='plugins/regenerateWebsize/js/jquery.progressbar.min.js' load='footer'}
2{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
3
4{footer_script require='jquery.progressBar,jquery.ajaxmanager'}
5var elements = new Array();
6var all_elements = [{','|@implode:$all_elements}];
7var redirect = '{$redirect_url}';
8
9{literal}
10var queuedManagerWebsize = $.manageAjax.create('queued', {
11        queue: true, 
12        cacheResponse: false,
13        maxRequests: 1
14});
15
16function progressWebsize(val, max, success) {
17  jQuery('#progressBarWebsize').progressBar(val, {
18    max: max,
19    textFormat: 'fraction',
20    boxImage: 'plugins/regenerateWebsize/images/progressbar.gif',
21    barImage: 'plugins/regenerateWebsize/images/progressbg_orange.gif'
22  });
23  type = success ? 'regenerateWebsizeSuccess': 'regenerateWebsizeError'
24  s = jQuery('[name="'+type+'"]').val();
25  jQuery('[name="'+type+'"]').val(++s);
26
27  if (val == max)
28    jQuery('#applyAction').click();
29}
30
31jQuery(document).ready(function() {
32  jQuery('#applyAction').click(function() {
33    if (jQuery('[name="selectAction"]').val() == 'regenerateWebsize') {
34      if (elements.length != 0)
35        return true;
36
37      if (jQuery('input[name="setSelected"]').attr('checked'))
38        elements = all_elements;
39      else
40        jQuery('input[name="selection[]"]').each(function() {
41          if (jQuery(this).attr('checked')) {
42            elements.push(jQuery(this).val());
43          }
44        });
45
46      maxwidth = jQuery('input[name="websize_maxwidth"]').val();
47      maxheight = jQuery('input[name="websize_maxheight"]').val();
48      progressBar_max = elements.length;
49      todo = 0;
50
51      jQuery('.websize_config').hide();
52      jQuery('#applyActionBlock').hide();
53      jQuery('select[name="selectAction"]').hide();
54      jQuery('#regenerationMsgWebsize').show();
55      jQuery('#progressBarWebsize').progressBar(0, {
56        max: progressBar_max,
57        textFormat: 'fraction',
58        boxImage: 'plugins/regenerateWebsize/images/progressbar.gif',
59        barImage: 'plugins/regenerateWebsize/images/progressbg_orange.gif'
60      });
61
62      for (i=0;i<elements.length;i++) {
63        queuedManagerWebsize.add({
64          type: 'GET',
65          url: 'ws.php',
66          data: {
67            method: 'pwg.images.regenerateWebsize',
68            maxwidth: maxwidth,
69            maxheight: maxheight,
70            image_id: elements[i],
71            format: 'json'
72          },
73          dataType: 'json',
74          success: ( function(data) { progressWebsize(++todo, progressBar_max, data['result']) }),
75          error: ( function(data) { progressWebsize(++todo, progressBar_max, false) })
76        });
77      }
78      return false;
79    }
80  });
81});
82{/literal}{/footer_script}
83
84<p class="websize_config">
85  <img src="plugins/regenerateWebsize/images/warning.png" alt="!" style="vertical-align:middle;">
86  {'Only photos with HD can be regenerated!'|@translate}
87</p>
88
89<table style="margin:10px 20px;" class="websize_config">
90  <tr>
91    <th>{'Maximum Width'|@translate}</th>
92    <td><input type="text" name="websize_maxwidth" value="{$upload_form_websize_settings.websize_maxwidth}" size="4" maxlength="4"> {'pixels'|@translate}</td>
93  </tr>
94  <tr>
95    <th>{'Maximum Height'|@translate}</th>
96    <td><input type="text" name="websize_maxheight" value="{$upload_form_websize_settings.websize_maxheight}" size="4" maxlength="4"> {'pixels'|@translate}</td>
97  </tr>
98  <tr>
99    <th>{'Image Quality'|@translate}</th>
100    <td><input type="text" name="websize_quality" value="{$upload_form_websize_settings.websize_quality}" size="3" maxlength="3"> %</td>
101  </tr>
102</table>
103
104<div id="regenerationMsgWebsize" style="display:none;">{'Websize photos generation in progress...'|@translate}<br><br>
105<span class="progressBarWebsize" id="progressBarWebsize"></span>
106</div>
107
108<input type="hidden" name="regenerateWebsizeSuccess" value="0">
109<input type="hidden" name="regenerateWebsizeError" value="0">
Note: See TracBrowser for help on using the repository browser.