source: trunk/admin/themes/default/template/updates_ext.tpl @ 13079

Last change on this file since 13079 was 12427, checked in by rvelices, 12 years ago

bug 2469 compiled_template_cache_language option does not work properly on some language keys because of double escaping

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