Fossil SCM

Fixes to the cookie handler. Simpler class structure on timelines.

drh 2017-11-29 02:20 UTC sticky-timeline-style
Commit 92af2148fbfce50d75f5e9f9a724fa07e0e9693935a9a3504ea704ed3f4b2072
2 files changed +4 -4 +28 -26
+4 -4
--- src/cookies.c
+++ src/cookies.c
@@ -89,16 +89,16 @@
8989
cookies.zCookieValue = z = mprintf("%s", z);
9090
while( cookies.nParam<COOKIE_NPARAM ){
9191
while( fossil_isspace(z[0]) ) z++;
9292
if( z[0]==0 ) break;
9393
cookies.aParam[cookies.nParam].zPName = z;
94
- while( *z && *z!='=' && *z!='&' ){ z++; }
94
+ while( *z && *z!='=' && *z!=',' ){ z++; }
9595
if( *z=='=' ){
9696
*z = 0;
9797
z++;
9898
cookies.aParam[cookies.nParam].zPValue = z;
99
- while( *z && *z!='&' ){ z++; }
99
+ while( *z && *z!=',' ){ z++; }
100100
if( *z ){
101101
*z = 0;
102102
z++;
103103
}
104104
dehttpize(cookies.aParam[cookies.nParam].zPValue);
@@ -177,12 +177,12 @@
177177
if( cookies.bChanged ){
178178
Blob new;
179179
int i;
180180
blob_init(&new, 0, 0);
181181
for(i=0;i<cookies.nParam;i++){
182
- if( i>0 ) blob_append(&new, "&", 1);
183
- blob_appendf(&new, "%s=%t",
182
+ if( i>0 ) blob_append(&new, ",", 1);
183
+ blob_appendf(&new, "%s=%T",
184184
cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
185185
}
186186
cgi_set_cookie(cookies.zCookieName, blob_str(&new), 0, 31536000);
187187
}
188188
cookies.zCookieName = 0;
189189
--- src/cookies.c
+++ src/cookies.c
@@ -89,16 +89,16 @@
89 cookies.zCookieValue = z = mprintf("%s", z);
90 while( cookies.nParam<COOKIE_NPARAM ){
91 while( fossil_isspace(z[0]) ) z++;
92 if( z[0]==0 ) break;
93 cookies.aParam[cookies.nParam].zPName = z;
94 while( *z && *z!='=' && *z!='&' ){ z++; }
95 if( *z=='=' ){
96 *z = 0;
97 z++;
98 cookies.aParam[cookies.nParam].zPValue = z;
99 while( *z && *z!='&' ){ z++; }
100 if( *z ){
101 *z = 0;
102 z++;
103 }
104 dehttpize(cookies.aParam[cookies.nParam].zPValue);
@@ -177,12 +177,12 @@
177 if( cookies.bChanged ){
178 Blob new;
179 int i;
180 blob_init(&new, 0, 0);
181 for(i=0;i<cookies.nParam;i++){
182 if( i>0 ) blob_append(&new, "&", 1);
183 blob_appendf(&new, "%s=%t",
184 cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
185 }
186 cgi_set_cookie(cookies.zCookieName, blob_str(&new), 0, 31536000);
187 }
188 cookies.zCookieName = 0;
189
--- src/cookies.c
+++ src/cookies.c
@@ -89,16 +89,16 @@
89 cookies.zCookieValue = z = mprintf("%s", z);
90 while( cookies.nParam<COOKIE_NPARAM ){
91 while( fossil_isspace(z[0]) ) z++;
92 if( z[0]==0 ) break;
93 cookies.aParam[cookies.nParam].zPName = z;
94 while( *z && *z!='=' && *z!=',' ){ z++; }
95 if( *z=='=' ){
96 *z = 0;
97 z++;
98 cookies.aParam[cookies.nParam].zPValue = z;
99 while( *z && *z!=',' ){ z++; }
100 if( *z ){
101 *z = 0;
102 z++;
103 }
104 dehttpize(cookies.aParam[cookies.nParam].zPValue);
@@ -177,12 +177,12 @@
177 if( cookies.bChanged ){
178 Blob new;
179 int i;
180 blob_init(&new, 0, 0);
181 for(i=0;i<cookies.nParam;i++){
182 if( i>0 ) blob_append(&new, ",", 1);
183 blob_appendf(&new, "%s=%T",
184 cookies.aParam[i].zPName, cookies.aParam[i].zPValue);
185 }
186 cgi_set_cookie(cookies.zCookieName, blob_str(&new), 0, 31536000);
187 }
188 cookies.zCookieName = 0;
189
+28 -26
--- src/timeline.c
+++ src/timeline.c
@@ -252,11 +252,11 @@
252252
static Stmt qbranch;
253253
int pendingEndTr = 0; /* True if a </td></tr> is needed */
254254
int vid = 0; /* Current checkout version */
255255
int dateFormat = 0; /* 0: HH:MM (default) */
256256
int bCommentGitStyle = 0; /* Only show comments through first blank line */
257
- const char *zTdClass;
257
+ const char *zStyle; /* Sub-name for classes for the style */
258258
const char *zDateFmt;
259259
int iTableId = timeline_tableid();
260260
261261
if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
262262
vid = db_lget_int("checkout", 0);
@@ -263,16 +263,18 @@
263263
}
264264
zPrevDate[0] = 0;
265265
mxWikiLen = db_get_int("timeline-max-comment", 0);
266266
dateFormat = db_get_int("timeline-date-format", 0);
267267
bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
268
- if( tmFlags & TIMELINE_NORMAL ){
269
- zTdClass = "timelineStyleNormal";
268
+ if( tmFlags & TIMELINE_COLUMNAR ){
269
+ zStyle = "Columnar";
270270
}else if( tmFlags & TIMELINE_COMPACT ){
271
- zTdClass = "timelineStyleCompact";
271
+ zStyle = "Compact";
272272
}else if( tmFlags & TIMELINE_DETAILED ){
273
- zTdClass = "timelineStyleDetailed";
273
+ zStyle = "Detailed";
274
+ }else{
275
+ zStyle = "Normal";
274276
}
275277
zDateFmt = P("datefmt");
276278
if( zDateFmt ) dateFormat = atoi(zDateFmt);
277279
if( tmFlags & TIMELINE_GRAPH ){
278280
pGraph = graph_init();
@@ -434,14 +436,13 @@
434436
db_reset(&qbranch);
435437
@ <div id="m%d(gidx)" class="tl-nodemark"></div>
436438
}
437439
@</td>
438440
if( zBgClr && zBgClr[0] && rid!=selectedRid ){
439
- @ <td class="timelineTableCell %s(zTdClass)" \
440
- @ style="background-color: %h(zBgClr);">
441
+ @ <td class="timeline%s(zStyle)Cell" style="background-color: %h(zBgClr);">
441442
}else{
442
- @ <td class="timelineTableCell %s(zTdClass)">
443
+ @ <td class="timeline%s(zStyle)Cell">
443444
}
444445
if( pGraph && zType[0]!='c' ){
445446
@ &bull;
446447
}
447448
if( modPending ){
@@ -464,12 +465,15 @@
464465
** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
465466
@ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
466467
wiki_convert(&comment, 0, WIKI_INLINE);
467468
@ </span>
468469
}else{
469
- @ <span class='timelineComment timelineCheckinComment' \
470
- @ onclick='toggleDetail(%d(rid))'>
470
+ if( tmFlags & TIMELINE_COMPACT ){
471
+ @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
472
+ }else{
473
+ @ <span class='timelineComment'>
474
+ }
471475
if( bCommentGitStyle ){
472476
/* Truncate comment at first blank line */
473477
int ii, jj;
474478
int n = blob_size(&comment);
475479
char *z = blob_str(&comment);
@@ -503,26 +507,19 @@
503507
@ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
504508
@ onclick='toggleDetail(%d(rid))'>...</span>
505509
}
506510
if( tmFlags & TIMELINE_COLUMNAR ){
507511
if( zBgClr && zBgClr[0] && rid!=selectedRid ){
508
- @ <td class="timelineTableCell timelineDetailCell"
509
- @ style="background-color: %h(zBgClr);">
512
+ @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
510513
}else{
511
- @ <td class="timelineTableCell timelineDetailCell">
514
+ @ <td class="timelineDetailCell">
512515
}
513516
}
514517
if( tmFlags & TIMELINE_COMPACT ){
515
- cgi_printf("<span class='timelineDetailWrapper clutter' id='detail-%d'>",rid);
516
- }else{
517
- cgi_printf("<span class='timelineDetailWrapper'>");
518
- }
519
- if( zType[0]=='c' ){
520
- cgi_printf("<span class='timelineDetail timelineCheckinDetail'>");
521
- }else{
522
- cgi_printf("<span class='timelineDetail'>");
523
- }
518
+ cgi_printf("<span class='clutter' id='detail-%d'>",rid);
519
+ }
520
+ cgi_printf("<span class='timeline%sDetail'>", zStyle);
524521
525522
if( zType[0]=='c' ){
526523
if( isLeaf ){
527524
if( db_exists("SELECT 1 FROM tagxref"
528525
" WHERE rid=%d AND tagid=%d AND tagtype>0",
@@ -589,12 +586,16 @@
589586
}
590587
tag_private_status(rid);
591588
if( xExtra ){
592589
xExtra(rid);
593590
}
594
- /* End timelineDetail and timelineDetailWrapper */
595
- cgi_printf("</span></span>\n");
591
+ /* End timelineDetail */
592
+ if( tmFlags & TIMELINE_COMPACT ){
593
+ @ </span></span>
594
+ }else{
595
+ @ </span>
596
+ }
596597
597598
/* Generate the file-change list if requested */
598599
if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0
599600
&& zType[0]=='c' && g.perm.Hyperlink
600601
){
@@ -1657,18 +1658,19 @@
16571658
if( fossil_strcmp(z,"all")==0 ){
16581659
nEntry = 0;
16591660
}else{
16601661
nEntry = atoi(z);
16611662
if( nEntry<=0 ){
1662
- cgi_replace_query_parameter("n","10");
1663
+ z = "10";
16631664
nEntry = 10;
16641665
}
16651666
}
16661667
}else{
1667
- cgi_replace_query_parameter("n","50");
1668
+ z = "50";
16681669
nEntry = 50;
16691670
}
1671
+ cgi_replace_query_parameter("n",z);
16701672
cookie_write_parameter("n","n",0);
16711673
cookie_link_parameter("ss","ss","n");
16721674
cViewStyle = PD("ss","n")[0];
16731675
style_submenu_multichoice("ss", 4, azViewStyles, 0);
16741676
16751677
--- src/timeline.c
+++ src/timeline.c
@@ -252,11 +252,11 @@
252 static Stmt qbranch;
253 int pendingEndTr = 0; /* True if a </td></tr> is needed */
254 int vid = 0; /* Current checkout version */
255 int dateFormat = 0; /* 0: HH:MM (default) */
256 int bCommentGitStyle = 0; /* Only show comments through first blank line */
257 const char *zTdClass;
258 const char *zDateFmt;
259 int iTableId = timeline_tableid();
260
261 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
262 vid = db_lget_int("checkout", 0);
@@ -263,16 +263,18 @@
263 }
264 zPrevDate[0] = 0;
265 mxWikiLen = db_get_int("timeline-max-comment", 0);
266 dateFormat = db_get_int("timeline-date-format", 0);
267 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
268 if( tmFlags & TIMELINE_NORMAL ){
269 zTdClass = "timelineStyleNormal";
270 }else if( tmFlags & TIMELINE_COMPACT ){
271 zTdClass = "timelineStyleCompact";
272 }else if( tmFlags & TIMELINE_DETAILED ){
273 zTdClass = "timelineStyleDetailed";
 
 
274 }
275 zDateFmt = P("datefmt");
276 if( zDateFmt ) dateFormat = atoi(zDateFmt);
277 if( tmFlags & TIMELINE_GRAPH ){
278 pGraph = graph_init();
@@ -434,14 +436,13 @@
434 db_reset(&qbranch);
435 @ <div id="m%d(gidx)" class="tl-nodemark"></div>
436 }
437 @</td>
438 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
439 @ <td class="timelineTableCell %s(zTdClass)" \
440 @ style="background-color: %h(zBgClr);">
441 }else{
442 @ <td class="timelineTableCell %s(zTdClass)">
443 }
444 if( pGraph && zType[0]!='c' ){
445 @ &bull;
446 }
447 if( modPending ){
@@ -464,12 +465,15 @@
464 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
465 @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
466 wiki_convert(&comment, 0, WIKI_INLINE);
467 @ </span>
468 }else{
469 @ <span class='timelineComment timelineCheckinComment' \
470 @ onclick='toggleDetail(%d(rid))'>
 
 
 
471 if( bCommentGitStyle ){
472 /* Truncate comment at first blank line */
473 int ii, jj;
474 int n = blob_size(&comment);
475 char *z = blob_str(&comment);
@@ -503,26 +507,19 @@
503 @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
504 @ onclick='toggleDetail(%d(rid))'>...</span>
505 }
506 if( tmFlags & TIMELINE_COLUMNAR ){
507 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
508 @ <td class="timelineTableCell timelineDetailCell"
509 @ style="background-color: %h(zBgClr);">
510 }else{
511 @ <td class="timelineTableCell timelineDetailCell">
512 }
513 }
514 if( tmFlags & TIMELINE_COMPACT ){
515 cgi_printf("<span class='timelineDetailWrapper clutter' id='detail-%d'>",rid);
516 }else{
517 cgi_printf("<span class='timelineDetailWrapper'>");
518 }
519 if( zType[0]=='c' ){
520 cgi_printf("<span class='timelineDetail timelineCheckinDetail'>");
521 }else{
522 cgi_printf("<span class='timelineDetail'>");
523 }
524
525 if( zType[0]=='c' ){
526 if( isLeaf ){
527 if( db_exists("SELECT 1 FROM tagxref"
528 " WHERE rid=%d AND tagid=%d AND tagtype>0",
@@ -589,12 +586,16 @@
589 }
590 tag_private_status(rid);
591 if( xExtra ){
592 xExtra(rid);
593 }
594 /* End timelineDetail and timelineDetailWrapper */
595 cgi_printf("</span></span>\n");
 
 
 
 
596
597 /* Generate the file-change list if requested */
598 if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0
599 && zType[0]=='c' && g.perm.Hyperlink
600 ){
@@ -1657,18 +1658,19 @@
1657 if( fossil_strcmp(z,"all")==0 ){
1658 nEntry = 0;
1659 }else{
1660 nEntry = atoi(z);
1661 if( nEntry<=0 ){
1662 cgi_replace_query_parameter("n","10");
1663 nEntry = 10;
1664 }
1665 }
1666 }else{
1667 cgi_replace_query_parameter("n","50");
1668 nEntry = 50;
1669 }
 
1670 cookie_write_parameter("n","n",0);
1671 cookie_link_parameter("ss","ss","n");
1672 cViewStyle = PD("ss","n")[0];
1673 style_submenu_multichoice("ss", 4, azViewStyles, 0);
1674
1675
--- src/timeline.c
+++ src/timeline.c
@@ -252,11 +252,11 @@
252 static Stmt qbranch;
253 int pendingEndTr = 0; /* True if a </td></tr> is needed */
254 int vid = 0; /* Current checkout version */
255 int dateFormat = 0; /* 0: HH:MM (default) */
256 int bCommentGitStyle = 0; /* Only show comments through first blank line */
257 const char *zStyle; /* Sub-name for classes for the style */
258 const char *zDateFmt;
259 int iTableId = timeline_tableid();
260
261 if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
262 vid = db_lget_int("checkout", 0);
@@ -263,16 +263,18 @@
263 }
264 zPrevDate[0] = 0;
265 mxWikiLen = db_get_int("timeline-max-comment", 0);
266 dateFormat = db_get_int("timeline-date-format", 0);
267 bCommentGitStyle = db_get_int("timeline-truncate-at-blank", 0);
268 if( tmFlags & TIMELINE_COLUMNAR ){
269 zStyle = "Columnar";
270 }else if( tmFlags & TIMELINE_COMPACT ){
271 zStyle = "Compact";
272 }else if( tmFlags & TIMELINE_DETAILED ){
273 zStyle = "Detailed";
274 }else{
275 zStyle = "Normal";
276 }
277 zDateFmt = P("datefmt");
278 if( zDateFmt ) dateFormat = atoi(zDateFmt);
279 if( tmFlags & TIMELINE_GRAPH ){
280 pGraph = graph_init();
@@ -434,14 +436,13 @@
436 db_reset(&qbranch);
437 @ <div id="m%d(gidx)" class="tl-nodemark"></div>
438 }
439 @</td>
440 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
441 @ <td class="timeline%s(zStyle)Cell" style="background-color: %h(zBgClr);">
 
442 }else{
443 @ <td class="timeline%s(zStyle)Cell">
444 }
445 if( pGraph && zType[0]!='c' ){
446 @ &bull;
447 }
448 if( modPending ){
@@ -464,12 +465,15 @@
465 ** "fossil rebuild" and expect to be rendered as text/x-fossil-wiki */
466 @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
467 wiki_convert(&comment, 0, WIKI_INLINE);
468 @ </span>
469 }else{
470 if( tmFlags & TIMELINE_COMPACT ){
471 @ <span class='timelineComment' onclick='toggleDetail(%d(rid))'>
472 }else{
473 @ <span class='timelineComment'>
474 }
475 if( bCommentGitStyle ){
476 /* Truncate comment at first blank line */
477 int ii, jj;
478 int n = blob_size(&comment);
479 char *z = blob_str(&comment);
@@ -503,26 +507,19 @@
507 @ <span class='timelineEllipsis anticlutter' id='ellipsis-%d(rid)' \
508 @ onclick='toggleDetail(%d(rid))'>...</span>
509 }
510 if( tmFlags & TIMELINE_COLUMNAR ){
511 if( zBgClr && zBgClr[0] && rid!=selectedRid ){
512 @ <td class="timelineDetailCell" style="background-color: %h(zBgClr);">
 
513 }else{
514 @ <td class="timelineDetailCell">
515 }
516 }
517 if( tmFlags & TIMELINE_COMPACT ){
518 cgi_printf("<span class='clutter' id='detail-%d'>",rid);
519 }
520 cgi_printf("<span class='timeline%sDetail'>", zStyle);
 
 
 
 
 
 
521
522 if( zType[0]=='c' ){
523 if( isLeaf ){
524 if( db_exists("SELECT 1 FROM tagxref"
525 " WHERE rid=%d AND tagid=%d AND tagtype>0",
@@ -589,12 +586,16 @@
586 }
587 tag_private_status(rid);
588 if( xExtra ){
589 xExtra(rid);
590 }
591 /* End timelineDetail */
592 if( tmFlags & TIMELINE_COMPACT ){
593 @ </span></span>
594 }else{
595 @ </span>
596 }
597
598 /* Generate the file-change list if requested */
599 if( (tmFlags & (TIMELINE_FCHANGES|TIMELINE_FRENAMES))!=0
600 && zType[0]=='c' && g.perm.Hyperlink
601 ){
@@ -1657,18 +1658,19 @@
1658 if( fossil_strcmp(z,"all")==0 ){
1659 nEntry = 0;
1660 }else{
1661 nEntry = atoi(z);
1662 if( nEntry<=0 ){
1663 z = "10";
1664 nEntry = 10;
1665 }
1666 }
1667 }else{
1668 z = "50";
1669 nEntry = 50;
1670 }
1671 cgi_replace_query_parameter("n",z);
1672 cookie_write_parameter("n","n",0);
1673 cookie_link_parameter("ss","ss","n");
1674 cViewStyle = PD("ss","n")[0];
1675 style_submenu_multichoice("ss", 4, azViewStyles, 0);
1676
1677

Keyboard Shortcuts

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