source: extensions/GThumb/template/admin.tpl @ 12857

Last change on this file since 12857 was 12857, checked in by patdenice, 12 years ago

Bug corrected with special images (like 3d pictures).
Work with question mark in urls = false.

File size: 6.0 KB
Line 
1<div class="titrePage">
2<h2>GThumb+</h2>
3</div>
4
5<form action="" method="post">
6
7<fieldset id="GThumb">
8<legend>{'Configuration'|@translate}</legend>
9<table>
10  <tr>
11    <td align="right">{'Thumbnails max height'|@translate} : &nbsp;&nbsp;</td>
12    <td><input type="text" size="2" maxlength="3" name="height" value="{$HEIGHT}">&nbsp;px</td></td>
13  </tr>
14
15  <tr>
16    <td align="right">{'Margin between thumbnails'|@translate} : &nbsp;&nbsp;</td>
17    <td><input type="text" size="2" maxlength="3" name="margin" value="{$MARGIN}">&nbsp;px</td>
18  </tr>
19
20  <tr>
21    <td align="right">{'Number of photos per page'|@translate} : &nbsp;&nbsp;</td>
22    <td><input type="text" size="2" maxlength="3" name="nb_image_page" value="{$NB_IMAGE_PAGE}"></td>
23  </tr>
24
25  <tr>
26    <td align="right">{'Double the size of the first thumbnail'|@translate} : &nbsp;&nbsp;</td>
27    <td><input type="radio" name="big_thumb" value="1" {if $BIG_THUMB}checked="checked"{/if}> {'Yes'|@translate} &nbsp;
28        <input type="radio" name="big_thumb" value="0" {if !$BIG_THUMB}checked="checked"{/if}> {'No'|@translate}
29    </td>
30  </tr>
31
32  <tr>
33    <td align="right">{'Cache the big thumbnails (recommended)'|@translate} : &nbsp;&nbsp;</td>
34    <td><input type="radio" name="cache_big_thumb" value="1" {if $CACHE_BIG_THUMB}checked="checked"{/if}> {'Yes'|@translate} &nbsp;
35        <input type="radio" name="cache_big_thumb" value="0" {if !$CACHE_BIG_THUMB}checked="checked"{/if}> {'No'|@translate}
36    </td>
37  </tr>
38
39  <tr>
40    <td align="right">{'Scale thumbnails'|@translate} : &nbsp;&nbsp;</td>
41    <td><input type="radio" name="method" value="crop" {if $METHOD == 'crop'}checked="checked"{/if}> {'Crop'|@translate} &nbsp;
42        <input type="radio" name="method" value="resize" {if $METHOD == 'resize'}checked="checked"{/if}> {'Resize'|@translate}
43    </td>
44  </tr>
45
46</table>
47</fieldset>
48
49<p><input type="submit" name="submit" value="{'Submit'|@translate}"></p>
50</form>
51
52<fieldset id="cacheinfo">
53<legend>{'Cache Informations'|@translate}</legend>
54<p id="cache_data">&nbsp;</p>
55<p id="GThumbAction">
56  <button onclick="GThumb.deletecache();" title="{'Delete images in GThumb+ cache.'|@translate}">{'Purge thumbnails cache'|@translate}</button>
57  <button onclick="GThumb.generatecache();" title="{'Finds images that have not been cached and creates the cached version.'|@translate}">{'Pre-cache thumbnails'|@translate}</button>
58</p>
59<div id="GThumbProgressbar" style="display:none;">
60  {'Generating cache, please wait...'|@translate}<br>
61  <div id="progressbar"></div>
62  <p><button onclick="GThumb.abort();">{'Cancel'|@translate}</button></p>
63</div>
64</fieldset>
65
66{html_head}{literal}
67<style type="text/css">
68#GThumb td { padding-bottom: 12px; }
69#cacheinfo p, #GThumbProgressbar { text-align:left; line-height:20px; margin:20px }
70.ui-progressbar-value { background-image: url(plugins/GThumb/template/pbar-ani.gif); }
71</style>
72{/literal}{/html_head}
73
74{combine_script id='jquery.ui.progressbar' load='footer'}
75{combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'}
76
77{footer_script}
78var pwg_token = '{$PWG_TOKEN}';
79var confirm_message = '{'Are you sure?'|@translate}';
80var nb_files_str  = '{'%d file'|@translate}';
81var nb_files_str_plur = '{'%d files'|@translate}';
82var lang_info_zero_plural = {if $lang_info.zero_plural}true{else}false{/if};
83var cache_size = {$CACHE_SIZE};
84var nb_files = {$NB_FILES};
85
86{literal}
87var GThumb = {
88
89  total: 0,
90  done: 0,
91
92  queue: jQuery.manageAjax.create('queued', {
93    queue: true, 
94    cacheResponse: false,
95    maxRequests: 3
96  }),
97
98  deletecache: function() {
99    if (confirm(confirm_message)) {
100      window.location = 'admin.php?page=plugin-GThumb&deletecache=true&pwg_token='+pwg_token;
101    }
102  },
103
104  generatecache: function() {
105    GThumb.total = nb_files;
106    GThumb.done = nb_files;
107    jQuery("#progressbar").progressbar({value: 1});
108    jQuery.ajax({
109      url: 'admin.php?page=plugin-GThumb&generatecache=request',
110      dataType: 'json',
111      success: function(data) {
112        if (data.length > 0) {
113          jQuery("#GThumbProgressbar, #GThumbAction").toggle();
114          GThumb.total = data.length + GThumb.done;
115          jQuery("#progressbar").progressbar({value: Math.ceil(GThumb.done * 100 / GThumb.total)});
116          for (i=0;i<data.length;i++) {
117            GThumb.queue.add({
118              type: 'GET',
119              url: 'ws.php',
120              data: {
121                method: 'pwg.images.getGThumbPlusThumbnail',
122                image_id: data[i],
123                format: 'json'
124              },
125              dataType: 'json',
126              success: function(data) {
127                nb_files++;
128                cache_size += data.result.filesize;
129                updateCacheSizeAndFiles();
130                GThumb.progressbar();
131              },
132              error: GThumb.progressbar
133            });
134          }
135        } else {
136          window.location = 'admin.php?page=plugin-GThumb&generatecache=complete';
137        }
138      },
139      error: function() {
140        alert('An error occured');
141      }
142    });
143    return false;
144  },
145
146  progressbar: function() {
147    jQuery( "#progressbar" ).progressbar({
148      value: Math.ceil(++GThumb.done * 100 / GThumb.total)
149    });
150    if (GThumb.done == GThumb.total) {
151      window.location = 'admin.php?page=plugin-GThumb&generatecache=complete';
152    }
153  },
154
155  abort: function() {
156    GThumb.queue.clear();
157    GThumb.queue.abort();
158    jQuery("#GThumbProgressbar, #GThumbAction").toggle();
159  }
160};
161
162function updateCacheSizeAndFiles() {
163 
164  if ( nb_files > 1 || (nb_files == 0 && lang_info_zero_plural)) {
165    nbstr = nb_files_str_plur;
166  } else {
167    nbstr = nb_files_str;
168  }
169
170  ret = nbstr.replace('%d', nb_files) + ', ';
171
172  if (cache_size > 1024 * 1024)
173    ret += Math.round((cache_size / (1024 * 1024))*100)/100 + ' MB';
174  else
175    ret += Math.round((cache_size / 1024)*100)/100 + ' KB';
176
177  jQuery("#cache_data").html(ret);
178}
179
180updateCacheSizeAndFiles();
181
182jQuery('#GThumbAction button').tipTip({'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200});
183{/literal}{/footer_script}
Note: See TracBrowser for help on using the repository browser.