Fossil SCM

Add the /emailoutq page, accessible only by the administrator.

drh 2018-08-17 14:24 trunk
Commit ca732777c4a0c1655da9bed0bc544c1d5fd1f560a96128c7446e7afe6d769091
1 file changed +66 -6
+66 -6
--- src/webmail.c
+++ src/webmail.c
@@ -821,17 +821,19 @@
821821
const char *zContent = db_column_text(&q, 0);
822822
@ <pre>%h(zContent)</pre>
823823
}
824824
db_finalize(&q);
825825
}else{
826
+ style_submenu_element("emailoutq table","%R/emailoutq");
826827
db_prepare(&q,
827828
"SELECT emailid, enref, ets, datetime(etime,'unixepoch'), esz,"
828829
" length(etxt)"
829830
" FROM emailblob ORDER BY etime DESC, emailid DESC");
830
- @ <table border="1" cellpadding="5" cellspacing="0">
831
- @ <tr><th> emailid <th> enref <th> ets <th> etime \
832
- @ <th> uncompressed <th> compressed </tr>
831
+ @ <table border="1" cellpadding="5" cellspacing="0" class="sortable" \
832
+ @ data-column-types='nnntkk'>
833
+ @ <thead><tr><th> emailid <th> enref <th> ets <th> etime \
834
+ @ <th> uncompressed <th> compressed </tr></thead><tbody>
833835
while( db_step(&q)==SQLITE_ROW ){
834836
int id = db_column_int(&q, 0);
835837
int nref = db_column_int(&q, 1);
836838
int ets = db_column_int(&q, 2);
837839
const char *zDate = db_column_text(&q, 3);
@@ -844,14 +846,72 @@
844846
@ <td align="right">%d(ets)</td>
845847
}else{
846848
@ <td>&nbsp;</td>
847849
}
848850
@ <td>%h(zDate)</td>
849
- @ <td align="right">%,d(sz)</td>
850
- @ <td align="right">%,d(csz)</td>
851
+ @ <td align="right" data-sortkey='%08x(sz)'>%,d(sz)</td>
852
+ @ <td align="right" data-sortkey='%08x(csz)'>%,d(csz)</td>
851853
@ </tr>
852854
}
853
- @ </table>
855
+ @ </tbody></table>
854856
db_finalize(&q);
857
+ style_table_sorter();
858
+ }
859
+ style_footer();
860
+}
861
+
862
+/*
863
+** WEBPAGE: emailoutq
864
+**
865
+** This page, accessible only to administrators, allows easy viewing of
866
+** the emailoutq table - the table that contains the email messages
867
+** that are queued for transmission via SMTP.
868
+*/
869
+void webmail_emailoutq_page(void){
870
+ Stmt q;
871
+ login_check_credentials();
872
+ if( !g.perm.Setup ){
873
+ login_needed(0);
874
+ return;
875
+ }
876
+ add_content_sql_commands(g.db);
877
+ style_header("emailoutq table");
878
+ style_submenu_element("emailblob table","%R/emailblob");
879
+ db_prepare(&q,
880
+ "SELECT edomain, efrom, eto, emsgid, "
881
+ " datetime(ectime,'unixepoch'),"
882
+ " datetime(nullif(emtime,0),'unixepoch'),"
883
+ " ensend, ets"
884
+ " FROM emailoutq"
885
+ );
886
+ @ <table border="1" cellpadding="5" cellspacing="0" class="sortable" \
887
+ @ data-column-types='tttnttnn'>
888
+ @ <thead><tr><th> edomain <th> efrom <th> eto <th> emsgid \
889
+ @ <th> ectime <th> emtime <th> ensend <th> ets </tr></thead><tbody>
890
+ while( db_step(&q)==SQLITE_ROW ){
891
+ const char *zDomain = db_column_text(&q, 0);
892
+ const char *zFrom = db_column_text(&q, 1);
893
+ const char *zTo = db_column_text(&q, 2);
894
+ int emsgid = db_column_int(&q, 3);
895
+ const char *zCTime = db_column_text(&q, 4);
896
+ const char *zMTime = db_column_text(&q, 5);
897
+ int ensend = db_column_int(&q, 6);
898
+ int ets = db_column_int(&q, 7);
899
+ @ <tr>
900
+ @ <td>%h(zDomain)
901
+ @ <td>%h(zFrom)
902
+ @ <td>%h(zTo)
903
+ @ <td align="right"><a href="%R/emailblob?id=%d(emsgid)">%d(emsgid)</a>
904
+ @ <td>%h(zCTime)
905
+ @ <td>%h(zMTime)
906
+ @ <td align="right">%d(ensend)
907
+ if( ets>0 ){
908
+ @ <td align="right"><a href="%R/emailblob?id=%d(ets)">%d(ets)</a></td>
909
+ }else{
910
+ @ <td>&nbsp;</td>
911
+ }
855912
}
913
+ @ </tbody></table>
914
+ db_finalize(&q);
915
+ style_table_sorter();
856916
style_footer();
857917
}
858918
--- src/webmail.c
+++ src/webmail.c
@@ -821,17 +821,19 @@
821 const char *zContent = db_column_text(&q, 0);
822 @ <pre>%h(zContent)</pre>
823 }
824 db_finalize(&q);
825 }else{
 
826 db_prepare(&q,
827 "SELECT emailid, enref, ets, datetime(etime,'unixepoch'), esz,"
828 " length(etxt)"
829 " FROM emailblob ORDER BY etime DESC, emailid DESC");
830 @ <table border="1" cellpadding="5" cellspacing="0">
831 @ <tr><th> emailid <th> enref <th> ets <th> etime \
832 @ <th> uncompressed <th> compressed </tr>
 
833 while( db_step(&q)==SQLITE_ROW ){
834 int id = db_column_int(&q, 0);
835 int nref = db_column_int(&q, 1);
836 int ets = db_column_int(&q, 2);
837 const char *zDate = db_column_text(&q, 3);
@@ -844,14 +846,72 @@
844 @ <td align="right">%d(ets)</td>
845 }else{
846 @ <td>&nbsp;</td>
847 }
848 @ <td>%h(zDate)</td>
849 @ <td align="right">%,d(sz)</td>
850 @ <td align="right">%,d(csz)</td>
851 @ </tr>
852 }
853 @ </table>
854 db_finalize(&q);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
855 }
 
 
 
