diff --git a/js/core/security/credentialmanager.js b/js/core/security/credentialmanager.js
index 442c63b8e..505553e14 100644
--- a/js/core/security/credentialmanager.js
+++ b/js/core/security/credentialmanager.js
@@ -160,3 +160,4 @@ CredentialManager.prototype.setActiveProposal = function(username, proposal){
}
};
+
diff --git a/js/ispyb-client/mx/datacollectiondataadapter.js b/js/ispyb-client/mx/datacollectiondataadapter.js
index 30d6d4a91..946313112 100644
--- a/js/ispyb-client/mx/datacollectiondataadapter.js
+++ b/js/ispyb-client/mx/datacollectiondataadapter.js
@@ -103,6 +103,15 @@ DataCollectionDataAdapter.prototype.getReportURLBySessionId = function(sessionId
};
+/**
+* This method sends by email the PDF report for the session
+* @method sendPdfReport
+*/
+DataCollectionDataAdapter.prototype.sendPdfReport = function(sessionId){
+ var url = ('/{token}/proposal/{proposal}/mx/datacollection/session/{0}/report/send/pdf'.format([sessionId]));
+ return this.getUrl(url);
+};
+
/**
* This method downloads a RTF report for the session
* @method getRtfReportURLBySessionId
diff --git a/js/mx/controller/mxdatacollectioncontroller.js b/js/mx/controller/mxdatacollectioncontroller.js
index 9b5af0826..58a47655b 100644
--- a/js/mx/controller/mxdatacollectioncontroller.js
+++ b/js/mx/controller/mxdatacollectioncontroller.js
@@ -23,9 +23,6 @@ MxDataCollectionController.prototype.notFound = ExiGenericController.prototype.n
MxDataCollectionController.prototype.init = function() {
var _this = this;
var listView;
-
-
-
Path.map("#/mx/datacollection/protein_acronym/:acronmys/main").to(function() {
var mainView = new DataCollectionMxMainView();
EXI.addMainPanel(mainView);
@@ -39,7 +36,8 @@ MxDataCollectionController.prototype.init = function() {
Path.map("#/mx/proposal/:proposal/datacollection/session/:sessionId/main").to(function() {
- var redirection = "#/mx/datacollection/session/" + this.params['sessionId'] +"/main";
+ var redirection = "#/mx/datacollection/session/" + this.params['sessionId'] +"/main";
+ this.proposal = this.params['proposal'];
/** Are we logged in yet? */
if (EXI.credentialManager.getConnections().length > 0){
ExiGenericController.prototype.redirect( this.params['proposal'], redirection);
@@ -52,18 +50,13 @@ MxDataCollectionController.prototype.init = function() {
Path.map("#/mx/datacollection/session/:sessionId/main").to(function() {
-
- var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId']});
+
+ var proposals = EXI.credentialManager.getCredentials()[0].activeProposals;
+ var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId'], proposal : proposals[0]});
EXI.addMainPanel(mainView);
EXI.hideNavigationPanel();
EXI.setLoadingMainPanel(true);
- var onSuccessProposal = function (sender,proposal) {
- if (proposal && proposal.length > 0) {
- mainView.loadProposal(proposal[0]);
- }
- }
- EXI.getDataAdapter({onSuccess : onSuccessProposal}).proposal.proposal.getProposalBySessionId(this.params['sessionId']);
-
+
var onSuccess = function(sender, data){
mainView.loadCollections(data);
EXI.setLoadingMainPanel(false);
@@ -100,7 +93,7 @@ MxDataCollectionController.prototype.init = function() {
Path.map("#/mx/datacollection/datacollectionid/:datacollectionid/main").to(function() {
- var mainView = new DataCollectionMxMainView();
+ var mainView = new DataCollectionMxMainView({sessionId : this.params['sessionId'], proposal : this.params['proposal']});
EXI.addMainPanel(mainView);
EXI.hideNavigationPanel();
EXI.setLoadingMainPanel(true);
diff --git a/js/mx/view/datacollection/datacollectionmxmainview.js b/js/mx/view/datacollection/datacollectionmxmainview.js
index bfeb693fa..c4f41ab69 100644
--- a/js/mx/view/datacollection/datacollectionmxmainview.js
+++ b/js/mx/view/datacollection/datacollectionmxmainview.js
@@ -15,10 +15,13 @@ function DataCollectionMxMainView(args) {
}
if (args.technique) {
this.technique = args.technique;
+ }
+ if (args.proposal) {
+ this.proposal = args.proposal;
}
}
-
- this.genericDataCollectionPanel = new MXDataCollectionGrid();
+
+ this.genericDataCollectionPanel = new MXDataCollectionGrid({proposal : this.proposal});
this.energyScanGrid = new EnergyScanGrid();
this.xfeScanGrid = new XFEScanGrid();
this.emStats = new EMSessionStats({sessionId: this.sessionId});
diff --git a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js
index 50b719e14..ccefa3ced 100644
--- a/js/mx/view/datacollection/grid/mxdatacollectiongrid.js
+++ b/js/mx/view/datacollection/grid/mxdatacollectiongrid.js
@@ -9,12 +9,22 @@ function MXDataCollectionGrid(args) {
/** DATACOLLECTION, DATACOLLECTION_COLLAPSED, PLATES_VIEW */
this.renderingType = 'DATACOLLECTION';
-
+ this.hideSendReport = true;
+
this.uncollapsedDataCollectionGrid = new UncollapsedDataCollectionGrid();
this.collapsedDataCollectionGrid = new CollapsedDataCollectionGrid();
this.containersDataCollectionGrid = new ContainersDataCollectionGrid();
- this.activePanel = this.uncollapsedDataCollectionGrid;
+ this.activePanel = this.uncollapsedDataCollectionGrid;
+
+ if (args) {
+ if (args.proposal) {
+ this.proposal = args.proposal;
+ if (this.proposal.substring(0,2).toLowerCase() == 'fx'){
+ this.hideSendReport = false
+ }
+ }
+ }
}
MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) {
@@ -26,12 +36,15 @@ MXDataCollectionGrid.prototype.getPanel = function(dataCollectionGroup) {
tbar: this.getToolBar(),
items: [_this.activePanel.getPanel(dataCollectionGroup)]
});
+
return this.panel;
};
MXDataCollectionGrid.prototype.getToolBar = function() {
var _this = this;
+
+ //var proposalCode = this.proposal.Proposal_proposalCode;
function onMenuClicked(widget) {
if (_this.activePanel != widget) {
@@ -42,9 +55,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
_this.reloadData(_this.dataCollectionGroup);
}
}
- }
-
-
+ }
return Ext.create('Ext.toolbar.Toolbar', {
width: 500,
@@ -123,7 +134,7 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
}
}
},
- {
+ {
text: " RTF summary",
id : 'rtfBtn',
tooltip: 'Download Session Summary Report as RTF',
@@ -155,7 +166,20 @@ MXDataCollectionGrid.prototype.getToolBar = function() {
location.href = _this.rtfAnalysisUrl;
}
}
+ },
+ {
+ text: " Send Report ",
+ id : 'sendPdfBtn',
+ tooltip: 'Send Session Summary Report as PDF',
+ margin: '1 0 1 2',
+ hidden: _this.hideSendReport,
+ handler : function(){
+ if (_this.sendPdfUrl != null){
+ location.href = _this.sendPdfUrl;
+ }
+ }
},
+
'->',
{
html: ' Best results',
@@ -244,7 +268,9 @@ MXDataCollectionGrid.prototype.load = function(dataCollectionGroup) {
this.rtfUrl = EXI.getDataAdapter().mx.dataCollection.getRtfReportURLBySessionId(sessionId);
this.pdfAnalysisUrl = EXI.getDataAdapter().mx.dataCollection.getAnalysisReportURLBySessionId(sessionId);
this.rtfAnalysisUrl = EXI.getDataAdapter().mx.dataCollection.getRtfAnalysisReportURLBySessionId(sessionId);
+ this.sendPdfUrl = EXI.getDataAdapter().mx.dataCollection.sendPdfReport(sessionId);
}
+
};
/**
diff --git a/mx/dev.html b/mx/dev.html
index 59432b903..60079886a 100644
--- a/mx/dev.html
+++ b/mx/dev.html
@@ -33,6 +33,7 @@
+
@@ -49,6 +50,7 @@
+
diff --git a/saxs/dev.html b/saxs/dev.html
index 90798544e..b09f490b6 100644
--- a/saxs/dev.html
+++ b/saxs/dev.html
@@ -35,6 +35,7 @@
+
@@ -51,6 +52,7 @@
+
diff --git a/test/dev.html b/test/dev.html
index f331e9362..3e27eee3c 100644
--- a/test/dev.html
+++ b/test/dev.html
@@ -35,6 +35,7 @@
+
@@ -51,6 +52,7 @@
+
@@ -60,16 +62,57 @@
-
+
+
+
+
+
+
-
-
-
-
- view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ view-source:http://lindemaria:8082/EXI/test/dev.html#/welcome
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tracking/dev.html b/tracking/dev.html
index 3c8b003bd..b28a1ab7c 100644
--- a/tracking/dev.html
+++ b/tracking/dev.html
@@ -32,6 +32,7 @@
+
@@ -48,6 +49,7 @@
+
@@ -57,16 +59,57 @@
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+