implemented showing public lists to visitors
This commit is contained in:
@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -117,10 +118,17 @@ public class MailingList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> safeMap() {
|
public Map<String, Object> safeMap() {
|
||||||
return Map.of(EMAIL, email, NAME, name,
|
var map = new HashMap<String,Object>();
|
||||||
IMAP_HOST, imapHost, IMAP_PORT, imapPort, IMAP_USER, imapUser,
|
map.put(EMAIL,email);
|
||||||
SMTP_HOST, smtpHost, SMTP_PORT, smtpPort, SMTP_USER, smtpUser,
|
map.put(NAME, name);
|
||||||
STATE, stateString(state));
|
if (imapHost != null) map.put(IMAP_HOST, imapHost);
|
||||||
|
if (imapPort != 0) map.put(IMAP_PORT, imapPort);
|
||||||
|
if (imapUser != null) map.put(IMAP_USER, imapUser);
|
||||||
|
if (smtpHost != null) map.put(SMTP_HOST, smtpHost);
|
||||||
|
if (smtpPort != 0) map.put(SMTP_PORT, smtpPort);
|
||||||
|
if (smtpUser != null) map.put(SMTP_USER, smtpUser);
|
||||||
|
map.put(STATE, stateString(state));
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String stateString(int state) {
|
private static String stateString(int state) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ function loadListAdminList(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadListList(){
|
function loadListList(){
|
||||||
$.getJSON('/api/list/list', showListAdminList);
|
$.getJSON('/api/list/list', showListList);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUserList(){
|
function loadUserList(){
|
||||||
@@ -34,22 +34,9 @@ function showList(listEmail){
|
|||||||
$.post('/api/list/show',{list:listEmail},showListResult,'json');
|
$.post('/api/list/show',{list:listEmail},showListResult,'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showListResult(result){
|
|
||||||
console.log(result);
|
|
||||||
if ('error' in result){
|
|
||||||
alert(result.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ('success' in result){
|
|
||||||
alert(result.success);
|
|
||||||
reload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
alert("Api call did not return result");
|
|
||||||
}
|
|
||||||
|
|
||||||
function showListAdminList(data){
|
|
||||||
}
|
|
||||||
|
|
||||||
function showListAdminList(data){
|
function showListAdminList(data){
|
||||||
for (let i in data.lists){
|
for (let i in data.lists){
|
||||||
@@ -85,6 +72,33 @@ function showListAdminList(data){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showListList(data){
|
||||||
|
for (let i in data.lists){
|
||||||
|
let list = data.lists[i];
|
||||||
|
let row = $('<tr/>');
|
||||||
|
|
||||||
|
$('<td/>').text(list.name).appendTo(row);
|
||||||
|
$('<td/>').text(list.email).appendTo(row);
|
||||||
|
$('<td/>').text(list.state).appendTo(row);
|
||||||
|
|
||||||
|
row.appendTo('#listlist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showListResult(result){
|
||||||
|
console.log(result);
|
||||||
|
if ('error' in result){
|
||||||
|
alert(result.error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ('success' in result){
|
||||||
|
alert(result.success);
|
||||||
|
reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
alert("Api call did not return result");
|
||||||
|
}
|
||||||
|
|
||||||
function showUserList(data){
|
function showUserList(data){
|
||||||
for (let i in data.users){
|
for (let i in data.users){
|
||||||
let user = data.users[i];
|
let user = data.users[i];
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
<legend>List of mailinglists</legend>
|
<legend>List of mailinglists</legend>
|
||||||
<table id="listlist">
|
<table id="listlist">
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="4">List Name</th>
|
<th>List Name</th>
|
||||||
<th colspan="3">List Address</th>
|
<th>List Address</th>
|
||||||
<th colspan="3">Actions</th>
|
<th>State</th>
|
||||||
|
<th>Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|||||||
Reference in New Issue
Block a user