From b8f83d01aeedb97538968f152b895212655db555 Mon Sep 17 00:00:00 2001
From: Ian Holsman
Date: Thu, 20 Nov 2003 03:45:22 +0000
Subject: [PATCH] mod_autoindex: new directive IndexStyleSheet
PR:
Obtained from:
Submitted by: Tyler Riddle and Paul Querna
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101809 13f79535-47bb-0310-9956-ffa450edef68
---
CHANGES | 3 +++
docs/manual/mod/mod_autoindex.xml | 18 ++++++++++++++++++
modules/generators/mod_autoindex.c | 18 +++++++++++++++++-
3 files changed, 38 insertions(+), 1 deletion(-)
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 , Paul Querna ]
+
*) 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
order.
+
+IndexStyleSheet
+Adds a CSS stylesheet to autoindexes output
+IndexStyleSheetURI
+server configvirtual host
+directory.htaccess
+
+Indexes
+
+
+ The IndexStyleSheet directive adds a stylesheet
+ to the output of mod_authindex
+
+
+ IndexStyleSheet "/css/style.css"
+
+
+
ReadmeName
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,
"\n \n Index of ", title,
- "\n \n \n", NULL);
+ "\n", NULL);
+ if (d->style_sheet != NULL) {
+ ap_rvputs(r, " style_sheet,
+ "\" type=\"text/css\"", xhtml ? "/>\n" : ">\n", NULL);
+ }
+ ap_rvputs(r, "\n \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;
--
2.40.0