Check-in [6d58613757]
Not logged in
Overview

SHA1 Hash:6d586137576db9e08ef404ce0391d0fc5cd8e483
Date: 2007-10-06 16:37:39
User: drh
Comment:Timeline comments are now rendered as wiki. Wiki changes appear on the timeline.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/manifest.c from [cf922053aa] to [fb34bded33].

@@ -826,10 +826,11 @@
   }
   if( m.type==CFTYPE_WIKI ){
     char *zTag = mprintf("wiki-%s", m.zWikiTitle);
     int tagid = tag_findid(zTag, 1);
     int prior;
+    char *zComment;
     tag_insert(zTag, 1, 0, rid, m.rDate, rid);
     free(zTag);
     prior = db_int(0,
       "SELECT rid FROM tagxref"
       " WHERE tagid=%d AND mtime<%.17g"
@@ -837,10 +838,26 @@
       tagid, m.rDate
     );
     if( prior ){
       content_deltify(prior, rid, 0);
     }
+    zComment = mprintf("Changes to wiki page [%h]", m.zWikiTitle);
+    db_multi_exec(
+      "INSERT INTO event(type,mtime,objid,user,comment,"
+      "                  bgcolor,brbgcolor,euser,ecomment)"
+      "VALUES('w',%.17g,%d,%Q,%Q,"
+      " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype=1),"
+      "(SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype!=1),"
+      "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
+      "  (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
+      m.rDate, rid, m.zUser, zComment,
+      TAG_BGCOLOR, rid,
+      TAG_BGCOLOR, rid,
+      TAG_USER, rid,
+      TAG_COMMENT, rid
+    );
+    free(zComment);
   }
   db_end_transaction(0);
   manifest_clear(&m);
   return 1;
 }

Modified src/timeline.c from [8bccb237e4] to [bffeb82d75].

@@ -97,16 +97,18 @@
   Blob *pArg
  ){
   char zPrevDate[20];
   int cnt = 0;
   zPrevDate[0] = 0;
+  Blob comment;
 
   db_multi_exec(
      "CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
      "DELETE FROM seen;"
   );
   @ <table cellspacing=0 border=0 cellpadding=0>
+  blob_zero(&comment);
   while( db_step(pQuery)==SQLITE_ROW ){
     int rid = db_column_int(pQuery, 0);
     const char *zUuid = db_column_text(pQuery, 1);
     int nPChild = db_column_int(pQuery, 5);
     int nParent = db_column_int(pQuery, 6);
@@ -151,11 +153,13 @@
       @ <b>Fork</b>
     }
     if( isLeaf ){
       @ <b>Leaf</b>
     }
-    @ %h(db_column_text(pQuery,3))
+    db_column_blob(pQuery, 3, &comment);
+    wiki_convert(&comment, 0);
+    blob_reset(&comment);
     @ (by %h(db_column_text(pQuery,4)))</td></tr>
   }
   @ </table>
 }
 
@@ -457,11 +461,11 @@
   static const char zBaseSql[] =
     @ SELECT
     @   blob.rid,
     @   uuid,
     @   datetime(event.mtime,'localtime'),
-    @   coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user) || ')',
+    @   coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user,'?') ||')',
     @   (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
     @   (SELECT count(*) FROM plink WHERE cid=blob.rid)
     @ FROM event, blob
     @ WHERE blob.rid=event.objid
   ;

Modified src/wiki.c from [e5a5435241] to [1ab1276742].

@@ -66,12 +66,12 @@
   style_header(zHtmlPageName);
   blob_init(&wiki, zBody, -1);
   wiki_convert(&wiki, 0);
   blob_reset(&wiki);
   manifest_clear(&m);
-  @ <hr>
-  if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
+  if( zPageName[0] && ((rid && g.okWrWiki) || (!rid && g.okNewWiki)) ){
+    @ <hr>
     @ [<a href="%s(g.zBaseURL)/wikiedit/%s(g.zExtra)">Edit</a>]
   }
   style_footer();
 }
 
@@ -146,11 +146,11 @@
     blob_reset(&wiki);
     content_deltify(rid, nrid, 0);
     db_end_transaction(0);
     cgi_redirect(mprintf("wiki/%s", g.zExtra));
   }
-  if( P("cancel")!=0 ){
+  if( P("cancel")!=0 || zPageName[0]==0 ){
     cgi_redirect(mprintf("wiki/%s", g.zExtra));
     return;
   }
   if( zBody==0 ){
     zBody = mprintf("<i>Empty Page</i>");