httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From C...@PROCESS.COM (Rodent of Unusual Size)
Subject RE: [STATUS] Wed Nov 5 05:04:04 EST 1997
Date Thu, 01 Jan 1970 00:00:00 GMT
>From the fingers of Jim Jagielski flowed the following:
>
>Available:
>
>    * Ken's [PATCH] Slight cleanup of logging of bad directives
>	<97101622521289@decus.org>
>	Status: Ken +1, Dean +1, Jim +1, Martin +1

    Committed.

>    * Ken's [PATCH] for mod_autoindex: no-sorting, last-modified
>	<97102015065144@decus.org>
>	Status: Ken +1, Dean +1/-1 (see
>	<Pine.LNX.3.95dg3.971020175347.21329i-100000@twinlark.arctic.org>
>	Martin +1/0

    Reduced patch for just the no-sorting change attached below; please
    re-test and re-vote.

    #ken    P-)}

Index: mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.53
diff -u -r1.53 mod_autoindex.c
--- mod_autoindex.c	1997/10/22 20:30:17	1.53
+++ mod_autoindex.c	1997/11/06 20:54:26
@@ -88,6 +88,7 @@
 #define SUPPRESS_SIZE 16
 #define SUPPRESS_DESC 32
 #define SUPPRESS_PREAMBLE 64
+#define SUPPRESS_COLSORT 128
 
 /*
  * Define keys for sorting.
@@ -270,6 +271,9 @@
 	    opts |= SUPPRESS_DESC;
 	else if (!strcasecmp(w, "SuppressHTMLPreamble"))
 	    opts |= SUPPRESS_PREAMBLE;
+        else if (!strcasecmp(w, "SuppressColumnSorting")) {
+            opts |= SUPPRESS_COLSORT;
+	}
 	else if (!strcasecmp(w, "None"))
 	    opts = 0;
 	else if (!strncasecmp(w, "IconWidth", 9)) {
@@ -743,11 +747,12 @@
  * selected again.  Non-active fields always start in ascending order.
  */
 static void emit_link(request_rec *r, char *anchor, char fname, char curkey,
-		      char curdirection)
+                      char curdirection, int nosort)
 {
     char qvalue[5];
     int reverse;
 
+    if (!nosort) {
     qvalue[0] = '?';
     qvalue[1] = fname;
     qvalue[2] = '=';
@@ -756,6 +761,10 @@
     qvalue[3] = reverse ? D_DESCENDING : D_ASCENDING;
     rvputs(r, "<A HREF=\"", qvalue, "\">", anchor, "</A>", NULL);
 }
+    else {
+        rputs(anchor, r);
+    }
+}
 
 static void output_directories(struct ent **ar, int n,
 			       autoindex_config_rec * d, request_rec *r,
@@ -764,6 +773,7 @@
     int x, len;
     char *name = r->uri;
     char *tp;
+    int static_columns = (autoindex_opts & SUPPRESS_COLSORT);
     pool *scratch = make_sub_pool(r->pool);
 
     if (name[0] == '\0')
@@ -785,18 +795,20 @@
 	    }
 	    rputs("> ", r);
 	}
-	emit_link(r, "Name", K_NAME, keyid, direction);
+        emit_link(r, "Name", K_NAME, keyid, direction, static_columns);
 	rputs("                   ", r);
 	if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
-	    emit_link(r, "Last modified", K_LAST_MOD, keyid, direction);
+            emit_link(r, "Last modified", K_LAST_MOD, keyid, direction,
+                      static_columns);
 	    rputs("     ", r);
 	}
 	if (!(autoindex_opts & SUPPRESS_SIZE)) {
-	    emit_link(r, "Size", K_SIZE, keyid, direction);
+            emit_link(r, "Size", K_SIZE, keyid, direction, static_columns);
 	    rputs("  ", r);
 	}
 	if (!(autoindex_opts & SUPPRESS_DESC)) {
-	    emit_link(r, "Description", K_DESC, keyid, direction);
+            emit_link(r, "Description", K_DESC, keyid, direction,
+                      static_columns);
 	}
 	rputs("\n<HR>\n", r);
     }
@@ -1027,11 +1039,16 @@
     /*
      * Figure out what sort of indexing (if any) we're supposed to use.
      */
+    if (autoindex_opts & SUPPRESS_COLSORT) {
+	keyid = K_NAME;
+	direction = D_ASCENDING;
+    }
+    else {
     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: ascending
+	 * by name.
      */
     if ((qstring == NULL) || (*qstring == '\0')) {
 	keyid = K_NAME;
@@ -1046,6 +1063,7 @@
 	else {
 	    direction = D_ASCENDING;
 	}
+    }
     }
 
     /* 

Mime
View raw message