mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
3fc2fc14ec
(merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41885 467b73ca-7a2a-4603-9d3b-597d59a354a9
70 lines
1.6 KiB
JavaScript
Executable File
70 lines
1.6 KiB
JavaScript
Executable File
SideReports = Class.extend('SidePanel');
|
|
SideReports.prototype = {
|
|
initialize: function() {
|
|
this.selector = $('ReportSelector');
|
|
if(this.selector) this.selector.holder = this;
|
|
this.SidePanel.initialize();
|
|
},
|
|
|
|
destroy: function() {
|
|
if(this.SidePanel) this.SidePanel.destroy();
|
|
this.SidePanel = null;
|
|
if(this.selector) this.selector.holder = null;
|
|
this.selector = null;
|
|
},
|
|
|
|
onshow: function() {
|
|
if(this.selector.value) this.showreport();
|
|
},
|
|
|
|
/**
|
|
* Retrieve a report via ajax
|
|
*/
|
|
showreport: function() {
|
|
if(this.selector.value) {
|
|
this.body.innerHTML = '<p>loading...</p>';
|
|
this.ajaxGetPanel(this.afterPanelLoaded);
|
|
} else {
|
|
this.body.innerHTML = "<p>choose a report in the dropdown.</p>";
|
|
}
|
|
},
|
|
afterPanelLoaded : function() {
|
|
SideReportRecord.applyTo('#' + this.id + ' a');
|
|
},
|
|
ajaxURL: function() {
|
|
return 'admin/sidereport/' + this.selector.value;
|
|
}
|
|
|
|
}
|
|
|
|
SideReportGo = Class.create();
|
|
SideReportGo.prototype = {
|
|
destroy: function() {
|
|
this.onclick = null;
|
|
this.holder = null;
|
|
},
|
|
onclick: function() {
|
|
$('reports_holder').showreport();
|
|
}
|
|
}
|
|
|
|
|
|
SideReportRecord = Class.create();
|
|
SideReportRecord.prototype = {
|
|
destroy: function() {
|
|
this.onclick = null;
|
|
},
|
|
|
|
onclick : function(event) {
|
|
Event.stop(event);
|
|
$('sitetree').loadingNode = $('sitetree').getTreeNodeByIdx( this.getID() );
|
|
$('Form_EditForm').getPageFromServer(this.getID());
|
|
},
|
|
getID : function() {
|
|
if(this.href.match(/\/([^\/]+)$/)) return parseInt(RegExp.$1);
|
|
}
|
|
}
|
|
|
|
SideReportGo.applyTo('#report_select_go');
|
|
SideReportRecord.applyTo('#reports_holder a');
|
|
SideReports.applyTo('#reports_holder'); |