You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2009/12/29 10:33:33 UTC

Re: svn commit: r894298 - in /httpd/httpd/trunk: docs/manual/mod/mod_autoindex.html.en docs/manual/mod/mod_autoindex.xml modules/generators/mod_autoindex.c

On 29.12.2009 03:18, rbowen@apache.org wrote:
> Author: rbowen
> Date: Tue Dec 29 02:18:55 2009
> New Revision: 894298
> 
> URL: http://svn.apache.org/viewvc?rev=894298&view=rev
> Log:
> Adds alternating CSS classes to table rows for trendy striped table
> support.
> 
> Modified:
>     httpd/httpd/trunk/docs/manual/mod/mod_autoindex.html.en
>     httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml
>     httpd/httpd/trunk/modules/generators/mod_autoindex.c
> 
> Modified: httpd/httpd/trunk/docs/manual/mod/mod_autoindex.html.en
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_autoindex.html.en?rev=894298&r1=894297&r2=894298&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/mod/mod_autoindex.html.en (original)
> +++ httpd/httpd/trunk/docs/manual/mod/mod_autoindex.html.en Tue Dec 29 02:18:55 2009
> @@ -900,6 +900,12 @@
>        IndexStyleSheet "/css/style.css"
>      </code></p></div>
>  
> +    <p>Using this directive in conjunction with <code>IndexOptions
> +    HTMLTable</code> also adds <code>ai-tr-odd</code> and
> +    <code>ai-tr-even</code> class declarations to alternating rows of
> +    the directory listing table, so that you can style alternate rows of
> +    the table differently.</p>
> +
>  </div>
>  <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
>  <div class="directive-section"><h2><a name="ReadmeName" id="ReadmeName">ReadmeName</a> <a name="readmename" id="readmename">Directive</a></h2>
> 
> Modified: httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml?rev=894298&r1=894297&r2=894298&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml (original)
> +++ httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml Tue Dec 29 02:18:55 2009
> @@ -934,6 +934,12 @@
>        <title>Example</title>
>        IndexStyleSheet "/css/style.css"
>      </example>
> +
> +    <p>Using this directive in conjunction with <code>IndexOptions
> +    HTMLTable</code> also adds <code>ai-tr-odd</code> and
> +    <code>ai-tr-even</code> class declarations to alternating rows of
> +    the directory listing table, so that you can style alternate rows of
> +    the table differently.</p>
>  </usage>
>  </directivesynopsis>
>  
> 
> Modified: httpd/httpd/trunk/modules/generators/mod_autoindex.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_autoindex.c?rev=894298&r1=894297&r2=894298&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/generators/mod_autoindex.c (original)
> +++ httpd/httpd/trunk/modules/generators/mod_autoindex.c Tue Dec 29 02:18:55 2009
> @@ -1482,6 +1482,7 @@
>                                 char direction, const char *colargs)
>  {
>      int x;
> +    int row_count;
>      apr_size_t rv;
>      char *name = r->uri;
>      char *tp;
> @@ -1658,7 +1659,23 @@
>          }
>  
>          if (autoindex_opts & TABLE_INDEXING) {
> -            ap_rputs("<tr>", r);
> +            ap_rputs("<tr", r);
> +
> +            /* Even/Odd rows for IndexStyleSheet */
> +            if (d->style_sheet != NULL) {
> +                ap_rputs(" class=\"", r);
> +                if ( row_count % 2 == 0 ) {
> +                    ap_rputs("ai_tr_even", r);
> +                }
> +                else {
> +                    ap_rputs("ai_tr_odd", r);
> +                }
> +                ap_rputs("\"", r);
> +                row_count++;
> +            }
> +
> +            ap_rputs(">", r);
> +
>              if (!(autoindex_opts & SUPPRESS_ICON)) {
>                  ap_rputs("<td valign=\"top\">", r);
>                  if (autoindex_opts & ICONS_ARE_LINKS) {
> 
> 
> 

Please inititialize row_count to 0 to avoid compiler warnings.

Regards

RĂ¼diger