working on list management scripts
This commit is contained in:
@@ -10,6 +10,10 @@ function enableList(listEmail){
|
||||
console.log('enableList('+listEmail+')');
|
||||
}
|
||||
|
||||
function hideList(listEmail){
|
||||
console.log('hideList('+listEmail+')');
|
||||
}
|
||||
|
||||
function loadListList(){
|
||||
$.getJSON("/api/list/list", showListList);
|
||||
}
|
||||
@@ -18,24 +22,30 @@ function loadUserList(){
|
||||
$.getJSON("/api/user/list", showUserList);
|
||||
}
|
||||
|
||||
function showList(listEmail){
|
||||
console.log('showList('+listEmail+')');
|
||||
}
|
||||
|
||||
function showListList(data){
|
||||
for (let i in data.lists){
|
||||
let list = data.lists[i];
|
||||
let row = $('<tr/>');
|
||||
let drop = $('<button/>').text('drop list').click(() => dropList(list.email))
|
||||
let start = $('<button/>').text('enable').click(() => enableList(list.email))
|
||||
let stop = $('<button/>').text('disable').click(() => disableList(list.email))
|
||||
|
||||
let actions = $('<td/>');
|
||||
$('<td/>').text(list.name).appendTo(row);
|
||||
$('<td/>').text(list.email).appendTo(row);
|
||||
$('<td/>').text(list.state).appendTo(row);
|
||||
|
||||
start.appendTo(actions);
|
||||
stop.appendTo(actions);
|
||||
drop.appendTo(actions);
|
||||
actions.appendTo(row);
|
||||
$('<td/>').text(list.imap_host).appendTo(row);
|
||||
let select = $('<select/>',{name:list.email}).change(function () {
|
||||
let action = $(this).children("option:selected").val();
|
||||
let list = $(this).attr('name');
|
||||
if (confirm("This will "+action+" '"+list+"'. Are you sure?"))self[action+'List'](list);
|
||||
});
|
||||
$('<option/>').text('Actions').appendTo(select);
|
||||
['enable','disable','drop','hide','show'].forEach(val => $('<option/>',{value:val}).text(val).appendTo(select));
|
||||
|
||||
select.appendTo($('<td/>')).appendTo(row);
|
||||
|
||||
$('<td/>').text(list.imap_host).appendTo(row);
|
||||
$('<td/>').text(list.imap_port).appendTo(row);
|
||||
$('<td/>').text(list.imap_user).appendTo(row);
|
||||
$('<td/>').text(list.smtp_host).appendTo(row);
|
||||
|
||||
Reference in New Issue
Block a user