From e9f641086fa7782ed212228ca9d5f40894321bc6 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 24 May 2006 06:54:14 +0000 Subject: [PATCH] Implemented "bottom text login" SVN revision: 1688 --- doc/config.html | 6 ++++++ doc/wishlist.html | 4 ++++ src/elogd.c | 54 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 3 deletions(-) diff --git a/doc/config.html b/doc/config.html index ba27c031..22c2b4fd 100755 --- a/doc/config.html +++ b/doc/config.html @@ -833,6 +833,12 @@ present in the resource directory. Alternatively, an absolute path can be used if the file name starts with a "/" (Unix) or "\" or "x:" (Windows). +
  • + Bottom text login = <file> | <string>
    + The same as Bottom text 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. +
  • Help URL = <URL>
    This URL is used for the Help button. By default, the file diff --git a/doc/wishlist.html b/doc/wishlist.html index e6fbcd07..722de2d5 100755 --- a/doc/wishlist.html +++ b/doc/wishlist.html @@ -118,6 +118,10 @@ email. time to time. 1 +"Incremental" options. Have fixed set of global options, and in each logbook +add or remove some of those with +Options = ... or -Options = ... +1 + diff --git a/src/elogd.c b/src/elogd.c index 02ab5d6d..5db1325c 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -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 + ("
    ELOG V%s-%d
    ", + 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("\n"); - rsprintf - ("
    ELOG V%s
    ", - VERSION); + show_bottom_text_login(lbs); rsprintf("\r\n");