coar 99/01/04 06:35:56
Modified: . STATUS
htdocs/manual/mod mod_autoindex.html
src CHANGES
src/modules/standard mod_autoindex.c
Log:
Allow fancyindexed directories to be presorted in some other way
than by name.
PR: 1699
Submitted by: Ken Coar
Reviewed by: Martin Kraemer
Revision Changes Path
1.587 +1 -7 apache-1.3/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apache-1.3/STATUS,v
retrieving revision 1.586
retrieving revision 1.587
diff -u -r1.586 -r1.587
--- STATUS 1999/01/03 13:46:16 1.586
+++ STATUS 1999/01/04 14:35:52 1.587
@@ -1,5 +1,5 @@
1.3 STATUS:
- Last modified at [$Date: 1999/01/03 13:46:16 $]
+ Last modified at [$Date: 1999/01/04 14:35:52 $]
Release:
@@ -93,12 +93,6 @@
vhost-xxx.html document out of it. -- rse
Available Patches:
-
- * Ken's default sort order for autoindexed listings
- First pass for concept; maybe directive should be renamed or
- syntax changed?
- Message-ID: <[EMAIL PROTECTED]>
- Status: Ken +1 (concept), Martin +1 (concept)
* Lars' 'binbuild' patch
Message-ID: <[EMAIL PROTECTED]>
1.30 +61 -0 apache-1.3/htdocs/manual/mod/mod_autoindex.html
Index: mod_autoindex.html
===================================================================
RCS file: /home/cvs/apache-1.3/htdocs/manual/mod/mod_autoindex.html,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mod_autoindex.html 1998/10/22 17:43:20 1.29
+++ mod_autoindex.html 1999/01/04 14:35:53 1.30
@@ -74,6 +74,7 @@
<LI><A HREF="#headername">HeaderName</A>
<LI><A HREF="#indexignore">IndexIgnore</A>
<LI><A HREF="#indexoptions">IndexOptions</A>
+<LI><A HREF="#indexorderdefault">IndexOrderDefault</A>
<LI><A HREF="#readmename">ReadmeName</A>
</MENU>
<HR>
@@ -668,6 +669,66 @@
</P>
</DD>
</DL>
+
+<HR>
+
+<H2><A NAME="indexorderdefault">IndexOrderDefault</A></H2>
+<!--%plaintext <?INDEX {\tt IndexOrderDefault} directive> -->
+<A
+ HREF="directive-dict.html#Syntax"
+ REL="Help"
+><STRONG>Syntax:</STRONG></A> IndexOrderDefault
+ <EM>Ascending|Descending</EM> <EM>Name|Date|Size|Description</EM>
+<BR>
+<A
+ HREF="directive-dict.html#Context"
+ REL="Help"
+><STRONG>Context:</STRONG></A> server config, virtual host, directory,
+ .htaccess
+<BR>
+<A
+ HREF="directive-dict.html#Override"
+ REL="Help"
+><STRONG>Override:</STRONG></A> Indexes
+<BR>
+<A
+ HREF="directive-dict.html#Status"
+ REL="Help"
+><STRONG>Status:</STRONG></A> Base
+<BR>
+<A
+ HREF="directive-dict.html#Module"
+ REL="Help"
+><STRONG>Module:</STRONG></A> mod_autoindex
+<BR>
+<A
+ HREF="directive-dict.html#Compatibility"
+ REL="Help"
+><STRONG>Compatibility:</STRONG></A> IndexOrderDefault is only available in
+Apache 1.3.4 and later.
+
+<P>
+The <SAMP>IndexOrderDefault</SAMP> directive is used in combination with
+the <A HREF="#indexoptions:fancyindexing"><SAMP>FancyIndexing</SAMP></A>
+index option. By default, fancyindexed directory listings are displayed in
ascending order by filename; the <SAMP>IndexOrderDefault</SAMP> allows
+you to change this initial display order.
+</P>
+<P>
+<SAMP>IndexOrderDefault</SAMP> takes two arguments. The first must be either
+<SAMP>Ascending</SAMP> or <SAMP>Descending</SAMP>, indicating the direction
+of the sort. The second argument must be one of the keywords
+<SAMP>Name</SAMP>, <SAMP>Date</SAMP>, <SAMP>Size</SAMP>, or
+<SAMP>Description</SAMP>, and identifies the primary key. The secondary
+key is <EM>always</EM> the ascending filename.
+</P>
+<P>
+You can force a directory listing to only be displayed in a particular
+order by combining this directive with the
+<A HREF="#indexoptions:suppresscolumnsorting"
+><SAMP>SuppressColumnSorting</SAMP></A> index option; this will prevent
+the client from requesting the directory listing in a different order.
+</P>
+
<HR>
<H2><A NAME="readmename">ReadmeName</A></H2>
1.1200 +5 -1 apache-1.3/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apache-1.3/src/CHANGES,v
retrieving revision 1.1199
retrieving revision 1.1200
diff -u -r1.1199 -r1.1200
--- CHANGES 1999/01/03 16:45:23 1.1199
+++ CHANGES 1999/01/04 14:35:54 1.1200
@@ -1,5 +1,8 @@
Changes with Apache 1.3.4
+ *) Added IndexOrderDefault directive to supply a default sort order
+ for FancyIndexed directory listings. [Ken Coar] PR#1699
+
*) Change the ap_assert macro to a variant that works on all platforms.
[Richard Prinz <[EMAIL PROTECTED]>] PR#2575
@@ -19,7 +22,8 @@
*) Make top-level Makefile aware of a parallel build procedures (make -j)
by
making sure the src/support/ tools are _forced_ to be build last (they
- depend on other libraries). [Markus Theissinger <[EMAIL PROTECTED]>]
+ depend on other libraries).
+ [Markus Theissinger <[EMAIL PROTECTED]>]
*) Fix installation procedure: Now that os-inline.c is actually used (a
recently fixed bug prevented this) we need to also install os-include.c
1.100 +54 -2 apache-1.3/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- mod_autoindex.c 1999/01/01 19:05:07 1.99
+++ mod_autoindex.c 1999/01/04 14:35:55 1.100
@@ -141,6 +141,7 @@
int name_adjust;
int icon_width;
int icon_height;
+ char *default_order;
array_header *icon_list, *alt_list, *desc_list, *ign_list;
array_header *hdr_list, *rdme_list;
@@ -442,6 +443,48 @@
return NULL;
}
+static const char *set_default_order(cmd_parms *cmd, void *m, char
*direction,
+ char *key)
+{
+ char temp[4];
+ autoindex_config_rec *d_cfg = (autoindex_config_rec *) m;
+
+ ap_cpystrn(temp, "k=d", sizeof(temp));
+ if (!strcasecmp(direction, "Ascending")) {
+ temp[2] = D_ASCENDING;
+ }
+ else if (!strcasecmp(direction, "Descending")) {
+ temp[2] = D_DESCENDING;
+ }
+ else {
+ return "First keyword must be 'Ascending' or 'Descending'";
+ }
+
+ if (!strcasecmp(key, "Name")) {
+ temp[0] = K_NAME;
+ }
+ else if (!strcasecmp(key, "Date")) {
+ temp[0] = K_LAST_MOD;
+ }
+ else if (!strcasecmp(key, "Size")) {
+ temp[0] = K_SIZE;
+ }
+ else if (!strcasecmp(key, "Description")) {
+ temp[0] = K_DESC;
+ }
+ else {
+ return "Second keyword must be 'Name', 'Date', 'Size', or "
+ "'Description'";
+ }
+
+ if (d_cfg->default_order == NULL) {
+ d_cfg->default_order = ap_palloc(cmd->pool, 4);
+ d_cfg->default_order[3] = '\0';
+ }
+ ap_cpystrn(d_cfg->default_order, temp, sizeof(temp));
+ return NULL;
+}
+
#define DIR_CMD_PERMS OR_INDEXES
static const command_rec autoindex_cmds[] =
@@ -460,6 +503,8 @@
"alternate descriptive text followed by one or more content encodings"},
{"IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS,
"one or more index options"},
+ {"IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, TAKE2,
+ "{Ascending,Descending} {Name,Size,Description,Date}"},
{"IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE,
"one or more file extensions"},
{"AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2,
@@ -492,6 +537,7 @@
new->opts = 0;
new->incremented_opts = 0;
new->decremented_opts = 0;
+ new->default_order = NULL;
return (void *) new;
}
@@ -570,6 +616,8 @@
new->name_adjust = add->name_adjust;
}
+ new->default_order = (add->default_order != NULL)
+ ? add->default_order : base->default_order;
return new;
}
@@ -1326,9 +1374,13 @@
qstring = r->args;
/*
- * If no QUERY_STRING was specified, we use the default: ascending
- * by name.
+ * If no QUERY_STRING was specified, we use the default specified
+ * by the IndexOrderDefault directive (if there is one); otherwise,
+ * we fall back to ascending by name.
*/
+ if ((qstring == NULL) || (*qstring == '\0')) {
+ qstring = autoindex_conf->default_order;
+ }
if ((qstring == NULL) || (*qstring == '\0')) {
keyid = K_NAME;
direction = D_ASCENDING;