From 14891a1fd849b425c82df8d5177b310314b3e5a9 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Mon, 25 Feb 2002 15:31:04 +0000 Subject: [PATCH] Made "move to", "copy to" and "submit" (from elog) work in other languages SVN revision: 34 --- elogd.c | 127 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 54 deletions(-) diff --git a/elogd.c b/elogd.c index 0b357d08..dd06dc6b 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.12 2002/02/25 15:31:04 midas + Made "move to", "copy to" and "submit" (from elog) work in other languages + Revision 1.11 2002/02/12 16:06:10 midas Fixed small bug @@ -40,7 +43,7 @@ \********************************************************************/ /* Version of ELOG */ -#define VERSION "1.3.2" +#define VERSION "1.3.3" #include #include @@ -4152,7 +4155,7 @@ FILE *f; } } else - rsprintf("\n", menu_item[i]); + rsprintf("\n", loc(menu_item[i])); } } else @@ -4177,13 +4180,13 @@ FILE *f; } else { - strcpy(str, menu_item[i]); + strcpy(str, loc(menu_item[i])); url_encode(str); if (i < n-1) - rsprintf(" %s |\n", logbook_enc, str, menu_item[i]); + rsprintf(" %s |\n", logbook_enc, str, loc(menu_item[i])); else - rsprintf(" %s \n", logbook_enc, str, menu_item[i]); + rsprintf(" %s \n", logbook_enc, str, loc(menu_item[i])); } } @@ -5512,6 +5515,18 @@ FILE *f; strcat(menu_str, loc("Help")); } + else + { + /* localize menu commands */ + n = strbreak(menu_str, menu_item, MAX_N_LIST); + menu_str[0] = 0; + for (i=0 ; iCopy to \"%s\" |\n", - logbook_enc, path, loc("Copy to"), ref, str); + if (equal_ustring(menu_item[i], loc("Copy to"))) + rsprintf(" %s \"%s\" |\n", + logbook_enc, path, loc("Copy to"), ref, loc("Copy to"), str); else - rsprintf(" Move to \"%s\" |\n", - logbook_enc, path, loc("Move to"), ref, str); + rsprintf(" %s \"%s\" |\n", + logbook_enc, path, loc("Move to"), ref, loc("Move to"), str); } } } @@ -7439,54 +7459,53 @@ struct timeval timeout; return_length = 0; /* extract logbook */ - if (strncmp(net_buffer, "GET", 3) == 0) + p = strchr(net_buffer, '/')+1; + logbook[0] = 0; + for (i=0 ; *p && *p != '/' && *p != '?' && *p != ' '; i++) + logbook[i] = *p++; + logbook[i] = 0; + strcpy(logbook_enc, logbook); + url_decode(logbook); + + /* check if logbook exists */ + for (i=0 ; ; i++) { - p = net_buffer+5; - logbook[0] = 0; - for (i=0 ; *p && *p != '/' && *p != '?' && *p != ' '; i++) - logbook[i] = *p++; - logbook[i] = 0; - strcpy(logbook_enc, logbook); - url_decode(logbook); + if (!enumgrp(i, str)) + break; + if (equal_ustring(logbook, str)) + break; + } - /* check if logbook exists */ - for (i=0 ; ; i++) + if (strstr(logbook, ".gif") || strstr(logbook, ".jpg") || strstr(logbook, ".png") || + strstr(logbook, ".htm")) + { + /* serve file directly */ + strcpy(str, cfg_dir); + strcat(str, logbook); + send_file(str); + send(_sock, return_buffer, return_length, 0); + + goto error; + } + else + { + if (!equal_ustring(logbook, str) && logbook[0]) { - if (!enumgrp(i, str)) - break; - if (equal_ustring(logbook, str)) - break; - } + if (verbose) + printf("\n\n\n%s\n", net_buffer); - if (strstr(logbook, ".gif") || strstr(logbook, ".jpg") || strstr(logbook, ".png") || - strstr(logbook, ".htm")) - { - /* server file directly */ - strcpy(str, cfg_dir); - strcat(str, logbook); - send_file(str); - send(_sock, return_buffer, return_length, 0); + sprintf(str, "Error: logbook \"%s\" not defined in elogd.cfg", logbook); + show_error(str); + send(_sock, return_buffer, strlen(return_buffer), 0); + if (verbose) + { + printf("==== Return ================================\n"); + puts(return_buffer); + printf("\n\n"); + } goto error; } - else - if (!equal_ustring(logbook, str) && logbook[0]) - { - if (verbose) - printf("\n\n\n%s\n", net_buffer); - - sprintf(str, "Error: logbook \"%s\" not defined in elogd.cfg", logbook); - show_error(str); - send(_sock, return_buffer, strlen(return_buffer), 0); - - if (verbose) - { - printf("==== Return ================================\n"); - puts(return_buffer); - printf("\n\n"); - } - goto error; - } } /* if no logbook is given and only one logbook defined, use this one */ @@ -7509,7 +7528,7 @@ struct timeval timeout; strcpy(logbook_enc, logbook); url_encode(logbook_enc); - /* redirect to logbook, necessary to get optionsl cookies for that logbook */ + /* redirect to logbook, necessary to get optional cookies for that logbook */ redirect(""); send(_sock, return_buffer, strlen(return_buffer), 0);