source: extensions/autoupdate/trunk/template/autoupdate.js @ 9735

Last change on this file since 9735 was 9735, checked in by patdenice, 13 years ago

Remove useless function.
Update englich language key.

File size: 2.8 KB
Line 
1function updateAll() {
2  if (confirm(confirmMsg)) {
3    extList = [];
4    jQuery('.updateExtension').each( function() {
5      if (jQuery(this).parents('div').css('display') == 'block') {
6        extList.push(jQuery(this).attr('onClick'));
7      }
8    });
9    if (extList.length > 0) eval(extList[0]);
10  }
11};
12
13function resetIgnored() {
14  jQuery.post(
15    "plugins/autoupdate/ajax/ignore_list.php",
16    { reset: true, pwg_token: pwg_token },
17    function(data) {
18      if (data == "ok") {
19        jQuery(".pluginBox, fieldset").show();
20        jQuery("#update_all").show();
21        jQuery("#up_to_date").hide();
22        jQuery("#reset_ignore").hide();
23        jQuery("#ignored").hide();
24        checkFieldsets();
25      }
26    }
27  );
28};
29
30function checkFieldsets() {
31  var types = new Array('plugin', 'theme', 'language');
32  var total = 0;
33  var ignored = 0;
34  for (i=0;i<3;i++) {
35    nbExtensions = 0;
36    jQuery("div[id^='"+types[i]+"_']").each(function(index) {
37      if (jQuery(this).css('display') == 'block')
38        nbExtensions++;
39      else
40        ignored++;
41    });
42    total = total + nbExtensions;
43    if (nbExtensions == 0)
44      jQuery("#"+types[i]+"s").hide();
45  }
46
47  if (total == 0) {
48    jQuery("#update_all").hide();
49    jQuery("#up_to_date").show();
50  }
51  if (ignored > 0) {
52    jQuery("#reset_ignore").val(restoreMsg + ' (' + ignored + ')');
53  }
54};
55
56function upgradeExtension(type, id, revision) {
57  jQuery('.autoupdate_bar').toggle();
58  jQuery.ajax({
59    type: 'POST',
60    url: 'plugins/autoupdate/ajax/update_'+type+'.php',
61    data: { id: id, revision: revision, pwg_token: pwg_token },
62    success: function(data) {
63      if (data['result']) {
64        jQuery("#"+type+"_"+id).remove();
65        checkFieldsets();
66        jQuery.jGrowl(
67          data['msg'],
68          {
69            theme:  'success',
70            header: successHead,
71            life:   4000,
72            sticky: false
73          }
74        );
75        if (extList.length > 0) extList.shift();
76        if (extList.length > 0) eval(extList[0]);
77      } else {
78        jQuery.jGrowl(
79          data['msg'],
80          {
81            theme:  'error',
82            header: errorHead,
83            sticky: true
84          }
85        );
86        extList = [];
87      }
88      jQuery('.autoupdate_bar').toggle();
89    },
90    error: function(data) {
91      jQuery.jGrowl(
92        errorMsg,
93        {
94          theme:  'error',
95          header: errorHead,
96          sticky: true
97        }
98      );
99      extList = [];
100      jQuery('.autoupdate_bar').toggle();
101    },
102    dataType: 'json'
103  });
104};
105
106function ignoreExtension(type, id) {
107  jQuery.post(
108    "plugins/autoupdate/ajax/ignore_list.php",
109    { type: type+'s', id: id, pwg_token: pwg_token },
110    function(data) {
111      if (data == "ok") {
112        jQuery("#"+type+"_"+id).hide();
113        jQuery("#reset_ignore").show();
114        checkFieldsets();
115      }
116    }
117  );
118};
Note: See TracBrowser for help on using the repository browser.