From ca323c0550dcbdbcc60e0587c9cda5a951c51cf1 Mon Sep 17 00:00:00 2001 From: Nick Kew Date: Tue, 26 Aug 2008 22:10:06 +0000 Subject: [PATCH] Add option to insert something in autoindex head. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@689261 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ docs/manual/mod/mod_autoindex.xml | 20 ++++++++++++++++++++ modules/generators/mod_autoindex.c | 9 +++++++++ 3 files changed, 32 insertions(+) diff --git a/CHANGES b/CHANGES index c1be181d4d..1c4902ed92 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) mod_autoindex: add configuration option to insert string + in HTML HEAD. [Nick Kew] + *) mod_ssl: implement dynamic mutex callbacks for the benefit of OpenSSL. [Sander Temme] diff --git a/docs/manual/mod/mod_autoindex.xml b/docs/manual/mod/mod_autoindex.xml index af4ff1c676..d5c3a61c5a 100644 --- a/docs/manual/mod/mod_autoindex.xml +++ b/docs/manual/mod/mod_autoindex.xml @@ -937,6 +937,26 @@ Name|Date|Size|Description + +IndexHeadInsert +Inserts text in the HEAD section of an index page. +IndexHeadInsert "markup ..." +server configvirtual host +directory.htaccess + +Indexes + + +

The IndexHeadInsert directive specifies a + string to insert in the <head> section of the HTML + generated for the index page.

+ + Example + IndexHeadInsert "<link rel=\"sitemap\" href=\"/sitemap.html\">" + +
+
+ ReadmeName Name of the file that will be inserted at the end diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 3e8153c153..1c38cf28c9 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -119,6 +119,7 @@ typedef struct autoindex_config_struct { char *default_icon; char *style_sheet; + char *head_insert; apr_int32_t opts; apr_int32_t incremented_opts; apr_int32_t decremented_opts; @@ -176,6 +177,9 @@ static void emit_preamble(request_rec *r, int xhtml, const char *title) ap_rvputs(r, " style_sheet, "\" type=\"text/css\"", xhtml ? " />\n" : ">\n", NULL); } + if (d->head_insert != NULL) { + ap_rputs(d->head_insert, r); + } ap_rvputs(r, " \n \n", NULL); } @@ -594,6 +598,9 @@ static const command_rec autoindex_cmds[] = AP_INIT_TAKE1("IndexStyleSheet", ap_set_string_slot, (void *)APR_OFFSETOF(autoindex_config_rec, style_sheet), DIR_CMD_PERMS, "URL to style sheet"), + AP_INIT_TAKE1("IndexHeadInsert", ap_set_string_slot, + (void *)APR_OFFSETOF(autoindex_config_rec, head_insert), + DIR_CMD_PERMS, "String to insert in HTML HEAD section"), {NULL} }; @@ -634,6 +641,8 @@ static void *merge_autoindex_configs(apr_pool_t *p, void *basev, void *addv) : base->default_icon; new->style_sheet = add->style_sheet ? add->style_sheet : base->style_sheet; + new->head_insert = add->head_insert ? add->head_insert + : base->head_insert; 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.50.1