Fossil SCM

Timeline comments are now rendered as wiki. Wiki changes appear on the timeline.

drh 2007-10-06 16:37 trunk
Commit 6d586137576db9e08ef404ce0391d0fc5cd8e483
--- src/manifest.c
+++ src/manifest.c
@@ -826,10 +826,11 @@
826826
}
827827
if( m.type==CFTYPE_WIKI ){
828828
char *zTag = mprintf("wiki-%s", m.zWikiTitle);
829829
int tagid = tag_findid(zTag, 1);
830830
int prior;
831
+ char *zComment;
831832
tag_insert(zTag, 1, 0, rid, m.rDate, rid);
832833
free(zTag);
833834
prior = db_int(0,
834835
"SELECT rid FROM tagxref"
835836
" WHERE tagid=%d AND mtime<%.17g"
@@ -837,10 +838,26 @@
837838
tagid, m.rDate
838839
);
839840
if( prior ){
840841
content_deltify(prior, rid, 0);
841842
}
843
+ zComment = mprintf("Changes to wiki page [%h]", m.zWikiTitle);
844
+ db_multi_exec(
845
+ "INSERT INTO event(type,mtime,objid,user,comment,"
846
+ " bgcolor,brbgcolor,euser,ecomment)"
847
+ "VALUES('w',%.17g,%d,%Q,%Q,"
848
+ " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype=1),"
849
+ "(SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype!=1),"
850
+ " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
851
+ " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
852
+ m.rDate, rid, m.zUser, zComment,
853
+ TAG_BGCOLOR, rid,
854
+ TAG_BGCOLOR, rid,
855
+ TAG_USER, rid,
856
+ TAG_COMMENT, rid
857
+ );
858
+ free(zComment);
842859
}
843860
db_end_transaction(0);
844861
manifest_clear(&m);
845862
return 1;
846863
}
847864
--- src/manifest.c
+++ src/manifest.c
@@ -826,10 +826,11 @@
826 }
827 if( m.type==CFTYPE_WIKI ){
828 char *zTag = mprintf("wiki-%s", m.zWikiTitle);
829 int tagid = tag_findid(zTag, 1);
830 int prior;
 
831 tag_insert(zTag, 1, 0, rid, m.rDate, rid);
832 free(zTag);
833 prior = db_int(0,
834 "SELECT rid FROM tagxref"
835 " WHERE tagid=%d AND mtime<%.17g"
@@ -837,10 +838,26 @@
837 tagid, m.rDate
838 );
839 if( prior ){
840 content_deltify(prior, rid, 0);
841 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
842 }
843 db_end_transaction(0);
844 manifest_clear(&m);
845 return 1;
846 }
847
--- src/manifest.c
+++ src/manifest.c
@@ -826,10 +826,11 @@
826 }
827 if( m.type==CFTYPE_WIKI ){
828 char *zTag = mprintf("wiki-%s", m.zWikiTitle);
829 int tagid = tag_findid(zTag, 1);
830 int prior;
831 char *zComment;
832 tag_insert(zTag, 1, 0, rid, m.rDate, rid);
833 free(zTag);
834 prior = db_int(0,
835 "SELECT rid FROM tagxref"
836 " WHERE tagid=%d AND mtime<%.17g"
@@ -837,10 +838,26 @@
838 tagid, m.rDate
839 );
840 if( prior ){
841 content_deltify(prior, rid, 0);
842 }
843 zComment = mprintf("Changes to wiki page [%h]", m.zWikiTitle);
844 db_multi_exec(
845 "INSERT INTO event(type,mtime,objid,user,comment,"
846 " bgcolor,brbgcolor,euser,ecomment)"
847 "VALUES('w',%.17g,%d,%Q,%Q,"
848 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype=1),"
849 "(SELECT value FROM tagxref WHERE tagid=%d AND rid=%d AND tagtype!=1),"
850 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d),"
851 " (SELECT value FROM tagxref WHERE tagid=%d AND rid=%d));",
852 m.rDate, rid, m.zUser, zComment,
853 TAG_BGCOLOR, rid,
854 TAG_BGCOLOR, rid,
855 TAG_USER, rid,
856 TAG_COMMENT, rid
857 );
858 free(zComment);
859 }
860 db_end_transaction(0);
861 manifest_clear(&m);
862 return 1;
863 }
864
+6 -2
--- src/timeline.c
+++ src/timeline.c
@@ -97,16 +97,18 @@
9797
Blob *pArg
9898
){
9999
char zPrevDate[20];
100100
int cnt = 0;
101101
zPrevDate[0] = 0;
102
+ Blob comment;
102103
103104
db_multi_exec(
104105
"CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
105106
"DELETE FROM seen;"
106107
);
107108
@ <table cellspacing=0 border=0 cellpadding=0>
109
+ blob_zero(&comment);
108110
while( db_step(pQuery)==SQLITE_ROW ){
109111
int rid = db_column_int(pQuery, 0);
110112
const char *zUuid = db_column_text(pQuery, 1);
111113
int nPChild = db_column_int(pQuery, 5);
112114
int nParent = db_column_int(pQuery, 6);
@@ -151,11 +153,13 @@
151153
@ <b>Fork</b>
152154
}
153155
if( isLeaf ){
154156
@ <b>Leaf</b>
155157
}
156
- @ %h(db_column_text(pQuery,3))
158
+ db_column_blob(pQuery, 3, &comment);
159
+ wiki_convert(&comment, 0);
160
+ blob_reset(&comment);
157161
@ (by %h(db_column_text(pQuery,4)))</td></tr>
158162
}
159163
@ </table>
160164
}
161165
@@ -457,11 +461,11 @@
457461
static const char zBaseSql[] =
458462
@ SELECT
459463
@ blob.rid,
460464
@ uuid,
461465
@ datetime(event.mtime,'localtime'),
462
- @ coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user) || ')',
466
+ @ coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user,'?') ||')',
463467
@ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
464468
@ (SELECT count(*) FROM plink WHERE cid=blob.rid)
465469
@ FROM event, blob
466470
@ WHERE blob.rid=event.objid
467471
;
468472
--- src/timeline.c
+++ src/timeline.c
@@ -97,16 +97,18 @@
97 Blob *pArg
98 ){
99 char zPrevDate[20];
100 int cnt = 0;
101 zPrevDate[0] = 0;
 
102
103 db_multi_exec(
104 "CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
105 "DELETE FROM seen;"
106 );
107 @ <table cellspacing=0 border=0 cellpadding=0>
 
108 while( db_step(pQuery)==SQLITE_ROW ){
109 int rid = db_column_int(pQuery, 0);
110 const char *zUuid = db_column_text(pQuery, 1);
111 int nPChild = db_column_int(pQuery, 5);
112 int nParent = db_column_int(pQuery, 6);
@@ -151,11 +153,13 @@
151 @ <b>Fork</b>
152 }
153 if( isLeaf ){
154 @ <b>Leaf</b>
155 }
156 @ %h(db_column_text(pQuery,3))
 
 
157 @ (by %h(db_column_text(pQuery,4)))</td></tr>
158 }
159 @ </table>
160 }
161
@@ -457,11 +461,11 @@
457 static const char zBaseSql[] =
458 @ SELECT
459 @ blob.rid,
460 @ uuid,
461 @ datetime(event.mtime,'localtime'),
462 @ coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user) || ')',
463 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
464 @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
465 @ FROM event, blob
466 @ WHERE blob.rid=event.objid
467 ;
468
--- src/timeline.c
+++ src/timeline.c
@@ -97,16 +97,18 @@
97 Blob *pArg
98 ){
99 char zPrevDate[20];
100 int cnt = 0;
101 zPrevDate[0] = 0;
102 Blob comment;
103
104 db_multi_exec(
105 "CREATE TEMP TABLE IF NOT EXISTS seen(rid INTEGER PRIMARY KEY);"
106 "DELETE FROM seen;"
107 );
108 @ <table cellspacing=0 border=0 cellpadding=0>
109 blob_zero(&comment);
110 while( db_step(pQuery)==SQLITE_ROW ){
111 int rid = db_column_int(pQuery, 0);
112 const char *zUuid = db_column_text(pQuery, 1);
113 int nPChild = db_column_int(pQuery, 5);
114 int nParent = db_column_int(pQuery, 6);
@@ -151,11 +153,13 @@
153 @ <b>Fork</b>
154 }
155 if( isLeaf ){
156 @ <b>Leaf</b>
157 }
158 db_column_blob(pQuery, 3, &comment);
159 wiki_convert(&comment, 0);
160 blob_reset(&comment);
161 @ (by %h(db_column_text(pQuery,4)))</td></tr>
162 }
163 @ </table>
164 }
165
@@ -457,11 +461,11 @@
461 static const char zBaseSql[] =
462 @ SELECT
463 @ blob.rid,
464 @ uuid,
465 @ datetime(event.mtime,'localtime'),
466 @ coalesce(ecomment,comment) || ' (by ' || coalesce(euser,user,'?') ||')',
467 @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim),
468 @ (SELECT count(*) FROM plink WHERE cid=blob.rid)
469 @ FROM event, blob
470 @ WHERE blob.rid=event.objid
471 ;
472
+3 -3
--- src/wiki.c
+++ src/wiki.c
@@ -66,12 +66,12 @@
6666
style_header(zHtmlPageName);
6767
blob_init(&wiki, zBody, -1);
6868
wiki_convert(&wiki, 0);
6969
blob_reset(&wiki);
7070
manifest_clear(&m);
71
- @ <hr>
72
- if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
71
+ if( zPageName[0] && ((rid && g.okWrWiki) || (!rid && g.okNewWiki)) ){
72
+ @ <hr>
7373
@ [<a href="%s(g.zBaseURL)/wikiedit/%s(g.zExtra)">Edit</a>]
7474
}
7575
style_footer();
7676
}
7777
@@ -146,11 +146,11 @@
146146
blob_reset(&wiki);
147147
content_deltify(rid, nrid, 0);
148148
db_end_transaction(0);
149149
cgi_redirect(mprintf("wiki/%s", g.zExtra));
150150
}
151
- if( P("cancel")!=0 ){
151
+ if( P("cancel")!=0 || zPageName[0]==0 ){
152152
cgi_redirect(mprintf("wiki/%s", g.zExtra));
153153
return;
154154
}
155155
if( zBody==0 ){
156156
zBody = mprintf("<i>Empty Page</i>");
157157
--- src/wiki.c
+++ src/wiki.c
@@ -66,12 +66,12 @@
66 style_header(zHtmlPageName);
67 blob_init(&wiki, zBody, -1);
68 wiki_convert(&wiki, 0);
69 blob_reset(&wiki);
70 manifest_clear(&m);
71 @ <hr>
72 if( (rid && g.okWrWiki) || (!rid && g.okNewWiki) ){
73 @ [<a href="%s(g.zBaseURL)/wikiedit/%s(g.zExtra)">Edit</a>]
74 }
75 style_footer();
76 }
77
@@ -146,11 +146,11 @@
146 blob_reset(&wiki);
147 content_deltify(rid, nrid, 0);
148 db_end_transaction(0);
149 cgi_redirect(mprintf("wiki/%s", g.zExtra));
150 }
151 if( P("cancel")!=0 ){
152 cgi_redirect(mprintf("wiki/%s", g.zExtra));
153 return;
154 }
155 if( zBody==0 ){
156 zBody = mprintf("<i>Empty Page</i>");
157
--- src/wiki.c
+++ src/wiki.c
@@ -66,12 +66,12 @@
66 style_header(zHtmlPageName);
67 blob_init(&wiki, zBody, -1);
68 wiki_convert(&wiki, 0);
69 blob_reset(&wiki);
70 manifest_clear(&m);
71 if( zPageName[0] && ((rid && g.okWrWiki) || (!rid && g.okNewWiki)) ){
72 @ <hr>
73 @ [<a href="%s(g.zBaseURL)/wikiedit/%s(g.zExtra)">Edit</a>]
74 }
75 style_footer();
76 }
77
@@ -146,11 +146,11 @@
146 blob_reset(&wiki);
147 content_deltify(rid, nrid, 0);
148 db_end_transaction(0);
149 cgi_redirect(mprintf("wiki/%s", g.zExtra));
150 }
151 if( P("cancel")!=0 || zPageName[0]==0 ){
152 cgi_redirect(mprintf("wiki/%s", g.zExtra));
153 return;
154 }
155 if( zBody==0 ){
156 zBody = mprintf("<i>Empty Page</i>");
157

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button