SMTP-Queue: streamline redisplaying
authorWilfried Goesgens <dothebart@citadel.org>
Mon, 9 Jul 2012 12:14:41 +0000 (14:14 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Mon, 9 Jul 2012 12:14:41 +0000 (14:14 +0200)
  - on delete, display important message, and trigger re-display of the queue
  - re-add the refresh button which re-loads the page
  - add ListOnly=yes to output just the table to replace not the full document.

webcit/smtpqueue.c
webcit/static/t/view_mailq/footer.html
webcit/static/t/view_mailq/footer_empty.html
webcit/static/t/view_mailq/footer_listonly.html [new file with mode: 0644]
webcit/static/t/view_mailq/header.html
webcit/static/t/view_mailq/table.html [new file with mode: 0644]
webcit/static/wclib.js

index 0ce44e3281f6f169a1aa14dd760799525093475d..360886380e69347663f08b1a9fd24a153c83a791 100644 (file)
@@ -311,7 +311,10 @@ ServerStartModule_SMTP_QUEUE
 
 int qview_PrintPageHeader(SharedMessageStatus *Stat, void **ViewSpecific)
 {
-       output_headers(1, 1, 1, 0, 0, 0);
+       if (yesbstr("ListOnly"))
+               output_headers(1, 0, 0, 0, 0, 0);
+       else
+               output_headers(1, 1, 1, 0, 0, 0);
        return 0;
 }
 
@@ -333,7 +336,10 @@ int qview_GetParamsGetServerCall(SharedMessageStatus *Stat,
        else {
                snprintf(cmd, len, "MSGS ALL|0|1");
                snprintf(filter, flen, "SUBJ|QMSG");
-               DoTemplate(HKEY("view_mailq_header"), NULL, NULL);
+               if (yesbstr("ListOnly"))
+                       DoTemplate(HKEY("view_mailq_table"), NULL, NULL);
+               else
+                       DoTemplate(HKEY("view_mailq_header"), NULL, NULL);
                return 200;
        }
 }
@@ -364,16 +370,22 @@ int qview_RenderView_or_Tail(SharedMessageStatus *Stat,
        wcsession *WCC = WC;
        WCTemplputParams SubTP;
 
-       if (GetCount(WCC->summ) == 0)
-               DoTemplate(HKEY("view_mailq_footer_empty"),NULL, &SubTP);
+       if (yesbstr("ListOnly"))
+               DoTemplate(HKEY("view_mailq_footer_listonly"),NULL, &SubTP);
        else
-               DoTemplate(HKEY("view_mailq_footer"),NULL, &SubTP);
-       
+       {
+               if (GetCount(WCC->summ) == 0)
+                       DoTemplate(HKEY("view_mailq_footer_empty"),NULL, &SubTP);
+               else
+                       DoTemplate(HKEY("view_mailq_footer"),NULL, &SubTP);
+       }
+
        return 0;
 }
 int qview_Cleanup(void **ViewSpecific)
 {
-       wDumpContent(1);
+       
+       wDumpContent(yesbstr("ListOnly")?0:1);
        return 0;
 }
 
index 2880a2b4673d5ec423ae15832f00973410629a71..d6c5574b5e5945e3cc79c66e5848823a3a18bfe3 100644 (file)
@@ -1,7 +1,7 @@
-</table>
-
+</table></div>
 <?!("COND:AIDE", 1)>
 <br><br><div align="center">
 <?_("You do not have permission to view this resource.")>
 </div><br><br>
 <?!("X", 1)>
+</div>
index 52e2324b687fa2f9449bb0b071a23e575bf931ae..50ac5ad051920f017c61188571595da18665d46b 100644 (file)
@@ -1,5 +1,5 @@
 </table>
-
+</div>
 <br><br><div align="center">
 <?_("The queue is empty.")>
 </div><br><br>
diff --git a/webcit/static/t/view_mailq/footer_listonly.html b/webcit/static/t/view_mailq/footer_listonly.html
new file mode 100644 (file)
index 0000000..bdcc76e
--- /dev/null
@@ -0,0 +1 @@
+</table></div>
index 98cd3be6f901b18699ef9b5ace0fe28514bdcf5b..20e5ce3e4ef1ad39250bfba4867a96a8d1b2547e 100644 (file)
 <br><a href="javascript:SMTPRunQueue();"><?_("Reschedule all messages for delivery on next queue run")></a>
 </div>
 
-<table class="mailbox_summary" rules=rows cellpadding=2 style="width:100%%;">
-<tr><td><b><i>
-<?_("Message ID")>
-</i></b></td><td><b><i>
-<?_("Date/time submitted")>
-</i></b></td><td><b><i>
-<?_("Next attempt")>
-</i></b></td><td><b><i>
-<?_("Sender")>
-</i></b></td><td><b><i>
-<?_("Recipients")>
-</i></b></td></tr>
+<div align="center">
+<a href="javascript:RefreshSMTPqueueDisplay();"><?_("Refresh this page")></a>
+</div>
 
+<?=("view_mailq_table">
diff --git a/webcit/static/t/view_mailq/table.html b/webcit/static/t/view_mailq/table.html
new file mode 100644 (file)
index 0000000..4d036e4
--- /dev/null
@@ -0,0 +1,13 @@
+<div id="mailqueue_list">
+<table class="mailbox_summary" rules=rows cellpadding=2 style="width:100%%;">
+<tr><td><b><i>
+<?_("Message ID")>
+</i></b></td><td><b><i>
+<?_("Date/time submitted")>
+</i></b></td><td><b><i>
+<?_("Next attempt")>
+</i></b></td><td><b><i>
+<?_("Sender")>
+</i></b></td><td><b><i>
+<?_("Recipients")>
+</i></b></td></tr>
index 63215312651561e41a4bafb202fa8ab0cb10db5d..fb828a6836803435ff0cee8afa5ba64420dbadb1 100644 (file)
@@ -931,8 +931,8 @@ function WCLog(msg) {
 }
 
 function RefreshSMTPqueueDisplay() {
-       new Ajax.Updater('smtpqueue_inner_div',
-       'display_smtpqueue_inner_div', { method: 'get',
+       new Ajax.Updater('mailqueue_list',
+       'dotskip?room=__CitadelSMTPspoolout__&view=11&ListOnly=yes', { method: 'get',
                parameters: Math.random() } );
 }
 
@@ -942,7 +942,7 @@ function DeleteSMTPqueueMsg(msgnum1, msgnum2) {
                'ajax_servcmd', {
                        method: 'post',
                        parameters: p,
-                       onComplete: RefreshSMTPqueueDisplay()
+                       onComplete: function(transport) { ajax_important_message(transport.responseText.substr(4)); RefreshSMTPqueueDisplay();}
                }
        );
 }