implemented hiding/unhiding of mailing lists on the database side

This commit is contained in:
2022-04-16 08:01:58 +02:00
parent 64ff431360
commit 321f05c09a
14 changed files with 245 additions and 65 deletions

View File

@@ -12,6 +12,6 @@
<h1>Widerhall Administration</h1>
«messages()»
«userlist()»
«listlist()»
«listadminlist()»
</body>
</html>

View File

@@ -11,5 +11,7 @@
«userinfo()»
«messages()»
<h1>Widerhall Index page</h1>
«messages()»
«listlist()»
</body>
</html>

View File

@@ -11,22 +11,47 @@ function enableList(listEmail){
}
function hideList(listEmail){
console.log('hideList('+listEmail+')');
$.post('/api/list/hide',{list:listEmail},showListResult,'json');
}
function loadListAdminList(){
$.getJSON('/api/list/list', showListAdminList);
}
function loadListList(){
$.getJSON("/api/list/list", showListList);
$.getJSON('/api/list/list', showListAdminList);
}
function loadUserList(){
$.getJSON("/api/user/list", showUserList);
$.getJSON('/api/user/list', showUserList);
}
function reload(){
window.location.reload(true);
}
function showList(listEmail){
console.log('showList('+listEmail+')');
$.post('/api/list/show',{list:listEmail},showListResult,'json');
}
function showListList(data){
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){
for (let i in data.lists){
let list = data.lists[i];
let row = $('<tr/>');

View File

@@ -0,0 +1,26 @@
<fieldset>
<legend>List of mailinglists</legend>
<table id="listlist">
<tr>
<th colspan="4">List</th>
<th colspan="3">IMAP</th>
<th colspan="3">SMTP</th>
</tr>
<tr>
<th>Name</th>
<th>Address</th>
<th>State</th>
<th>Actions</th>
<th>Host</th>
<th>Port</th>
<th>User</th>
<th>Host</th>
<th>Port</th>
<th>User</th>
</tr>
</table>
<a href="add_list">Add new mailing list</a>
<script type="text/javascript">
loadListAdminList();
</script>
</fieldset>

View File

@@ -2,24 +2,11 @@
<legend>List of mailinglists</legend>
<table id="listlist">
<tr>
<th colspan="4">List</th>
<th colspan="3">IMAP</th>
<th colspan="3">SMTP</th>
</tr>
<tr>
<th>Name</th>
<th>Address</th>
<th>State</th>
<th>Actions</th>
<th>Host</th>
<th>Port</th>
<th>User</th>
<th>Host</th>
<th>Port</th>
<th>User</th>
<th colspan="4">List Name</th>
<th colspan="3">List Address</th>
<th colspan="3">Actions</th>
</tr>
</table>
<a href="add_list">Add new mailing list</a>
<script type="text/javascript">
loadListList();
</script>