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 | }; |
---|
12 | |
---|
13 | function resetIgnored() { |
---|
14 | jQuery.ajax({ |
---|
15 | type: 'GET', |
---|
16 | url: 'ws.php', |
---|
17 | dataType: 'json', |
---|
18 | data: { method: 'pwg.extensions.ignoreUpdates', reset: true, pwg_token: pwg_token, format: 'json' }, |
---|
19 | success: function(data) { |
---|
20 | if (data['stat'] == 'ok') { |
---|
21 | jQuery(".pluginBox, fieldset").show(); |
---|
22 | jQuery("#update_all").show(); |
---|
23 | jQuery("#up_to_date").hide(); |
---|
24 | jQuery("#reset_ignore").hide(); |
---|
25 | jQuery("#ignored").hide(); |
---|
26 | checkFieldsets(); |
---|
27 | } |
---|
28 | } |
---|
29 | }); |
---|
30 | }; |
---|
31 | |
---|
32 | function checkFieldsets() { |
---|
33 | var types = new Array('plugin', 'theme', 'language'); |
---|
34 | var total = 0; |
---|
35 | var ignored = 0; |
---|
36 | for (i=0;i<3;i++) { |
---|
37 | nbExtensions = 0; |
---|
38 | jQuery("div[id^='"+types[i]+"_']").each(function(index) { |
---|
39 | if (jQuery(this).css('display') == 'block') |
---|
40 | nbExtensions++; |
---|
41 | else |
---|
42 | ignored++; |
---|
43 | }); |
---|
44 | total = total + nbExtensions; |
---|
45 | if (nbExtensions == 0) |
---|
46 | jQuery("#"+types[i]+"s").hide(); |
---|
47 | } |
---|
48 | |
---|
49 | if (total == 0) { |
---|
50 | jQuery("#update_all").hide(); |
---|
51 | jQuery("#up_to_date").show(); |
---|
52 | } |
---|
53 | if (ignored > 0) { |
---|
54 | jQuery("#reset_ignore").val(restoreMsg + ' (' + ignored + ')'); |
---|
55 | } |
---|
56 | }; |
---|
57 | |
---|
58 | function upgradeExtension(type, id, revision) { |
---|
59 | jQuery('.autoupdate_bar').toggle(); |
---|
60 | jQuery.ajax({ |
---|
61 | type: 'GET', |
---|
62 | url: 'ws.php', |
---|
63 | data: { method: 'pwg.'+type+'s.update', id: id, revision: revision, pwg_token: pwg_token, format: 'json' }, |
---|
64 | success: function(data) { |
---|
65 | if (data['stat'] == 'ok') { |
---|
66 | jQuery("#"+type+"_"+id).remove(); |
---|
67 | checkFieldsets(); |
---|
68 | jQuery.jGrowl( |
---|
69 | data['result'], |
---|
70 | { |
---|
71 | theme: 'success', |
---|
72 | header: successHead, |
---|
73 | life: 4000, |
---|
74 | sticky: false |
---|
75 | } |
---|
76 | ); |
---|
77 | if (extList.length > 0) extList.shift(); |
---|
78 | if (extList.length > 0) eval(extList[0]); |
---|
79 | } else { |
---|
80 | jQuery.jGrowl( |
---|
81 | data['result'], |
---|
82 | { |
---|
83 | theme: 'error', |
---|
84 | header: errorHead, |
---|
85 | sticky: true |
---|
86 | } |
---|
87 | ); |
---|
88 | extList = []; |
---|
89 | } |
---|
90 | jQuery('.autoupdate_bar').toggle(); |
---|
91 | }, |
---|
92 | error: function(data) { |
---|
93 | jQuery.jGrowl( |
---|
94 | errorMsg, |
---|
95 | { |
---|
96 | theme: 'error', |
---|
97 | header: errorHead, |
---|
98 | sticky: true |
---|
99 | } |
---|
100 | ); |
---|
101 | extList = []; |
---|
102 | jQuery('.autoupdate_bar').toggle(); |
---|
103 | }, |
---|
104 | dataType: 'json' |
---|
105 | }); |
---|
106 | }; |
---|
107 | |
---|
108 | function ignoreExtension(type, id) { |
---|
109 | jQuery.ajax({ |
---|
110 | type: 'GET', |
---|
111 | url: 'ws.php', |
---|
112 | dataType: 'json', |
---|
113 | data: { method: 'pwg.extensions.ignoreUpdates', type: type+'s', id: id, pwg_token: pwg_token, format: 'json' }, |
---|
114 | success: function(data) { |
---|
115 | if (data['stat'] == 'ok') { |
---|
116 | jQuery("#"+type+"_"+id).hide(); |
---|
117 | jQuery("#reset_ignore").show(); |
---|
118 | checkFieldsets(); |
---|
119 | } |
---|
120 | } |
---|
121 | }); |
---|
122 | }; |
---|