Fossil SCM

On timelines, to show the "selected" entry, give the row some vertical space between the previous and following rows, a yellow background, a gray border, and a shadow-box (all adjustable via CSS). For the c=TIME "circa" query parameter, highlight the nearest entry.

drh 2015-02-09 04:10 trunk
Commit f4e299d0e5602c3fa4c505e10346f15629aae40e
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -159,10 +159,11 @@
159159
table.timelineTable {
160160
cellspacing: 0;
161161
border: 0;
162162
cellpadding: 0;
163163
font-family: "courier new";
164
+ border-collapse: collapse;
164165
}
165166
166167
/* Side-by-side diff */
167168
table.sbsdiff {
168169
background-color: #485D7B;
169170
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -159,10 +159,11 @@
159 table.timelineTable {
160 cellspacing: 0;
161 border: 0;
162 cellpadding: 0;
163 font-family: "courier new";
 
164 }
165
166 /* Side-by-side diff */
167 table.sbsdiff {
168 background-color: #485D7B;
169
--- skins/eagle/css.txt
+++ skins/eagle/css.txt
@@ -159,10 +159,11 @@
159 table.timelineTable {
160 cellspacing: 0;
161 border: 0;
162 cellpadding: 0;
163 font-family: "courier new";
164 border-collapse: collapse;
165 }
166
167 /* Side-by-side diff */
168 table.sbsdiff {
169 background-color: #485D7B;
170
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -527,9 +527,9 @@
527527
"%s AND blob.rid IN (SELECT rid FROM tagxref"
528528
" WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
529529
" ORDER BY event.mtime DESC",
530530
timeline_query_for_www(), TAG_BRANCH
531531
);
532
- www_print_timeline(&q, 0, 0, 0, brtimeline_extra);
532
+ www_print_timeline(&q, 0, 0, 0, 0, brtimeline_extra);
533533
db_finalize(&q);
534534
style_footer();
535535
}
536536
--- src/branch.c
+++ src/branch.c
@@ -527,9 +527,9 @@
527 "%s AND blob.rid IN (SELECT rid FROM tagxref"
528 " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
529 " ORDER BY event.mtime DESC",
530 timeline_query_for_www(), TAG_BRANCH
531 );
532 www_print_timeline(&q, 0, 0, 0, brtimeline_extra);
533 db_finalize(&q);
534 style_footer();
535 }
536
--- src/branch.c
+++ src/branch.c
@@ -527,9 +527,9 @@
527 "%s AND blob.rid IN (SELECT rid FROM tagxref"
528 " WHERE tagtype>0 AND tagid=%d AND srcid!=0)"
529 " ORDER BY event.mtime DESC",
530 timeline_query_for_www(), TAG_BRANCH
531 );
532 www_print_timeline(&q, 0, 0, 0, 0, brtimeline_extra);
533 db_finalize(&q);
534 style_footer();
535 }
536
--- src/descendants.c
+++ src/descendants.c
@@ -482,11 +482,11 @@
482482
}else if( !showAll ){
483483
blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
484484
}
485485
db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
486486
blob_reset(&sql);
487
- www_print_timeline(&q, TIMELINE_LEAFONLY, 0, 0, 0);
487
+ www_print_timeline(&q, TIMELINE_LEAFONLY, 0, 0, 0, 0);
488488
db_finalize(&q);
489489
@ <br />
490490
style_footer();
491491
}
492492
493493
--- src/descendants.c
+++ src/descendants.c
@@ -482,11 +482,11 @@
482 }else if( !showAll ){
483 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
484 }
485 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
486 blob_reset(&sql);
487 www_print_timeline(&q, TIMELINE_LEAFONLY, 0, 0, 0);
488 db_finalize(&q);
489 @ <br />
490 style_footer();
491 }
492
493
--- src/descendants.c
+++ src/descendants.c
@@ -482,11 +482,11 @@
482 }else if( !showAll ){
483 blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid"));
484 }
485 db_prepare(&q, "%s ORDER BY event.mtime DESC", blob_sql_text(&sql));
486 blob_reset(&sql);
487 www_print_timeline(&q, TIMELINE_LEAFONLY, 0, 0, 0, 0);
488 db_finalize(&q);
489 @ <br />
490 style_footer();
491 }
492
493
+1 -1
--- src/moderate.c
+++ src/moderate.c
@@ -154,10 +154,10 @@
154154
blob_append_sql(&sql,
155155
" AND event.objid IN (SELECT objid FROM modreq)"
156156
" ORDER BY event.mtime DESC"
157157
);
158158
db_prepare(&q, "%s", blob_sql_text(&sql));
159
- www_print_timeline(&q, 0, 0, 0, 0);
159
+ www_print_timeline(&q, 0, 0, 0, 0, 0);
160160
db_finalize(&q);
161161
}
162162
style_footer();
163163
}
164164
--- src/moderate.c
+++ src/moderate.c
@@ -154,10 +154,10 @@
154 blob_append_sql(&sql,
155 " AND event.objid IN (SELECT objid FROM modreq)"
156 " ORDER BY event.mtime DESC"
157 );
158 db_prepare(&q, "%s", blob_sql_text(&sql));
159 www_print_timeline(&q, 0, 0, 0, 0);
160 db_finalize(&q);
161 }
162 style_footer();
163 }
164
--- src/moderate.c
+++ src/moderate.c
@@ -154,10 +154,10 @@
154 blob_append_sql(&sql,
155 " AND event.objid IN (SELECT objid FROM modreq)"
156 " ORDER BY event.mtime DESC"
157 );
158 db_prepare(&q, "%s", blob_sql_text(&sql));
159 www_print_timeline(&q, 0, 0, 0, 0, 0);
160 db_finalize(&q);
161 }
162 style_footer();
163 }
164
+12
--- src/style.c
+++ src/style.c
@@ -663,10 +663,11 @@
663663
@ font-size: small;
664664
},
665665
{ "table.timelineTable",
666666
"the format for the timeline data table",
667667
@ border: 0;
668
+ @ border-collapse: collapse;
668669
},
669670
{ "td.timelineTableCell",
670671
"the format for the timeline data cells",
671672
@ vertical-align: top;
672673
@ text-align: left;
@@ -673,10 +674,21 @@
673674
},
674675
{ "tr.timelineCurrent td.timelineTableCell",
675676
"the format for the timeline data cell of the current checkout",
676677
@ padding: .1em .2em;
677678
@ border: 1px dashed #446979;
679
+ },
680
+ { "tr.timelineSelected",
681
+ "The row in the timeline table that contains the entry of interest",
682
+ @ padding: .1em .2em;
683
+ @ border: 2px solid lightgray;
684
+ @ background-color: #ffc;
685
+ @ box-shadow: 4px 4px 2px #888;
686
+ },
687
+ { "tr.timelineSpacer",
688
+ "An extra row inserted to give vertical space between two rows",
689
+ @ height: 1ex;
678690
},
679691
{ "span.timelineLeaf",
680692
"the format for the timeline leaf marks",
681693
@ font-weight: bold;
682694
},
683695
--- src/style.c
+++ src/style.c
@@ -663,10 +663,11 @@
663 @ font-size: small;
664 },
665 { "table.timelineTable",
666 "the format for the timeline data table",
667 @ border: 0;
 
668 },
669 { "td.timelineTableCell",
670 "the format for the timeline data cells",
671 @ vertical-align: top;
672 @ text-align: left;
@@ -673,10 +674,21 @@
673 },
674 { "tr.timelineCurrent td.timelineTableCell",
675 "the format for the timeline data cell of the current checkout",
676 @ padding: .1em .2em;
677 @ border: 1px dashed #446979;
 
 
 
 
 
 
 
 
 
 
 
678 },
679 { "span.timelineLeaf",
680 "the format for the timeline leaf marks",
681 @ font-weight: bold;
682 },
683
--- src/style.c
+++ src/style.c
@@ -663,10 +663,11 @@
663 @ font-size: small;
664 },
665 { "table.timelineTable",
666 "the format for the timeline data table",
667 @ border: 0;
668 @ border-collapse: collapse;
669 },
670 { "td.timelineTableCell",
671 "the format for the timeline data cells",
672 @ vertical-align: top;
673 @ text-align: left;
@@ -673,10 +674,21 @@
674 },
675 { "tr.timelineCurrent td.timelineTableCell",
676 "the format for the timeline data cell of the current checkout",
677 @ padding: .1em .2em;
678 @ border: 1px dashed #446979;
679 },
680 { "tr.timelineSelected",
681 "The row in the timeline table that contains the entry of interest",
682 @ padding: .1em .2em;
683 @ border: 2px solid lightgray;
684 @ background-color: #ffc;
685 @ box-shadow: 4px 4px 2px #888;
686 },
687 { "tr.timelineSpacer",
688 "An extra row inserted to give vertical space between two rows",
689 @ height: 1ex;
690 },
691 { "span.timelineLeaf",
692 "the format for the timeline leaf marks",
693 @ font-weight: bold;
694 },
695
+1 -1
--- src/tag.c
+++ src/tag.c
@@ -594,10 +594,10 @@
594594
" AND tagid IN (SELECT tagid FROM tag "
595595
" WHERE tagname GLOB 'sym-*'))"
596596
" ORDER BY event.mtime DESC",
597597
timeline_query_for_www()
598598
);
599
- www_print_timeline(&q, 0, 0, 0, 0);
599
+ www_print_timeline(&q, 0, 0, 0, 0, 0);
600600
db_finalize(&q);
601601
@ <br />
602602
style_footer();
603603
}
604604
--- src/tag.c
+++ src/tag.c
@@ -594,10 +594,10 @@
594 " AND tagid IN (SELECT tagid FROM tag "
595 " WHERE tagname GLOB 'sym-*'))"
596 " ORDER BY event.mtime DESC",
597 timeline_query_for_www()
598 );
599 www_print_timeline(&q, 0, 0, 0, 0);
600 db_finalize(&q);
601 @ <br />
602 style_footer();
603 }
604
--- src/tag.c
+++ src/tag.c
@@ -594,10 +594,10 @@
594 " AND tagid IN (SELECT tagid FROM tag "
595 " WHERE tagname GLOB 'sym-*'))"
596 " ORDER BY event.mtime DESC",
597 timeline_query_for_www()
598 );
599 www_print_timeline(&q, 0, 0, 0, 0, 0);
600 db_finalize(&q);
601 @ <br />
602 style_footer();
603 }
604
+36 -35
--- src/timeline.c
+++ src/timeline.c
@@ -21,10 +21,15 @@
2121
#include "config.h"
2222
#include <string.h>
2323
#include <time.h>
2424
#include "timeline.h"
2525
26
+/*
27
+** The value of one second in julianday notation
28
+*/
29
+#define ONE_SECOND (1.0/86400.0)
30
+
2631
/*
2732
** Add an appropriate tag to the output if "rid" is unpublished (private)
2833
*/
2934
#define UNPUB_TAG "<em>(unpublished)</em>"
3035
void tag_private_status(int rid){
@@ -209,10 +214,11 @@
209214
void www_print_timeline(
210215
Stmt *pQuery, /* Query to implement the timeline */
211216
int tmFlags, /* Flags controlling display behavior */
212217
const char *zThisUser, /* Suppress links to this user */
213218
const char *zThisTag, /* Suppress links to this tag */
219
+ int selectedRid, /* Highlight the line with this RID value */
214220
void (*xExtra)(int) /* Routine to call on each line of display */
215221
){
216222
int mxWikiLen;
217223
Blob comment;
218224
int prevTagid = 0;
@@ -289,15 +295,18 @@
289295
@ event%s(suppressCnt>1?"s":"") omitted.</span>
290296
suppressCnt = 0;
291297
}
292298
if( pendingEndTr ){
293299
@ </td></tr>
300
+ if( pendingEndTr>1 ){
301
+ @ <tr class="timelineSpacer"></tr>
302
+ }
294303
pendingEndTr = 0;
295304
}
296305
if( fossil_strcmp(zType,"div")==0 ){
297306
if( !prevWasDivider ){
298
- @ <tr><td colspan="3"><hr /></td></tr>
307
+ @ <tr><td colspan="3"><hr class="timelineMarker"/></td></tr>
299308
}
300309
prevWasDivider = 1;
301310
continue;
302311
}
303312
prevWasDivider = 0;
@@ -332,11 +341,16 @@
332341
zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
333342
zTime[pos++] = 0;
334343
}else{
335344
zTime[0] = 0;
336345
}
337
- if( rid == vid ){
346
+ pendingEndTr = 1;
347
+ if( rid==selectedRid ){
348
+ @ <tr class="timelineSpacer"></tr>
349
+ @ <tr class="timelineSelected">
350
+ pendingEndTr = 2;
351
+ }else if( rid==vid ){
338352
@ <tr class="timelineCurrent">
339353
}else {
340354
@ <tr>
341355
}
342356
@ <td class="timelineTime">%s(zTime)</td>
@@ -379,11 +393,11 @@
379393
zUuid, isLeaf);
380394
db_reset(&qbranch);
381395
@ <div id="m%d(gidx)"></div>
382396
}
383397
@</td>
384
- if( zBgClr && zBgClr[0] ){
398
+ if( zBgClr && zBgClr[0] && rid!=selectedRid ){
385399
@ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
386400
}else{
387401
@ <td class="timelineTableCell">
388402
}
389403
if( pGraph && zType[0]!='c' ){
@@ -550,11 +564,10 @@
550564
db_reset(&fchngQuery);
551565
if( inUl ){
552566
@ </ul>
553567
}
554568
}
555
- pendingEndTr = 1;
556569
}
557570
if( suppressCnt ){
558571
@ <span class="timelineDisabled">... %d(suppressCnt) similar
559572
@ event%s(suppressCnt>1?"s":"") omitted.</span>
560573
suppressCnt = 0;
@@ -975,36 +988,23 @@
975988
}
976989
return mtime;
977990
}
978991
979992
/*
980
-** The value of one second in julianday notation
981
-*/
982
-#define ONE_SECOND (1.0/86400.0)
983
-
984
-/*
985
-** zDate is a localtime date. Insert records into the
986
-** "timeline" table to cause <hr> to be inserted before and after
987
-** entries of that date. If zDate==NULL then put dividers around
988
-** the event identified by rid.
989
-*/
990
-static void timeline_add_dividers(double rDate, int rid){
991
- char *zToDel = 0;
992
- if( rDate==0 ){
993
- rDate = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
994
- }
995
- db_multi_exec(
996
- "INSERT INTO timeline(rid,sortby,etype)"
997
- "VALUES(-1,%.16g,'div')",
998
- rDate-ONE_SECOND
999
- );
1000
- db_multi_exec(
1001
- "INSERT INTO timeline(rid,sortby,etype)"
1002
- "VALUES(-2,%.17g,'div')",
1003
- rDate+ONE_SECOND
1004
- );
1005
- fossil_free(zToDel);
993
+** zDate is a localtime date. Insert records into the
994
+** "timeline" table to cause <hr> to be inserted on zDate.
995
+*/
996
+static int timeline_add_divider(double rDate){
997
+ int rid = db_int(-1,
998
+ "SELECT rid FROM timeline ORDER BY abs(sortby-%.16g) LIMIT 1", rDate
999
+ );
1000
+ if( rid>0 ) return rid;
1001
+ db_multi_exec(
1002
+ "INSERT INTO timeline(rid,sortby,etype) VALUES(-1,%.16g,'div')",
1003
+ rDate
1004
+ );
1005
+ return -1;
10061006
}
10071007
10081008
/*
10091009
** Return all possible names for file zUuid.
10101010
*/
@@ -1139,10 +1139,11 @@
11391139
int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
11401140
int pd_rid;
11411141
double rBefore, rAfter, rCirca; /* Boundary times */
11421142
const char *z;
11431143
char *zOlderButton = 0; /* URL for Older button at the bottom */
1144
+ int selectedRid = -9999999; /* Show a highlight on this RID */
11441145
11451146
/* Set number of rows to display */
11461147
z = P("n");
11471148
if( z ){
11481149
if( fossil_strcmp(z,"all")==0 ){
@@ -1294,11 +1295,11 @@
12941295
if( d_rid ){
12951296
compute_descendants(d_rid, nEntry+1);
12961297
nd = db_int(0, "SELECT count(*)-1 FROM ok");
12971298
if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
12981299
if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
1299
- if( useDividers ) timeline_add_dividers(0, d_rid);
1300
+ if( useDividers ) selectedRid = d_rid;
13001301
db_multi_exec("DELETE FROM ok");
13011302
}
13021303
if( p_rid ){
13031304
compute_ancestors(p_rid, nEntry+1, 0);
13041305
np = db_int(0, "SELECT count(*)-1 FROM ok");
@@ -1305,11 +1306,11 @@
13051306
if( np>0 ){
13061307
if( nd>0 ) blob_appendf(&desc, " and ");
13071308
blob_appendf(&desc, "%d ancestors", np);
13081309
db_multi_exec("%s", blob_sql_text(&sql));
13091310
}
1310
- if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1311
+ if( useDividers ) selectedRid = p_rid;
13111312
}
13121313
blob_appendf(&desc, " of %z[%S]</a>",
13131314
href("%R/info/%s", zUuid), zUuid);
13141315
if( d_rid ){
13151316
if( p_rid ){
@@ -1331,11 +1332,11 @@
13311332
"INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
13321333
f_rid, f_rid, f_rid
13331334
);
13341335
blob_append_sql(&sql, " AND event.objid IN ok");
13351336
db_multi_exec("%s", blob_sql_text(&sql));
1336
- if( useDividers ) timeline_add_dividers(0, f_rid);
1337
+ if( useDividers ) selectedRid = f_rid;
13371338
blob_appendf(&desc, "Parents and children of check-in ");
13381339
zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
13391340
blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid);
13401341
tmFlags |= TIMELINE_DISJOINT;
13411342
style_submenu_binary("v","With Files","Without Files",
@@ -1489,16 +1490,16 @@
14891490
blob_append_sql(&sql,
14901491
" AND event.mtime>=%f ORDER BY event.mtime ASC",
14911492
rCirca
14921493
);
14931494
nEntry -= (nEntry+1)/2;
1494
- if( useDividers ) timeline_add_dividers(rCirca, 0);
14951495
}else{
14961496
blob_append_sql(&sql, " ORDER BY event.mtime DESC");
14971497
}
14981498
if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
14991499
db_multi_exec("%s", blob_sql_text(&sql));
1500
+ if( zCirca && useDividers ) selectedRid = timeline_add_divider(rCirca);
15001501
15011502
n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
15021503
if( zYearMonth ){
15031504
blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
15041505
}else if( zYearWeek ){
@@ -1576,11 +1577,11 @@
15761577
if( P("showid") ) tmFlags |= TIMELINE_SHOWRID;
15771578
blob_zero(&sql);
15781579
db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
15791580
@ <h2>%b(&desc)</h2>
15801581
blob_reset(&desc);
1581
- www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0);
1582
+ www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0);
15821583
db_finalize(&q);
15831584
if( zOlderButton ){
15841585
@ %z(xhref("class='button'","%z",zOlderButton))Older</a>
15851586
}
15861587
style_footer();
15871588
--- src/timeline.c
+++ src/timeline.c
@@ -21,10 +21,15 @@
21 #include "config.h"
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
25
 
 
 
 
 
26 /*
27 ** Add an appropriate tag to the output if "rid" is unpublished (private)
28 */
29 #define UNPUB_TAG "<em>(unpublished)</em>"
30 void tag_private_status(int rid){
@@ -209,10 +214,11 @@
209 void www_print_timeline(
210 Stmt *pQuery, /* Query to implement the timeline */
211 int tmFlags, /* Flags controlling display behavior */
212 const char *zThisUser, /* Suppress links to this user */
213 const char *zThisTag, /* Suppress links to this tag */
 
214 void (*xExtra)(int) /* Routine to call on each line of display */
215 ){
216 int mxWikiLen;
217 Blob comment;
218 int prevTagid = 0;
@@ -289,15 +295,18 @@
289 @ event%s(suppressCnt>1?"s":"") omitted.</span>
290 suppressCnt = 0;
291 }
292 if( pendingEndTr ){
293 @ </td></tr>
 
 
 
294 pendingEndTr = 0;
295 }
296 if( fossil_strcmp(zType,"div")==0 ){
297 if( !prevWasDivider ){
298 @ <tr><td colspan="3"><hr /></td></tr>
299 }
300 prevWasDivider = 1;
301 continue;
302 }
303 prevWasDivider = 0;
@@ -332,11 +341,16 @@
332 zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
333 zTime[pos++] = 0;
334 }else{
335 zTime[0] = 0;
336 }
337 if( rid == vid ){
 
 
 
 
 
338 @ <tr class="timelineCurrent">
339 }else {
340 @ <tr>
341 }
342 @ <td class="timelineTime">%s(zTime)</td>
@@ -379,11 +393,11 @@
379 zUuid, isLeaf);
380 db_reset(&qbranch);
381 @ <div id="m%d(gidx)"></div>
382 }
383 @</td>
384 if( zBgClr && zBgClr[0] ){
385 @ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
386 }else{
387 @ <td class="timelineTableCell">
388 }
389 if( pGraph && zType[0]!='c' ){
@@ -550,11 +564,10 @@
550 db_reset(&fchngQuery);
551 if( inUl ){
552 @ </ul>
553 }
554 }
555 pendingEndTr = 1;
556 }
557 if( suppressCnt ){
558 @ <span class="timelineDisabled">... %d(suppressCnt) similar
559 @ event%s(suppressCnt>1?"s":"") omitted.</span>
560 suppressCnt = 0;
@@ -975,36 +988,23 @@
975 }
976 return mtime;
977 }
978
979 /*
980 ** The value of one second in julianday notation
981 */
982 #define ONE_SECOND (1.0/86400.0)
983
984 /*
985 ** zDate is a localtime date. Insert records into the
986 ** "timeline" table to cause <hr> to be inserted before and after
987 ** entries of that date. If zDate==NULL then put dividers around
988 ** the event identified by rid.
989 */
990 static void timeline_add_dividers(double rDate, int rid){
991 char *zToDel = 0;
992 if( rDate==0 ){
993 rDate = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
994 }
995 db_multi_exec(
996 "INSERT INTO timeline(rid,sortby,etype)"
997 "VALUES(-1,%.16g,'div')",
998 rDate-ONE_SECOND
999 );
1000 db_multi_exec(
1001 "INSERT INTO timeline(rid,sortby,etype)"
1002 "VALUES(-2,%.17g,'div')",
1003 rDate+ONE_SECOND
1004 );
1005 fossil_free(zToDel);
1006 }
1007
1008 /*
1009 ** Return all possible names for file zUuid.
1010 */
@@ -1139,10 +1139,11 @@
1139 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
1140 int pd_rid;
1141 double rBefore, rAfter, rCirca; /* Boundary times */
1142 const char *z;
1143 char *zOlderButton = 0; /* URL for Older button at the bottom */
 
