Differences From:
File
src/timeline.c
part of check-in
[713b8be852]
- Deleted some obsolete "todo" files. Updated the FAQ. Modified the the
"vinfo" page to show check-in differences and made "vinfo" the default
display for check-ins instead of "vdiff".
by
drh on
2009-08-28 22:59:27.
[view]
To:
File
src/timeline.c
part of check-in
[b5f4f910b7]
- Add additional hyperlinking of dates and userids. For a "circa" timeline,
show the "circa" point in the timeline listing.
by
drh on
2009-08-29 16:45:30.
[view]
@@ -76,8 +76,38 @@
}
}
/*
+** Generate a hyperlink to a date & time.
+*/
+void hyperlink_to_date(const char *zDate, const char *zSuffix){
+ if( zSuffix==0 ) zSuffix = "";
+ if( g.okHistory ){
+ @ <a href="%s(g.zTop)/timeline?c=%T(zDate)">%s(zDate)</a>%s(zSuffix)
+ }else{
+ @ %s(zDate)%s(zSuffix)
+ }
+}
+
+/*
+** Generate a hyperlink to a user. This will link to a timeline showing
+** events by that user. If the date+time is specified, then the timeline
+** is centered on that date+time.
+*/
+void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
+ if( zSuf==0 ) zSuf = "";
+ if( g.okHistory ){
+ if( zD && zD[0] ){
+ @ <a href="%s(g.zTop)/timeline?c=%T(zD)&u=%T(zU)">%h(zU)</a>%s(zSuf)
+ }else{
+ @ <a href="%s(g.zTop)/timeline?u=%T(zU)">%h(zU)</a>%s(zSuf)
+ }
+ }else{
+ @ %s(zU)
+ }
+}
+
+/*
** Count the number of primary non-branch children for the given check-in.
**
** A primary child is one where the parent is the primary parent, not
** a merge parent.
@@ -156,8 +186,12 @@
const char *zDate = db_column_text(pQuery, 2);
const char *zType = db_column_text(pQuery, 9);
const char *zUser = db_column_text(pQuery, 4);
const char *zTagList = db_column_text(pQuery, 10);
+ if( strcmp(zType,"div")==0 ){
+ @ <tr><td colspan=3><hr></td></tr>
+ continue;
+ }
db_multi_exec("INSERT OR IGNORE INTO seen VALUES(%d)", rid);
if( memcmp(zDate, zPrevDate, 10) ){
sprintf(zPrevDate, "%.10s", zDate);
@ <tr><td colspan=3>
@@ -462,8 +496,13 @@
" AND event.mtime>=%f ORDER BY event.mtime ASC",
rCirca
);
nEntry -= (nEntry+1)/2;
+ db_multi_exec(
+ "INSERT OR IGNORE INTO timeline(timestamp,etype)"
+ "VALUES(datetime(%f,'localtime'),'div')",
+ rCirca
+ );
url_add_parameter(&url, "c", zCirca);
}else{
zCirca = 0;
}
@@ -626,15 +665,8 @@
@ }
@ }
@ </script>
style_footer();
-}
-
-/*
-** Render the date string given as a hyperlink to a "circa" timeline.
-*/
-void link_to_date(const char *zDate, const char *zSuffix){
- @ <a href="%s(g.zBaseURL)/timeline?c=%t(zDate)">%h(zDate)</a>%s(zSuffix)
}
/*
** The input query q selects various records. Print a human-readable