]> granicus.if.org Git - apache/commitdiff
Adds alternating CSS classes to table rows for trendy striped table
authorRich Bowen <rbowen@apache.org>
Tue, 29 Dec 2009 02:18:55 +0000 (02:18 +0000)
committerRich Bowen <rbowen@apache.org>
Tue, 29 Dec 2009 02:18:55 +0000 (02:18 +0000)
support.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@894298 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_autoindex.html.en
docs/manual/mod/mod_autoindex.xml
modules/generators/mod_autoindex.c

index f5ac3205da5e24bc731cd907e4881f61c911bcbf..018a7056e0f4db84d7f900fcee7528f814e3ab1a 100644 (file)
@@ -900,6 +900,12 @@ Name|Date|Size|Description</code></td></tr>
       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>
index d5c3a61c5adf7a226292e18783c052c15b1ec029..bb2ee18fa32d7cfa6e68c5609ffd7f5bfacc7204 100644 (file)
@@ -934,6 +934,12 @@ Name|Date|Size|Description</syntax>
       <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>
 
index 8d93f633684f64d1fec400b6b8a0f44503911483..b6669421bd5382085d640907acd25f26fc3427e5 100644 (file)
@@ -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("<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) {