Browse Source

working on list management scripts

drop_old_mail
Stephan Richter 3 years ago
parent
commit
1c84a63e66
  1. 1
      src/main/java/de/srsoftware/widerhall/data/MailingList.java
  2. 28
      static/templates/js.st

1
src/main/java/de/srsoftware/widerhall/data/MailingList.java

@ -21,6 +21,7 @@ public class MailingList { @@ -21,6 +21,7 @@ public class MailingList {
private static final String SMTP_USER = "smtp_user";
private static final String SMTP_PASS = "smtp_pass";
private static final int ENABLED = 1;
private static final int PUBLIC = 2;
private final String name;
private final String email;
public static final String TABLE_NAME = "Lists";

28
static/templates/js.st

@ -10,6 +10,10 @@ function enableList(listEmail){ @@ -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(){ @@ -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);

Loading…
Cancel
Save