1 | {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } |
---|
2 | {combine_css path="admin/themes/default/uploadify.jGrowl.css"} |
---|
3 | |
---|
4 | {footer_script require='jquery.jgrowl'} |
---|
5 | var extList = new Array(); |
---|
6 | var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; |
---|
7 | var errorHead = '{'ERROR'|@translate|@escape:'javascript'}'; |
---|
8 | var successHead = '{'Upgrade Complete'|@translate|@escape:'javascript'}'; |
---|
9 | var errorMsg = '{'an error happened'|@translate|@escape:'javascript'}'; |
---|
10 | |
---|
11 | {literal} |
---|
12 | jQuery(document).ready(function() { |
---|
13 | |
---|
14 | jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() { |
---|
15 | id = this.id.split('_'); |
---|
16 | jQuery("#revdesc_"+id[1]).toggle('blind'); |
---|
17 | jQuery(".button_"+id[1]).toggle(); |
---|
18 | return false; |
---|
19 | }); |
---|
20 | |
---|
21 | jQuery("#update_all").click(function() { |
---|
22 | if (confirm(confirmMsg)) { |
---|
23 | extList = []; |
---|
24 | jQuery('.updateExtension').each( function() { |
---|
25 | if (jQuery(this).parents('div').css('display') == 'block') { |
---|
26 | extList.push(jQuery(this).attr('onClick')); |
---|
27 | } |
---|
28 | }); |
---|
29 | if (extList.length > 0) eval(extList[0]); |
---|
30 | } |
---|
31 | return false; |
---|
32 | }); |
---|
33 | |
---|
34 | jQuery("#reset_ignore").click(function() { |
---|
35 | jQuery.post( |
---|
36 | "plugins/autoupdate/ajax/ignore_list.php", |
---|
37 | { reset: true }, |
---|
38 | function(data) { if (data == "ok") { jQuery(".pluginBox, fieldset").show(); jQuery("#reset_ignore").hide(); } } |
---|
39 | ); |
---|
40 | return false; |
---|
41 | }); |
---|
42 | |
---|
43 | }); |
---|
44 | |
---|
45 | function checkFieldsets() { |
---|
46 | var types = new Array('plugin', 'theme', 'language'); |
---|
47 | var total = 0; |
---|
48 | for (i=0;i<3;i++) { |
---|
49 | nbExtensions = 0; |
---|
50 | jQuery("div[id^='"+types[i]+"_']").each(function(index) { |
---|
51 | if (jQuery(this).css('display') == 'block') |
---|
52 | nbExtensions++; |
---|
53 | }); |
---|
54 | total = total + nbExtensions; |
---|
55 | if (nbExtensions == 0) |
---|
56 | jQuery("#"+types[i]+"s").hide(); |
---|
57 | } |
---|
58 | |
---|
59 | if (total == 0) { |
---|
60 | jQuery("#update_all").hide(); |
---|
61 | jQuery("#up_to_date").show(); |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | function upgradeExtension(type, id, revision) { |
---|
66 | jQuery.ajax({ |
---|
67 | type: 'POST', |
---|
68 | url: 'plugins/autoupdate/ajax/update_'+type+'.php', |
---|
69 | data: { id: id, revision: revision }, |
---|
70 | success: function(data) { |
---|
71 | if (data['result']) { |
---|
72 | jQuery("#"+type+"_"+id).remove(); |
---|
73 | checkFieldsets(); |
---|
74 | jQuery.jGrowl( |
---|
75 | data['msg'], |
---|
76 | { |
---|
77 | theme: 'success', |
---|
78 | header: successHead, |
---|
79 | life: 4000, |
---|
80 | sticky: false |
---|
81 | } |
---|
82 | ); |
---|
83 | if (extList.length > 0) extList.shift(); |
---|
84 | if (extList.length > 0) eval(extList[0]); |
---|
85 | } else { |
---|
86 | jQuery.jGrowl( |
---|
87 | data['msg'], |
---|
88 | { |
---|
89 | theme: 'error', |
---|
90 | header: errorHead, |
---|
91 | sticky: true |
---|
92 | } |
---|
93 | ); |
---|
94 | extList = []; |
---|
95 | } |
---|
96 | }, |
---|
97 | error: function(data) { |
---|
98 | jQuery.jGrowl( |
---|
99 | errorMsg, |
---|
100 | { |
---|
101 | theme: 'error', |
---|
102 | header: errorHead, |
---|
103 | sticky: true |
---|
104 | } |
---|
105 | ); |
---|
106 | extList = []; |
---|
107 | }, |
---|
108 | dataType: 'json' |
---|
109 | }); |
---|
110 | return false; |
---|
111 | } |
---|
112 | |
---|
113 | function ignoreExtension(type, id) { |
---|
114 | jQuery.post( |
---|
115 | "plugins/autoupdate/ajax/ignore_list.php", |
---|
116 | { type: type+'s', id: id }, |
---|
117 | function(data) { |
---|
118 | if (data == "ok") { |
---|
119 | jQuery("#"+type+"_"+id).hide(); |
---|
120 | jQuery("#reset_ignore").show(); |
---|
121 | checkFieldsets(); |
---|
122 | } |
---|
123 | } |
---|
124 | ); |
---|
125 | return false; |
---|
126 | } |
---|
127 | |
---|
128 | checkFieldsets(); |
---|
129 | {/literal}{/footer_script} |
---|
130 | |
---|
131 | <div class="titrePage"> |
---|
132 | <h2>Piwigo AutoUpgrade</h2> |
---|
133 | </div> |
---|
134 | <div> |
---|
135 | <input type="button" id="update_all" value="{'autoupdate_update_all'|@translate}"> |
---|
136 | <input type="button" id="reset_ignore" value="{'autoupdate_reset_ignore'|@translate}" {if !$SHOW_RESET}style="display:none;"{/if}> |
---|
137 | </div> |
---|
138 | |
---|
139 | {if not empty($update_plugins)} |
---|
140 | <div> |
---|
141 | <fieldset id="plugins"> |
---|
142 | <legend>{'Plugins which need upgrade'|@translate}</legend> |
---|
143 | {foreach from=$update_plugins item=plugin name=plugins_loop} |
---|
144 | <div class="pluginBox" id="plugin_{$plugin.PLUGIN_ID}" {if $plugin.IGNORED}style="display:none;"{/if}> |
---|
145 | <table> |
---|
146 | <tr> |
---|
147 | <td class="pluginBoxNameCell"> |
---|
148 | {$plugin.EXT_NAME} |
---|
149 | </td> |
---|
150 | <td> |
---|
151 | <a href="#" onClick="upgradeExtension('plugin', '{$plugin.PLUGIN_ID}', {$plugin.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> |
---|
152 | | <a href="{$plugin.URL_DOWNLOAD}">{'Download'|@translate}</a> |
---|
153 | | <a href="#" onClick="ignoreExtension('plugin', '{$plugin.PLUGIN_ID}');">{'autoupdate_ignore'|@translate}</a> |
---|
154 | </td> |
---|
155 | </tr> |
---|
156 | <tr> |
---|
157 | <td> |
---|
158 | {'Version'|@translate} {$plugin.CURRENT_VERSION} |
---|
159 | </td> |
---|
160 | <td class="pluginDesc" id="desc_{$plugin.ID}"> |
---|
161 | <em>{'Downloads'|@translate}: {$plugin.DOWNLOADS}</em> |
---|
162 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$plugin.ID}"> |
---|
163 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$plugin.ID}" style="display:none;"> |
---|
164 | {'New Version'|@translate} : {$plugin.NEW_VERSION} |
---|
165 | | {'By %s'|@translate|@sprintf:$plugin.AUTHOR} |
---|
166 | </td> |
---|
167 | </tr> |
---|
168 | <tr> |
---|
169 | <td></td> |
---|
170 | <td class="pluginDesc"> |
---|
171 | <p id="revdesc_{$plugin.ID}" style="display:none;">{$plugin.REV_DESC|htmlspecialchars|nl2br}</p> |
---|
172 | </td> |
---|
173 | </tr> |
---|
174 | </table> |
---|
175 | </div> |
---|
176 | {/foreach} |
---|
177 | </fieldset> |
---|
178 | </div> |
---|
179 | {/if} |
---|
180 | |
---|
181 | {if not empty($update_themes)} |
---|
182 | <div> |
---|
183 | <fieldset id="themes"> |
---|
184 | <legend>{'Themes which need upgrade'|@translate}</legend> |
---|
185 | {foreach from=$update_themes item=theme name=themes_loop} |
---|
186 | <div class="pluginBox" id="theme_{$theme.THEME_ID}" {if $theme.IGNORED}style="display:none;"{/if}> |
---|
187 | <table> |
---|
188 | <tr> |
---|
189 | <td class="pluginBoxNameCell"> |
---|
190 | {$theme.EXT_NAME} |
---|
191 | </td> |
---|
192 | <td> |
---|
193 | <a href="#" onClick="upgradeExtension('theme', '{$theme.THEME_ID}', {$theme.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> |
---|
194 | | <a href="{$theme.URL_DOWNLOAD}">{'Download'|@translate}</a> |
---|
195 | | <a href="#" onClick="ignoreExtension('theme', '{$theme.THEME_ID}');">{'autoupdate_ignore'|@translate}</a> |
---|
196 | </td> |
---|
197 | </tr> |
---|
198 | <tr> |
---|
199 | <td> |
---|
200 | {'Version'|@translate} {$theme.CURRENT_VERSION} |
---|
201 | </td> |
---|
202 | <td class="pluginDesc" id="desc_{$theme.ID}"> |
---|
203 | <em>{'Downloads'|@translate}: {$theme.DOWNLOADS}</em> |
---|
204 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$theme.ID}"> |
---|
205 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$theme.ID}" style="display:none;"> |
---|
206 | {'New Version'|@translate} : {$theme.NEW_VERSION} |
---|
207 | | {'By %s'|@translate|@sprintf:$theme.AUTHOR} |
---|
208 | </td> |
---|
209 | </tr> |
---|
210 | <tr> |
---|
211 | <td></td> |
---|
212 | <td class="pluginDesc"> |
---|
213 | <p id="revdesc_{$theme.ID}" style="display:none;">{$theme.REV_DESC|htmlspecialchars|nl2br}</p> |
---|
214 | </td> |
---|
215 | </tr> |
---|
216 | </table> |
---|
217 | </div> |
---|
218 | {/foreach} |
---|
219 | </fieldset> |
---|
220 | </div> |
---|
221 | {/if} |
---|
222 | |
---|
223 | {if not empty($update_languages)} |
---|
224 | <div> |
---|
225 | <fieldset id="languages"> |
---|
226 | <legend>{'Languages which need upgrade'|@translate}</legend> |
---|
227 | {foreach from=$update_languages item=language name=languages_loop} |
---|
228 | <div class="pluginBox" id="language_{$language.LANGUAGE_ID}" {if $language.IGNORED}style="display:none;"{/if}> |
---|
229 | <table> |
---|
230 | <tr> |
---|
231 | <td class="pluginBoxNameCell"> |
---|
232 | {$language.EXT_NAME} |
---|
233 | </td> |
---|
234 | <td> |
---|
235 | <a href="#" onClick="upgradeExtension('language', '{$language.LANGUAGE_ID}', {$language.REVISION_ID});" class="updateExtension">{'Install'|@translate}</a> |
---|
236 | | <a href="{$language.URL_DOWNLOAD}">{'Download'|@translate}</a> |
---|
237 | | <a href="#" onClick="ignoreExtension('language', '{$language.LANGUAGE_ID}');">{'autoupdate_ignore'|@translate}</a> |
---|
238 | </td> |
---|
239 | </tr> |
---|
240 | <tr> |
---|
241 | <td> |
---|
242 | {'Version'|@translate} {$language.CURRENT_VERSION} |
---|
243 | </td> |
---|
244 | <td class="pluginDesc" id="desc_{$language.ID}"> |
---|
245 | <em>{'Downloads'|@translate}: {$language.DOWNLOADS}</em> |
---|
246 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/plus.gif" alt="" class="button_{$language.ID}"> |
---|
247 | <img src="{$ROOT_URL}{$themeconf.admin_icon_dir}/minus.gif" alt="" class="button_{$language.ID}" style="display:none;"> |
---|
248 | {'New Version'|@translate} : {$language.NEW_VERSION} |
---|
249 | | {'By %s'|@translate|@sprintf:$language.AUTHOR} |
---|
250 | </td> |
---|
251 | </tr> |
---|
252 | <tr> |
---|
253 | <td></td> |
---|
254 | <td class="pluginDesc"> |
---|
255 | <p id="revdesc_{$language.ID}" style="display:none;">{$language.REV_DESC|htmlspecialchars|nl2br}</p> |
---|
256 | </td> |
---|
257 | </tr> |
---|
258 | </table> |
---|
259 | </div> |
---|
260 | {/foreach} |
---|
261 | </fieldset> |
---|
262 | </div> |
---|
263 | {/if} |
---|
264 | |
---|
265 | <p>{'All extensions are up to date'|@translate}</p> |
---|