mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Added javascript for required attributes checking
SVN revision: 731
This commit is contained in:
parent
d6f092fc13
commit
efef52b299
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.223 2004/02/02 16:28:04 midas
|
||||||
|
Added javascript for required attributes checking
|
||||||
|
|
||||||
Revision 1.222 2004/02/02 16:00:01 midas
|
Revision 1.222 2004/02/02 16:00:01 midas
|
||||||
Fixed bug that '<' was not correctly displayed in links
|
Fixed bug that '<' was not correctly displayed in links
|
||||||
|
|
||||||
@ -4786,7 +4789,7 @@ void show_plain_header(int size)
|
|||||||
rsprintf("\r\n");
|
rsprintf("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_html_header(LOGBOOK * lbs, BOOL expires, char *title)
|
void show_html_header(LOGBOOK * lbs, BOOL expires, char *title, BOOL close_head)
|
||||||
{
|
{
|
||||||
char css[256], str[256];
|
char css[256], str[256];
|
||||||
|
|
||||||
@ -4807,14 +4810,15 @@ void show_html_header(LOGBOOK * lbs, BOOL expires, char *title)
|
|||||||
else if (lbs == NULL && getcfg("global", "CSS", str))
|
else if (lbs == NULL && getcfg("global", "CSS", str))
|
||||||
strlcpy(css, str, sizeof(css));
|
strlcpy(css, str, sizeof(css));
|
||||||
|
|
||||||
rsprintf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">", css);
|
rsprintf("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\">\n", css);
|
||||||
|
|
||||||
rsprintf("</head>\n");
|
if (close_head)
|
||||||
|
rsprintf("</head>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_standard_header(LOGBOOK * lbs, BOOL expires, char *title, char *path)
|
void show_standard_header(LOGBOOK * lbs, BOOL expires, char *title, char *path)
|
||||||
{
|
{
|
||||||
show_html_header(lbs, expires, title);
|
show_html_header(lbs, expires, title, TRUE);
|
||||||
|
|
||||||
rsprintf("<body>\n");
|
rsprintf("<body>\n");
|
||||||
|
|
||||||
@ -4832,7 +4836,7 @@ void show_upgrade_page(LOGBOOK * lbs)
|
|||||||
{
|
{
|
||||||
char str[1000];
|
char str[1000];
|
||||||
|
|
||||||
show_html_header(lbs, FALSE, "ELOG Upgrade Information");
|
show_html_header(lbs, FALSE, "ELOG Upgrade Information", TRUE);
|
||||||
|
|
||||||
rsprintf("<body>\n");
|
rsprintf("<body>\n");
|
||||||
|
|
||||||
@ -5261,7 +5265,7 @@ void show_bottom_text(LOGBOOK * lbs)
|
|||||||
void show_error(char *error)
|
void show_error(char *error)
|
||||||
{
|
{
|
||||||
/* header */
|
/* header */
|
||||||
show_html_header(NULL, FALSE, "ELOG error");
|
show_html_header(NULL, FALSE, "ELOG error", TRUE);
|
||||||
|
|
||||||
rsprintf("<body><center>\n");
|
rsprintf("<body><center>\n");
|
||||||
rsprintf("<table class=\"dlgframe\" width=\"50%%\" cellpadding=1 cellspacing=0");
|
rsprintf("<table class=\"dlgframe\" width=\"50%%\" cellpadding=1 cellspacing=0");
|
||||||
@ -5404,7 +5408,7 @@ void send_file_direct(char *file_name)
|
|||||||
|
|
||||||
close(fh);
|
close(fh);
|
||||||
} else {
|
} else {
|
||||||
show_html_header(NULL, FALSE, "404 Not Found");
|
show_html_header(NULL, FALSE, "404 Not Found", TRUE);
|
||||||
|
|
||||||
rsprintf("<body><h1>Not Found</h1>\r\n");
|
rsprintf("<body><h1>Not Found</h1>\r\n");
|
||||||
rsprintf("The requested file <b>%s</b> was not found on this server<p>\r\n",
|
rsprintf("The requested file <b>%s</b> was not found on this server<p>\r\n",
|
||||||
@ -6019,10 +6023,37 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* header */
|
/* header */
|
||||||
show_html_header(lbs, FALSE, "ELOG");
|
show_html_header(lbs, FALSE, "ELOG", FALSE);
|
||||||
|
|
||||||
rsprintf
|
/* java script for checking required attributes */
|
||||||
("<body><form name=form1 method=\"POST\" action=\".\" enctype=\"multipart/form-data\">\n");
|
rsprintf("<script type=\"text/javascript\">\n");
|
||||||
|
rsprintf("<!--\n");
|
||||||
|
rsprintf("function chkform()\n");
|
||||||
|
rsprintf("{\n");
|
||||||
|
|
||||||
|
for (i = 0; i < lbs->n_attr; i++)
|
||||||
|
if (attr_flags[i] & AF_REQUIRED) {
|
||||||
|
|
||||||
|
if ((attr_flags[i] & AF_MULTI) == 0) {
|
||||||
|
rsprintf(" if (document.form1.%s.value == \"\") {\n", attr_list[i]);
|
||||||
|
sprintf(str, loc("Please enter attribute '%s'"), attr_list[i]);
|
||||||
|
rsprintf(" alert(\"%s\");\n", str);
|
||||||
|
rsprintf(" document.form1.%s.focus();\n", attr_list[i]);
|
||||||
|
rsprintf(" return false;\n");
|
||||||
|
rsprintf(" }\n");
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rsprintf(" return true;\n");
|
||||||
|
rsprintf("}\n");
|
||||||
|
rsprintf("//-->\n");
|
||||||
|
rsprintf("</script>\n");
|
||||||
|
rsprintf("</head>\n");
|
||||||
|
|
||||||
|
rsprintf("<body>\n");
|
||||||
|
rsprintf("<form name=form1 method=\"POST\" action=\".\" ");
|
||||||
|
rsprintf("enctype=\"multipart/form-data\" onSubmit=\"return chkform();\">\n");
|
||||||
|
|
||||||
/*---- add password in case cookie expires during edit ----*/
|
/*---- add password in case cookie expires during edit ----*/
|
||||||
|
|
||||||
@ -7052,7 +7083,7 @@ void show_admin_page(LOGBOOK * lbs, char *top_group)
|
|||||||
/*---- header ----*/
|
/*---- header ----*/
|
||||||
|
|
||||||
sprintf(str, "ELOG %s", loc("Admin"));
|
sprintf(str, "ELOG %s", loc("Admin"));
|
||||||
show_html_header(lbs, FALSE, str);
|
show_html_header(lbs, FALSE, str, TRUE);
|
||||||
|
|
||||||
rsprintf
|
rsprintf
|
||||||
("<body><form method=\"POST\" action=\".\" enctype=\"multipart/form-data\">\n");
|
("<body><form method=\"POST\" action=\".\" enctype=\"multipart/form-data\">\n");
|
||||||
@ -9531,7 +9562,7 @@ void synchronize(LOGBOOK * lbs, BOOL bcron)
|
|||||||
char str[256], pwd[256];
|
char str[256], pwd[256];
|
||||||
|
|
||||||
if (!bcron) {
|
if (!bcron) {
|
||||||
show_html_header(NULL, FALSE, loc("Synchronization"));
|
show_html_header(NULL, FALSE, loc("Synchronization"), TRUE);
|
||||||
rsprintf("<body>\n");
|
rsprintf("<body>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13635,7 +13666,7 @@ BOOL check_user_password(LOGBOOK * lbs, char *user, char *password, char *redir)
|
|||||||
/* display error message for invalid user */
|
/* display error message for invalid user */
|
||||||
if (isparam("iusr")) {
|
if (isparam("iusr")) {
|
||||||
/* header */
|
/* header */
|
||||||
show_html_header(NULL, FALSE, "ELOG error");
|
show_html_header(NULL, FALSE, "ELOG error", TRUE);
|
||||||
|
|
||||||
rsprintf("<body><center>\n");
|
rsprintf("<body><center>\n");
|
||||||
rsprintf("<table class=\"dlgframe\" width=\"50%%\" cellpadding=1 cellspacing=0>");
|
rsprintf("<table class=\"dlgframe\" width=\"50%%\" cellpadding=1 cellspacing=0>");
|
||||||
@ -13676,7 +13707,7 @@ BOOL check_user_password(LOGBOOK * lbs, char *user, char *password, char *redir)
|
|||||||
|
|
||||||
/* show login password page */
|
/* show login password page */
|
||||||
sprintf(str, "ELOG %s", loc("Login"));
|
sprintf(str, "ELOG %s", loc("Login"));
|
||||||
show_html_header(lbs, TRUE, str);
|
show_html_header(lbs, TRUE, str, TRUE);
|
||||||
|
|
||||||
/* set focus on name field */
|
/* set focus on name field */
|
||||||
rsprintf("<body OnLoad=\"document.form1.uname.focus();\">\n");
|
rsprintf("<body OnLoad=\"document.form1.uname.focus();\">\n");
|
||||||
@ -13936,9 +13967,9 @@ void show_selection_page()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (getcfg("global", "Page Title", str))
|
if (getcfg("global", "Page Title", str))
|
||||||
show_html_header(NULL, TRUE, str);
|
show_html_header(NULL, TRUE, str, TRUE);
|
||||||
else
|
else
|
||||||
show_html_header(NULL, TRUE, "ELOG Logbook Selection");
|
show_html_header(NULL, TRUE, "ELOG Logbook Selection", TRUE);
|
||||||
rsprintf("<body>\n\n");
|
rsprintf("<body>\n\n");
|
||||||
rsprintf("<table class=\"selframe\" cellspacing=0 align=center>\n");
|
rsprintf("<table class=\"selframe\" cellspacing=0 align=center>\n");
|
||||||
rsprintf("<tr><td colspan=13 class=\"dlgtitle\">\n");
|
rsprintf("<tr><td colspan=13 class=\"dlgtitle\">\n");
|
||||||
@ -14120,7 +14151,7 @@ void show_calendar(LOGBOOK * lbs)
|
|||||||
else
|
else
|
||||||
index = 1;
|
index = 1;
|
||||||
|
|
||||||
show_html_header(lbs, FALSE, loc("Calendar"));
|
show_html_header(lbs, FALSE, loc("Calendar"), TRUE);
|
||||||
rsprintf("<body><form name=form1 method=\"GET\" action=\"\">\n");
|
rsprintf("<body><form name=form1 method=\"GET\" action=\"\">\n");
|
||||||
rsprintf("<input type=hidden name=\"y\" value=\"%d\">\n", cur_year);
|
rsprintf("<input type=hidden name=\"y\" value=\"%d\">\n", cur_year);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user