Implemented "suppress email on edit"

SVN revision: 1722
This commit is contained in:
Stefan Ritt 2006-10-09 20:31:10 +00:00
parent 9fd0c17b55
commit 1618bb2cec
2 changed files with 100 additions and 106 deletions

View File

@ -2182,6 +2182,11 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
notification is always produced. If this value is set to <b>3</b>, the notification is always produced. If this value is set to <b>3</b>, the
email notification is always suppressed. The default is <b>0</b>. email notification is always suppressed. The default is <b>0</b>.
</li> </li>
<li>
<b><code>Suppress Email on edit = 0|1|2|3</code></b><br>
This is the same as <b><code>Suppress default</code></b>, but just for
edited entries. The default is <b>0</b>.
</li>
<li> <li>
<b><code>Resubmit default = 0|1|2</code></b><br> <b><code>Resubmit default = 0|1|2</code></b><br>
This specifies the default state of the "<i>Resubmit as new entry</i>" This specifies the default state of the "<i>Resubmit as new entry</i>"
@ -2227,11 +2232,6 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
</ul>So to send for example only the attributes and the URL, set </ul>So to send for example only the attributes and the URL, set
&lt;n&gt; to <b>6</b>. Default is <b>63</b> (send everything). &lt;n&gt; to <b>6</b>. Default is <b>63</b> (send everything).
</li> </li>
<li>
<b><code>Suppress Email on edit = 0|1</code></b><br>
If this flag is <b>1</b>, no email notifications are sent for edited
messages, only for new messages. The default is <b>0</b>.
</li>
<li> <li>
<b><code>Email Encoding = &lt;n&gt;</code></b><br> <b><code>Email Encoding = &lt;n&gt;</code></b><br>
Specifies in which encoding an email is sent. &lt;n&gt; is the sum of Specifies in which encoding an email is sent. &lt;n&gt; is the sum of

View File

@ -10021,21 +10021,21 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
} }
/* Suppress email check box */ /* Suppress email check box */
if (!(bedit && !breedit && !bupload && getcfg(lbs->name, "Suppress Email on edit", str, sizeof(str)) if (bedit)
&& atoi(str) == 1)) { getcfg(lbs->name, "Suppress Email on edit", str, sizeof(str));
if (getcfg(lbs->name, "Suppress default", str, sizeof(str))) { else
getcfg(lbs->name, "Suppress default", str, sizeof(str));
if (atoi(str) == 0) { if (atoi(str) == 0) {
rsprintf("<input type=\"checkbox\" name=\"suppress\" id=\"suppress\" value=\"1\">"); rsprintf("<input type=\"checkbox\" name=\"suppress\" id=\"suppress\" value=\"1\">");
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification")); rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
} else if (atoi(str) == 1) { } else if (atoi(str) == 1) {
rsprintf("<input type=\"checkbox\" checked name=\"suppress\" id=\"suppress\" value=\"1\">"); rsprintf("<input type=\"checkbox\" checked name=\"suppress\" id=\"suppress\" value=\"1\">");
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification")); rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
} } else if (atoi(str) == 2) {
rsprintf("<input type=\"hidden\" name=\"suppress\" id=\"suppress\" value=\"2\">");
} else { } else if (atoi(str) == 3) {
rsprintf("<input type=\"checkbox\" name=\"suppress\" id=\"suppress\" value=\"1\">"); rsprintf("<input type=\"hidden\" name=\"suppress\" id=\"suppress\" value=\"3\">");
rsprintf("<label for=\"suppress\">%s</label>\n", loc("Suppress Email notification"));
}
} }
/* Suppress execute shell check box */ /* Suppress execute shell check box */
@ -19602,8 +19602,6 @@ void submit_elog(LOGBOOK * lbs)
/*---- email notifications ----*/ /*---- email notifications ----*/
suppress = isparam("suppress") ? atoi(getparam("suppress")) : 0; suppress = isparam("suppress") ? atoi(getparam("suppress")) : 0;
if (getcfg(lbs->name, "Suppress default", str, sizeof(str)) && atoi(str) == 3)
suppress = 3;
/* check for mail submissions */ /* check for mail submissions */
mail_param[0] = 0; mail_param[0] = 0;
@ -19614,13 +19612,10 @@ void submit_elog(LOGBOOK * lbs)
rcpt_to[0] = 0; rcpt_to[0] = 0;
rcpt_to_size = 256; rcpt_to_size = 256;
if (suppress) { if (suppress == 1 || suppress == 3) {
if (suppress != 3) if (suppress == 1)
strcpy(mail_param, "?suppress=1"); strcpy(mail_param, "?suppress=1");
} else { } else {
if (!(isparam("edit_id")
&& getcfg(lbs->name, "Suppress Email on edit", str, sizeof(str))
&& atoi(str) == 1)) {
/* go throuch "Email xxx" in configuration file */ /* go throuch "Email xxx" in configuration file */
for (index = mindex = 0; index <= n_attr; index++) { for (index = mindex = 0; index <= n_attr; index++) {
@ -19722,7 +19717,6 @@ void submit_elog(LOGBOOK * lbs)
} }
} }
} }
}
if (strlen(mail_to) > 0) { if (strlen(mail_to) > 0) {
if (strlen(mail_to) > 4 && mail_to[strlen(mail_to) - 4] == ',') if (strlen(mail_to) > 4 && mail_to[strlen(mail_to) - 4] == ',')