sum7/warehost-frontend
sum7
/
warehost-frontend
Archived
1
0
Fork 0

fix #12: mail forward - mail ist ready

This commit is contained in:
Martin Geno 2016-11-17 23:16:35 +01:00
parent 87ddb163c2
commit e3df788f05
4 changed files with 120 additions and 15 deletions

View File

@ -8,11 +8,23 @@
.input-group .input-group
input.form-control(id="name",name="name",ng-model="obj.name") input.form-control(id="name",name="name",ng-model="obj.name")
span.input-group-addon @{{domain.fqdn}} span.input-group-addon @{{domain.fqdn}}
.form-group .form-group
ui-select(ng-model="obj.login",theme="bootstrap") label Inbox
ui-select-match {{$select.selected.username}} .input-group
ui-select-choices(repeat="item in loginlist | filter: $select.search") ui-select(ng-model="obj.login")
div(ng-bind-html="item.username | highlight: $select.search") ui-select-match
span(ng-repeat="i in loginlist",ng-show="i.ID == $select.selected.ID") {{i.username}}
ui-select-choices(repeat="i.ID as i in loginlist | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
span.input-group-btn
button.btn.btn-default(type="button",ng-click="obj.login = undefined")
span.glyphicon.glyphicon-trash
.form-group
label Forwards
ui-select(ng-model="obj.forwards",multiple,tagging="newMail")
ui-select-match {{$item.to}}
ui-select-choices(repeat="i in obj.forwards")
div(ng-bind-html="i.to | highlight: $select.search")
button.btn.btn-primary(type="submit") button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
@ -28,15 +40,30 @@
input.form-control(id="name",name="name",ng-model="item.name") input.form-control(id="name",name="name",ng-model="item.name")
span.input-group-addon @{{item.domain.fqdn}} span.input-group-addon @{{item.domain.fqdn}}
.form-group .form-group
ui-select(ng-model="item.login",theme="bootstrap") label Inbox
ui-select-match {{$select.selected.username}} .input-group
ui-select-choices(repeat="i in loginlist | filter: $select.search") ui-select(ng-model="item.login")
div(ng-bind-html="i.username | highlight: $select.search") ui-select-match
span(ng-repeat="i in loginlist",ng-show="i.ID == $select.selected.ID") {{i.username}}
ui-select-choices(repeat="i.ID as i in loginlist | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
span.input-group-btn
button.btn.btn-default(type="button",ng-click="item.login = undefined")
span.glyphicon.glyphicon-trash
.form-group
label Forwards
ui-select(ng-model="item.forwards",multiple,tagging="newMail")
ui-select-match {{$item.to}}
ui-select-choices(repeat="i in item.forwards")
div(ng-bind-html="i.to | highlight: $select.search")
button.btn.btn-primary(type="submit",ng-click="edit(item)") button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
td(data-title="'Postfach'") td(data-title="'Inbox'")
span(ng-repeat="i in loginlist",ng-if="i.ID == item.login") {{i.username}} span(ng-repeat="i in loginlist",ng-if="i.ID == item.login") {{i.username}}
td(data-title="'Forwards'")
ul
li(ng-repeat="i in item.forwards") {{i.to}}
td(data-title="'Option'") td(data-title="'Option'")
.btn-group.btn-group-xs .btn-group.btn-group-xs
span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing") span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing")

View File

@ -50,4 +50,15 @@ angular.module('warehost')
$http.post(config.api+'/host/domain/'+$stateParams.domainid+'/mail',$scope.obj).then(submitresult); $http.post(config.api+'/host/domain/'+$stateParams.domainid+'/mail',$scope.obj).then(submitresult);
}; };
$scope.newMail = function(to){
if(/^[_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/.test(to)){
return {
ID: null,
mail: null,
to: to
};
}
return null;
};
}); });

View File

