Fossil SCM

Rename the /msgtoadmin page to /contact_admin. Improvements to the setup pages for notifications.

drh 2018-07-11 20:37 trunk
Commit 9830d7cbedf0e379ba67fc933acddb2a87f95e922def239afb4e53da77c3cb2b
1 file changed +23 -13
+23 -13
--- src/email.c
+++ src/email.c
@@ -202,10 +202,11 @@
202202
return;
203203
}
204204
db_begin_transaction();
205205
206206
email_submenu_common();
207
+ style_submenu_element("Send Announcement","%R/announce");
207208
style_header("Email Notification Setup");
208209
@ <form action="%R/setup_notification" method="post"><div>
209210
@ <input type="submit" name="submit" value="Apply Changes" /><hr>
210211
login_insert_csrf_secret();
211212
@@ -246,33 +247,35 @@
246247
@ <hr>
247248
248249
multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
249250
"off", count(azSendMethods)/2, azSendMethods);
250251
@ <p>How to send email. Requires auxiliary information from the fields
251
- @ that follow. (Property: "email-send-method")</p>
252
+ @ that follow. Hint: Use the <a href="%R/announce">/announce</a> page
253
+ @ to send test message to debug this setting.
254
+ @ (Property: "email-send-method")</p>
252255
email_schema(1);
253
- entry_attribute("Command To Pipe Email To", 60, "email-send-command",
256
+ entry_attribute("Pipe Email Text Into This Command", 60, "email-send-command",
254257
"ecmd", "sendmail -t", 0);
255258
@ <p>When the send method is "pipe to a command", this is the command
256259
@ that is run. Email messages are piped into the standard input of this
257260
@ command. The command is expected to extract the sender address,
258261
@ recepient addresses, and subject from the header of the piped email
259262
@ text. (Property: "email-send-command")</p>
260263
261
- entry_attribute("Database In Which To Store Email", 60, "email-send-db",
264
+ entry_attribute("Store Emails In This Database", 60, "email-send-db",
262265
"esdb", "", 0);
263266
@ <p>When the send method is "store in a databaes", each email message is
264267
@ stored in an SQLite database file with the name given here.
265268
@ (Property: "email-send-db")</p>
266269
267
- entry_attribute("Directory In Which To Store Email", 60, "email-send-dir",
270
+ entry_attribute("Store Emails In This Directory", 60, "email-send-dir",
268271
"esdir", "", 0);
269272
@ <p>When the send method is "store in a directory", each email message is
270273
@ stored as a separate file in the directory shown here.
271274
@ (Property: "email-send-dir")</p>
272275
273
- entry_attribute("SMTP relay host", 60, "email-send-relayhost",
276
+ entry_attribute("SMTP Relay Host", 60, "email-send-relayhost",
274277
"esrh", "", 0);
275278
@ <p>When the send method is "SMTP relay", each email message is
276279
@ transmitted via the SMTP protocol (rfc5321) to a "Mail Submission
277280
@ Agent" or "MSA" (rfc4409) at the hostname shown here. Optionally
278281
@ append a colon and TCP port number (ex: smtp.example.com:587).
@@ -1715,10 +1718,14 @@
17151718
" sdigest," /* 5 */
17161719
" date(sctime,'unixepoch')," /* 6 */
17171720
" julianday(mtime,'unixepoch')" /* 7 */
17181721
" FROM subscriber"
17191722
);
1723
+ if( P("only")!=0 ){
1724
+ blob_append_sql(&sql, " WHERE ssub LIKE '%%%q%%'", P("only"));
1725
+ style_submenu_element("Show All","%R/subscribers");
1726
+ }
17201727
db_prepare_blob(&q, &sql);
17211728
rNow = db_double(0.0,"SELECT julianday('now')");
17221729
@ <table border="1">
17231730
@ <tr>
17241731
@ <th>Email
@@ -2069,24 +2076,25 @@
20692076
autoexec_done:
20702077
db_end_transaction(0);
20712078
}
20722079
20732080
/*
2074
-** WEBPAGE: msgtoadmin
2081
+** WEBPAGE: contact_admin
20752082
**
2076
-** A web-form to send a message to the repository administrator.
2083
+** A web-form to send an email message to the repository administrator,
2084
+** or (with appropriate permissions) to anybody.
20772085
*/
2078
-void msgtoadmin_page(void){
2086
+void contact_admin_page(void){
20792087
const char *zAdminEmail = db_get("email-admin",0);
20802088
unsigned int uSeed;
20812089
const char *zDecoded;
20822090
char *zCaptcha = 0;
20832091
20842092
login_check_credentials();
20852093
if( zAdminEmail==0 || zAdminEmail[0]==0 ){
2086
- style_header("Admin Messaging Disabled");
2087
- @ <p>Messages to the administrator are disabled on this repository
2094
+ style_header("Outbound Email Disabled");
2095
+ @ <p>Outbound email is disabled on this repository
20882096
style_footer();
20892097
return;
20902098
}
20912099
if( P("submit")!=0
20922100
&& P("subject")!=0
@@ -2124,11 +2132,11 @@
21242132
uSeed = captcha_seed();
21252133
zDecoded = captcha_decode(uSeed);
21262134
zCaptcha = captcha_render(zDecoded);
21272135
}
21282136
style_header("Message To Administrator");
2129
- form_begin(0, "%R/msgtoadmin");
2137
+ form_begin(0, "%R/contact_admin");
21302138
@ <p>Enter a message to the repository administrator below:</p>
21312139
@ <table class="subscribe">
21322140
if( zCaptcha ){
21332141
@ <tr>
21342142
@ <td class="form_label">Security&nbsp;Code:</td>
@@ -2271,13 +2279,15 @@
22712279
const char *allck = all ? "checked" : "";
22722280
@ <tr>
22732281
@ <td class="form_label">To:</td>
22742282
@ <td><input type="text" name="to" value="%h(PT("to"))" size="30"><br>
22752283
@ <label><input type="checkbox" name="aa" %s(aack)> \
2276
- @ All "announcement" subscribers</label><br>
2284
+ @ All "announcement" subscribers</label> \
2285
+ @ <a href="%R/subscribers?only=a" target="_blank">(list)</a><br>
22772286
@ <label><input type="checkbox" name="all" %s(allck)> \
2278
- @ All subscribers</label></td>
2287
+ @ All subscribers</label> \
2288
+ @ <a href="%R/subscribers" target="_blank">(list)</a><br></td>
22792289
@ </tr>
22802290
}
22812291
@ <tr>
22822292
@ <td class="form_label">Subject:</td>
22832293
@ <td><input type="text" name="subject" value="%h(PT("subject"))"\
22842294
--- src/email.c
+++ src/email.c
@@ -202,10 +202,11 @@
202 return;
203 }
204 db_begin_transaction();
205
206 email_submenu_common();
 
207 style_header("Email Notification Setup");
208 @ <form action="%R/setup_notification" method="post"><div>
209 @ <input type="submit" name="submit" value="Apply Changes" /><hr>
210 login_insert_csrf_secret();
211
@@ -246,33 +247,35 @@
246 @ <hr>
247
248 multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
249 "off", count(azSendMethods)/2, azSendMethods);
250 @ <p>How to send email. Requires auxiliary information from the fields
251 @ that follow. (Property: "email-send-method")</p>
 
 
252 email_schema(1);
253 entry_attribute("Command To Pipe Email To", 60, "email-send-command",
254 "ecmd", "sendmail -t", 0);
255 @ <p>When the send method is "pipe to a command", this is the command
256 @ that is run. Email messages are piped into the standard input of this
257 @ command. The command is expected to extract the sender address,
258 @ recepient addresses, and subject from the header of the piped email
259 @ text. (Property: "email-send-command")</p>
260
261 entry_attribute("Database In Which To Store Email", 60, "email-send-db",
262 "esdb", "", 0);
263 @ <p>When the send method is "store in a databaes", each email message is
264 @ stored in an SQLite database file with the name given here.
265 @ (Property: "email-send-db")</p>
266
267 entry_attribute("Directory In Which To Store Email", 60, "email-send-dir",
268 "esdir", "", 0);
269 @ <p>When the send method is "store in a directory", each email message is
270 @ stored as a separate file in the directory shown here.
271 @ (Property: "email-send-dir")</p>
272
273 entry_attribute("SMTP relay host", 60, "email-send-relayhost",
274 "esrh", "", 0);
275 @ <p>When the send method is "SMTP relay", each email message is
276 @ transmitted via the SMTP protocol (rfc5321) to a "Mail Submission
277 @ Agent" or "MSA" (rfc4409) at the hostname shown here. Optionally
278 @ append a colon and TCP port number (ex: smtp.example.com:587).
@@ -1715,10 +1718,14 @@
1715 " sdigest," /* 5 */
1716 " date(sctime,'unixepoch')," /* 6 */
1717 " julianday(mtime,'unixepoch')" /* 7 */
1718 " FROM subscriber"
1719 );
 
 
 
 
1720 db_prepare_blob(&q, &sql);
1721 rNow = db_double(0.0,"SELECT julianday('now')");
1722 @ <table border="1">
1723 @ <tr>
1724 @ <th>Email
@@ -2069,24 +2076,25 @@
2069 autoexec_done:
2070 db_end_transaction(0);
2071 }
2072
2073 /*
2074 ** WEBPAGE: msgtoadmin
2075 **
2076 ** A web-form to send a message to the repository administrator.
 
2077 */
2078 void msgtoadmin_page(void){
2079 const char *zAdminEmail = db_get("email-admin",0);
2080 unsigned int uSeed;
2081 const char *zDecoded;
2082 char *zCaptcha = 0;
2083
2084 login_check_credentials();
2085 if( zAdminEmail==0 || zAdminEmail[0]==0 ){
2086 style_header("Admin Messaging Disabled");
2087 @ <p>Messages to the administrator are disabled on this repository
2088 style_footer();
2089 return;
2090 }
2091 if( P("submit")!=0
2092 && P("subject")!=0
@@ -2124,11 +2132,11 @@
2124 uSeed = captcha_seed();
2125 zDecoded = captcha_decode(uSeed);
2126 zCaptcha = captcha_render(zDecoded);
2127 }
2128 style_header("Message To Administrator");
2129 form_begin(0, "%R/msgtoadmin");
2130 @ <p>Enter a message to the repository administrator below:</p>
2131 @ <table class="subscribe">
2132 if( zCaptcha ){
2133 @ <tr>
2134 @ <td class="form_label">Security&nbsp;Code:</td>
@@ -2271,13 +2279,15 @@
2271 const char *allck = all ? "checked" : "";
2272 @ <tr>
2273 @ <td class="form_label">To:</td>
2274 @ <td><input type="text" name="to" value="%h(PT("to"))" size="30"><br>
2275 @ <label><input type="checkbox" name="aa" %s(aack)> \
2276 @ All "announcement" subscribers</label><br>
 
2277 @ <label><input type="checkbox" name="all" %s(allck)> \
2278 @ All subscribers</label></td>
 
2279 @ </tr>
2280 }
2281 @ <tr>
2282 @ <td class="form_label">Subject:</td>
2283 @ <td><input type="text" name="subject" value="%h(PT("subject"))"\
2284
--- src/email.c
+++ src/email.c
@@ -202,10 +202,11 @@
202 return;
203 }
204 db_begin_transaction();
205
206 email_submenu_common();
207 style_submenu_element("Send Announcement","%R/announce");
208 style_header("Email Notification Setup");
209 @ <form action="%R/setup_notification" method="post"><div>
210 @ <input type="submit" name="submit" value="Apply Changes" /><hr>
211 login_insert_csrf_secret();
212
@@ -246,33 +247,35 @@
247 @ <hr>
248
249 multiple_choice_attribute("Email Send Method", "email-send-method", "esm",
250 "off", count(azSendMethods)/2, azSendMethods);
251 @ <p>How to send email. Requires auxiliary information from the fields
252 @ that follow. Hint: Use the <a href="%R/announce">/announce</a> page
253 @ to send test message to debug this setting.
254 @ (Property: "email-send-method")</p>
255 email_schema(1);
256 entry_attribute("Pipe Email Text Into This Command", 60, "email-send-command",
257 "ecmd", "sendmail -t", 0);
258 @ <p>When the send method is "pipe to a command", this is the command
259 @ that is run. Email messages are piped into the standard input of this
260 @ command. The command is expected to extract the sender address,
261 @ recepient addresses, and subject from the header of the piped email
262 @ text. (Property: "email-send-command")</p>
263
264 entry_attribute("Store Emails In This Database", 60, "email-send-db",
265 "esdb", "", 0);
266 @ <p>When the send method is "store in a databaes", each email message is
267 @ stored in an SQLite database file with the name given here.
268 @ (Property: "email-send-db")</p>
269
270 entry_attribute("Store Emails In This Directory", 60, "email-send-dir",
271 "esdir", "", 0);
272 @ <p>When the send method is "store in a directory", each email message is
273 @ stored as a separate file in the directory shown here.
274 @ (Property: "email-send-dir")</p>
275
276 entry_attribute("SMTP Relay Host", 60, "email-send-relayhost",
277 "esrh", "", 0);
278 @ <p>When the send method is "SMTP relay", each email message is
279 @ transmitted via the SMTP protocol (rfc5321) to a "Mail Submission
280 @ Agent" or "MSA" (rfc4409) at the hostname shown here. Optionally
281 @ append a colon and TCP port number (ex: smtp.example.com:587).
@@ -1715,10 +1718,14 @@
1718 " sdigest," /* 5 */
1719 " date(sctime,'unixepoch')," /* 6 */
1720 " julianday(mtime,'unixepoch')" /* 7 */
1721 " FROM subscriber"
1722 );
1723 if( P("only")!=0 ){
1724 blob_append_sql(&sql, " WHERE ssub LIKE '%%%q%%'", P("only"));
1725 style_submenu_element("Show All","%R/subscribers");
1726 }
1727 db_prepare_blob(&q, &sql);
1728 rNow = db_double(0.0,"SELECT julianday('now')");
1729 @ <table border="1">
1730 @ <tr>
1731 @ <th>Email
@@ -2069,24 +2076,25 @@
2076 autoexec_done:
2077 db_end_transaction(0);
2078 }
2079
2080 /*
2081 ** WEBPAGE: contact_admin
2082 **
2083 ** A web-form to send an email message to the repository administrator,
2084 ** or (with appropriate permissions) to anybody.
2085 */
2086 void contact_admin_page(void){
2087 const char *zAdminEmail = db_get("email-admin",0);
2088 unsigned int uSeed;
2089 const char *zDecoded;
2090 char *zCaptcha = 0;
2091
2092 login_check_credentials();
2093 if( zAdminEmail==0 || zAdminEmail[0]==0 ){
2094 style_header("Outbound Email Disabled");
2095 @ <p>Outbound email is disabled on this repository
2096 style_footer();
2097 return;
2098 }
2099 if( P("submit")!=0
2100 && P("subject")!=0
@@ -2124,11 +2132,11 @@
2132 uSeed = captcha_seed();
2133 zDecoded = captcha_decode(uSeed);
2134 zCaptcha = captcha_render(zDecoded);
2135 }
2136 style_header("Message To Administrator");
2137 form_begin(0, "%R/contact_admin");
2138 @ <p>Enter a message to the repository administrator below:</p>
2139 @ <table class="subscribe">
2140 if( zCaptcha ){
2141 @ <tr>
2142 @ <td class="form_label">Security&nbsp;Code:</td>
@@ -2271,13 +2279,15 @@
2279 const char *allck = all ? "checked" : "";
2280 @ <tr>
2281 @ <td class="form_label">To:</td>
2282 @ <td><input type="text" name="to" value="%h(PT("to"))" size="30"><br>
2283 @ <label><input type="checkbox" name="aa" %s(aack)> \
2284 @ All "announcement" subscribers</label> \
2285 @ <a href="%R/subscribers?only=a" target="_blank">(list)</a><br>
2286 @ <label><input type="checkbox" name="all" %s(allck)> \
2287 @ All subscribers</label> \
2288 @ <a href="%R/subscribers" target="_blank">(list)</a><br></td>
2289 @ </tr>
2290 }
2291 @ <tr>
2292 @ <td class="form_label">Subject:</td>
2293 @ <td><input type="text" name="subject" value="%h(PT("subject"))"\
2294

Keyboard Shortcuts

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