adminversiondashlet.js
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function AdminVersionDashlet() {
}
AdminVersionDashlet.prototype = {
'initialize' : function() {
this.dashlet = $('admin_version_dashlet');
this.span_newVersion = $('new_version');
this.currentVersions = _KT_VERSIONS;
this.check();
},
'check' : function() {
var res = loadJSONDoc(_KT_VERSIONS_URL);
res.addCallback(bind(this.callbackCheck, this));
},
'callbackCheck' : function(res) {
var updates = 0;
for(var k in this.currentVersions) {
if(res[k]!=this.currentVersions[k]) {
updates ++;
appendChildNodes('up_upgrades', SPAN({'class':'up_new_version'}, k + ': ' + res[k]), BR(null));
}
}
if(updates == 0) {
// next line is cause I thought this dashlet was causing orphaned
// dashlet buttons. it doesn't seem to be, but this may be needed.
// more investigation necessary.
// this.dashlet.style.display = 'none';
} else if(updates == 1) {
$('up_single').style.display = 'block';
this.dashlet.style.display = 'block';
} else {
$('up_multi').style.display = 'block';
this.dashlet.style.display = 'block';
}
}
}
addLoadEvent(function() {
var d = new AdminVersionDashlet();
d.initialize();
});