@ -26,6 +26,19 @@
.form-group .form-group
label(for="proxy") Proxy label(for="proxy") Proxy
input.form-control(id="proxy",name="proxy",ng-model="obj.proxy") input.form-control(id="proxy",name="proxy",ng-model="obj.proxy")
//
.form-group
label FTP Access
ui-select(ng-model="obj.ftpaccess",multiple,on-select="newUser(obj.ftpaccess, $model)")
ui-select-match {{$item.login.username}}
ui-select-choices(repeat="i in loginlist | afterKeyID:obj.ftpaccess:'login' | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
.form-group
label HTTP Access
ui-select(ng-model="obj.httpaccess",multiple,on-select="newUser(obj.httpaccess, $model)")
ui-select-match {{$item.login.username}}
ui-select-choices(repeat="i in loginlist | afterKeyID:obj.httpaccess:'login' | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
button.btn.btn-primary(type="submit") button.btn.btn-primary(type="submit")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
@ -60,9 +73,29 @@
.form-group .form-group
label(for="proxy") Proxy label(for="proxy") Proxy
input.form-control(id="proxy",name="proxy",ng-model="item.proxy") input.form-control(id="proxy",name="proxy",ng-model="item.proxy")
//
.form-group
label FTP Access
ui-select(ng-model="item.ftpaccess",multiple,on-select="newUser(item.ftpaccess, $model)")
ui-select-match {{$item.login.username}}
ui-select-choices(repeat="i in loginlist | afterKeyID:obj.ftpaccess:'login' | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
.form-group
label HTTP Access
ui-select(ng-model="item.httpaccess",multiple,on-select="newUser(item.httpaccess, $model)")
ui-select-match {{$item.login.username}}
ui-select-choices(repeat="i in loginlist | afterKeyID:obj.httpaccess:'login' | filter: $select.search")
div(ng-bind-html="i.username | highlight: $select.search")
button.btn.btn-primary(type="submit",ng-click="edit(item)") button.btn.btn-primary(type="submit",ng-click="edit(item)")
span.glyphicon.glyphicon-floppy-disk span.glyphicon.glyphicon-floppy-disk
| Save | Save
//
td(data-title="'FTPAccess'")
ul
li(ng-repeat="i in item.ftpaccess") {{i.login.username}}
td(data-title="'HTTPAccess'")
ul
li(ng-repeat="i in item.httpaccess") {{i.login.username}}
td(data-title="'Options'") td(data-title="'Options'")
span.glyphicon.glyphicon-cd(ng-if="item.php") span.glyphicon.glyphicon-cd(ng-if="item.php")
span.glyphicon.glyphicon-lock(ng-if="item.ssl") span.glyphicon.glyphicon-lock(ng-if="item.ssl")

View File

@ -1,6 +1,23 @@
'use strict'; 'use strict';
angular.module('warehost') angular.module('warehost')
.filter('afterKeyID',function(){
return function(collection,list,key){
var output = [],
keys = [];
angular.forEach(list, function(item) {
if(item[key] !== undefined){
keys.push(item[key].ID);
}
});
angular.forEach(collection, function(item) {
if(keys.indexOf(item.ID)){
output.push(item);
}
});
return output;
};
})
.controller('WebDomainHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http,$stateParams){ .controller('WebDomainHostCtrl',function(session,config,alert,NgTableParams,$rootScope,$scope,$http,$stateParams){
$scope.tableParams = new NgTableParams({ $scope.tableParams = new NgTableParams({
sorting: { 'subdomain': 'asc' }, sorting: { 'subdomain': 'asc' },
@ -10,16 +27,20 @@ angular.module('warehost')
alert.set({}); alert.set({});
$scope.obj = {}; $scope.obj = {};
$scope.domain = {}; $scope.domain = {};
$scope.loginlist = [];
function resetObj(){ function resetObj(){
$scope.obj = {}; $scope.obj = {};
} }
function load(){ function load(){
$http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){ $http.get(config.api+'/user').then(function(res){
$scope.domain = res.data.data; $scope.loginlist = res.data.data;
$http.get(config.api+'/host/domain/'+$stateParams.domainid+'/web').then(function(res){ $http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){
session.set(res); $scope.domain = res.data.data;
$scope.tableParams.settings({dataset: angular.copy(res.data.data),total: (res.data.data).length}); $http.get(config.api+'/host/domain/'+$stateParams.domainid+'/web').then(function(res){
session.set(res);
$scope.tableParams.settings({dataset: angular.copy(res.data.data),total: (res.data.data).length});
});
}); });
}); });
} }
@ -45,5 +66,18 @@ angular.module('warehost')
$scope.add = function(){ $scope.add = function(){
$http.post(config.api+'/host/domain/'+$stateParams.domainid+'/web',$scope.obj).then(submitresult); $http.post(config.api+'/host/domain/'+$stateParams.domainid+'/web',$scope.obj).then(submitresult);
}; };
$scope.newUser = function(list, $model){
var ids= [];
list.forEach(function(item, i) {
if(item.login === undefined){
list[i] = {login: $model};
}
if(ids.indexOf(list[i].login.ID) < 0){
ids.push(list[i].login.ID);
}else{
list.splice(i);
}
});
};
}); });