Added Prepend/Append on Edit/Reply

SVN revision: 812
This commit is contained in:
Stefan Ritt 2004-03-05 22:35:15 +00:00
parent 110ed47eac
commit 70d01d43a0
3 changed files with 87 additions and 36 deletions

View File

@ -1528,15 +1528,28 @@ resulting in all messages being locked. In those cases locking has to be turned
Default for "Use Lock" is <b>0</b>.<p> Default for "Use Lock" is <b>0</b>.<p>
<li><b><code>Date on reply = 0|1|2</code></b> <li><b><code>Prepend on reply = &lt;string&gt;</code></b>
</br> <br>
If this flag is nozero, the current date is placed between the quoted original entry With this option a string can be placed on top of a reply. Using string substition,
and the new entry. <b>1</b> causes the date to appear on top of the quoted entry, this can be useful for adding the author and the date of a reply, like<br>
<b>2</b> cuses the date to appear below the quoted entry. <br>
This can be useful for email notifications, if one wants to see the <code><b>Prepend on reply = Added $date by $long_name\n\n</code></b><br>
time history of all replies in the email messages. Default is <b>0</b>. <br>
where "\n" causes a line break.
<p> <p>
<li><b><code>Apend on reply = &lt;string&gt;</code></b>
<br>
Same as before, but gets added after the previous entry.
<p>
<li><b><code>Prepend on edit = &lt;string&gt;</code></b>
<li><b><code>Apend on edit = &lt;string&gt;</code></b>
</br>
Same as before, but for editing entries.
<p>
</ul><p> </ul><p>
<a name="themes"><hr> <a name="themes"><hr>

View File

