--- mod_autoindex.c.orig 2007-06-01 14:50:02.058981270 +0800 +++ mod_autoindex.c 2007-06-01 17:10:52.346451938 +0800 @@ -151,8 +151,23 @@ */ static void emit_preamble(request_rec *r, int xhtml, const char *title) { - ap_rvputs(r, xhtml ? DOCTYPE_XHTML_1_0T : DOCTYPE_HTML_3_2, - "\n \n Index of ", title, + ap_rvputs(r, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", xhtml ? DOCTYPE_XHTML_1_0T : DOCTYPE_HTML_3_2, + "<html>\n <head>\n", + " <style type=\"text/css\">\n", + " a, a:active {text-decoration: none; color: blue;}\n", + " a:visited {color: #48468F;}\n", + " a:hover, a:focus {text-decoration: underline; color: red;}\n", + " body {background-color: #F5F5F5;}\n", + " h2 {margin-bottom: 12px;}\n", + " table {margin-left: 12px;}\n", + " th, td { font-family: \"Courier New\", Courier, monospace; font-size: 10pt; text-align: left;}\n", + " th { font-weight: bold; padding-right: 14px; padding-bottom: 3px;}\n", + " td {padding-right: 14px;}\n", + " td.s, th.s {text-align: right;}\n", + " div.list { background-color: white; border-top: 1px solid #646464; border-bottom: 1px solid #646464; padding-top: 10px; padding-bottom: 14px;}\n", + " div.foot { font-family: \"Courier New\", Courier, monospace; font-size: 10pt; color: #787878; padding-top: 4px;}\n", + " </style>\n", + " <title>Index of ", title, "\n \n \n", NULL); } @@ -1057,7 +1072,7 @@ emit_preamble(r, emit_xhtml, title); } if (emit_H1) { - ap_rvputs(r, "

Index of ", title, "

\n", NULL); + ap_rvputs(r, "

Index of ", title, "

\n", NULL); } if (rr != NULL) { ap_destroy_sub_req(rr); @@ -1547,7 +1562,7 @@ ap_rvputs(r, "", breakrow, NULL); } else if (autoindex_opts & FANCY_INDEXING) { - ap_rputs("
", r);
+        ap_rputs("
\n\n\n\n", r); } else { ap_rputc('\n', r); @@ -1718,7 +1730,7 @@ ap_rvputs(r, "", NULL); } if ((ar[x]->icon) || d->default_icon) { - ap_rvputs(r, "", pad_scratch + nwidth, NULL); /* * The blank before the storm.. er, before the next field. */ - ap_rputs(" ", r); + ap_rputs(" ", &ts); ap_rputs(time_str, r); } else { @@ -1779,15 +1791,18 @@ } if (!(autoindex_opts & SUPPRESS_SIZE)) { char buf[5]; + ap_rputs(" ", r); } if (!(autoindex_opts & SUPPRESS_DESC)) { + ap_rputs(" ", r); } ap_rputc('\n', r); } @@ -1801,11 +1816,7 @@ } else if (autoindex_opts & FANCY_INDEXING) { if (!(autoindex_opts & SUPPRESS_RULES)) { - ap_rputs("\n", r); + ap_rputs("\n
", r); if (!(autoindex_opts & SUPPRESS_ICON)) { if ((tp = find_default_icon(d, "^^BLANKICON^^"))) { ap_rvputs(r, "", r); /* * Emit the guaranteed-at-least-one-space-between-columns byte. */ - ap_rputs(" ", r); + ap_rputs(" ", r); if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { emit_link(r, "Last modified", K_LAST_MOD, keyid, direction, colargs, static_columns); - ap_rputs(" ", r); + ap_rputs(" ", r); } if (!(autoindex_opts & SUPPRESS_SIZE)) { emit_link(r, "Size", K_SIZE, keyid, direction, colargs, static_columns); - ap_rputs(" ", r); + ap_rputs(" ", r); } if (!(autoindex_opts & SUPPRESS_DESC)) { emit_link(r, "Description", K_DESC, keyid, direction, colargs, static_columns); } if (!(autoindex_opts & SUPPRESS_RULES)) { - ap_rputs("", r); + ap_rputs("
icon ? ar[x]->icon : d->default_icon), @@ -1758,18 +1770,18 @@ } ap_rvputs(r, "", ap_escape_html(scratch, t2), - "", pad_scratch + nwidth, NULL); + "", r); if (!(autoindex_opts & SUPPRESS_LAST_MOD)) { if (ar[x]->lm != -1) { char time_str[MAX_STRING_LEN]; apr_time_exp_t ts; apr_time_exp_lt(&ts, ar[x]->lm); apr_strftime(time_str, &rv, MAX_STRING_LEN, - "%d-%b-%Y %H:%M ", &ts); + "%d-%b-%Y %H:%M", r); ap_rputs(apr_strfsize(ar[x]->size, buf), r); - ap_rputs(" ", r); + ap_rputs("", r); if (ar[x]->desc) { ap_rputs(terminate_description(d, ar[x]->desc, autoindex_opts, desc_width), r); } + ap_rputs("
\n
\n", r); } else { ap_rputs("
\n", r); @@ -1951,7 +1962,7 @@ #if APR_HAS_UNICODE_FS ap_set_content_type(r, "text/html;charset=utf-8"); #else - ap_set_content_type(r, "text/html"); + ap_set_content_type(r, "text/html;charset=utf-8"); #endif if (autoindex_opts & TRACK_MODIFIED) { ap_update_mtime(r, r->finfo.mtime);