Index: extensions/autoupdate/trunk/template/update_ext.tpl =================================================================== --- extensions/autoupdate/trunk/template/extensions.tpl (revision 9710) +++ extensions/autoupdate/trunk/template/update_ext.tpl (revision 9712) @@ -1,6 +1,7 @@ {combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' } +{combine_script id='jquery.autoupdate' load='footer' require='jquery' path='plugins/autoupdate/template/autoupdate.js' } {combine_css path="admin/themes/default/uploadify.jGrowl.css"} -{footer_script require='jquery.jgrowl'} +{footer_script require='jquery.autoupdate,jquery.effects.blind,jquery.jgrowl'} var extList = new Array(); var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; @@ -10,7 +11,8 @@ var restoreMsg = '{'autoupdate_reset_ignore'|@translate|@escape:'javascript'}'; +checkFieldsets(); + {literal} jQuery(document).ready(function() { - jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() { id = this.id.split('_'); @@ -19,127 +21,7 @@ return false; }); - - jQuery("#update_all").click(function() { - if (confirm(confirmMsg)) { - extList = []; - jQuery('.updateExtension').each( function() { - if (jQuery(this).parents('div').css('display') == 'block') { - extList.push(jQuery(this).attr('onClick')); - } - }); - if (extList.length > 0) eval(extList[0]); - } - return false; - }); - - jQuery("#reset_ignore").click(function() { - jQuery.post( - "plugins/autoupdate/ajax/ignore_list.php", - { reset: true }, - function(data) { - if (data == "ok") { - jQuery(".pluginBox, fieldset").show(); - jQuery("#up_to_date").hide(); - jQuery("#reset_ignore").hide(); - jQuery("#ignored").hide(); - } - } - ); - return false; - }); - }); - -function checkFieldsets() { - var types = new Array('plugin', 'theme', 'language'); - var total = 0; - var ignored = 0; - for (i=0;i<3;i++) { - nbExtensions = 0; - jQuery("div[id^='"+types[i]+"_']").each(function(index) { - if (jQuery(this).css('display') == 'block') - nbExtensions++; - else - ignored++; - }); - total = total + nbExtensions; - if (nbExtensions == 0) - jQuery("#"+types[i]+"s").hide(); - } - - if (total == 0) { - jQuery("#update_all").hide(); - jQuery("#up_to_date").show(); - } - if (ignored > 0) { - jQuery("#reset_ignore").val(restoreMsg + ' (' + ignored + ')'); - } -} - -function upgradeExtension(type, id, revision) { - jQuery.ajax({ - type: 'POST', - url: 'plugins/autoupdate/ajax/update_'+type+'.php', - data: { id: id, revision: revision }, - success: function(data) { - if (data['result']) { - jQuery("#"+type+"_"+id).remove(); - checkFieldsets(); - jQuery.jGrowl( - data['msg'], - { - theme: 'success', - header: successHead, - life: 4000, - sticky: false - } - ); - if (extList.length > 0) extList.shift(); - if (extList.length > 0) eval(extList[0]); - } else { - jQuery.jGrowl( - data['msg'], - { - theme: 'error', - header: errorHead, - sticky: true - } - ); - extList = []; - } - }, - error: function(data) { - jQuery.jGrowl( - errorMsg, - { - theme: 'error', - header: errorHead, - sticky: true - } - ); - extList = []; - }, - dataType: 'json' - }); - return false; -} - -function ignoreExtension(type, id) { - jQuery.post( - "plugins/autoupdate/ajax/ignore_list.php", - { type: type+'s', id: id }, - function(data) { - if (data == "ok") { - jQuery("#"+type+"_"+id).hide(); - jQuery("#reset_ignore").show(); - checkFieldsets(); - } - } - ); - return false; -} - -checkFieldsets(); -{/literal}{/footer_script} +{/literal} +{/footer_script}