1 | function 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 | return false; |
---|
12 | }; |
---|
13 | |
---|
14 | function resetIgnored() { |
---|
15 | jQuery.post( |
---|
16 | "plugins/autoupdate/ajax/ignore_list.php", |
---|
17 | { reset: true }, |
---|
18 | function(data) { |
---|
19 | if (data == "ok") { |
---|
20 | jQuery(".pluginBox, fieldset").show(); |
---|
21 | jQuery("#update_all").show(); |
---|
22 | jQuery("#up_to_date").hide(); |
---|
23 | jQuery("#reset_ignore").hide(); |
---|
24 | jQuery("#ignored").hide(); |
---|
25 | } |
---|
26 | } |
---|
27 | ); |
---|
28 | return false; |
---|
29 | }; |
---|
30 | |
---|
31 | function checkFieldsets() { |
---|
32 | var types = new Array('plugin', 'theme', 'language'); |
---|
33 | var total = 0; |
---|
34 | var ignored = 0; |
---|
35 | for (i=0;i<3;i++) { |
---|
36 | nbExtensions = 0; |
---|
37 | jQuery("div[id^='"+types[i]+"_']").each(function(index) { |
---|
38 | if (jQuery(this).css('display') == 'block') |
---|
39 | nbExtensions++; |
---|
40 | else |
---|
41 | ignored++; |
---|
42 | }); |
---|
43 | total = total + nbExtensions; |
---|
44 | if (nbExtensions == 0) |
---|
45 | jQuery("#"+types[i]+"s").hide(); |
---|
46 | } |
---|
47 | |
---|
48 | if (total == 0) { |
---|
49 | jQuery("#update_all").hide(); |
---|
50 | jQuery("#up_to_date").show(); |
---|
51 | } |
---|
52 | if (ignored > 0) { |
---|
53 | jQuery("#reset_ignore").val(restoreMsg + ' (' + ignored + ')'); |
---|
54 | } |
---|
55 | }; |
---|
56 | |
---|
57 | function upgradeExtension(type, id, revision) { |
---|
58 | jQuery.ajax({ |
---|
59 | type: 'POST', |
---|
60 | url: 'plugins/autoupdate/ajax/update_'+type+'.php', |
---|
61 | data: { id: id, revision: revision }, |
---|
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 | }, |
---|
89 | error: function(data) { |
---|
90 | jQuery.jGrowl( |
---|
91 | errorMsg, |
---|
92 | { |
---|
93 | theme: 'error', |
---|
94 | header: errorHead, |
---|
95 | sticky: true |
---|
96 | } |
---|
97 | ); |
---|
98 | extList = []; |
---|
99 | }, |
---|
100 | dataType: 'json' |
---|
101 | }); |
---|
102 | return false; |
---|
103 | }; |
---|
104 | |
---|
105 | function ignoreExtension(type, id) { |
---|
106 | jQuery.post( |
---|
107 | "plugins/autoupdate/ajax/ignore_list.php", |
---|
108 | { type: type+'s', id: id }, |
---|
109 | function(data) { |
---|
110 | if (data == "ok") { |
---|
111 | jQuery("#"+type+"_"+id).hide(); |
---|
112 | jQuery("#reset_ignore").show(); |
---|
113 | checkFieldsets(); |
---|
114 | } |
---|
115 | } |
---|
116 | ); |
---|
117 | return false; |
---|
118 | }; |
---|