Current File : //usr/local/jetapps/var/www/jetbackup5/docroot/app/plugins/notification/Email/controller.js |
'use strict';
define(['app'], function(app) {
app.controller("notificationEmail", ["$scope", function ($scope) {
if($scope.saveData.options.smtp === undefined) $scope.saveData.options.smtp = 0;
if($scope.saveData.options.smtp_secure === undefined) $scope.saveData.options.smtp_secure = 0;
if($scope.saveData.options.smtp_verifyssl === undefined) $scope.saveData.options.smtp_verifyssl = 1;
if($scope.saveData.options.smtp_timeout === undefined) $scope.saveData.options.smtp_timeout = 15;
$scope.fixBooleanField = function(options, fieldName) {
if(typeof options[fieldName] == 'bigint') return;
if(typeof options[fieldName] == 'boolean') options[fieldName] = options[fieldName] ? 1 : 0;
options[fieldName] = parseInt(options[fieldName]);
};
$scope.$watch('saveData.options.smtp', function () {
$scope.fixBooleanField($scope.saveData.options, 'smtp');
});
$scope.$watch('saveData.options.smtp_verifyssl', function () {
$scope.fixBooleanField($scope.saveData.options, 'smtp_verifyssl');
});
}]);
});