@ -45,7 +45,8 @@ starting at the items with the most votes. You can vote for a feature, or sugges
<tr><td>Add/Remove logbooks though the web interface<td>1</tr> <tr><td>Add/Remove logbooks though the web interface<td>1</tr>
<tr><td>Specify date format explicitly for substitutions, like $entry date{%Y}<td>1</tr> <tr><td>Specify date format explicitly for substitutions, like $entry date{%Y}<td>1</tr>
<tr><td>Implement attribute substituions including message id (or change message id display fromat)<td>1</tr> <tr><td>Implement attribute substituions including message id (or change message id display fromat)<td>1</tr>
<tr><td>Only display a subset of attributes if not logged in (guest mode)<td>1</tr> <tr><td>Only display a subset of attributes if not logged in (guest mode)<td>2</tr>
<tr><td>Only display a subset of attributes in edit, entry and list mode<td>1</tr>
</table></center><p> </table></center><p>

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.279 2004/03/05 22:35:15 midas
Added Prepend/Append on Edit/Reply
Revision 1.278 2004/03/05 21:40:01 midas Revision 1.278 2004/03/05 21:40:01 midas
Substitution of $message id and $entry time now works on all possible places Substitution of $message id and $entry time now works on all possible places
@ -6170,7 +6173,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
reply_tag[MAX_REPLY_TO * 10], att[MAX_ATTACHMENTS][256], encoding[80], reply_tag[MAX_REPLY_TO * 10], att[MAX_ATTACHMENTS][256], encoding[80],
slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH], slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH],
owner[256], locked_by[256], class_value[80], class_name[80], condition[256], owner[256], locked_by[256], class_value[80], class_name[80], condition[256],
ua[NAME_LENGTH]; ua[NAME_LENGTH], mid[80];
time_t now, ltime; time_t now, ltime;
char fl[8][NAME_LENGTH]; char fl[8][NAME_LENGTH];
struct tm *pts, ts; struct tm *pts, ts;
@ -6902,22 +6905,42 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (text[0]) { if (text[0]) {
if (bedit) { if (bedit) {
if (bupload || (!bupload && !breedit) if (bupload || (!bupload && !breedit)
|| (breedit && !getcfg_cond(lbs->name, condition, "Preset text", str))) || (breedit && !getcfg_cond(lbs->name, condition, "Preset text", str))) {
j = build_subst_list(lbs, slist, svalue, attrib);
sprintf(mid, "%d", message_id);
add_subst_list(slist, svalue, "message id", mid, &j);
add_subst_time(lbs, slist, svalue, "entry time", date, &j);
if (getcfg_cond(lbs->name, condition, "Prepend on edit", str)) {
strsubst(str, slist, svalue, j);
while (strstr(str, "\\n"))
memcpy(strstr(str, "\\n"), "\r\n", 2);
rsprintf(str);
}
rsputs(text); rsputs(text);
if (getcfg_cond(lbs->name, condition, "Append on edit", str)) {
strsubst(str, slist, svalue, j);
while (strstr(str, "\\n"))
memcpy(strstr(str, "\\n"), "\r\n", 2);
rsprintf(str);
}
}
} else { } else {
if (!getcfg_cond(lbs->name, condition, "Quote on reply", str) if (!getcfg_cond(lbs->name, condition, "Quote on reply", str)
|| atoi(str) > 0) { || atoi(str) > 0) {
if (getcfg_cond(lbs->name, condition, "Date on reply", str) if (getcfg_cond(lbs->name, condition, "Prepend on reply", str)) {
&& atoi(str) == 1) { j = build_subst_list(lbs, slist, svalue, attrib);
time(&now); sprintf(mid, "%d", message_id);
pts = localtime(&now); add_subst_list(slist, svalue, "message id", mid, &j);
if (getcfg_cond(lbs->name, condition, "Time format", format)) add_subst_time(lbs, slist, svalue, "entry time", date, &j);
strftime(str, sizeof(str), format, pts);
else { strsubst(str, slist, svalue, j);
strcpy(str, ctime(&now)); while (strstr(str, "\\n"))
str[strlen(str) - 1] = 0; memcpy(strstr(str, "\\n"), "\r\n", 2);
} rsprintf(str);
rsprintf("%s\n\n", str);
} }
p = text; p = text;
@ -6954,17 +6977,16 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
} while (TRUE); } while (TRUE);
if (getcfg_cond(lbs->name, condition, "Date on reply", str) if (getcfg_cond(lbs->name, condition, "Append on reply", str)) {
&& atoi(str) == 2) {
time(&now); j = build_subst_list(lbs, slist, svalue, attrib);
pts = localtime(&now); sprintf(mid, "%d", message_id);
if (getcfg_cond(lbs->name, condition, "Time format", format)) add_subst_list(slist, svalue, "message id", mid, &j);
strftime(str, sizeof(str), format, pts); add_subst_time(lbs, slist, svalue, "entry time", date, &j);
else { strsubst(str, slist, svalue, j);
strcpy(str, ctime(&now)); while (strstr(str, "\\n"))
str[strlen(str) - 1] = 0; memcpy(strstr(str, "\\n"), "\r\n", 2);
} rsprintf(str);
rsprintf("%s\n\n", str);
} }
} }
} }
@ -10327,7 +10349,12 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
(char (*)[NAME_LENGTH])svalue, j); (char (*)[NAME_LENGTH])svalue, j);
rsprintf("<a href=\"%s\">", ref); rsprintf("<a href=\"%s\">", ref);
rsputs2(display);
if (is_html(display))
rsputs(display);
else
rsputs2(display);
rsprintf("</a>\n"); rsprintf("</a>\n");
} else { } else {
/* show select box */ /* show select box */
@ -10425,7 +10452,10 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
} else } else
rsprintf(", "); rsprintf(", ");
rsputs2(attrib[i]); if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
rsprintf("&nbsp"); rsprintf("&nbsp");
} }
@ -10444,7 +10474,11 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
} else } else
rsprintf(", "); rsprintf(", ");
rsputs2(attrib[i]); if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
} }
} else { } else {
if (strieq(attr_options[i][0], "boolean")) { if (strieq(attr_options[i][0], "boolean")) {
@ -10488,7 +10522,10 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
rsputs(attrib[i]); rsputs(attrib[i]);
else { else {
rsprintf("<a href=\"%s\">", ref); rsprintf("<a href=\"%s\">", ref);
rsputs2(attrib[i]); if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
rsprintf("</a>"); rsprintf("</a>");
} }