coar        97/06/23 04:36:58

  Modified:    src       CHANGES mod_dir.c
  Log:
        Add IconHeight and IconWidth to mod_dir's IndexOptions
        directive.  These allow the specification of HEIGHT and
        WIDTH attributes in the IMG tags emitted when FancyIndexing
        is enabled.
  
  Reviewed by:  Randy Terbush, Sameer Parekh
  
  Revision  Changes    Path
  1.288     +4 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.287
  retrieving revision 1.288
  diff -C3 -r1.287 -r1.288
  *** CHANGES   1997/06/16 06:06:21     1.287
  --- CHANGES   1997/06/23 11:36:56     1.288
  ***************
  *** 1,5 ****
  --- 1,9 ----
    Changes with Apache 1.3
    
  +   *) Added IconHeight and IconWidth to mod_dir's IndexOptions directive.
  +      When used together, these cause mod_dir to emit HEIGHT and WIDTH
  +      attributes in the FancyIndexing IMG tags.  [Ken Coar]
  + 
      *) Added NT support [Ben Laurie and Ambarish Malpani <[EMAIL PROTECTED]>]
    
    Changes with Apache 1.2
  
  
  
  1.29      +62 -4     apache/src/mod_dir.c
  
  Index: mod_dir.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_dir.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -C3 -r1.28 -r1.29
  *** mod_dir.c 1997/06/17 00:09:14     1.28
  --- mod_dir.c 1997/06/23 11:36:56     1.29
  ***************
  *** 86,91 ****
  --- 86,97 ----
    #define SUPPRESS_SIZE 16
    #define SUPPRESS_DESC 32
    
  + /*
  +  * These are the dimensions of the default icons supplied with Apache.
  +  */
  + #define DEFAULT_ICON_WIDTH 20
  + #define DEFAULT_ICON_HEIGHT 22
  + 
    struct item {
        char *type;
        char *apply_to;
  ***************
  *** 97,102 ****
  --- 103,110 ----
    
        char *default_icon;
        char *index_names;
  +     int icon_width;
  +     int icon_height;
      
        array_header *icon_list, *alt_list, *desc_list, *ign_list;
        array_header *hdr_list, *rdme_list, *opts_list;
  ***************
  *** 192,197 ****
  --- 200,206 ----
    const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) {
        char *w;
        int opts = 0;
  +     dir_config_rec *d_cfg = (dir_config_rec *) d;
    
        while(optstr[0]) {
            w = getword_conf(cmd->pool, &optstr);
  ***************
  *** 209,214 ****
  --- 218,247 ----
                opts |= SUPPRESS_DESC;
            else if(!strcasecmp(w,"None"))
                opts = 0;
  +     else if (! strncasecmp (w, "IconWidth", 9)) {
  +         if (strchr (w, '=') != NULL) {
  +             const char *x = pstrdup (cmd->pool, w);
  +             char *val;
  +             val = getword (cmd->pool, &x, '=');
  +             val = getword (cmd->pool, &x, '=');
  +             d_cfg->icon_width = atoi(val);
  +         }
  +         else {
  +             d_cfg->icon_width = DEFAULT_ICON_WIDTH;
  +         }
  +     }
  +     else if (! strncasecmp (w, "IconHeight", 10)) {
  +         if (strchr (w, '=') != NULL) {
  +             const char *x = pstrdup (cmd->pool, w);
  +             char *val;
  +             val = getword (cmd->pool, &x, '=');
  +             val = getword (cmd->pool, &x, '=');
  +             d_cfg->icon_height = atoi(val);
  +         }
  +         else {
  +             d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
  +         }
  +     }
        else
            return "Invalid directory indexing option";
        }
  ***************
  *** 256,261 ****
  --- 289,296 ----
            (dir_config_rec *) pcalloc (p, sizeof(dir_config_rec));
    
        new->index_names = NULL;
  +     new->icon_width = 0;
  +     new->icon_height = 0;
        new->icon_list = make_array (p, 4, sizeof (struct item));
        new->alt_list = make_array (p, 4, sizeof (struct item));
        new->desc_list = make_array (p, 4, sizeof (struct item));
  ***************
  *** 275,280 ****
  --- 310,317 ----
    
        new->default_icon = 
add->default_icon?add->default_icon:base->default_icon;
        new->index_names = add->index_names? add->index_names: 
base->index_names;
  +     new->icon_height = add->icon_height ? add->icon_height : 
base->icon_height;
  +     new->icon_width = add->icon_width ? add->icon_width : base->icon_width;
    
        new->alt_list = append_arrays (p, add->alt_list, base->alt_list);
        new->ign_list = append_arrays (p, add->ign_list, base->ign_list);
  ***************
  *** 579,587 ****
    
        if(dir_opts & FANCY_INDEXING) {
            rputs("<PRE>", r);
  !         if((tp = find_default_icon(d,"^^BLANKICON^^")))
                rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  !                "\" ALT=\"     \"> ", NULL);
            rputs("Name                   ", r);
            if(!(dir_opts & SUPPRESS_LAST_MOD))
                rputs("Last modified     ", r);
  --- 616,635 ----
    
        if(dir_opts & FANCY_INDEXING) {
            rputs("<PRE>", r);
  !         if((tp = find_default_icon(d,"^^BLANKICON^^"))) {
                rvputs(r, "<IMG SRC=\"", escape_html(scratch, tp),
  !                "\" ALT=\"     \"", NULL);
  !         if (d->icon_width && d->icon_height) {
  !             rprintf
  !                 (
  !                     r,
  !                     " HEIGHT=\"%d\" WIDTH=\"%d\"",
  !                     d->icon_height,
  !                     d->icon_width
  !                 );
  !         }
  !         rputs ("> ", r);
  !     }
            rputs("Name                   ", r);
            if(!(dir_opts & SUPPRESS_LAST_MOD))
                rputs("Last modified     ", r);
  ***************
  *** 639,646 ****
                       escape_html(scratch, ar[x]->icon ?
                                   ar[x]->icon : d->default_icon),
                       "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : "   "),
  !                    "]\">", NULL);
  !             }
                if(dir_opts & ICONS_ARE_LINKS) 
                    rputs("</A>", r);
    
  --- 687,704 ----
                       escape_html(scratch, ar[x]->icon ?
                                   ar[x]->icon : d->default_icon),
                       "\" ALT=\"[", (ar[x]->alt ? ar[x]->alt : "   "),
  !                    "]\"", NULL);
  !             if (d->icon_width && d->icon_height) {
  !                 rprintf
  !                     (
  !                         r,
  !                         " HEIGHT=\"%d\" WIDTH=\"%d\"",
  !                         d->icon_height,
  !                         d->icon_width
  !                     );
  !             }
  !             rputs (">", r);
  !         }
                if(dir_opts & ICONS_ARE_LINKS) 
                    rputs("</A>", r);
    
  
  
  

Reply via email to