From ebd6de08a45b3f960bfeab378f6fe42e1a3a1aac Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Thu, 8 Jul 2004 19:48:09 +0000 Subject: [PATCH] Implemented 'show top groups' flag SVN revision: 945 --- doc/config.html | 11 ++++++++- src/elogd.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/doc/config.html b/doc/config.html index 333f6ec4..1e398991 100755 --- a/doc/config.html +++ b/doc/config.html @@ -335,7 +335,8 @@ groups. Instead, one has to append the top group name to the URL, such as http://your.host:8080/engineering or http://your.host:8080/administration. If someone does not know the top group name, one cannot see the list of logbooks there, so the groups become completely -independent of each other.

+independent of each other. If this feature is not wanted, it can be disabled by setting +Show top groups = 1.


@@ -1662,6 +1663,14 @@ Same as before, but gets added after the previous entry. Same as before, but for editing entries.

+

  • Show top groups = 0|1 +
    +When using top groups, the root of the elogd server is not accessible any more, to avoid +cases where one group can "see" the logbooks of the other groups. If this feature is +unwanted, the flag Show top groups can be set to 1, +in which case a list of available top groups is shown. +

    +

    diff --git a/src/elogd.c b/src/elogd.c index 66b46bcd..bc0d4039 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 1.374 2004/07/08 19:48:09 midas + Implemented 'show top groups' flag + Revision 1.373 2004/07/08 11:31:33 midas Fixed compiler warning @@ -16669,6 +16672,54 @@ void show_logbook_node(LBLIST plb, LBLIST pparent, int level, int btop) /*------------------------------------------------------------------*/ +void show_top_selection_page() +{ + int i; + char str[NAME_LENGTH], name[NAME_LENGTH], name_enc[NAME_LENGTH]; + LBLIST phier; + + /* if selection page protected, check password */ + if (getcfg("global", "password file", str) && + getcfg("global", "protect selection page", str) && atoi(str) == 1) + if (!check_user_password(NULL, getparam("unm"), getparam("upwd"), "")) + return; + + if (getcfg("global", "Page Title", str)) { + strip_html(str); + show_html_header(NULL, TRUE, str, TRUE); + } else + show_html_header(NULL, TRUE, "ELOG Logbook Selection", TRUE); + rsprintf("\n\n"); + rsprintf("\n"); + rsprintf("\n"); + + phier = get_logbook_hierarchy(); + for (i = 0; i < phier->n_members; i++) + if (phier->member[i]->is_top) { + rsprintf("\n"); + } + + free_logbook_hierarchy(phier); + rsprintf("
    \n"); + + if (getcfg("global", "Welcome title", str)) { + rsputs(str); + } else { + rsprintf("%s.
    \n", loc("Several logbooks groups are defined on this host")); + rsprintf("%s:\n", loc("Please select one to list the logbooks in that group")); + } + + rsprintf("
    "); + strlcpy(name, phier->member[i]->name, sizeof(name)); + strlcpy(name_enc, name, sizeof(name_enc)); + url_encode(name_enc, sizeof(name_enc)); + rsprintf("%s", name_enc, name); + rsprintf("
    \n"); + rsprintf("\r\n\r\n"); +} + +/*------------------------------------------------------------------*/ + void show_selection_page() { int i, j, show_title; @@ -16711,9 +16762,14 @@ void show_selection_page() return; } - /* top group present and no top group in URL -> abort connection */ - if (exist_top_group() && getcfg_topgroup() == NULL) - return; + /* top group present and no top group in URL */ + if (exist_top_group() && getcfg_topgroup() == NULL) { + if (getcfg("global", "show top groups", str) && atoi(str) == 1) { + show_top_selection_page(); + return; + } else + return; /* abort connection */ + } /* if selection page protected, check password */ if (getcfg("global", "password file", str) &&