mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-10 18:23:28 +00:00
Fixed wrong date on date attributes on edit/reply if attribute is fixed
SVN revision: 993
This commit is contained in:
parent
0456bcfce4
commit
f4e074fa4d
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.412 2004/07/28 19:20:46 midas
|
||||||
|
Fixed wrong date on date attributes on edit/reply if attribute is fixed
|
||||||
|
|
||||||
Revision 1.411 2004/07/28 18:51:48 midas
|
Revision 1.411 2004/07/28 18:51:48 midas
|
||||||
Close syslog on cleanup
|
Close syslog on cleanup
|
||||||
|
|
||||||
@ -7431,8 +7434,23 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
(bedit && (attr_flags[index] & AF_FIXED_EDIT)) || (message_id && !bedit
|
(bedit && (attr_flags[index] & AF_FIXED_EDIT)) || (message_id && !bedit
|
||||||
&& (attr_flags[index] &
|
&& (attr_flags[index] &
|
||||||
AF_FIXED_REPLY))) {
|
AF_FIXED_REPLY))) {
|
||||||
|
if (attr_flags[index] & AF_DATE) {
|
||||||
|
|
||||||
|
if (!getcfg(lbs->name, "Date format", format, sizeof(format)))
|
||||||
|
strcpy(format, DEFAULT_DATE_FORMAT);
|
||||||
|
|
||||||
|
ltime = atoi(attrib[index]);
|
||||||
|
pts = localtime(<ime);
|
||||||
|
if (ltime == 0)
|
||||||
|
strcpy(str, "-");
|
||||||
|
else
|
||||||
|
strftime(str, sizeof(str), format, pts);
|
||||||
|
|
||||||
|
} else
|
||||||
|
strlcpy(str, attrib[index], sizeof(str));
|
||||||
|
|
||||||
rsprintf("<td%s class=\"attribvalue\">\n", title);
|
rsprintf("<td%s class=\"attribvalue\">\n", title);
|
||||||
rsputs2(attrib[index]);
|
rsputs2(str);
|
||||||
rsprintf(" ");
|
rsprintf(" ");
|
||||||
|
|
||||||
if (attr_flags[index] & AF_MULTI) {
|
if (attr_flags[index] & AF_MULTI) {
|
||||||
@ -15577,28 +15595,33 @@ void submit_elog(LOGBOOK * lbs)
|
|||||||
}
|
}
|
||||||
} else if (attr_flags[i] & AF_DATE) {
|
} else if (attr_flags[i] & AF_DATE) {
|
||||||
|
|
||||||
sprintf(str, "y%d", i);
|
if (isparam(ua)) // from edit/reply of fixed attributes
|
||||||
year = atoi(getparam(str));
|
strlcpy(attrib[i], getparam(ua), NAME_LENGTH);
|
||||||
if (year < 100)
|
|
||||||
year += 2000;
|
|
||||||
|
|
||||||
sprintf(str, "m%d", i);
|
|
||||||
month = atoi(getparam(str));
|
|
||||||
|
|
||||||
sprintf(str, "d%d", i);
|
|
||||||
day = atoi(getparam(str));
|
|
||||||
|
|
||||||
if (month == 0 || day == 0)
|
|
||||||
strcpy(attrib[i], "");
|
|
||||||
else {
|
else {
|
||||||
memset(&tms, 0, sizeof(struct tm));
|
|
||||||
tms.tm_year = year - 1900;
|
|
||||||
tms.tm_mon = month - 1;
|
|
||||||
tms.tm_mday = day;
|
|
||||||
tms.tm_hour = 12;
|
|
||||||
|
|
||||||
ltime = mktime(&tms);
|
sprintf(str, "y%d", i);
|
||||||
sprintf(attrib[i], "%d", ltime);
|
year = atoi(getparam(str));
|
||||||
|
if (year < 100)
|
||||||
|
year += 2000;
|
||||||
|
|
||||||
|
sprintf(str, "m%d", i);
|
||||||
|
month = atoi(getparam(str));
|
||||||
|
|
||||||
|
sprintf(str, "d%d", i);
|
||||||
|
day = atoi(getparam(str));
|
||||||
|
|
||||||
|
if (month == 0 || day == 0)
|
||||||
|
strcpy(attrib[i], "");
|
||||||
|
else {
|
||||||
|
memset(&tms, 0, sizeof(struct tm));
|
||||||
|
tms.tm_year = year - 1900;
|
||||||
|
tms.tm_mon = month - 1;
|
||||||
|
tms.tm_mday = day;
|
||||||
|
tms.tm_hour = 12;
|
||||||
|
|
||||||
|
ltime = mktime(&tms);
|
||||||
|
sprintf(attrib[i], "%d", ltime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user