]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_autoindex: new directive IndexStyleSheet
authorIan Holsman <ianh@apache.org>
Thu, 20 Nov 2003 03:45:22 +0000 (03:45 +0000)
committerIan Holsman <ianh@apache.org>
Thu, 20 Nov 2003 03:45:22 +0000 (03:45 +0000)
PR:
Obtained from:
Submitted by: Tyler Riddle <triddle_1999 yahoo.com> and Paul Querna <chip force-elite.com>
Reviewed by:

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

CHANGES
docs/manual/mod/mod_autoindex.xml
modules/generators/mod_autoindex.c

diff --git a/CHANGES b/CHANGES
index 42c89c78e1b068e86bb15087b6d47a698128d8fe..e45250edf73bc38c7e5de0ec5ba867437167de3d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_autoindex: new directive IndexStyleSheet 
+    [Tyler Riddle <triddle_1999 yahoo.com>, Paul Querna <chip force-elite.com>]
+
   *) Fix a long delay with CGI requests and keepalive connections on
      AIX.  [Jeff Trawick]
 
index 0b9ac8140ce4370f27af9fdb7e034b89128b9204..9c1d8729054295cb7632c41b8216cae74eb34308 100644 (file)
@@ -859,6 +859,24 @@ Name|Date|Size|Description</syntax>
     order.</p>
 </usage>
 </directivesynopsis>
+<directivesynopsis>
+<name>IndexStyleSheet</name>
+<description>Adds a CSS stylesheet to autoindexes output</description>
+<syntax>IndexStyleSheet<var>URI</var> </syntax>
+<contextlist><context>server config</context><context>virtual host</context>
+<context>directory</context><context>.htaccess</context>
+</contextlist>
+<override>Indexes</override>
+
+<usage>
+    <p>The <directive>IndexStyleSheet</directive> directive adds a stylesheet
+    to the output of mod_authindex
+    </p>
+    <example>
+      IndexStyleSheet "/css/style.css"
+    </example>
+</usage>
+</directivesynopsis>
 
 <directivesynopsis>
 <name>ReadmeName</name>
index 96d3349dc39e4956cec37f1d48c1ddae4782c42f..aa6475525df4041179fa7ed6ed157637cf60350c 100644 (file)
@@ -159,6 +159,7 @@ typedef struct ai_desc_t {
 typedef struct autoindex_config_struct {
 
     char *default_icon;
+    char *style_sheet;
     apr_int32_t opts;
     apr_int32_t incremented_opts;
     apr_int32_t decremented_opts;
@@ -193,9 +194,19 @@ static char c_by_encoding, c_by_type, c_by_path;
  */
 static void emit_preamble(request_rec *r, int xhtml, const char *title)
 {
+    autoindex_config_rec *d;
+
+    d = (autoindex_config_rec *) ap_get_module_config(r->per_dir_config,
+                                                      &autoindex_module);
+
     ap_rvputs(r, xhtml ? DOCTYPE_XHTML_1_0T : DOCTYPE_HTML_3_2,
               "<html>\n <head>\n  <title>Index of ", title,
-              "</title>\n </head>\n <body>\n", NULL);
+              "</title>\n", NULL);
+    if (d->style_sheet != NULL) {
+        ap_rvputs(r, "  <link rel=\"stylesheet\" href=\"", d->style_sheet,
+                "\" type=\"text/css\"", xhtml ? "/>\n" : ">\n", NULL);
+    }
+    ap_rvputs(r, "</head>\n <body>\n", NULL);
 }
 
 static void push_item(apr_array_header_t *arr, char *type, const char *to,
@@ -599,6 +610,9 @@ static const command_rec autoindex_cmds[] =
     AP_INIT_TAKE1("DefaultIcon", ap_set_string_slot,
                   (void *)APR_OFFSETOF(autoindex_config_rec, default_icon),
                   DIR_CMD_PERMS, "an icon URL"),
+    AP_INIT_TAKE1("IndexStyleSheet", ap_set_string_slot,
+                  (void *)APR_OFFSETOF(autoindex_config_rec, style_sheet),
+                  DIR_CMD_PERMS, "URL to style sheet"),
     {NULL}
 };
 
@@ -637,6 +651,8 @@ static void *merge_autoindex_configs(apr_pool_t *p, void *basev, void *addv)
     new = (autoindex_config_rec *) apr_pcalloc(p, sizeof(autoindex_config_rec));
     new->default_icon = add->default_icon ? add->default_icon
                                           : base->default_icon;
+    new->style_sheet = add->style_sheet ? add->style_sheet
+                                          : base->style_sheet;
     new->icon_height = add->icon_height ? add->icon_height : base->icon_height;
     new->icon_width = add->icon_width ? add->icon_width : base->icon_width;