1144
1145 /* Set number of rows to display */
1146 z = P("n");
1147 if( z ){
1148 if( fossil_strcmp(z,"all")==0 ){
@@ -1294,11 +1295,11 @@
1294 if( d_rid ){
1295 compute_descendants(d_rid, nEntry+1);
1296 nd = db_int(0, "SELECT count(*)-1 FROM ok");
1297 if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
1298 if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
1299 if( useDividers ) timeline_add_dividers(0, d_rid);
1300 db_multi_exec("DELETE FROM ok");
1301 }
1302 if( p_rid ){
1303 compute_ancestors(p_rid, nEntry+1, 0);
1304 np = db_int(0, "SELECT count(*)-1 FROM ok");
@@ -1305,11 +1306,11 @@
1305 if( np>0 ){
1306 if( nd>0 ) blob_appendf(&desc, " and ");
1307 blob_appendf(&desc, "%d ancestors", np);
1308 db_multi_exec("%s", blob_sql_text(&sql));
1309 }
1310 if( d_rid==0 && useDividers ) timeline_add_dividers(0, p_rid);
1311 }
1312 blob_appendf(&desc, " of %z[%S]</a>",
1313 href("%R/info/%s", zUuid), zUuid);
1314 if( d_rid ){
1315 if( p_rid ){
@@ -1331,11 +1332,11 @@
1331 "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
1332 f_rid, f_rid, f_rid
1333 );
1334 blob_append_sql(&sql, " AND event.objid IN ok");
1335 db_multi_exec("%s", blob_sql_text(&sql));
1336 if( useDividers ) timeline_add_dividers(0, f_rid);
1337 blob_appendf(&desc, "Parents and children of check-in ");
1338 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1339 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid);
1340 tmFlags |= TIMELINE_DISJOINT;
1341 style_submenu_binary("v","With Files","Without Files",
@@ -1489,16 +1490,16 @@
1489 blob_append_sql(&sql,
1490 " AND event.mtime>=%f ORDER BY event.mtime ASC",
1491 rCirca
1492 );
1493 nEntry -= (nEntry+1)/2;
1494 if( useDividers ) timeline_add_dividers(rCirca, 0);
1495 }else{
1496 blob_append_sql(&sql, " ORDER BY event.mtime DESC");
1497 }
1498 if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
1499 db_multi_exec("%s", blob_sql_text(&sql));
 
1500
1501 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
1502 if( zYearMonth ){
1503 blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
1504 }else if( zYearWeek ){
@@ -1576,11 +1577,11 @@
1576 if( P("showid") ) tmFlags |= TIMELINE_SHOWRID;
1577 blob_zero(&sql);
1578 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
1579 @ <h2>%b(&desc)</h2>
1580 blob_reset(&desc);
1581 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, 0);
1582 db_finalize(&q);
1583 if( zOlderButton ){
1584 @ %z(xhref("class='button'","%z",zOlderButton))Older</a>
1585 }
1586 style_footer();
1587
--- src/timeline.c
+++ src/timeline.c
@@ -21,10 +21,15 @@
21 #include "config.h"
22 #include <string.h>
23 #include <time.h>
24 #include "timeline.h"
25
26 /*
27 ** The value of one second in julianday notation
28 */
29 #define ONE_SECOND (1.0/86400.0)
30
31 /*
32 ** Add an appropriate tag to the output if "rid" is unpublished (private)
33 */
34 #define UNPUB_TAG "<em>(unpublished)</em>"
35 void tag_private_status(int rid){
@@ -209,10 +214,11 @@
214 void www_print_timeline(
215 Stmt *pQuery, /* Query to implement the timeline */
216 int tmFlags, /* Flags controlling display behavior */
217 const char *zThisUser, /* Suppress links to this user */
218 const char *zThisTag, /* Suppress links to this tag */
219 int selectedRid, /* Highlight the line with this RID value */
220 void (*xExtra)(int) /* Routine to call on each line of display */
221 ){
222 int mxWikiLen;
223 Blob comment;
224 int prevTagid = 0;
@@ -289,15 +295,18 @@
295 @ event%s(suppressCnt>1?"s":"") omitted.</span>
296 suppressCnt = 0;
297 }
298 if( pendingEndTr ){
299 @ </td></tr>
300 if( pendingEndTr>1 ){
301 @ <tr class="timelineSpacer"></tr>
302 }
303 pendingEndTr = 0;
304 }
305 if( fossil_strcmp(zType,"div")==0 ){
306 if( !prevWasDivider ){
307 @ <tr><td colspan="3"><hr class="timelineMarker"/></td></tr>
308 }
309 prevWasDivider = 1;
310 continue;
311 }
312 prevWasDivider = 0;
@@ -332,11 +341,16 @@
341 zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
342 zTime[pos++] = 0;
343 }else{
344 zTime[0] = 0;
345 }
346 pendingEndTr = 1;
347 if( rid==selectedRid ){
348 @ <tr class="timelineSpacer"></tr>
349 @ <tr class="timelineSelected">
350 pendingEndTr = 2;
351 }else if( rid==vid ){
352 @ <tr class="timelineCurrent">
353 }else {
354 @ <tr>
355 }
356 @ <td class="timelineTime">%s(zTime)</td>
@@ -379,11 +393,11 @@
393 zUuid, isLeaf);
394 db_reset(&qbranch);
395 @ <div id="m%d(gidx)"></div>
396 }
397 @</td>
398 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
399 @ <td class="timelineTableCell" style="background-color: %h(zBgClr);">
400 }else{
401 @ <td class="timelineTableCell">
402 }
403 if( pGraph && zType[0]!='c' ){
@@ -550,11 +564,10 @@
564 db_reset(&fchngQuery);
565 if( inUl ){
566 @ </ul>
567 }
568 }
 
