Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,93 @@
|
||||
<md-dialog flex="40">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools md-portal">
|
||||
<span>SMTP Configuration</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="cancel()">
|
||||
<md-icon>close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
|
||||
<md-dialog-content flex>
|
||||
<md-tabs md-dynamic-height md-border-bottom>
|
||||
<md-tab label="General Configuration">
|
||||
<md-content class="md-padding" flex>
|
||||
<md-list>
|
||||
<md-list-item ng-repeat="conf in smtpConfig | limitTo: 5">
|
||||
<div layout="row" layout-align="center start" flex>
|
||||
<md-input-container>
|
||||
<input ng-model="conf.displayValue" ng-disabled="true" style="color: rgba(0,0,0,1) !important; background: none !important;"/>
|
||||
</md-input-container>
|
||||
<span flex="5"></span>
|
||||
<md-switch flex ng-model="conf.value" ng-if="conf.type === 'boolean'" class="md-primary" ng-disabled="!canEdit">{{conf.value ? 'Yes' : 'No'}}</md-switch>
|
||||
<div layout="row" layout-align="start center" flex ng-if="conf.type !== 'boolean'">
|
||||
<md-input-container flex>
|
||||
<input ng-model="conf.value" ng-disabled="!canEdit" type="{{conf.type}}" />
|
||||
</md-input-container>
|
||||
<md-button class="md-icon-button" ng-if="conf.meta === 'password'" style="margin-bottom: 25px;" ng-mousedown="conf.type='text'" ng-mouseup="conf.type='password'">
|
||||
<md-icon>remove_red_eye</md-icon>
|
||||
<md-tooltip>View password</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<md-tab label="Start TLS Configuration">
|
||||
<md-content class="md-padding" flex>
|
||||
<md-list>
|
||||
<md-list-item ng-repeat="conf in smtpConfig | limitTo: 3:5">
|
||||
<div layout="row" layout-align="center start" flex>
|
||||
<md-input-container>
|
||||
<input ng-model="conf.displayValue" ng-disabled="true" style="color: rgba(0,0,0,1) !important; background: none !important;"/>
|
||||
</md-input-container>
|
||||
<span flex="5"></span>
|
||||
<md-switch flex ng-model="conf.value" ng-if="conf.type === 'boolean'" class="md-primary" ng-disabled="!canEdit">{{conf.value ? 'Yes' : 'No'}}</md-switch>
|
||||
<div layout="row" layout-align="start center" flex ng-if="conf.type !== 'boolean'">
|
||||
<md-input-container flex>
|
||||
<input ng-model="conf.value" ng-disabled="!canEdit" type="{{conf.type}}" />
|
||||
</md-input-container>
|
||||
<md-button class="md-icon-button" ng-if="conf.meta === 'password'" style="margin-bottom: 25px;" ng-mousedown="conf.type='text'" ng-mouseup="conf.type='password'">
|
||||
<md-icon>remove_red_eye</md-icon>
|
||||
<md-tooltip>View password</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</md-content>
|
||||
</md-tab>
|
||||
<md-tab label="Auth Configuration">
|
||||
<md-content class="md-padding" flex>
|
||||
<md-list>
|
||||
<md-list-item ng-repeat="conf in smtpConfig | limitTo: 4:8">
|
||||
<div layout="row" layout-align="center start" flex>
|
||||
<md-input-container>
|
||||
<input ng-model="conf.displayValue" ng-disabled="true" style="color: rgba(0,0,0,1) !important; background: none !important;"/>
|
||||
</md-input-container>
|
||||
<span flex="5"></span>
|
||||
<md-switch flex ng-model="conf.value" ng-if="conf.type === 'boolean'" class="md-primary" ng-disabled="!canEdit">{{conf.value ? 'Yes' : 'No'}}</md-switch>
|
||||
<div layout="row" layout-align="start center" flex ng-if="conf.type !== 'boolean'">
|
||||
<md-input-container flex>
|
||||
<input ng-model="conf.value" ng-disabled="!canEdit" type="{{conf.type}}" />
|
||||
</md-input-container>
|
||||
<md-button class="md-icon-button" ng-if="conf.meta === 'password'" style="margin-bottom: 25px;" ng-mousedown="conf.type='text'" ng-mouseup="conf.type='password'">
|
||||
<md-icon>remove_red_eye</md-icon>
|
||||
<md-tooltip>View password</md-tooltip>
|
||||
</md-button>
|
||||
</div>
|
||||
</div>
|
||||
</md-list-item>
|
||||
</md-list>
|
||||
</md-content>
|
||||
</md-tab>
|
||||
</md-tabs>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions layout="row" class="modal-footer">
|
||||
<div class="text-danger">{{error}}</div>
|
||||
<md-button id="okButton" type="submit" class="md-raised md-primary" ng-click="ok()">Save</md-button>
|
||||
<md-button id="cancelButton" class="md-raised md-warn" ng-click="cancel()">Cancel</md-button>
|
||||
</md-dialog-actions>
|
||||
</md-dialog>
|
||||
@@ -0,0 +1,140 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.common.partials.smtpinfo', ['ui.router']).controller('SMTPInfoCtrl', smtpInfoCtrlController);
|
||||
|
||||
function smtpInfoCtrlController($scope, $state, cache, $mdDialog, systemProvider, systemStores,
|
||||
portalUtils, permissions, Constants, Triggers) {
|
||||
$scope.saving = false;
|
||||
|
||||
permissions.canView({permission: Constants.Permissions.EDIT_SMTP_CONFIG}).then(function(allowed){
|
||||
$scope.canEdit = allowed;
|
||||
});
|
||||
|
||||
$scope.smtpConfig = [
|
||||
{
|
||||
name: 'smtp.enabled',
|
||||
displayValue: 'SMTP Enabled',
|
||||
value: false,
|
||||
type: 'boolean'
|
||||
},{
|
||||
name: 'mail.transport.protocol',
|
||||
displayValue: 'Transport Protocol',
|
||||
value: 'smtp',
|
||||
type: 'text'
|
||||
},{
|
||||
name: 'mail.smtp.host',
|
||||
displayValue: 'SMTP Server Url',
|
||||
value: '',
|
||||
type: 'text'
|
||||
},{
|
||||
name: 'mail.smtp.port',
|
||||
displayValue: 'SMTP Server Port',
|
||||
value: 0,
|
||||
type: 'number'
|
||||
},{
|
||||
name: 'mail.debug',
|
||||
displayValue: 'Enable Mail Debug Logging',
|
||||
value: false,
|
||||
type: 'boolean'
|
||||
},{
|
||||
name: 'mail.smtp.starttls.enable',
|
||||
displayValue: 'Enable Start TLS',
|
||||
value: false,
|
||||
type: 'boolean'
|
||||
},{
|
||||
name: 'mail.smtp.starttls.required',
|
||||
displayValue: 'Require Start TLS',
|
||||
value: false,
|
||||
type: 'boolean'
|
||||
},{
|
||||
name: 'mail.smtp.ssl.trust',
|
||||
displayValue: 'SSL Trust Certificate',
|
||||
value: '*',
|
||||
type: 'text'
|
||||
},{
|
||||
name: 'mail.smtp.auth',
|
||||
displayValue: 'Require Authentication',
|
||||
value: false,
|
||||
type: 'boolean'
|
||||
},{
|
||||
name: 'smtp.from.user',
|
||||
displayValue: 'From User',
|
||||
value: '',
|
||||
type: 'text'
|
||||
},{
|
||||
name: 'smtp.username',
|
||||
displayValue: 'SMTP Username',
|
||||
value: '',
|
||||
type: 'text'
|
||||
},{
|
||||
name: 'smtp.password',
|
||||
displayValue: 'SMTP Password',
|
||||
value: '',
|
||||
type: 'password',
|
||||
meta: 'password'
|
||||
},
|
||||
];
|
||||
|
||||
$scope.mCache = cache.request([new systemStores.SMTPConfig()]).then(function(){
|
||||
var conf = $scope.mCache.smtpConfig.data.values;
|
||||
|
||||
$.each($scope.smtpConfig, function(key, value) {
|
||||
$.each(conf, function(key2, value2) {
|
||||
if (value.name === value2.name) {
|
||||
if (value.type === 'number') {
|
||||
value.value = parseInt(value2.value);
|
||||
} else if (value.type === 'boolean') {
|
||||
value.value = value2.value === 'true' || value2.value === true;
|
||||
} else {
|
||||
value.value = value2.value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* OK button handler
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.ok = function () {
|
||||
portalUtils.confirmBox('saveSmtpConfig', 'Update SMTP Configuration',
|
||||
['Are you sure you want to update the smtp configuration?'],
|
||||
false, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.saveSMTPConf();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.saveSMTPConf = function() {
|
||||
systemProvider.updateSmtpConfig($scope.smtpConfig).then(function() {
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.error = err.message;
|
||||
portalUtils.toast('Failed to save configuration: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel button handler.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.cancel = function () {
|
||||
//Dismiss the modal
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
|
||||
Triggers.listen([Triggers.SMTP_CONFIG_UPDATED], function(trigger, payload) {
|
||||
new systemStores.SMTPConfig().refresh();
|
||||
});
|
||||
|
||||
} //end smtpInfoCtrlController function
|
||||
})();
|
||||
Reference in new issue
Block a user