From: Rich Bowen Date: Tue, 29 Dec 2009 02:18:55 +0000 (+0000) Subject: Adds alternating CSS classes to table rows for trendy striped table X-Git-Tag: 2.3.5~57 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36d32b499809304858c8db725a954d5938823048;p=apache Adds alternating CSS classes to table rows for trendy striped table support. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894298 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_autoindex.html.en b/docs/manual/mod/mod_autoindex.html.en index f5ac3205da..018a7056e0 100644 --- a/docs/manual/mod/mod_autoindex.html.en +++ b/docs/manual/mod/mod_autoindex.html.en @@ -900,6 +900,12 @@ Name|Date|Size|Description IndexStyleSheet "/css/style.css"

+

Using this directive in conjunction with IndexOptions + HTMLTable also adds ai-tr-odd and + ai-tr-even class declarations to alternating rows of + the directory listing table, so that you can style alternate rows of + the table differently.

+
top

ReadmeName Directive

diff --git a/docs/manual/mod/mod_autoindex.xml b/docs/manual/mod/mod_autoindex.xml index d5c3a61c5a..bb2ee18fa3 100644 --- a/docs/manual/mod/mod_autoindex.xml +++ b/docs/manual/mod/mod_autoindex.xml @@ -934,6 +934,12 @@ Name|Date|Size|Description Example IndexStyleSheet "/css/style.css" + +

Using this directive in conjunction with IndexOptions + HTMLTable also adds ai-tr-odd and + ai-tr-even class declarations to alternating rows of + the directory listing table, so that you can style alternate rows of + the table differently.

diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 8d93f63368..b6669421bd 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -1482,6 +1482,7 @@ static void output_directories(struct ent **ar, int n, char direction, const char *colargs) { int x; + int row_count; apr_size_t rv; char *name = r->uri; char *tp; @@ -1658,7 +1659,23 @@ static void output_directories(struct ent **ar, int n, } if (autoindex_opts & TABLE_INDEXING) { - ap_rputs("", r); + ap_rputs("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("", r); if (autoindex_opts & ICONS_ARE_LINKS) {