Fossil SCM
Rename the /msgtoadmin page to /contact_admin. Improvements to the setup pages for notifications.
Commit
9830d7cbedf0e379ba67fc933acddb2a87f95e922def239afb4e53da77c3cb2b
Parent
0a201f7159b8833…
1 file changed
+23
-13
+23
-13
| --- src/email.c | ||
| +++ src/email.c | ||
| @@ -202,10 +202,11 @@ | ||
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | db_begin_transaction(); |
| 205 | 205 | |
| 206 | 206 | email_submenu_common(); |
| 207 | + style_submenu_element("Send Announcement","%R/announce"); | |
| 207 | 208 | style_header("Email Notification Setup"); |
| 208 | 209 | @ <form action="%R/setup_notification" method="post"><div> |
| 209 | 210 | @ <input type="submit" name="submit" value="Apply Changes" /><hr> |
| 210 | 211 | login_insert_csrf_secret(); |
| 211 | 212 | |
| @@ -246,33 +247,35 @@ | ||
| 246 | 247 | @ <hr> |
| 247 | 248 | |
| 248 | 249 | multiple_choice_attribute("Email Send Method", "email-send-method", "esm", |
| 249 | 250 | "off", count(azSendMethods)/2, azSendMethods); |
| 250 | 251 | @ <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> | |
| 252 | 255 | 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", | |
| 254 | 257 | "ecmd", "sendmail -t", 0); |
| 255 | 258 | @ <p>When the send method is "pipe to a command", this is the command |
| 256 | 259 | @ that is run. Email messages are piped into the standard input of this |
| 257 | 260 | @ command. The command is expected to extract the sender address, |
| 258 | 261 | @ recepient addresses, and subject from the header of the piped email |
| 259 | 262 | @ text. (Property: "email-send-command")</p> |
| 260 | 263 | |
| 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", | |
| 262 | 265 | "esdb", "", 0); |
| 263 | 266 | @ <p>When the send method is "store in a databaes", each email message is |
| 264 | 267 | @ stored in an SQLite database file with the name given here. |
| 265 | 268 | @ (Property: "email-send-db")</p> |
| 266 | 269 | |
| 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", | |
| 268 | 271 | "esdir", "", 0); |
| 269 | 272 | @ <p>When the send method is "store in a directory", each email message is |
| 270 | 273 | @ stored as a separate file in the directory shown here. |
| 271 | 274 | @ (Property: "email-send-dir")</p> |
| 272 | 275 | |
| 273 | - entry_attribute("SMTP relay host", 60, "email-send-relayhost", | |
| 276 | + entry_attribute("SMTP Relay Host", 60, "email-send-relayhost", | |
| 274 | 277 | "esrh", "", 0); |
| 275 | 278 | @ <p>When the send method is "SMTP relay", each email message is |
| 276 | 279 | @ transmitted via the SMTP protocol (rfc5321) to a "Mail Submission |
| 277 | 280 | @ Agent" or "MSA" (rfc4409) at the hostname shown here. Optionally |
| 278 | 281 | @ append a colon and TCP port number (ex: smtp.example.com:587). |
| @@ -1715,10 +1718,14 @@ | ||
| 1715 | 1718 | " sdigest," /* 5 */ |
| 1716 | 1719 | " date(sctime,'unixepoch')," /* 6 */ |
| 1717 | 1720 | " julianday(mtime,'unixepoch')" /* 7 */ |
| 1718 | 1721 | " FROM subscriber" |
| 1719 | 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 | + } | |
| 1720 | 1727 | db_prepare_blob(&q, &sql); |
| 1721 | 1728 | rNow = db_double(0.0,"SELECT julianday('now')"); |
| 1722 | 1729 | @ <table border="1"> |
| 1723 | 1730 | @ <tr> |
| 1724 | 1731 | @ <th>Email |
| @@ -2069,24 +2076,25 @@ | ||
| 2069 | 2076 | autoexec_done: |
| 2070 | 2077 | db_end_transaction(0); |
| 2071 | 2078 | } |
| 2072 | 2079 | |
| 2073 | 2080 | /* |
| 2074 | -** WEBPAGE: msgtoadmin | |
| 2081 | +** WEBPAGE: contact_admin | |
| 2075 | 2082 | ** |
| 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. | |
| 2077 | 2085 | */ |
| 2078 | -void msgtoadmin_page(void){ | |
| 2086 | +void contact_admin_page(void){ | |
| 2079 | 2087 | const char *zAdminEmail = db_get("email-admin",0); |
| 2080 | 2088 | unsigned int uSeed; |
| 2081 | 2089 | const char *zDecoded; |
| 2082 | 2090 | char *zCaptcha = 0; |
| 2083 | 2091 | |
| 2084 | 2092 | login_check_credentials(); |
| 2085 | 2093 | 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 | |
| 2088 | 2096 | style_footer(); |
| 2089 | 2097 | return; |
| 2090 | 2098 | } |
| 2091 | 2099 | if( P("submit")!=0 |
| 2092 | 2100 | && P("subject")!=0 |
| @@ -2124,11 +2132,11 @@ | ||
| 2124 | 2132 | uSeed = captcha_seed(); |
| 2125 | 2133 | zDecoded = captcha_decode(uSeed); |
| 2126 | 2134 | zCaptcha = captcha_render(zDecoded); |
| 2127 | 2135 | } |
| 2128 | 2136 | style_header("Message To Administrator"); |
| 2129 | - form_begin(0, "%R/msgtoadmin"); | |
| 2137 | + form_begin(0, "%R/contact_admin"); | |
| 2130 | 2138 | @ <p>Enter a message to the repository administrator below:</p> |
| 2131 | 2139 | @ <table class="subscribe"> |
| 2132 | 2140 | if( zCaptcha ){ |
| 2133 | 2141 | @ <tr> |
| 2134 | 2142 | @ <td class="form_label">Security Code:</td> |
| @@ -2271,13 +2279,15 @@ | ||
| 2271 | 2279 | const char *allck = all ? "checked" : ""; |
| 2272 | 2280 | @ <tr> |
| 2273 | 2281 | @ <td class="form_label">To:</td> |
| 2274 | 2282 | @ <td><input type="text" name="to" value="%h(PT("to"))" size="30"><br> |
| 2275 | 2283 | @ <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> | |
| 2277 | 2286 | @ <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> | |
| 2279 | 2289 | @ </tr> |
| 2280 | 2290 | } |
| 2281 | 2291 | @ <tr> |
| 2282 | 2292 | @ <td class="form_label">Subject:</td> |
| 2283 | 2293 | @ <td><input type="text" name="subject" value="%h(PT("subject"))"\ |
| 2284 | 2294 |
| --- 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 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 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 |