Added Prepend/Append on Edit/Reply

SVN revision: 812
This commit is contained in:
2004-03-05 22:35:15 +00:00
parent 110ed47eac
commit 70d01d43a0
3 changed files with 87 additions and 36 deletions
+20 -7
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>
<li><b><code>Date on reply = 0|1|2</code></b>
</br>
If this flag is nozero, the current date is placed between the quoted original entry
and the new entry. <b>1</b> causes the date to appear on top of the quoted entry,
<b>2</b> cuses the date to appear below the quoted entry.
This can be useful for email notifications, if one wants to see the
time history of all replies in the email messages. Default is <b>0</b>.
<li><b><code>Prepend on reply = &lt;string&gt;</code></b>
<br>
With this option a string can be placed on top of a reply. Using string substition,
this can be useful for adding the author and the date of a reply, like<br>
<br>
<code><b>Prepend on reply = Added $date by $long_name\n\n</code></b><br>
<br>
where "\n" causes a line break.
<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>
<a name="themes"><hr>
+2 -1
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>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>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>
+65 -28
View File
@@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$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
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],
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],
ua[NAME_LENGTH];
ua[NAME_LENGTH], mid[80];
time_t now, ltime;
char fl[8][NAME_LENGTH];
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 (bedit) {
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);
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 {
if (!getcfg_cond(lbs->name, condition, "Quote on reply", str)
|| atoi(str) > 0) {
if (getcfg_cond(lbs->name, condition, "Date on reply", str)
&& atoi(str) == 1) {
time(&now);
pts = localtime(&now);
if (getcfg_cond(lbs->name, condition, "Time format", format))
strftime(str, sizeof(str), format, pts);
else {
strcpy(str, ctime(&now));
str[strlen(str) - 1] = 0;
}
rsprintf("%s\n\n", str);
if (getcfg_cond(lbs->name, condition, "Prepend on reply", 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);
strsubst(str, slist, svalue, j);
while (strstr(str, "\\n"))
memcpy(strstr(str, "\\n"), "\r\n", 2);
rsprintf(str);
}
p = text;
@@ -6954,17 +6977,16 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
} while (TRUE);
if (getcfg_cond(lbs->name, condition, "Date on reply", str)
&& atoi(str) == 2) {
time(&now);
pts = localtime(&now);
if (getcfg_cond(lbs->name, condition, "Time format", format))
strftime(str, sizeof(str), format, pts);
else {
strcpy(str, ctime(&now));
str[strlen(str) - 1] = 0;
}
rsprintf("%s\n\n", str);
if (getcfg_cond(lbs->name, condition, "Append on reply", 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);
strsubst(str, slist, svalue, j);
while (strstr(str, "\\n"))
memcpy(strstr(str, "\\n"), "\r\n", 2);
rsprintf(str);
}
}
}
@@ -10327,7 +10349,12 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
(char (*)[NAME_LENGTH])svalue, j);
rsprintf("<a href=\"%s\">", ref);
rsputs2(display);
if (is_html(display))
rsputs(display);
else
rsputs2(display);
rsprintf("</a>\n");
} else {
/* show select box */
@@ -10425,7 +10452,10 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
} else
rsprintf(", ");
rsputs2(attrib[i]);
if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
rsprintf("&nbsp");
}
@@ -10444,7 +10474,11 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
} else
rsprintf(", ");
rsputs2(attrib[i]);
if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
}
} else {
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]);
else {
rsprintf("<a href=\"%s\">", ref);
rsputs2(attrib[i]);
if (is_html(attrib[i]))
rsputs(attrib[i]);
else
rsputs2(attrib[i]);
rsprintf("</a>");
}