diff --git a/doc/CHANGELOG.TXT b/doc/CHANGELOG.TXT index 32bef403..026887e2 100755 --- a/doc/CHANGELOG.TXT +++ b/doc/CHANGELOG.TXT @@ -3,6 +3,9 @@ Version 2.2.5, released December xxth, 2002 - Improved speed for sending many email notifications - Added "Omit email to" option +- Added "Suppress Email to users" option +- Email recipients can now use subsitution like $name +- Added hierarchical logbooks Version 2.2.4, released December 12th, 2002 =========================================== diff --git a/doc/config.html b/doc/config.html index 4723a34c..3cd3171a 100755 --- a/doc/config.html +++ b/doc/config.html @@ -831,6 +831,7 @@ individual logbook sections, one has to log in to each logbook separately.

  • Use Email Subject = <string>
  • Use Email From = <string>
  • Omit Email To = 0|1 +
  • Suppress Email to users = 0|1

    @@ -840,8 +841,12 @@ of the configuration file. To submit an email based on an attribute value, use t <list>. Whenever an entry is submitted where attribute is equal to value, an email notification is sent to the email addresses in list. -Several mail addresses may be supplied, separated by commas. Multiple -Email xxx statements may occur in a configuration +Several mail addresses may be supplied, separated by commas. The mail addresses can +contain attributes via the "$" substitution. If a logbook contains for +example an attribute name which contains email names, then one can +put $name@domain to form a valid email address.

    + +Multiple Email xxx statements may occur in a configuration file. If either the attribute or the value contains one or more blanks the string must be enclosed with quotation marks, as in:

    @@ -856,9 +861,12 @@ attribute. For a full list of possible substitutions, see the "Subst <attribute>" option. The option Use Email From = <string> is used for the "from" field in the email. If the flag Omit Email To is set to 1, the To: field in the email is -left empty insted set to the real email address of the recipients. This can +left empty instead set to the real email address of the recipients. This can be useful if one recipient should not see the email addresses of the other recipients.

    +The flag Suppress Email to users can be set to "1" if email should +only be sent to the recipients of the Email <attribute> <value> = <list> +statements but not to the users who have registerd for automatic email notification.


      Flags  
    diff --git a/doc/index.html b/doc/index.html index 625eb908..04804fe4 100755 --- a/doc/index.html +++ b/doc/index.html @@ -30,7 +30,7 @@  [
    Links]  * 

    Home of the Electronic Logbook package by Stefan Ritt

    -
      Current version is : 2.2.3  
    +
      Current version is : 2.2.4  

      What is ELOG ?  
    diff --git a/elogd.c b/elogd.c index 7b213454..8b0c98dd 100755 --- a/elogd.c +++ b/elogd.c @@ -6,6 +6,9 @@ Contents: Web server program for Electronic Logbook ELOG $Log$ + Revision 2.117 2003/01/04 20:22:35 midas + Added new email options and hierarchical logbooks + Revision 2.116 2002/12/19 14:37:14 midas Avoid long lines with many radio/check buttons @@ -672,6 +675,15 @@ typedef struct { int n_attr; } LOGBOOK; +typedef struct LBNODE *LBLIST; + +struct LBNODE { + char name[256]; + LBLIST member; + int n_members; + int subgroup; +} LBNODE; + typedef struct { LOGBOOK *lbs; int index; @@ -3769,12 +3781,111 @@ void show_standard_header(char *title, char *path) rsprintf("
    \n\n"); } +/*------------------------------------------------------------------*/ + +int get_logbook_hierarchy(LBLIST *lblist) +{ +int i, j, k, n, m; +char str[1000], grpname[256], grpmembers[1000]; +LBLIST lbl; +char grplist[MAX_N_LIST][NAME_LENGTH]; + + /* enumerate groups */ + for (i=n=0 ; ; i++) + { + if (!enumcfg("global", grpname, grpmembers, i)) + break; + + strlcpy(str, grpname, sizeof(str)); + str[5] = 0; + if (equal_ustring(str, "group")) + { + if (n == 0) + lbl = malloc(sizeof(LBNODE)); + else + lbl = realloc(lbl, (n+1) * sizeof(LBNODE)); + memset(lbl+n, 0, sizeof(LBNODE)); + + strlcpy(lbl[n].name, grpname+6, 256); + m = strbreak(grpmembers, grplist, MAX_N_LIST); + lbl[n].n_members = m; + + lbl[n].member = calloc(sizeof(LBNODE), m); + for (j=0 ; jname, logbook)) + return 1; + + for (i=0 ; in_members ; i++) + { + if (equal_ustring(logbook, lbl->member[i].name)) + return 1; + + if (lbl->member[i].n_members > 0 && + is_logbook_in_group(&(lbl->member[i]), logbook)) + return 1; + } + + return 0; +} + + /*------------------------------------------------------------------*/ void show_standard_title(char *logbook, char *text, int printable) { -char str[256], ref[256]; -int i, j; +char str[256], ref[256]; +int i, j, n_grp, n_lb, nnum, level; +LBLIST clb, flb, nlb, lbl; /* overall table, containing title, menu and message body */ if (printable) @@ -3784,51 +3895,84 @@ int i, j; rsprintf("\n\n", gt("Table width"), gt("Border width"), gt("Frame color")); + /* scan logbook hierarchy */ + n_grp = get_logbook_hierarchy(&lbl); + /*---- logbook selection row ----*/ + clb = lbl; + nlb = NULL; + n_lb = n_grp; if (!printable && getcfg(logbook, "logbook tabs", str) && atoi(str) == 1) { - rsprintf("\n\n"); + + clb = nlb; + n_lb = nnum; + + if (nlb == NULL) break; - if (equal_ustring(str, "global")) - continue; - - strcpy(ref, str); - url_encode(ref, sizeof(ref)); - - if (equal_ustring(str, logbook)) - { - rsprintf(" ", - gt("Title fontcolor"), gt("Title BGColor")); - rsprintf("", gt("Title fontcolor"), ref); - } - else - { - rsprintf(" "); - rsprintf("", ref); - } - - - for (j=0 ; j<(int)strlen(str) ; j++) - if (str[j] == ' ') - rsprintf(" "); - else - rsprintf("%c", str[j]); - - rsprintf("  \n"); } - rsprintf("\n\n"); - } + /* free logbook node memory */ + for (i=0 ; i
    \n"); - - if (getcfg("global", "main tab", str)) - rsprintf(" %s  \n", str); - - for (i=0 ; ; i++) + for (level = 0 ; ; level++) { - if (!enumgrp(i, str)) + rsprintf("
    \n"); + + if (getcfg("global", "main tab", str)) + rsprintf(" %s  \n", str); + + for (i=0 ; imember) // so traverse hierarchy + flb = &flb->member[0]; + strlcpy(ref, flb->name, sizeof(ref)); + } + url_encode(ref, sizeof(ref)); + + if (is_logbook_in_group(&clb[i], logbook)) + { + nlb = clb[i].member; + nnum = clb[i].n_members; + + rsprintf(" ", + gt("Title fontcolor"), gt("Title BGColor")); + rsprintf("", gt("Title fontcolor"), ref); + } + else + { + rsprintf(" "); + rsprintf("", ref); + } + + + for (j=0 ; j<(int)strlen(str) ; j++) + if (str[j] == ' ') + rsprintf(" "); + else + rsprintf("%c", str[j]); + + rsprintf("  \n"); + } + rsprintf("
    \n", @@ -8592,6 +8736,9 @@ int i, j, n, missing, first, index, suppress, message_id, resubmit_orig, mail for (i=0 ; i= mail_to_size) { mail_to_size += 256; @@ -8603,23 +8750,27 @@ int i, j, n, missing, first, index, suppress, message_id, resubmit_orig, mail } } - /* go through password file */ - for (index=0 ; ; index++) + if (!getcfg(lbs->name, "Suppress Email to users", str) || + atoi(str) == 0) { - if (!enum_user_line(lbs, index, user)) - break; - - get_user_line(lbs->name, user, NULL, NULL, user_email, email_notify); - - if (email_notify[0]) + /* go through password file */ + for (index=0 ; ; index++) { - if ((int)strlen(mail_to) + (int)strlen(user_email) >= mail_to_size) + if (!enum_user_line(lbs, index, user)) + break; + + get_user_line(lbs->name, user, NULL, NULL, user_email, email_notify); + + if (email_notify[0]) { - mail_to_size += 256; - mail_to = realloc(mail_to, mail_to_size); + if ((int)strlen(mail_to) + (int)strlen(user_email) >= mail_to_size) + { + mail_to_size += 256; + mail_to = realloc(mail_to, mail_to_size); + } + strcat(mail_to, user_email); + strcat(mail_to, ","); } - strcat(mail_to, user_email); - strcat(mail_to, ","); } } }