Check-in [e38c89130f]
Not logged in
Overview

SHA1 Hash:e38c89130f8ee98be86a3a22c60bf65666487477
Date: 2008-02-24 21:51:57
User: drh
Comment:Add a human-readable description on each timeline. Add the "ancestors" and "decendents" links on the baseline information pages, making it easier to understand the context of a baseline.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [97d9ed98da] to [7d442c6c2d].

@@ -330,10 +330,14 @@
     if( g.okSetup ){
       @ <tr><th>Record ID:</th><td>%d(rid)</td></tr>
     }
     @ <tr><th>Original&nbsp;User:</th><td>%h(db_column_text(&q, 2))</td></tr>
     @ <tr><th>Original&nbsp;Comment:</th><td>%w(db_column_text(&q,3))</td></tr>
+    @ </td></tr>
+    @ <tr><th>Timelines:</th><td>
+    @    <a href="%s(g.zBaseURL)/timeline?e=%d(rid)&r">ancestors</a>
+    @    | <a href="%s(g.zBaseURL)/timeline?e=%d(rid)&r&a">descendents</a>
     @ </td></tr>
     @ <tr><th>Commands:</th>
     @   <td>
     @     <a href="%s(g.zBaseURL)/vdiff/%d(rid)">diff</a>
     @     | <a href="%s(g.zBaseURL)/zip/%s(zUuid).zip">ZIP archive</a>

Modified src/timeline.c from [d21da06aad] to [d5cc80fe9b].

@@ -252,23 +252,25 @@
 **    y=TYPE         show only TYPE ('ci' or 'w')       dflt: nil
 **    s              show the SQL                       dflt: nil
 */
 void page_timeline(void){
   Stmt q;
-  Blob sql;
-  char *zSQL;
+  Blob sql;                    /* text of SQL used to generate timeline */
+  char *zSQL;                  /* Rendered copy of sql */
   Blob scriptInit;
   char zDate[100];
-  const char *zStart = P("d");
-  int nEntry = atoi(PD("n","20"));
-  const char *zUser = P("u");
-  int objid = atoi(PD("e","0"));
-  int relatedEvents = P("r")!=0;
-  int afterFlag = P("a")!=0;
-  const char *zType = P("y");
-  int firstEvent;
-  int lastEvent;
+  const char *zStart = P("d");       /* Starting date */
+  int nEntry = atoi(PD("n","20"));   /* Max number of entries on timeline */
+  const char *zUser = P("u");        /* All entries by this user if not NULL */
+  int objid = atoi(PD("e","0"));     /* Entries related to this event */
+  int relatedEvents = P("r")!=0;     /* Must be directly related to of objid */
+  int afterFlag = P("a")!=0;         /* After objid if true */
+  const char *zType = P("y");        /* Type of events.  All if NULL */
+  int firstEvent;              /* First event displayed */
+  int lastEvent;               /* Last event displayed */
+  Blob desc;                   /* Human readable description of the timeline */
+  const char *zEType;          /* Human readable event type */
 
   /* To view the timeline, must have permission to read project data.
   */
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
@@ -280,16 +282,25 @@
                 "   AND cap LIKE '%%h%%'") ){
     @ <p><b>Note:</b> You will be able to access <u>much</u> more
     @ historical information if you <a href="%s(g.zTop)/login">login</a>.</p>
   }
   blob_zero(&sql);
+  blob_zero(&desc);
   blob_append(&sql, timeline_query_for_www(), -1);
+  zEType = "events";
   if( zType ){
     blob_appendf(&sql, " AND event.type=%Q", zType);
-  }
+    if( zType[0]=='c' ){
+      zEType = "checkins";
+    }else if( zType[0]=='w' ){
+      zEType = "wiki edits";
+    }
+  }
+  blob_appendf(&desc, "Timeline of up to %d %s", nEntry, zEType);
   if( zUser ){
     blob_appendf(&sql, " AND event.user=%Q", zUser);
+    blob_appendf(&desc, " by user %h", zUser);
   }
   if( objid ){
     char *z = db_text(0, "SELECT datetime(event.mtime, 'localtime') FROM event"
                          " WHERE objid=%d", objid);
     if( z ){
@@ -300,20 +311,31 @@
     while( isspace(zStart[0]) ){ zStart++; }
     if( zStart[0] ){
       blob_appendf(&sql,
          " AND event.mtime %s (SELECT julianday(%Q, 'utc'))",
                           afterFlag ? ">=" : "<=", zStart);
+      blob_appendf(&desc, " occurring on or %s %h",
+          afterFlag ? "after": "before",
+          zStart);
     }
   }
   if( relatedEvents && objid ){
+    char *zUuid;
     db_multi_exec(
        "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
     );
+    zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", objid);
     if( afterFlag ){
       compute_descendents(objid, nEntry);
+      blob_appendf(&desc,
+         " and decended from <a href='%s/vinfo/%d'>[%.10s]</a>",
+         g.zBaseURL, objid, zUuid);
     }else{
       compute_ancestors(objid, nEntry);
+      blob_appendf(&desc,
+         " and a ancestor of <a href='%s/vinfo/%d'>[%.10s]</a>",
+         g.zBaseURL, objid, zUuid);
     }
     blob_append(&sql, " AND event.objid IN ok", -1);
   }
   if( afterFlag ){
     blob_appendf(&sql, " ORDER BY event.mtime ASC LIMIT %d",
@@ -328,10 +350,12 @@
   }
   db_prepare(&q, zSQL);
   if( P("s")!=0 ){
     @ <hr><p>%h(zSQL)</p><hr>
   }
+  @ <h2>%b(&desc)</h2>
+  blob_reset(&desc);
   blob_zero(&sql);
   if( afterFlag ){
     free(zSQL);
   }
   zDate[0] = 0;