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