Implemented "bottom text login"

SVN revision: 1688
This commit is contained in:
2006-05-24 06:54:14 +00:00
parent db3f0a98cc
commit e9f641086f
3 changed files with 61 additions and 3 deletions
+6
View File
@@ -833,6 +833,12 @@ present in the resource directory. Alternatively, an absolute path can be used
if the file name starts with a <b><code>"/"</code></b> (Unix) or <b><code>
"\"</code></b> or <b><code>"x:"</code></b> (Windows).
</li>
<li>
<b><code>Bottom text login = &lt;file&gt; | &lt;string&gt;</code></b><br>
The same as <b><code>Bottom text</code></b> but for the login page. This
allows to display a different text at the bottom of the login page. It
can also be used to execute some JavaScript.
</li>
<li>
<b><code>Help URL = &lt;URL&gt;</code></b><br>
This URL is used for the Help button. By default, the file
+4
View File
@@ -118,6 +118,10 @@ email.
time to time.</td>
<td>1</td>
</tr>
<td>"Incremental" options. Have fixed set of global options, and in each logbook
add or remove some of those with <b>+Options = ...</b> or <b>-Options = ...</b></td>
<td>1</td>
</tr>
</tbody>
</table>
</center>
+51 -3
View File
@@ -7365,6 +7365,56 @@ void show_bottom_text(LOGBOOK * lbs)
/*------------------------------------------------------------------*/
void show_bottom_text_login(LOGBOOK * lbs)
{
char str[NAME_LENGTH], slist[20][NAME_LENGTH], svalue[20][NAME_LENGTH];
int i, size;
if (getcfg(lbs->name, "bottom text login", str, sizeof(str))) {
FILE *f;
char file_name[256], *buf;
if (str[0]) {
/* check if file starts with an absolute directory */
if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else {
strlcpy(file_name, resource_dir, sizeof(file_name));
strlcat(file_name, str, sizeof(file_name));
}
f = fopen(file_name, "rb");
if (f != NULL) {
fseek(f, 0, SEEK_END);
size = TELL(fileno(f));
fseek(f, 0, SEEK_SET);
buf = xmalloc(size + 100);
fread(buf, 1, size, f);
buf[size] = 0;
fclose(f);
i = build_subst_list(lbs, slist, svalue, NULL, TRUE);
strsubst_list(buf, size+100, slist, svalue, i);
rsputs(buf);
xfree(buf);
} else {
i = build_subst_list(lbs, slist, svalue, NULL, TRUE);
strsubst_list(str, sizeof(str), slist, svalue, i);
rsputs(str);
}
}
} else
/* add little logo */
rsprintf
("<center><a class=\"bottomlink\" title=\"%s\" href=\"http://midas.psi.ch/elog/\">ELOG V%s-%d</a></center>",
loc("Goto ELOG home page"), VERSION, atoi(svn_revision + 13));
}
/*------------------------------------------------------------------*/
void show_error(char *error)
{
/* header */
@@ -21406,9 +21456,7 @@ BOOL check_user_password(LOGBOOK * lbs, char *user, char *password, char *redir)
rsprintf("</table>\n");
rsprintf
("<center><a class=\"bottomlink\" href=\"http://midas.psi.ch/elog/\">ELOG V%s</a></center>",
VERSION);
show_bottom_text_login(lbs);
rsprintf("</form></body></html>\r\n");