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} : </td> |
---|
12 | <td><input type="text" size="2" maxlength="3" name="height" value="{$HEIGHT}"> px</td></td> |
---|
13 | </tr> |
---|
14 | |
---|
15 | <tr> |
---|
16 | <td align="right">{'Margin between thumbnails'|@translate} : </td> |
---|
17 | <td><input type="text" size="2" maxlength="3" name="margin" value="{$MARGIN}"> px</td> |
---|
18 | </tr> |
---|
19 | |
---|
20 | <tr> |
---|
21 | <td align="right">{'Number of photos per page'|@translate} : </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} : </td> |
---|
27 | <td><label><input type="radio" name="big_thumb" value="1" {if $BIG_THUMB}checked="checked"{/if}> {'Yes'|@translate}</label> |
---|
28 | <label><input type="radio" name="big_thumb" value="0" {if !$BIG_THUMB}checked="checked"{/if}> {'No'|@translate}</label> |
---|
29 | </td> |
---|
30 | </tr> |
---|
31 | |
---|
32 | <tr> |
---|
33 | <td align="right">{'Cache the big thumbnails (recommended)'|@translate} : </td> |
---|
34 | <td><label><input type="radio" name="cache_big_thumb" value="1" {if $CACHE_BIG_THUMB}checked="checked"{/if}> {'Yes'|@translate}</label> |
---|
35 | <label><input type="radio" name="cache_big_thumb" value="0" {if !$CACHE_BIG_THUMB}checked="checked"{/if}> {'No'|@translate}</label> |
---|
36 | </td> |
---|
37 | </tr> |
---|
38 | |
---|
39 | <tr> |
---|
40 | <td align="right">{'Scale thumbnails'|@translate} : </td> |
---|
41 | <td><label><input type="radio" name="method" value="crop" {if $METHOD == 'crop'}checked="checked"{/if}> {'Crop'|@translate}</label> |
---|
42 | <label><input type="radio" name="method" value="resize" {if $METHOD == 'resize'}checked="checked"{/if}> {'Resize'|@translate}</label> |
---|
43 | </td> |
---|
44 | </tr> |
---|
45 | |
---|
46 | <tr> |
---|
47 | <td align="right">{'Show thumbnails caption'|@translate} : </td> |
---|
48 | <td><label><input type="radio" name="show_thumbnail_caption" value="1" {if $SHOW_THUMBNAIL_CAPTION}checked="checked"{/if}> {'Yes'|@translate}</label> |
---|
49 | <label><input type="radio" name="show_thumbnail_caption" value="0" {if !$SHOW_THUMBNAIL_CAPTION}checked="checked"{/if}> {'No'|@translate}</label> |
---|
50 | </td> |
---|
51 | </tr> |
---|
52 | |
---|
53 | </table> |
---|
54 | </fieldset> |
---|
55 | |
---|
56 | <p> |
---|
57 | <input type="hidden" name="pwg_token" value="{$PWG_TOKEN}"> |
---|
58 | <input type="submit" name="submit" value="{'Submit'|@translate}"> |
---|
59 | <input type="submit" name="cachedelete" value="{'Purge thumbnails cache'|@translate}" title="{'Delete images in GThumb+ cache.'|@translate}" onclick="return confirm('{'Are you sure?'|@translate}');"> |
---|
60 | <input type="button" name="cachebuild" value="{'Pre-cache thumbnails'|@translate}" title="{'Finds images that have not been cached and creates the cached version.'|@translate}" onclick="start()"> |
---|
61 | </p> |
---|
62 | </form> |
---|
63 | |
---|
64 | <fieldset id="generate_cache"> |
---|
65 | <legend>{'Pre-cache thumbnails'|@translate}</legend> |
---|
66 | <p> |
---|
67 | <input id="startLink" value="{'Start'|@translate}" onclick="start()" type="button"> |
---|
68 | <input id="pauseLink" value="{'Pause'|@translate}" onclick="pause()" type="button" disabled="disbled"> |
---|
69 | <input id="stopLink" value="{'Stop'|@translate}" onclick="stop()" type="button" disabled="disbled"> |
---|
70 | </p> |
---|
71 | <p> |
---|
72 | <table> |
---|
73 | <tr> |
---|
74 | <td>Errors</td> |
---|
75 | <td id="errors">0</td> |
---|
76 | </tr> |
---|
77 | <tr> |
---|
78 | <td>Loaded</td> |
---|
79 | <td id="loaded">0</td> |
---|
80 | </tr> |
---|
81 | <tr> |
---|
82 | <td>Remaining</td> |
---|
83 | <td id="remaining">0</td> |
---|
84 | </tr> |
---|
85 | </table> |
---|
86 | </p> |
---|
87 | <div id="feedbackWrap" style="height:{$HEIGHT}px; min-height:{$HEIGHT}px;"> |
---|
88 | <img id="feedbackImg"> |
---|
89 | </div> |
---|
90 | |
---|
91 | <div id="errorList"> |
---|
92 | </div> |
---|
93 | </fieldset> |
---|
94 | |
---|
95 | {html_head}{literal} |
---|
96 | <style type="text/css"> |
---|
97 | #GThumb td { padding-bottom: 12px; } |
---|
98 | #cacheinfo p, #GThumbProgressbar { text-align:left; line-height:20px; margin:20px } |
---|
99 | .ui-progressbar-value { background-image: url(plugins/GThumb/template/pbar-ani.gif); } |
---|
100 | #generate_cache { display: none; } |
---|
101 | </style> |
---|
102 | {/literal}{/html_head} |
---|
103 | |
---|
104 | {combine_script id='iloader' load='footer' path='plugins/GThumb/js/image.loader.js'} |
---|
105 | |
---|
106 | {footer_script require='jquery.ui.effect-slide'}{literal} |
---|
107 | jQuery('input[name^="cache"]').tipTip({'delay' : 0, 'fadeIn' : 200, 'fadeOut' : 200}); |
---|
108 | |
---|
109 | var loader = new ImageLoader( {onChanged: loaderChanged, maxRequests:1 } ) |
---|
110 | , pending_next_page = null |
---|
111 | , last_image_show_time = 0 |
---|
112 | , allDoneDfd, urlDfd; |
---|
113 | |
---|
114 | function start() { |
---|
115 | allDoneDfd = jQuery.Deferred(); |
---|
116 | urlDfd = jQuery.Deferred(); |
---|
117 | |
---|
118 | allDoneDfd.always( function() { |
---|
119 | jQuery("#startLink").attr('disabled', false).css("opacity", 1); |
---|
120 | jQuery("#pauseLink,#stopLink").attr('disabled', true).css("opacity", 0.5); |
---|
121 | } ); |
---|
122 | |
---|
123 | urlDfd.always( function() { |
---|
124 | if (loader.remaining()==0) |
---|
125 | allDoneDfd.resolve(); |
---|
126 | } ); |
---|
127 | |
---|
128 | jQuery('#generate_cache').show(); |
---|
129 | jQuery("#startLink").attr('disabled', true).css("opacity", 0.5); |
---|
130 | jQuery("#pauseLink,#stopLink").attr('disabled', false).css("opacity", 1); |
---|
131 | |
---|
132 | loader.pause(false); |
---|
133 | updateStats(); |
---|
134 | getUrls(0); |
---|
135 | } |
---|
136 | |
---|
137 | function pause() { |
---|
138 | loader.pause( !loader.pause() ); |
---|
139 | } |
---|
140 | |
---|
141 | function stop() { |
---|
142 | loader.clear(); |
---|
143 | urlDfd.resolve(); |
---|
144 | } |
---|
145 | |
---|
146 | function getUrls(page_token) { |
---|
147 | data = {prev_page: page_token, max_urls: 500, types: []}; |
---|
148 | jQuery.post( '{/literal}{$ROOT_URL}{literal}admin.php?page=plugin-GThumb&getMissingDerivative=', |
---|
149 | data, wsData, "json").fail( wsError ); |
---|
150 | } |
---|
151 | |
---|
152 | function wsData(data) { |
---|
153 | loader.add( data.urls ); |
---|
154 | if (data.next_page) { |
---|
155 | if (loader.pause() || loader.remaining() > 100) { |
---|
156 | pending_next_page = data.next_page; |
---|
157 | } |
---|
158 | else { |
---|
159 | getUrls(data.next_page); |
---|
160 | } |
---|
161 | } |
---|
162 | } |
---|
163 | |
---|
164 | function wsError() { |
---|
165 | urlDfd.reject(); |
---|
166 | } |
---|
167 | |
---|
168 | function updateStats() { |
---|
169 | jQuery("#loaded").text( loader.loaded ); |
---|
170 | jQuery("#errors").text( loader.errors ); |
---|
171 | jQuery("#remaining").text( loader.remaining() ); |
---|
172 | } |
---|
173 | |
---|
174 | function loaderChanged(type, img) { |
---|
175 | updateStats(); |
---|
176 | if (img) { |
---|
177 | if (type==="load") { |
---|
178 | var now = jQuery.now(); |
---|
179 | if (now - last_image_show_time > 3000) { |
---|
180 | last_image_show_time = now; |
---|
181 | var h=img.height, url=img.src; |
---|
182 | jQuery("#feedbackWrap").hide("slide", {direction:'down'}, function() { |
---|
183 | last_image_show_time = jQuery.now(); |
---|
184 | if (h > 300 ) |
---|
185 | jQuery("#feedbackImg").attr("height", 300); |
---|
186 | else |
---|
187 | jQuery("#feedbackImg").removeAttr("height"); |
---|
188 | jQuery("#feedbackImg").attr("src", url); |
---|
189 | jQuery("#feedbackWrap").show("slide", {direction:'up'} ); |
---|
190 | } ); |
---|
191 | } |
---|
192 | } |
---|
193 | else { |
---|
194 | jQuery("#errorList").prepend( '<a href="'+img.src+'">'+img.src+'</a>' + "<br>"); |
---|
195 | } |
---|
196 | } |
---|
197 | if (pending_next_page && 100 > loader.remaining() ) { |
---|
198 | getUrls(pending_next_page); |
---|
199 | pending_next_page = null; |
---|
200 | } |
---|
201 | else if (loader.remaining() == 0 && (urlDfd.isResolved() || urlDfd.isRejected())) { |
---|
202 | allDoneDfd.resolve(); |
---|
203 | } |
---|
204 | } |
---|
205 | {/literal}{/footer_script} |
---|