569 }
570 if( suppressCnt ){
571 @ <span class="timelineDisabled">... %d(suppressCnt) similar
572 @ event%s(suppressCnt>1?"s":"") omitted.</span>
573 suppressCnt = 0;
@@ -975,36 +988,23 @@
988 }
989 return mtime;
990 }
991
992 /*
993 ** zDate is a localtime date. Insert records into the
994 ** "timeline" table to cause <hr> to be inserted on zDate.
995 */
996 static int timeline_add_divider(double rDate){
997 int rid = db_int(-1,
998 "SELECT rid FROM timeline ORDER BY abs(sortby-%.16g) LIMIT 1", rDate
999 );
1000 if( rid>0 ) return rid;
1001 db_multi_exec(
1002 "INSERT INTO timeline(rid,sortby,etype) VALUES(-1,%.16g,'div')",
1003 rDate
1004 );
1005 return -1;
 
 
 
 
 
 
 
 
 
 
 
 
 
1006 }
1007
1008 /*
1009 ** Return all possible names for file zUuid.
1010 */
@@ -1139,10 +1139,11 @@
1139 int you_rid = name_to_typed_rid(P("you"),"ci");/* you= for common ancst */
1140 int pd_rid;
1141 double rBefore, rAfter, rCirca; /* Boundary times */
1142 const char *z;
1143 char *zOlderButton = 0; /* URL for Older button at the bottom */
1144 int selectedRid = -9999999; /* Show a highlight on this RID */
1145
1146 /* Set number of rows to display */
1147 z = P("n");
1148 if( z ){
1149 if( fossil_strcmp(z,"all")==0 ){
@@ -1294,11 +1295,11 @@
1295 if( d_rid ){
1296 compute_descendants(d_rid, nEntry+1);
1297 nd = db_int(0, "SELECT count(*)-1 FROM ok");
1298 if( nd>=0 ) db_multi_exec("%s", blob_sql_text(&sql));
1299 if( nd>0 ) blob_appendf(&desc, "%d descendant%s", nd,(1==nd)?"":"s");
1300 if( useDividers ) selectedRid = d_rid;
1301 db_multi_exec("DELETE FROM ok");
1302 }
1303 if( p_rid ){
1304 compute_ancestors(p_rid, nEntry+1, 0);
1305 np = db_int(0, "SELECT count(*)-1 FROM ok");
@@ -1305,11 +1306,11 @@
1306 if( np>0 ){
1307 if( nd>0 ) blob_appendf(&desc, " and ");
1308 blob_appendf(&desc, "%d ancestors", np);
1309 db_multi_exec("%s", blob_sql_text(&sql));
1310 }
1311 if( useDividers ) selectedRid = p_rid;
1312 }
1313 blob_appendf(&desc, " of %z[%S]</a>",
1314 href("%R/info/%s", zUuid), zUuid);
1315 if( d_rid ){
1316 if( p_rid ){
@@ -1331,11 +1332,11 @@
1332 "INSERT OR IGNORE INTO ok SELECT cid FROM plink WHERE pid=%d;",
1333 f_rid, f_rid, f_rid
1334 );
1335 blob_append_sql(&sql, " AND event.objid IN ok");
1336 db_multi_exec("%s", blob_sql_text(&sql));
1337 if( useDividers ) selectedRid = f_rid;
1338 blob_appendf(&desc, "Parents and children of check-in ");
1339 zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", f_rid);
1340 blob_appendf(&desc, "%z[%S]</a>", href("%R/info/%s", zUuid), zUuid);
1341 tmFlags |= TIMELINE_DISJOINT;
1342 style_submenu_binary("v","With Files","Without Files",
@@ -1489,16 +1490,16 @@
1490 blob_append_sql(&sql,
1491 " AND event.mtime>=%f ORDER BY event.mtime ASC",
1492 rCirca
1493 );
1494 nEntry -= (nEntry+1)/2;
 
1495 }else{
1496 blob_append_sql(&sql, " ORDER BY event.mtime DESC");
1497 }
1498 if( nEntry>0 ) blob_append_sql(&sql, " LIMIT %d", nEntry);
1499 db_multi_exec("%s", blob_sql_text(&sql));
1500 if( zCirca && useDividers ) selectedRid = timeline_add_divider(rCirca);
1501
1502 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
1503 if( zYearMonth ){
1504 blob_appendf(&desc, "%s events for %h", zEType, zYearMonth);
1505 }else if( zYearWeek ){
@@ -1576,11 +1577,11 @@
1577 if( P("showid") ) tmFlags |= TIMELINE_SHOWRID;
1578 blob_zero(&sql);
1579 db_prepare(&q, "SELECT * FROM timeline ORDER BY sortby DESC /*scan*/");
1580 @ <h2>%b(&desc)</h2>
1581 blob_reset(&desc);
1582 www_print_timeline(&q, tmFlags, zThisUser, zThisTag, selectedRid, 0);
1583 db_finalize(&q);
1584 if( zOlderButton ){
1585 @ %z(xhref("class='button'","%z",zOlderButton))Older</a>
1586 }
1587 style_footer();
1588
+1 -1
--- src/tkt.c
+++ src/tkt.c
@@ -893,11 +893,11 @@
893893
timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
894894
);
895895
}
896896
db_prepare(&q, "%z", zSQL/*safe-for-%s*/);
897897
www_print_timeline(&q, TIMELINE_ARTID|TIMELINE_DISJOINT|TIMELINE_GRAPH,
898
- 0, 0, 0);
898
+ 0, 0, 0, 0);
899899
db_finalize(&q);
900900
style_footer();
901901
}
902902
903903
/*
904904
--- src/tkt.c
+++ src/tkt.c
@@ -893,11 +893,11 @@
893 timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
894 );
895 }
896 db_prepare(&q, "%z", zSQL/*safe-for-%s*/);
897 www_print_timeline(&q, TIMELINE_ARTID|TIMELINE_DISJOINT|TIMELINE_GRAPH,
898 0, 0, 0);
899 db_finalize(&q);
900 style_footer();
901 }
902
903 /*
904
--- src/tkt.c
+++ src/tkt.c
@@ -893,11 +893,11 @@
893 timeline_query_for_www(), tagid, zFullUuid, zFullUuid, zFullUuid
894 );
895 }
896 db_prepare(&q, "%z", zSQL/*safe-for-%s*/);
897 www_print_timeline(&q, TIMELINE_ARTID|TIMELINE_DISJOINT|TIMELINE_GRAPH,
898 0, 0, 0, 0);
899 db_finalize(&q);
900 style_footer();
901 }
902
903 /*
904
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -852,11 +852,11 @@
852852
" UNION SELECT attachid FROM attachment"
853853
" WHERE target=%Q)"
854854
"ORDER BY mtime DESC",
855855
timeline_query_for_www(), zPageName, zPageName);
856856
zWikiPageName = zPageName;
857
- www_print_timeline(&q, TIMELINE_ARTID, 0, 0, wiki_history_extra);
857
+ www_print_timeline(&q, TIMELINE_ARTID, 0, 0, 0, wiki_history_extra);
858858
db_finalize(&q);
859859
style_footer();
860860
}
861861
862862
/*
863863
--- src/wiki.c
+++ src/wiki.c
@@ -852,11 +852,11 @@
852 " UNION SELECT attachid FROM attachment"
853 " WHERE target=%Q)"
854 "ORDER BY mtime DESC",
855 timeline_query_for_www(), zPageName, zPageName);
856 zWikiPageName = zPageName;
857 www_print_timeline(&q, TIMELINE_ARTID, 0, 0, wiki_history_extra);
858 db_finalize(&q);
859 style_footer();
860 }
861
862 /*
863
--- src/wiki.c
+++ src/wiki.c
@@ -852,11 +852,11 @@
852 " UNION SELECT attachid FROM attachment"
853 " WHERE target=%Q)"
854 "ORDER BY mtime DESC",
855 timeline_query_for_www(), zPageName, zPageName);
856 zWikiPageName = zPageName;
857 www_print_timeline(&q, TIMELINE_ARTID, 0, 0, 0, wiki_history_extra);
858 db_finalize(&q);
859 style_footer();
860 }
861
862 /*
863

Keyboard Shortcuts

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