You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@apache.org on 2005/08/29 02:54:36 UTC

svn commit: r263976 - in /httpd/mod_mbox/branches/httpd-mbox-if: STATUS data/archives.js module-2.0/mbox_parse.c module-2.0/mbox_parse.h module-2.0/mod_mbox_out.c

Author: maxime
Date: Sun Aug 28 17:54:29 2005
New Revision: 263976

URL: http://svn.apache.org/viewcvs?rev=263976&view=rev
Log:
Use apr_strftime() for a shorter date string in message list. Some
XHTML validation work. Added 'Previous' and 'Next' links into page
selector.


Modified:
    httpd/mod_mbox/branches/httpd-mbox-if/STATUS
    httpd/mod_mbox/branches/httpd-mbox-if/data/archives.js
    httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.c
    httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.h
    httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mod_mbox_out.c

Modified: httpd/mod_mbox/branches/httpd-mbox-if/STATUS
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/branches/httpd-mbox-if/STATUS?rev=263976&r1=263975&r2=263976&view=diff
==============================================================================
--- httpd/mod_mbox/branches/httpd-mbox-if/STATUS (original)
+++ httpd/mod_mbox/branches/httpd-mbox-if/STATUS Sun Aug 28 17:54:29 2005
@@ -8,8 +8,7 @@
 
 Release showstoppers:
 
-    * Massive bug squashing.
-    * Use apr_strftime() to format dates instead of apr_rfc822_date()
+    * Massive bug squashing. [in progress]
 
 Known bugs:
 
@@ -36,4 +35,4 @@
     * Use Javascript object-oriented features
     * When viewing a message, come back to the page we came instead of
       the first page of the choosen listing (without cookie, if
-      possible)
\ No newline at end of file
+      possible)

Modified: httpd/mod_mbox/branches/httpd-mbox-if/data/archives.js
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/branches/httpd-mbox-if/data/archives.js?rev=263976&r1=263975&r2=263976&view=diff
==============================================================================
--- httpd/mod_mbox/branches/httpd-mbox-if/data/archives.js (original)
+++ httpd/mod_mbox/branches/httpd-mbox-if/data/archives.js Sun Aug 28 17:54:29 2005
@@ -228,14 +228,20 @@
 function getMsgListHeader ()
 {
   /* Fetch current page and page count */
-  var current_page = _msglist.getAttribute('page');
-  var pages = _msglist.getAttribute('pages');
+  var current_page = parseInt(_msglist.getAttribute('page'));
+  var pages = parseInt(_msglist.getAttribute('pages'));
 
   var str = '<thead><tr><th class="title">Message list</th>';
 
   /* Page selector */
   str += '<th class="pages">';
 
+  if (current_page) {
+    str += '<a href="browser" onclick="javascript:getMsgList(\'' + _sort + '\', \'' +
+      (current_page - 1) + '\'); return false;">' +
+      '&laquo; Previous</a> &middot; ';
+  }
+
   if (pages > 1) {
     for (i = 0; i<pages ; i++) {
       if (i) {
@@ -250,6 +256,12 @@
 	str += (i+1);
       }
     }
+  }
+
+  if (current_page+1 < pages) {
+    str += ' &middot; <a href="browser" onclick="javascript:getMsgList(\'' + _sort + '\', \'' +
+      (current_page + 1) + '\'); return false;">' +
+      'Next &raquo;</a>';
   }
 
   str += '</th>';

Modified: httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.c?rev=263976&r1=263975&r2=263976&view=diff
==============================================================================
--- httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.c Sun Aug 28 17:54:29 2005
@@ -497,6 +497,9 @@
  */
 static void normalize_message(request_rec *r, Message *m)
 {
+    apr_time_exp_t time_exp;
+    apr_size_t len = 0;
+
     /* Clean up the from to hide email addresses if possible. */
     parse_from(r, m);
 
@@ -507,8 +510,14 @@
     if (!m->content_type || !*m->content_type)
         m->content_type = "text/plain";
 
+    apr_time_exp_gmt(&time_exp, m->date);
+
     m->str_date = (char*)apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
-    apr_rfc822_date(m->str_date, m->date);
+    m->rfc822_date = (char*)apr_pcalloc(r->pool, APR_RFC822_DATE_LEN);
+
+    apr_strftime(m->str_date, &len, APR_RFC822_DATE_LEN,
+		 "%A %d, %T", &time_exp);
+    apr_rfc822_date(m->rfc822_date, m->date);
 
     /* Parse the references into a table. */
     parse_references(r, m);

Modified: httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.h
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.h?rev=263976&r1=263975&r2=263976&view=diff
==============================================================================
--- httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.h (original)
+++ httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mbox_parse.h Sun Aug 28 17:54:29 2005
@@ -136,6 +136,7 @@
 
     apr_time_t date;
     char *str_date;
+    char *rfc822_date;
 
     char *content_type;
     char *boundary;

Modified: httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mod_mbox_out.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mod_mbox_out.c?rev=263976&r1=263975&r2=263976&view=diff
==============================================================================
--- httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mod_mbox_out.c (original)
+++ httpd/mod_mbox/branches/httpd-mbox-if/module-2.0/mod_mbox_out.c Sun Aug 28 17:54:29 2005
@@ -291,13 +291,13 @@
     }
 
     /* Message author */
+    ap_rputs("   <tr>\n", r);
+
     if (linked) {
-        ap_rprintf(r, "   <tr id=\"%s\">\n", URI_ESCAPE_OR_BLANK(r->pool, m->msgID));
         ap_rprintf(r, "    <td class=\"author\">%s</td>\n", from);
     }
     else {
-        ap_rputs("   <tr>\n", r);
-        ap_rputs("    <td class=\"author\"></td>\n", r);
+      ap_rputs("    <td class=\"author\"></td>\n", r);
     }
 
     /* Subject, linked or not */
@@ -514,6 +514,11 @@
         return;
     }
 