856 style_footer();
857 }
858
--- src/webmail.c
+++ src/webmail.c
@@ -821,17 +821,19 @@
821 const char *zContent = db_column_text(&q, 0);
822 @ <pre>%h(zContent)</pre>
823 }
824 db_finalize(&q);
825 }else{
826 style_submenu_element("emailoutq table","%R/emailoutq");
827 db_prepare(&q,
828 "SELECT emailid, enref, ets, datetime(etime,'unixepoch'), esz,"
829 " length(etxt)"
830 " FROM emailblob ORDER BY etime DESC, emailid DESC");
831 @ <table border="1" cellpadding="5" cellspacing="0" class="sortable" \
832 @ data-column-types='nnntkk'>
833 @ <thead><tr><th> emailid <th> enref <th> ets <th> etime \
834 @ <th> uncompressed <th> compressed </tr></thead><tbody>
835 while( db_step(&q)==SQLITE_ROW ){
836 int id = db_column_int(&q, 0);
837 int nref = db_column_int(&q, 1);
838 int ets = db_column_int(&q, 2);
839 const char *zDate = db_column_text(&q, 3);
@@ -844,14 +846,72 @@
846 @ <td align="right">%d(ets)</td>
847 }else{
848 @ <td>&nbsp;</td>
849 }
850 @ <td>%h(zDate)</td>
851 @ <td align="right" data-sortkey='%08x(sz)'>%,d(sz)</td>
852 @ <td align="right" data-sortkey='%08x(csz)'>%,d(csz)</td>
853 @ </tr>
854 }
855 @ </tbody></table>
856 db_finalize(&q);
857 style_table_sorter();
858 }
859 style_footer();
860 }
861
862 /*
863 ** WEBPAGE: emailoutq
864 **
865 ** This page, accessible only to administrators, allows easy viewing of
866 ** the emailoutq table - the table that contains the email messages
867 ** that are queued for transmission via SMTP.
868 */
869 void webmail_emailoutq_page(void){
870 Stmt q;
871 login_check_credentials();
872 if( !g.perm.Setup ){
873 login_needed(0);
874 return;
875 }
876 add_content_sql_commands(g.db);
877 style_header("emailoutq table");
878 style_submenu_element("emailblob table","%R/emailblob");
879 db_prepare(&q,
880 "SELECT edomain, efrom, eto, emsgid, "
881 " datetime(ectime,'unixepoch'),"
882 " datetime(nullif(emtime,0),'unixepoch'),"
883 " ensend, ets"
884 " FROM emailoutq"
885 );
886 @ <table border="1" cellpadding="5" cellspacing="0" class="sortable" \
887 @ data-column-types='tttnttnn'>
888 @ <thead><tr><th> edomain <th> efrom <th> eto <th> emsgid \
889 @ <th> ectime <th> emtime <th> ensend <th> ets </tr></thead><tbody>
890 while( db_step(&q)==SQLITE_ROW ){
891 const char *zDomain = db_column_text(&q, 0);
892 const char *zFrom = db_column_text(&q, 1);
893 const char *zTo = db_column_text(&q, 2);
894 int emsgid = db_column_int(&q, 3);
895 const char *zCTime = db_column_text(&q, 4);
896 const char *zMTime = db_column_text(&q, 5);
897 int ensend = db_column_int(&q, 6);
898 int ets = db_column_int(&q, 7);
899 @ <tr>
900 @ <td>%h(zDomain)
901 @ <td>%h(zFrom)
902 @ <td>%h(zTo)
903 @ <td align="right"><a href="%R/emailblob?id=%d(emsgid)">%d(emsgid)</a>
904 @ <td>%h(zCTime)
905 @ <td>%h(zMTime)
906 @ <td align="right">%d(ensend)
907 if( ets>0 ){
908 @ <td align="right"><a href="%R/emailblob?id=%d(ets)">%d(ets)</a></td>
909 }else{
910 @ <td>&nbsp;</td>
911 }
912 }
913 @ </tbody></table>
914 db_finalize(&q);
915 style_table_sorter();
916 style_footer();
917 }
918

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button