summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Holsman <ianh@apache.org>2003-11-20 04:45:22 +0100
committerIan Holsman <ianh@apache.org>2003-11-20 04:45:22 +0100
commitb8f83d01aeedb97538968f152b895212655db555 (patch)
tree42439ce95f86089854e94cd67b9d4395df2ee8e6
parentimprove this document step by step: (diff)
downloadapache2-b8f83d01aeedb97538968f152b895212655db555.tar.xz
apache2-b8f83d01aeedb97538968f152b895212655db555.zip
mod_autoindex: new directive IndexStyleSheet
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
-rw-r--r--CHANGES3
-rw-r--r--docs/manual/mod/mod_autoindex.xml18
-rw-r--r--modules/generators/mod_autoindex.c18
3 files changed, 38 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 42c89c78e1..e45250edf7 100644
--- 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]
diff --git a/docs/manual/mod/mod_autoindex.xml b/docs/manual/mod/mod_autoindex.xml
index 0b9ac8140c..9c1d872905 100644
--- a/docs/manual/mod/mod_autoindex.xml
+++ b/docs/manual/mod/mod_autoindex.xml
@@ -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>
diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c
index 96d3349dc3..aa6475525d 100644
--- a/modules/generators/mod_autoindex.c
+++ b/modules/generators/mod_autoindex.c
@@ -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;