first version with working archive
This commit is contained in:
26
static/templates/archive.st
Normal file
26
static/templates/archive.st
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="jquery"></script>
|
||||
<script src="js"></script>
|
||||
<link rel="stylesheet" href="css" />
|
||||
</head>
|
||||
<body>
|
||||
«navigation()»
|
||||
«userinfo()»
|
||||
«messages()»
|
||||
<h1>Widerhall List Archive</h1>
|
||||
<table id="archive">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>From</th>
|
||||
<th>Subject</th>
|
||||
</tr>
|
||||
</table>
|
||||
«footer()»
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
loadArchive('«data.domain»','«data.prefix»');
|
||||
</script>
|
||||
</html>
|
||||
@@ -35,6 +35,10 @@
|
||||
<input type="checkbox" name="hide_receivers">
|
||||
Hide receivers (using BCC)
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="archive">
|
||||
Collect messages in public archive
|
||||
</label>
|
||||
<button type="submit">Save</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -27,6 +27,11 @@ function hideList(listEmail){
|
||||
$.post('/api/list/hide',{list:listEmail},showListResult,'json');
|
||||
}
|
||||
|
||||
function loadArchive(domain,prefix){
|
||||
let listEmail = prefix+'@'+domain;
|
||||
$.get('/api/list/archive?list='+listEmail,showListArchive,'json');
|
||||
}
|
||||
|
||||
function loadListDetail(listEmail){
|
||||
$.post('/api/list/detail',{list:listEmail},showListDetail,'json');
|
||||
}
|
||||
@@ -55,13 +60,26 @@ function showList(listEmail){
|
||||
$.post('/api/list/show',{list:listEmail},showListResult,'json');
|
||||
}
|
||||
|
||||
function showListArchive(data){
|
||||
for (let time in data.archive){
|
||||
let post = data.archive[time];
|
||||
let row = $('<tr/>');
|
||||
var url = 'post?id='+post.id;
|
||||
$('<td/>').html('<a href="'+url+'">'+new Date(post.date)+'</a>').appendTo(row);
|
||||
$('<td/>').html('<a href="'+url+'">'+post.from_name+'</a>').appendTo(row);
|
||||
$('<td/>').html('<a href="'+url+'">'+post.subject+'</a>').appendTo(row);
|
||||
row.appendTo($('#archive'));
|
||||
console.log(post);
|
||||
}
|
||||
}
|
||||
|
||||
function showListDetail(data){
|
||||
console.log(data);
|
||||
if (data.forward_from) $('input[name="forward_from"]').prop('checked',true);
|
||||
if (data.forward_attached) $('input[name="forward_attached"]').prop('checked',true);
|
||||
if (data.hide_receivers) $('input[name="hide_receivers"]').prop('checked',true);
|
||||
if (data.reply_to_list) $('input[name="reply_to_list"]').prop('checked',true);
|
||||
if (data.open) $('input[name="open"]').prop('checked',true);
|
||||
if (data.archive) $('input[name="archive"]').prop('checked',true);
|
||||
}
|
||||
|
||||
function showListOfEditableLists(data){
|
||||
@@ -112,7 +130,7 @@ function showListList(data){
|
||||
for (let i in data.lists){
|
||||
let list = data.lists[i];
|
||||
let row = $('<tr/>');
|
||||
$('<td/>').text(list.name).appendTo(row);
|
||||
$('<td/>').html('<a href="archive?prefix='+list.email.prefix+'&domain='+list.email.domain+'">'+list.name+'</a>').appendTo(row);
|
||||
$('<td/>',{class:'right'}).text(list.email.prefix).appendTo(row);
|
||||
$('<td/>',{class:'right'}).text('@').appendTo(row);
|
||||
$('<td/>').text(list.email.domain).appendTo(row);
|
||||
|
||||
34
static/templates/post.st
Normal file
34
static/templates/post.st
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="jquery"></script>
|
||||
<script src="js"></script>
|
||||
<link rel="stylesheet" href="css" />
|
||||
</head>
|
||||
<body>
|
||||
«navigation()»
|
||||
«userinfo()»
|
||||
«messages()»
|
||||
<h1>Widerhall Archive:</h1>
|
||||
<table id="post">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<td>«data.date»</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<td>«data.from_name»</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Subject</th>
|
||||
<td>«data.subject»</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Content</th>
|
||||
<td><pre>«data.text»</pre></td>
|
||||
</tr>
|
||||
</table>
|
||||
«footer()»
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user