fix #12: mail forward - mail ist ready
This commit is contained in:
parent
87ddb163c2
commit
e3df788f05
|
@ -8,11 +8,23 @@
|
|||
.input-group
|
||||
input.form-control(id="name",name="name",ng-model="obj.name")
|
||||
span.input-group-addon @{{domain.fqdn}}
|
||||
.form-group
|
||||
ui-select(ng-model="obj.login",theme="bootstrap")
|
||||
ui-select-match {{$select.selected.username}}
|
||||
ui-select-choices(repeat="item in loginlist | filter: $select.search")
|
||||
div(ng-bind-html="item.username | highlight: $select.search")
|
||||
.form-group
|
||||
label Inbox
|
||||
.input-group
|
||||
ui-select(ng-model="obj.login")
|
||||
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")
|
||||
span.glyphicon.glyphicon-floppy-disk
|
||||
| Save
|
||||
|
@ -28,15 +40,30 @@
|
|||
input.form-control(id="name",name="name",ng-model="item.name")
|
||||
span.input-group-addon @{{item.domain.fqdn}}
|
||||
.form-group
|
||||
ui-select(ng-model="item.login",theme="bootstrap")
|
||||
ui-select-match {{$select.selected.username}}
|
||||
ui-select-choices(repeat="i in loginlist | filter: $select.search")
|
||||
div(ng-bind-html="i.username | highlight: $select.search")
|
||||
label Inbox
|
||||
.input-group
|
||||
ui-select(ng-model="item.login")
|
||||
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)")
|
||||
span.glyphicon.glyphicon-floppy-disk
|
||||
| Save
|
||||
td(data-title="'Postfach'")
|
||||
td(data-title="'Inbox'")
|
||||
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'")
|
||||
.btn-group.btn-group-xs
|
||||
span.btn.btn-default(ng-click="item.isEditing = true",ng-if="!item.isEditing")
|
||||
|
|
|
@ -50,4 +50,15 @@ angular.module('warehost')
|
|||
$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;
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -26,6 +26,19 @@
|
|||
.form-group
|
||||
label(for="proxy") 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")
|
||||
span.glyphicon.glyphicon-floppy-disk
|
||||
| Save
|
||||
|
@ -60,9 +73,29 @@
|
|||
.form-group
|
||||
label(for="proxy") 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)")
|
||||
span.glyphicon.glyphicon-floppy-disk
|
||||
| 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'")
|
||||
span.glyphicon.glyphicon-cd(ng-if="item.php")
|
||||
span.glyphicon.glyphicon-lock(ng-if="item.ssl")
|
||||
|
|
|
@ -1,6 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
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){
|
||||
$scope.tableParams = new NgTableParams({
|
||||
sorting: { 'subdomain': 'asc' },
|
||||
|
@ -10,16 +27,20 @@ angular.module('warehost')
|
|||
alert.set({});
|
||||
$scope.obj = {};
|
||||
$scope.domain = {};
|
||||
$scope.loginlist = [];
|
||||
|
||||
function resetObj(){
|
||||
$scope.obj = {};
|
||||
}
|
||||
function load(){
|
||||
$http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){
|
||||
$scope.domain = res.data.data;
|
||||
$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});
|
||||
$http.get(config.api+'/user').then(function(res){
|
||||
$scope.loginlist = res.data.data;
|
||||
$http.get(config.api+'/host/domain/'+$stateParams.domainid).then(function(res){
|
||||
$scope.domain = res.data.data;
|
||||
$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(){
|
||||
$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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
Reference in New Issue