Skip to content

Commit

Permalink
Show message on file sent by email
Browse files Browse the repository at this point in the history
  • Loading branch information
adube committed Feb 12, 2019
1 parent 377b140 commit 8730602
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contribs/gmf/src/controllers/AbstractDesktopController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import gmfControllersAbstractAPIController, {AbstractAPIController} from 'gmf/co
import gmfContextualdataModule from 'gmf/contextualdata/module.js';
import gmfEditingModule from 'gmf/editing/module.js';
import gmfPermalinkShareComponent from 'gmf/permalink/shareComponent.js';
import gmfPrintComponent from 'gmf/print/component.js';
import gmfPrintModule from 'gmf/print/module.js';
import gmfProfileModule from 'gmf/profile/module.js';
import gmfRasterComponent from 'gmf/raster/component.js';
import ngeoDrawFeatures from 'ngeo/draw/features.js';
Expand Down Expand Up @@ -258,7 +258,7 @@ const module = angular.module('GmfAbstractDesktopControllerModule', [
gmfContextualdataModule.name,
gmfEditingModule.name,
gmfPermalinkShareComponent.name,
gmfPrintComponent.name,
gmfPrintModule.name,
gmfProfileModule.name,
gmfRasterComponent.name,
ngeoDrawFeatures.name,
Expand Down
9 changes: 9 additions & 0 deletions contribs/gmf/src/print/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,13 @@
class="gmf-print-error-capabilities form-group pull-left text-danger">
<p>{{'The print server is unavailable. Please, try later.' | translate}}</p>
</div>

<div
ng-show="$ctrl.smtpMessage"
class="gmf-print-smtp-message form-group pull-left">
<button
class="btn prime"
ng-click="$ctrl.closeSmtpMessage()" translate>Close</button>
<p>{{'The file will be sent to your email when ready.' | translate}}</p>
</div>
</div>
23 changes: 23 additions & 0 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,28 @@ class Controller {
this.rotation = 0;

/**
* The email of the user to which send the file. Obtained from the
* authentication service.
* @type {?string}
*/
this.smtpEmail = null;

/**
* Whether to send the printed file by email or not.
* @type {boolean}
*/
this.smtpEnabled = false;

/**
* Flag that determines whether to show a message notifying the
* user about his upcomping file or not.
* @type {boolean}
*/
this.smtpMessage = false;

/**
* Whether sending file by email is supported or not. Obtained
* from the print capabilities.
* @type {boolean}
*/
this.smtpSupported = false;
Expand Down Expand Up @@ -1161,6 +1173,10 @@ class Controller {
// The report is ready. Open it by changing the window location.
window.location.href = this.ngeoPrint_.getReportUrl(ref);
this.resetPrintStates_();
// If the file was sent by email, show message
if (this.smtpSupported && this.smtpEmail && this.smtpEnabled) {
this.smtpMessage = true;
}
} else {
console.error(mfResp.error);
this.handleCreateReportError_();
Expand Down Expand Up @@ -1332,6 +1348,13 @@ class Controller {
isState(stateEnumKey) {
return this.gmfPrintState_.state === PrintStateEnum[stateEnumKey];
}

/**
* Close the SMTP message
*/
closeSmtpMessage() {
this.smtpMessage = false;
}
}

module.controller('GmfPrintController', Controller);
Expand Down
14 changes: 14 additions & 0 deletions contribs/gmf/src/print/print.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,17 @@
width: 5rem;
}
}

.gmf-print-smtp-message {
background-color: white;
clear: both;
padding: 10px;

button {
float: right;
}

p {
margin: 0;
}
}

0 comments on commit 8730602

Please sign in to comment.