Ignore:
Timestamp:
Mar 15, 2011, 8:25:09 PM (13 years ago)
Author:
patdenice
Message:

Clean code.
Rename files.

Location:
extensions/autoupdate/trunk/template
Files:
1 added
2 moved

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/trunk/template/update_ext.tpl

    r9710 r9712  
    11{combine_script id='jquery.jgrowl' load='footer' require='jquery' path='themes/default/js/plugins/jquery.jgrowl_minimized.js' }
     2{combine_script id='jquery.autoupdate' load='footer' require='jquery' path='plugins/autoupdate/template/autoupdate.js' }
    23{combine_css path="admin/themes/default/uploadify.jGrowl.css"}
    34
    4 {footer_script require='jquery.jgrowl'}
     5{footer_script require='jquery.autoupdate,jquery.effects.blind,jquery.jgrowl'}
    56var extList = new Array();
    67var confirmMsg  = '{'Are you sure?'|@translate|@escape:'javascript'}';
     
    1011var restoreMsg  = '{'autoupdate_reset_ignore'|@translate|@escape:'javascript'}';
    1112
     13checkFieldsets();
     14
    1215{literal}
    1316jQuery(document).ready(function() {
    14 
    1517        jQuery("td[id^='desc_'], p[id^='revdesc_']").click(function() {
    1618                id = this.id.split('_');
     
    1921                return false;
    2022        });
    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 
    5123});
    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}
     24{/literal}
     25{/footer_script}
    14426
    14527<div class="titrePage">
     
    14830
    14931<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}>
     32<input type="button" id="update_all" value="{'autoupdate_update_all'|@translate}" onClick="updateAll();">
     33<input type="button" id="reset_ignore" value="{'autoupdate_reset_ignore'|@translate}" onClick="resetIgnored();" {if !$SHOW_RESET}style="display:none;"{/if}>
    15234</div>
    15335
Note: See TracChangeset for help on using the changeset viewer.