mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Implemented 'Duplicate' command
SVN revision: 1306
This commit is contained in:
parent
3109b1fd1b
commit
3c1bfa7c5d
@ -521,6 +521,7 @@ commands are possible:
|
|||||||
<li><b>Edit</b> - Edit current logbook entry
|
<li><b>Edit</b> - Edit current logbook entry
|
||||||
<li><b>Delete</b> - Delete current logbook entry
|
<li><b>Delete</b> - Delete current logbook entry
|
||||||
<li><b>Reply</b> - Submit a reply to current entry
|
<li><b>Reply</b> - Submit a reply to current entry
|
||||||
|
<li><b>Duplicate</b> - Duplicate the current entry with the possibility to change some values
|
||||||
<li><b>Download</b> - Download a message in ASCII format
|
<li><b>Download</b> - Download a message in ASCII format
|
||||||
<li><b>Find</b> - Search entries in logbooks
|
<li><b>Find</b> - Search entries in logbooks
|
||||||
<li><b>Last day</b> - Display entries from last day
|
<li><b>Last day</b> - Display entries from last day
|
||||||
@ -541,7 +542,7 @@ setting, and are automatically translated into the specified language.<br><br>
|
|||||||
|
|
||||||
If this option is not present, following default is used:
|
If this option is not present, following default is used:
|
||||||
<br>
|
<br>
|
||||||
<pre>Menu commands = List, New, Edit, Delete, Reply, Find, Config, Help</pre>
|
<pre>Menu commands = List, New, Edit, Delete, Reply, Duplicate, Find, Config, Help</pre>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<li><b><code>Copy to = <logbook list></code></b>
|
<li><b><code>Copy to = <logbook list></code></b>
|
||||||
@ -580,7 +581,7 @@ menu, with which one can login as a real user (username and password have to mat
|
|||||||
from the password file), which then allowes full access via the <b>"Menu commands"</b> list.
|
from the password file), which then allowes full access via the <b>"Menu commands"</b> list.
|
||||||
A typical example for the menu settings for this scenario are:<p>
|
A typical example for the menu settings for this scenario are:<p>
|
||||||
<pre>
|
<pre>
|
||||||
Menu commands = List, New, Edit, Reply, Find, Config, Logout, Help
|
Menu commands = List, New, Edit, Reply, Duplicate, Find, Config, Logout, Help
|
||||||
Guest menu commands = List, Find, Login, Help
|
Guest menu commands = List, Find, Login, Help
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
65
src/elogd.c
65
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.613 2005/03/31 20:37:05 ritt
|
||||||
|
Implemented 'Duplicate' command
|
||||||
|
|
||||||
Revision 1.612 2005/03/31 18:15:32 ritt
|
Revision 1.612 2005/03/31 18:15:32 ritt
|
||||||
Implemented seconds for datetime
|
Implemented seconds for datetime
|
||||||
|
|
||||||
@ -7831,7 +7834,7 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH])
|
|||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
||||||
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit)
|
void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL bupload, BOOL breedit, BOOL bduplicate)
|
||||||
{
|
{
|
||||||
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
|
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
|
||||||
format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, attr_index[MAX_N_ATTR];
|
format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, attr_index[MAX_N_ATTR];
|
||||||
@ -8845,7 +8848,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
|
|
||||||
|
|
||||||
/* leave space for '> ' */
|
/* leave space for '> ' */
|
||||||
if (!bedit)
|
if (!bedit && !bduplicate)
|
||||||
width += 2;
|
width += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8877,7 +8880,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
if (preset_text) {
|
if (preset_text) {
|
||||||
|
|
||||||
/* don't use preset text if editing */
|
/* don't use preset text if editing */
|
||||||
if (bedit)
|
if (bedit || bduplicate)
|
||||||
preset_text = FALSE;
|
preset_text = FALSE;
|
||||||
|
|
||||||
/* user preset on reedit only if preset is under condition */
|
/* user preset on reedit only if preset is under condition */
|
||||||
@ -8904,12 +8907,13 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
add_subst_list(slist, svalue, "message id", mid, &j);
|
add_subst_list(slist, svalue, "message id", mid, &j);
|
||||||
add_subst_time(lbs, slist, svalue, "entry time", date, &j);
|
add_subst_time(lbs, slist, svalue, "entry time", date, &j);
|
||||||
|
|
||||||
if (getcfg(lbs->name, "Prepend on edit", str, sizeof(str))) {
|
if (!bupload)
|
||||||
strsubst(str, slist, svalue, j);
|
if (getcfg(lbs->name, "Prepend on edit", str, sizeof(str))) {
|
||||||
while (strstr(str, "\\n"))
|
strsubst(str, slist, svalue, j);
|
||||||
memcpy(strstr(str, "\\n"), "\r\n", 2);
|
while (strstr(str, "\\n"))
|
||||||
rsprintf(str);
|
memcpy(strstr(str, "\\n"), "\r\n", 2);
|
||||||
}
|
rsputs3(str);
|
||||||
|
}
|
||||||
|
|
||||||
/* use rsputs3 which just converts "<", ">", "&", "\"" to > etc. */
|
/* use rsputs3 which just converts "<", ">", "&", "\"" to > etc. */
|
||||||
/* otherwise some HTML statments would break the page syntax */
|
/* otherwise some HTML statments would break the page syntax */
|
||||||
@ -8923,6 +8927,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
rsputs3(str);
|
rsputs3(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (bduplicate) {
|
||||||
|
|
||||||
|
rsputs3(text);
|
||||||
|
|
||||||
} else if (breply) {
|
} else if (breply) {
|
||||||
if (!getcfg(lbs->name, "Quote on reply", str, sizeof(str))
|
if (!getcfg(lbs->name, "Quote on reply", str, sizeof(str))
|
||||||
|| atoi(str) > 0) {
|
|| atoi(str) > 0) {
|
||||||
@ -9129,7 +9137,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
if (!getcfg(lbs->name, "Enable attachments", str, sizeof(str))
|
if (!getcfg(lbs->name, "Enable attachments", str, sizeof(str))
|
||||||
|| atoi(str) > 0) {
|
|| atoi(str) > 0) {
|
||||||
i = 0;
|
i = 0;
|
||||||
if (bedit) {
|
if (bedit || bduplicate) {
|
||||||
/* show existing attachments */
|
/* show existing attachments */
|
||||||
for (i = 0; i < MAX_ATTACHMENTS; i++)
|
for (i = 0; i < MAX_ATTACHMENTS; i++)
|
||||||
if (att[i][0]) {
|
if (att[i][0]) {
|
||||||
@ -14414,7 +14422,7 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command)
|
|||||||
|
|
||||||
/* default menu commands */
|
/* default menu commands */
|
||||||
if (menu_str[0] == 0) {
|
if (menu_str[0] == 0) {
|
||||||
strcpy(menu_str, "List, New, Edit, Delete, Reply, Find, ");
|
strcpy(menu_str, "List, New, Edit, Delete, Reply, Duplicate, Find, ");
|
||||||
|
|
||||||
if (getcfg(lbs->name, "Password file", str, sizeof(str))) {
|
if (getcfg(lbs->name, "Password file", str, sizeof(str))) {
|
||||||
|
|
||||||
@ -18867,6 +18875,8 @@ BOOL convert_password_file(char *file_name)
|
|||||||
char *buf, *p;
|
char *buf, *p;
|
||||||
PMXML_NODE root, list, node;
|
PMXML_NODE root, list, node;
|
||||||
|
|
||||||
|
printf("Converting password file \"%s\" to new XML format ... ", file_name);
|
||||||
|
|
||||||
fh = open(file_name, O_RDONLY | O_BINARY);
|
fh = open(file_name, O_RDONLY | O_BINARY);
|
||||||
if (fh < 0)
|
if (fh < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -18958,6 +18968,8 @@ BOOL convert_password_file(char *file_name)
|
|||||||
mxml_write_tree(file_name, root);
|
mxml_write_tree(file_name, root);
|
||||||
mxml_free_tree(root);
|
mxml_free_tree(root);
|
||||||
|
|
||||||
|
printf("Ok\n");
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -20229,18 +20241,16 @@ void interprete(char *lbook, char *path)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("New")) ||
|
if (strieq(command, loc("New")) || strieq(command, loc("Edit")) || strieq(command, loc("Reply")) ||
|
||||||
strieq(command, loc("Edit")) || strieq(command, loc("Reply")) || strieq(command, loc("Delete"))
|
strieq(command, loc("Duplicate")) || strieq(command, loc("Delete")) || strieq(command, loc("Upload")) ||
|
||||||
|| strieq(command, loc("Upload"))
|
strieq(command, loc("Submit"))) {
|
||||||
|| strieq(command, loc("Submit"))) {
|
|
||||||
sprintf(str, "%s?cmd=%s", path, command);
|
sprintf(str, "%s?cmd=%s", path, command);
|
||||||
if (!check_password(lbs, "Write password", getparam("wpwd"), str))
|
if (!check_password(lbs, "Write password", getparam("wpwd"), str))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("Delete")) || strieq(command, loc("Config"))
|
if (strieq(command, loc("Delete")) || strieq(command, loc("Config")) ||
|
||||||
|| strieq(command, loc("Copy to"))
|
strieq(command, loc("Copy to")) || strieq(command, loc("Move to"))) {
|
||||||
|| strieq(command, loc("Move to"))) {
|
|
||||||
sprintf(str, "%s?cmd=%s", path, command);
|
sprintf(str, "%s?cmd=%s", path, command);
|
||||||
if (!check_password(lbs, "Admin password", getparam("apwd"), str))
|
if (!check_password(lbs, "Admin password", getparam("apwd"), str))
|
||||||
return;
|
return;
|
||||||
@ -20456,7 +20466,7 @@ void interprete(char *lbook, char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("New"))) {
|
if (strieq(command, loc("New"))) {
|
||||||
show_edit_form(lbs, 0, FALSE, FALSE, FALSE, FALSE);
|
show_edit_form(lbs, 0, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20481,34 +20491,41 @@ void interprete(char *lbook, char *path)
|
|||||||
unsetparam(str);
|
unsetparam(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, TRUE, FALSE);
|
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, TRUE, FALSE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
message_id = atoi(dec_path);
|
message_id = atoi(dec_path);
|
||||||
if (strieq(command, loc("Upload"))) {
|
if (strieq(command, loc("Upload"))) {
|
||||||
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, TRUE, FALSE);
|
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, TRUE, FALSE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("Edit"))) {
|
if (strieq(command, loc("Edit"))) {
|
||||||
if (message_id) {
|
if (message_id) {
|
||||||
show_edit_form(lbs, message_id, FALSE, TRUE, FALSE, FALSE);
|
show_edit_form(lbs, message_id, FALSE, TRUE, FALSE, FALSE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("Reply"))) {
|
if (strieq(command, loc("Reply"))) {
|
||||||
show_edit_form(lbs, message_id, TRUE, FALSE, FALSE, FALSE);
|
show_edit_form(lbs, message_id, TRUE, FALSE, FALSE, FALSE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("Update"))) {
|
if (strieq(command, loc("Update"))) {
|
||||||
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, FALSE, TRUE);
|
show_edit_form(lbs, atoi(getparam("edit_id")), FALSE, TRUE, FALSE, TRUE, FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strieq(command, loc("Duplicate"))) {
|
||||||
|
if (message_id) {
|
||||||
|
show_edit_form(lbs, message_id, FALSE, FALSE, FALSE, FALSE, TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (strieq(command, loc("Submit"))
|
if (strieq(command, loc("Submit"))
|
||||||
|| strieq(command, "Submit")) {
|
|| strieq(command, "Submit")) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user