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