Fossil SCM

Break out some of the obscure timelinen links on the /sitemap page into a separate /sitemap-timeline page.

drh 2020-12-02 15:29 trunk
Commit 79f7808ba4b95322243f718c437c64b9bf8c05164303e2d3bdfb14156947b08c
+41 -5
--- src/sitemap.c
+++ src/sitemap.c
@@ -100,14 +100,11 @@
100100
}
101101
if( g.perm.Read ){
102102
@ <li>%z(href("%R/timeline"))Project Timeline</a>
103103
@ <ul>
104104
@ <li>%z(href("%R/reports"))Activity Reports</a></li>
105
- @ <li>%z(href("%R/timeline?n=all&namechng"))File name changes</a></li>
106
- @ <li>%z(href("%R/timeline?n=all&forks"))Forks</a></li>
107
- @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10
108
- @ check-ins</a></li>
105
+ @ <li>%z(href("%R/sitemap-timeline"))Other timelines</a></li>
109106
@ </ul>
110107
@ </li>
111108
}
112109
if( g.perm.Read ){
113110
@ <li>%z(href("%R/brlist"))Branches</a>
@@ -192,11 +189,10 @@
192189
if( g.perm.Admin ){
193190
@ <li>%z(href("%R/urllist"))List of URLs used to access
194191
@ this repository</a></li>
195192
}
196193
@ <li>%z(href("%R/bloblist"))List of Artifacts</a></li>
197
- @ <li>%z(href("%R/timewarps"))List of "Timewarp" Check-ins</a></li>
198194
@ </ul>
199195
@ </li>
200196
}
201197
@ <li>%z(href("%R/help"))Help</a>
202198
@ <ul>
@@ -276,9 +272,49 @@
276272
@ <li>%z(href("%R/timewarps"))Timeline of timewarps</a></li>
277273
}
278274
@ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
279275
@ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
280276
@ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
277
+ if( !isPopup ){
278
+ style_finish_page("sitemap");
279
+ }
280
+}
281
+
282
+/*
283
+** WEBPAGE: sitemap-timeline
284
+**
285
+** Generate a list of hyperlinks to various (obscure) variations on
286
+** the /timeline page.
287
+*/
288
+void sitemap_timeline_page(void){
289
+ int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
290
+
291
+ login_check_credentials();
292
+ if( P("popup")!=0 && cgi_csrf_safe(0) ){
293
+ /* If this is a POST from the same origin with the popup=1 parameter,
294
+ ** then disable anti-robot defenses */
295
+ isPopup = 1;
296
+ g.perm.Hyperlink = 1;
297
+ g.javascriptHyperlink = 0;
298
+ }
299
+ if( !isPopup ){
300
+ style_header("Timeline Examples");
301
+ style_adunit_config(ADUNIT_RIGHT_OK);
302
+ }
303
+ @ <ul id="sitemap" class="columns" style="column-width:20em">
304
+ @ <li>%z(href("%R/timeline?ymd"))Current day</a></li>
305
+ @ <li>%z(href("%R/timeline?yw"))Current week</a></li>
306
+ @ <li>%z(href("%R/timeline?ym"))Current month</a></li>
307
+ @ <li>%z(href("%R/thisdayinhistory"))Today in history</a></li>
308
+ @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10
309
+ @ check-ins</a></li>
310
+ @ <li>%z(href("%R/timeline?namechng"))File name changes</a></li>
311
+ @ <li>%z(href("%R/timeline?forks"))Forks</a></li>
312
+ @ <li>%z(href("%R/timeline?cherrypicks"))Cherrypick merges</a></li>
313
+ @ <li>%z(href("%R/timewarps"))Timewarps</a></li>
314
+ @ <li>%z(href("%R/timeline?ubg"))Color-coded by user</a></li>
315
+ @ <li>%z(href("%R/timeline?deltabg"))Delta vs. baseline manifests</a></li>
316
+ @ </ul>
281317
if( !isPopup ){
282318
style_finish_page("sitemap");
283319
}
284320
}
285321
--- src/sitemap.c
+++ src/sitemap.c
@@ -100,14 +100,11 @@
100 }
101 if( g.perm.Read ){
102 @ <li>%z(href("%R/timeline"))Project Timeline</a>
103 @ <ul>
104 @ <li>%z(href("%R/reports"))Activity Reports</a></li>
105 @ <li>%z(href("%R/timeline?n=all&namechng"))File name changes</a></li>
106 @ <li>%z(href("%R/timeline?n=all&forks"))Forks</a></li>
107 @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10
108 @ check-ins</a></li>
109 @ </ul>
110 @ </li>
111 }
112 if( g.perm.Read ){
113 @ <li>%z(href("%R/brlist"))Branches</a>
@@ -192,11 +189,10 @@
192 if( g.perm.Admin ){
193 @ <li>%z(href("%R/urllist"))List of URLs used to access
194 @ this repository</a></li>
195 }
196 @ <li>%z(href("%R/bloblist"))List of Artifacts</a></li>
197 @ <li>%z(href("%R/timewarps"))List of "Timewarp" Check-ins</a></li>
198 @ </ul>
199 @ </li>
200 }
201 @ <li>%z(href("%R/help"))Help</a>
202 @ <ul>
@@ -276,9 +272,49 @@
276 @ <li>%z(href("%R/timewarps"))Timeline of timewarps</a></li>
277 }
278 @ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
279 @ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
280 @ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281 if( !isPopup ){
282 style_finish_page("sitemap");
283 }
284 }
285
--- src/sitemap.c
+++ src/sitemap.c
@@ -100,14 +100,11 @@
100 }
101 if( g.perm.Read ){
102 @ <li>%z(href("%R/timeline"))Project Timeline</a>
103 @ <ul>
104 @ <li>%z(href("%R/reports"))Activity Reports</a></li>
105 @ <li>%z(href("%R/sitemap-timeline"))Other timelines</a></li>
 
 
 
106 @ </ul>
107 @ </li>
108 }
109 if( g.perm.Read ){
110 @ <li>%z(href("%R/brlist"))Branches</a>
@@ -192,11 +189,10 @@
189 if( g.perm.Admin ){
190 @ <li>%z(href("%R/urllist"))List of URLs used to access
191 @ this repository</a></li>
192 }
193 @ <li>%z(href("%R/bloblist"))List of Artifacts</a></li>
 
194 @ </ul>
195 @ </li>
196 }
197 @ <li>%z(href("%R/help"))Help</a>
198 @ <ul>
@@ -276,9 +272,49 @@
272 @ <li>%z(href("%R/timewarps"))Timeline of timewarps</a></li>
273 }
274 @ <li>%z(href("%R/cookies"))Content of display preference cookie</a></li>
275 @ <li>%z(href("%R/test-captcha"))Random ASCII-art Captcha image</a></li>
276 @ <li>%z(href("%R/test-piechart"))Pie-Chart generator test</a></li>
277 if( !isPopup ){
278 style_finish_page("sitemap");
279 }
280 }
281
282 /*
283 ** WEBPAGE: sitemap-timeline
284 **
285 ** Generate a list of hyperlinks to various (obscure) variations on
286 ** the /timeline page.
287 */
288 void sitemap_timeline_page(void){
289 int isPopup = 0; /* This is an XMLHttpRequest() for /sitemap */
290
291 login_check_credentials();
292 if( P("popup")!=0 && cgi_csrf_safe(0) ){
293 /* If this is a POST from the same origin with the popup=1 parameter,
294 ** then disable anti-robot defenses */
295 isPopup = 1;
296 g.perm.Hyperlink = 1;
297 g.javascriptHyperlink = 0;
298 }
299 if( !isPopup ){
300 style_header("Timeline Examples");
301 style_adunit_config(ADUNIT_RIGHT_OK);
302 }
303 @ <ul id="sitemap" class="columns" style="column-width:20em">
304 @ <li>%z(href("%R/timeline?ymd"))Current day</a></li>
305 @ <li>%z(href("%R/timeline?yw"))Current week</a></li>
306 @ <li>%z(href("%R/timeline?ym"))Current month</a></li>
307 @ <li>%z(href("%R/thisdayinhistory"))Today in history</a></li>
308 @ <li>%z(href("%R/timeline?a=1970-01-01&y=ci&n=10"))First 10
309 @ check-ins</a></li>
310 @ <li>%z(href("%R/timeline?namechng"))File name changes</a></li>
311 @ <li>%z(href("%R/timeline?forks"))Forks</a></li>
312 @ <li>%z(href("%R/timeline?cherrypicks"))Cherrypick merges</a></li>
313 @ <li>%z(href("%R/timewarps"))Timewarps</a></li>
314 @ <li>%z(href("%R/timeline?ubg"))Color-coded by user</a></li>
315 @ <li>%z(href("%R/timeline?deltabg"))Delta vs. baseline manifests</a></li>
316 @ </ul>
317 if( !isPopup ){
318 style_finish_page("sitemap");
319 }
320 }
321
+4 -2
--- src/style.c
+++ src/style.c
@@ -1204,14 +1204,16 @@
12041204
@ <pre>
12051205
@ %h(blob_str(&g.httpHeader))
12061206
@ </pre>
12071207
}
12081208
}
1209
- style_finish_page("error");
1210
- if( zErr ){
1209
+ if( zErr && zErr[0] ){
1210
+ style_finish_page("error");
12111211
cgi_reply();
12121212
fossil_exit(1);
1213
+ }else{
1214
+ style_finish_page("test");
12131215
}
12141216
}
12151217
12161218
/*
12171219
** Generate a Not Yet Implemented error page.
12181220
--- src/style.c
+++ src/style.c
@@ -1204,14 +1204,16 @@
1204 @ <pre>
1205 @ %h(blob_str(&g.httpHeader))
1206 @ </pre>
1207 }
1208 }
1209 style_finish_page("error");
1210 if( zErr ){
1211 cgi_reply();
1212 fossil_exit(1);
 
 
1213 }
1214 }
1215
1216 /*
1217 ** Generate a Not Yet Implemented error page.
1218
--- src/style.c
+++ src/style.c
@@ -1204,14 +1204,16 @@
1204 @ <pre>
1205 @ %h(blob_str(&g.httpHeader))
1206 @ </pre>
1207 }
1208 }
1209 if( zErr && zErr[0] ){
1210 style_finish_page("error");
1211 cgi_reply();
1212 fossil_exit(1);
1213 }else{
1214 style_finish_page("test");
1215 }
1216 }
1217
1218 /*
1219 ** Generate a Not Yet Implemented error page.
1220
+9 -1
--- src/timeline.c
+++ src/timeline.c
@@ -2226,12 +2226,19 @@
22262226
if( bisectLocal || zBisect!=0 ){
22272227
blob_append_sql(&cond, " AND event.objid IN (SELECT rid FROM bilog) ");
22282228
}
22292229
if( zYearMonth ){
22302230
zYearMonth = timeline_expand_datetime(zYearMonth);
2231
+ if( strlen(zYearMonth)>7 ){
2232
+ zYearMonth = mprintf("%.7s", zYearMonth);
2233
+ }
2234
+ if( db_int(0,"SELECT julianday('%q-01') IS NULL", zYearMonth) ){
2235
+ zYearMonth = db_text(0, "SELECT strftime('%%Y-%%m','now');");
2236
+ }
22312237
blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%m',event.mtime) ",
22322238
zYearMonth);
2239
+ nEntry = -1;
22332240
}
22342241
else if( zYearWeek ){
22352242
char *z;
22362243
zYearWeek = timeline_expand_datetime(zYearWeek);
22372244
z = db_text(0, "SELECT strftime('%%Y-%%W',%Q)", zYearWeek);
@@ -2461,11 +2468,12 @@
24612468
db_multi_exec("%s", blob_sql_text(&sql));
24622469
24632470
n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
24642471
zPlural = n==1 ? "" : "s";
24652472
if( zYearMonth ){
2466
- blob_appendf(&desc, "%d %s%s for %h", n, zEType, zPlural, zYearMonth);
2473
+ blob_appendf(&desc, "%d %s%s for month beginning %h-01",
2474
+ n, zEType, zPlural, zYearMonth);
24672475
}else if( zYearWeek ){
24682476
blob_appendf(&desc, "%d %s%s for week %h beginning on %h",
24692477
n, zEType, zPlural, zYearWeek, zYearWeekStart);
24702478
}else if( zDay ){
24712479
blob_appendf(&desc, "%d %s%s occurring on %h", n, zEType, zPlural, zDay);
24722480
--- src/timeline.c
+++ src/timeline.c
@@ -2226,12 +2226,19 @@
2226 if( bisectLocal || zBisect!=0 ){
2227 blob_append_sql(&cond, " AND event.objid IN (SELECT rid FROM bilog) ");
2228 }
2229 if( zYearMonth ){
2230 zYearMonth = timeline_expand_datetime(zYearMonth);
 
 
 
 
 
 
2231 blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%m',event.mtime) ",
2232 zYearMonth);
 
2233 }
2234 else if( zYearWeek ){
2235 char *z;
2236 zYearWeek = timeline_expand_datetime(zYearWeek);
2237 z = db_text(0, "SELECT strftime('%%Y-%%W',%Q)", zYearWeek);
@@ -2461,11 +2468,12 @@
2461 db_multi_exec("%s", blob_sql_text(&sql));
2462
2463 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
2464 zPlural = n==1 ? "" : "s";
2465 if( zYearMonth ){
2466 blob_appendf(&desc, "%d %s%s for %h", n, zEType, zPlural, zYearMonth);
 
2467 }else if( zYearWeek ){
2468 blob_appendf(&desc, "%d %s%s for week %h beginning on %h",
2469 n, zEType, zPlural, zYearWeek, zYearWeekStart);
2470 }else if( zDay ){
2471 blob_appendf(&desc, "%d %s%s occurring on %h", n, zEType, zPlural, zDay);
2472
--- src/timeline.c
+++ src/timeline.c
@@ -2226,12 +2226,19 @@
2226 if( bisectLocal || zBisect!=0 ){
2227 blob_append_sql(&cond, " AND event.objid IN (SELECT rid FROM bilog) ");
2228 }
2229 if( zYearMonth ){
2230 zYearMonth = timeline_expand_datetime(zYearMonth);
2231 if( strlen(zYearMonth)>7 ){
2232 zYearMonth = mprintf("%.7s", zYearMonth);
2233 }
2234 if( db_int(0,"SELECT julianday('%q-01') IS NULL", zYearMonth) ){
2235 zYearMonth = db_text(0, "SELECT strftime('%%Y-%%m','now');");
2236 }
2237 blob_append_sql(&cond, " AND %Q=strftime('%%Y-%%m',event.mtime) ",
2238 zYearMonth);
2239 nEntry = -1;
2240 }
2241 else if( zYearWeek ){
2242 char *z;
2243 zYearWeek = timeline_expand_datetime(zYearWeek);
2244 z = db_text(0, "SELECT strftime('%%Y-%%W',%Q)", zYearWeek);
@@ -2461,11 +2468,12 @@
2468 db_multi_exec("%s", blob_sql_text(&sql));
2469
2470 n = db_int(0, "SELECT count(*) FROM timeline WHERE etype!='div' /*scan*/");
2471 zPlural = n==1 ? "" : "s";
2472 if( zYearMonth ){
2473 blob_appendf(&desc, "%d %s%s for month beginning %h-01",
2474 n, zEType, zPlural, zYearMonth);
2475 }else if( zYearWeek ){
2476 blob_appendf(&desc, "%d %s%s for week %h beginning on %h",
2477 n, zEType, zPlural, zYearWeek, zYearWeekStart);
2478 }else if( zDay ){
2479 blob_appendf(&desc, "%d %s%s occurring on %h", n, zEType, zPlural, zDay);
2480

Keyboard Shortcuts

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