You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
868 B
48 lines
868 B
14 years ago
|
Page.Log = new Class({
|
||
|
|
||
|
Extends: PageBase,
|
||
|
|
||
|
name: 'log',
|
||
14 years ago
|
title: 'Show recent logs.',
|
||
14 years ago
|
|
||
14 years ago
|
indexAction: function(){
|
||
|
var self = this;
|
||
14 years ago
|
|
||
|
self.getLogs(0);
|
||
|
|
||
|
},
|
||
|
|
||
|
getLogs: function(nr){
|
||
|
var self = this;
|
||
|
|
||
14 years ago
|
if(self.log) self.log.destroy();
|
||
14 years ago
|
self.log = new Element('div.container.loading', {
|
||
14 years ago
|
'text': 'loading...'
|
||
14 years ago
|
}).inject(self.el);
|
||
|
|
||
14 years ago
|
Api.request('logging.get', {
|
||
|
'data': {
|
||
14 years ago
|
'nr': nr
|
||
14 years ago
|
},
|
||
|
'onComplete': function(json){
|
||
14 years ago
|
self.log.set('html', '<pre>'+json.log+'</pre>');
|
||
|
self.log.removeClass('loading');
|
||
14 years ago
|
|
||
|
var nav = new Element('ul.nav').inject(self.log, 'top');
|
||
|
for (var i = 0; i < json.total; i++) {
|
||
|
new Element('li', {
|
||
|
'text': i+1,
|
||
14 years ago
|
'class': nr == i ? 'active': '',
|
||
14 years ago
|
'events': {
|
||
14 years ago
|
'click': function(e){
|
||
|
self.getLogs(e.target.get('text')-1);
|
||
|
}
|
||
14 years ago
|
}
|
||
14 years ago
|
}).inject(nav);
|
||
14 years ago
|
};
|
||
14 years ago
|
}
|
||
14 years ago
|
});
|
||
|
|
||
14 years ago
|
}
|
||
14 years ago
|
|
||
|
})
|