diff --git a/elogd.c b/elogd.c index acb75d4e..eefb62d4 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 2.71 2002/09/10 05:59:04 midas + Made selections work with 'copy to' and 'move to' + Revision 2.70 2002/09/09 08:04:58 midas Added select boxes @@ -5423,7 +5426,10 @@ char str[256], in_reply_to[80], reply_to[256]; strcpy(str, getparam("nextmsg")); if (atoi(str) == 0) sprintf(str, "%d", el_search_message(lbs, EL_LAST, 0, TRUE)); - redirect(str); + if (atoi(str) == 0) + redirect(""); + else + redirect(str); return; } } @@ -5746,7 +5752,7 @@ FILE *f; { /* show select box */ if (select) - rsprintf("
");
- strcat(str, loc("Please check that it exists and elogd has write access"));
- show_error(str);
- return;
- }
+ fh = open(file_name, O_RDONLY | O_BINARY);
+ if (fh > 0)
+ {
+ lseek(fh, 0, SEEK_END);
+ _attachment_size[i] = TELL(fh);
+ lseek(fh, 0, SEEK_SET);
- /* delete original message for move */
- if (move)
- {
- el_delete_message(lbs, src_id, TRUE, NULL, TRUE);
+
+ _attachment_buffer[i] = malloc(_attachment_size[i]);
- /* check if this was the last message */
- src_id = el_search_message(lbs, EL_NEXT, src_id, FALSE);
+ if (_attachment_buffer[i])
+ read(fh, _attachment_buffer[i], _attachment_size[i]);
- /* if yes, force display of new last message */
- if (src_id <= 0)
- src_id = el_search_message(lbs, EL_LAST, 0, FALSE);
+ close(fh);
+ }
+
+ /* stip date/time from file name */
+ strcpy(str, attachment[i]);
+ strcpy(attachment[i], str+14);
+ }
+
+ /* submit in destination logbook without links */
+
+ message_id = el_submit(lbs_dest, 0, date, attr_list, attrib, lbs_dest->n_attr, text,
+ "", "", encoding,
+ attachment,
+ _attachment_buffer,
+ _attachment_size);
+
+ for (i=0 ; i ");
+ strcat(str, loc("Please check that it exists and elogd has write access"));
+ show_error(str);
+ return;
+ }
+
+ n_done++;
+
+ /* delete original message for move */
+ if (move)
+ {
+ el_delete_message(lbs, source_id, TRUE, NULL, TRUE);
+
+ /* check if this was the last message */
+ source_id = el_search_message(lbs, EL_NEXT, source_id, FALSE);
+
+ /* if yes, force display of new last message */
+ if (source_id <= 0)
+ source_id = el_search_message(lbs, EL_LAST, 0, FALSE);
+ }
}
/* display status message */
- sprintf(str, "%d", src_id);
+ sprintf(str, "%d", source_id);
show_standard_header(loc("Copy ELog entry"), str);
rsprintf("",
@@ -7575,14 +7673,29 @@ LOGBOOK *lbs_dest;
rsprintf("
\n", gt("Frame color"));
rsprintf("
\n");
- rsprintf("");
- if (move)
- rsprintf(loc("Message moved successfully from \"%s\" to \"%s\""), lbs->name, lbs_dest->name);
+ if (n>1)
+ {
+ if (move)
+ rsprintf(loc("%d messages moved successfully from \"%s\" to \"%s\""), n_done, lbs->name, lbs_dest->name);
+ else
+ rsprintf(loc("%d messages copied successfully from \"%s\" to \"%s\""), n_done, lbs->name, lbs_dest->name);
+ }
else
- rsprintf(loc("Message copied successfully from \"%s\" to \"%s\""), lbs->name, lbs_dest->name);
+ {
+ if (move)
+ rsprintf(loc("Message moved successfully from \"%s\" to \"%s\""), lbs->name, lbs_dest->name);
+ else
+ rsprintf(loc("Message copied successfully from \"%s\" to \"%s\""), lbs->name, lbs_dest->name);
+ }
rsprintf(" \n",
- gt("Cell BGColor"), loc("Go to"), lbs->name, src_id, lbs->name);
+ if (src_id)
+ rsprintf("%s %s \n",
+ gt("Cell BGColor"), loc("Go to"), lbs->name, source_id, lbs->name);
+ else
+ rsprintf("%s %s \n",
+ gt("Cell BGColor"), loc("Go to"), lbs->name, getparam("cmdline"), lbs->name);
+
rsprintf("%s %s \n",
gt("Cell BGColor"), loc("Go to"), lbs_dest->name, lbs_dest->name);
@@ -7603,7 +7716,7 @@ char date[80], text[TEXT_SIZE], menu_str[1000], other_str[1000], cmd[256],
orig_tag[80], reply_tag[80], attachment[MAX_ATTACHMENTS][256], encoding[80], att[256], lattr[256];
char menu_item[MAX_N_LIST][NAME_LENGTH], format[80], admin_user[80],
slist[MAX_N_ATTR+10][NAME_LENGTH], svalue[MAX_N_ATTR+10][NAME_LENGTH], *p;
-char lb_list[MAX_N_LIST][NAME_LENGTH];
+char lbk_list[MAX_N_LIST][NAME_LENGTH];
FILE *f;
BOOL first;
@@ -8205,10 +8318,10 @@ BOOL first;
if (str[0])
{
- n_log = strbreak(str, lb_list, MAX_N_LIST);
+ n_log = strbreak(str, lbk_list, MAX_N_LIST);
for (j=0 ; j%s %s