working on list management scripts
This commit is contained in:
@@ -21,6 +21,7 @@ public class MailingList {
|
|||||||
private static final String SMTP_USER = "smtp_user";
|
private static final String SMTP_USER = "smtp_user";
|
||||||
private static final String SMTP_PASS = "smtp_pass";
|
private static final String SMTP_PASS = "smtp_pass";
|
||||||
private static final int ENABLED = 1;
|
private static final int ENABLED = 1;
|
||||||
|
private static final int PUBLIC = 2;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String email;
|
private final String email;
|
||||||
public static final String TABLE_NAME = "Lists";
|
public static final String TABLE_NAME = "Lists";
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ function enableList(listEmail){
|
|||||||
console.log('enableList('+listEmail+')');
|
console.log('enableList('+listEmail+')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideList(listEmail){
|
||||||
|
console.log('hideList('+listEmail+')');
|
||||||
|
}
|
||||||
|
|
||||||
function loadListList(){
|
function loadListList(){
|
||||||
$.getJSON("/api/list/list", showListList);
|
$.getJSON("/api/list/list", showListList);
|
||||||
}
|
}
|
||||||
@@ -18,24 +22,30 @@ function loadUserList(){
|
|||||||
$.getJSON("/api/user/list", showUserList);
|
$.getJSON("/api/user/list", showUserList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showList(listEmail){
|
||||||
|
console.log('showList('+listEmail+')');
|
||||||
|
}
|
||||||
|
|
||||||
function showListList(data){
|
function showListList(data){
|
||||||
for (let i in data.lists){
|
for (let i in data.lists){
|
||||||
let list = data.lists[i];
|
let list = data.lists[i];
|
||||||
let row = $('<tr/>');
|
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.name).appendTo(row);
|
||||||
$('<td/>').text(list.email).appendTo(row);
|
$('<td/>').text(list.email).appendTo(row);
|
||||||
$('<td/>').text(list.state).appendTo(row);
|
$('<td/>').text(list.state).appendTo(row);
|
||||||
|
|
||||||
start.appendTo(actions);
|
let select = $('<select/>',{name:list.email}).change(function () {
|
||||||
stop.appendTo(actions);
|
let action = $(this).children("option:selected").val();
|
||||||
drop.appendTo(actions);
|
let list = $(this).attr('name');
|
||||||
actions.appendTo(row);
|
if (confirm("This will "+action+" '"+list+"'. Are you sure?"))self[action+'List'](list);
|
||||||
$('<td/>').text(list.imap_host).appendTo(row);
|
});
|
||||||
|
$('<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_port).appendTo(row);
|
||||||
$('<td/>').text(list.imap_user).appendTo(row);
|
$('<td/>').text(list.imap_user).appendTo(row);
|
||||||
$('<td/>').text(list.smtp_host).appendTo(row);
|
$('<td/>').text(list.smtp_host).appendTo(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user