implemented showing public lists to visitors

This commit is contained in:
2022-04-16 08:12:41 +02:00
parent 321f05c09a
commit 3ef331db1a
3 changed files with 46 additions and 23 deletions

View File

@@ -19,7 +19,7 @@ function loadListAdminList(){
}
function loadListList(){
$.getJSON('/api/list/list', showListAdminList);
$.getJSON('/api/list/list', showListList);
}
function loadUserList(){
@@ -34,22 +34,9 @@ function showList(listEmail){
$.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){
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){
for (let i in data.users){
let user = data.users[i];

View File

@@ -2,9 +2,10 @@
<legend>List of mailinglists</legend>
<table id="listlist">
<tr>
<th colspan="4">List Name</th>
<th colspan="3">List Address</th>
<th colspan="3">Actions</th>
<th>List Name</th>
<th>List Address</th>
<th>State</th>
<th>Actions</th>
</tr>
</table>
<script type="text/javascript">