+    if (current_page) {
+      ap_rprintf(r, "<a href=\"%s%s?%d\">&laquo; Previous</a> &middot; ",
+		 baseURI, r->path_info, current_page-1);
+    }
+
     for (i = 0; i < pages; i++) {
         if (i != 0) {
 	    ap_rputs(" &middot; ", r);
@@ -527,6 +532,11 @@
 	  ap_rprintf(r, "%d", i+1);
 	}
     }
+
+    if (current_page+1 < pages) {
+      ap_rprintf(r, " &middot; <a href=\"%s%s?%d\">Next &raquo;</a>",
+		 baseURI, r->path_info, current_page+1);
+    }
 }
 
 /* Display the XHTML index of the specified mbox file. */
@@ -603,7 +613,7 @@
     ap_rputs(" </head>\n\n", r);
     ap_rputs(" <body id=\"archives\">\n", r);
 
-    ap_rprintf(r, "  <h1>Mailing list archives: %s %.4s</a></h1>\n\n",
+    ap_rprintf(r, "  <h1>Mailing list archives: %s %.4s</h1>\n\n",
 	       mbox_months[atoi(apr_pstrndup(r->pool, baseURI +
 					     (strlen(baseURI) -
 					      strlen(".mbox") - 2), 2)) - 1][1],
@@ -838,9 +848,9 @@
         ap_rputs("&laquo;", r);
     }
 
-    ap_rprintf(r, " <a href=\"%s/date#%s\" "
+    ap_rprintf(r, " <a href=\"%s/date\" "
 	       "title=\"View messages sorted by date\">Date</a> ",
-	       baseURI, msgID);
+	       baseURI);
 
     if (context[1]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
@@ -863,9 +873,9 @@
         ap_rputs("&laquo;", r);
     }
 
-    ap_rprintf(r, " <a href=\"%s/thread#%s\" "
+    ap_rprintf(r, " <a href=\"%s/thread\" "
 	       "title=\"View messages sorted by thread\">Thread</a> ",
-	       baseURI, msgID);
+	       baseURI);
 
     if (context[3]) {
         ap_rprintf(r, "<a href=\"%s/%s\" "
@@ -966,7 +976,7 @@
     ap_rprintf(r, "   <tr class=\"date\">\n"
 	       "    <td class=\"left\">Date</td>\n"
 	       "    <td class=\"right\">%s</td>\n"
-	       "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->str_date));
+	       "   </tr>\n", ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
 
     /* Message body */
     ap_rputs("   <tr class=\"contents\"><td colspan=\"2\"><pre>\n", r);
@@ -1037,7 +1047,7 @@
 	       URI_ESCAPE_OR_BLANK(r->pool, m->msgID),
 	       from,
 	       ESCAPE_OR_BLANK(r->pool, m->subject),
-	       ESCAPE_OR_BLANK(r->pool, m->str_date));
+	       ESCAPE_OR_BLANK(r->pool, m->rfc822_date));
 
     ap_rprintf(r, "%s", mbox_wrap_text(mbox_mime_get_body(r->pool, m->mime_msg)));
     ap_rputs("]]></contents>\n", r);