Fossil SCM
Add a new timeline date format "(off)" which omits all date and time stamps.
Commit
e5176d9473a7c5d59857fff7a30f4ac39649fcc7
Parent
346c05fbddb3987…
2 files changed
+8
-3
+13
-6
+8
-3
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -19,10 +19,14 @@ | ||
| 19 | 19 | */ |
| 20 | 20 | #include "config.h" |
| 21 | 21 | #include <assert.h> |
| 22 | 22 | #include "setup.h" |
| 23 | 23 | |
| 24 | +#if INTERFACE | |
| 25 | +#define ArraySize(x) (sizeof(x)/sizeof(x[0])) | |
| 26 | +#endif | |
| 27 | + | |
| 24 | 28 | /* |
| 25 | 29 | ** The table of web pages supported by this application is generated |
| 26 | 30 | ** automatically by the "mkindex" program and written into a file |
| 27 | 31 | ** named "page_index.h". We include that file here to get access |
| 28 | 32 | ** to the table. |
| @@ -1248,11 +1252,12 @@ | ||
| 1248 | 1252 | char zTmDiff[20]; |
| 1249 | 1253 | static const char *const azTimeFormats[] = { |
| 1250 | 1254 | "0", "HH:MM", |
| 1251 | 1255 | "1", "HH:MM:SS", |
| 1252 | 1256 | "2", "YYYY-MM-DD HH:MM", |
| 1253 | - "3", "YYMMDD HH:MM" | |
| 1257 | + "3", "YYMMDD HH:MM", | |
| 1258 | + "4", "(off)" | |
| 1254 | 1259 | }; |
| 1255 | 1260 | login_check_credentials(); |
| 1256 | 1261 | if( !g.perm.Setup ){ |
| 1257 | 1262 | login_needed(); |
| 1258 | 1263 | } |
| @@ -1294,12 +1299,12 @@ | ||
| 1294 | 1299 | }else{ |
| 1295 | 1300 | @ %s(zTmDiff) hours ahead of UTC.</p> |
| 1296 | 1301 | } |
| 1297 | 1302 | |
| 1298 | 1303 | @ <hr /> |
| 1299 | - multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", "tdf", "0", | |
| 1300 | - 4, azTimeFormats); | |
| 1304 | + multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", | |
| 1305 | + "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats); | |
| 1301 | 1306 | @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown |
| 1302 | 1307 | @ in a separate box (using CSS class "timelineDate") whenever the date changes. |
| 1303 | 1308 | @ With the "YYYY-MM-DD HH:MM" and "YYMMDD ..." formats, the complete date |
| 1304 | 1309 | @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p> |
| 1305 | 1310 | |
| 1306 | 1311 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -19,10 +19,14 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <assert.h> |
| 22 | #include "setup.h" |
| 23 | |
| 24 | /* |
| 25 | ** The table of web pages supported by this application is generated |
| 26 | ** automatically by the "mkindex" program and written into a file |
| 27 | ** named "page_index.h". We include that file here to get access |
| 28 | ** to the table. |
| @@ -1248,11 +1252,12 @@ | |
| 1248 | char zTmDiff[20]; |
| 1249 | static const char *const azTimeFormats[] = { |
| 1250 | "0", "HH:MM", |
| 1251 | "1", "HH:MM:SS", |
| 1252 | "2", "YYYY-MM-DD HH:MM", |
| 1253 | "3", "YYMMDD HH:MM" |
| 1254 | }; |
| 1255 | login_check_credentials(); |
| 1256 | if( !g.perm.Setup ){ |
| 1257 | login_needed(); |
| 1258 | } |
| @@ -1294,12 +1299,12 @@ | |
| 1294 | }else{ |
| 1295 | @ %s(zTmDiff) hours ahead of UTC.</p> |
| 1296 | } |
| 1297 | |
| 1298 | @ <hr /> |
| 1299 | multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", "tdf", "0", |
| 1300 | 4, azTimeFormats); |
| 1301 | @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown |
| 1302 | @ in a separate box (using CSS class "timelineDate") whenever the date changes. |
| 1303 | @ With the "YYYY-MM-DD HH:MM" and "YYMMDD ..." formats, the complete date |
| 1304 | @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p> |
| 1305 | |
| 1306 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -19,10 +19,14 @@ | |
| 19 | */ |
| 20 | #include "config.h" |
| 21 | #include <assert.h> |
| 22 | #include "setup.h" |
| 23 | |
| 24 | #if INTERFACE |
| 25 | #define ArraySize(x) (sizeof(x)/sizeof(x[0])) |
| 26 | #endif |
| 27 | |
| 28 | /* |
| 29 | ** The table of web pages supported by this application is generated |
| 30 | ** automatically by the "mkindex" program and written into a file |
| 31 | ** named "page_index.h". We include that file here to get access |
| 32 | ** to the table. |
| @@ -1248,11 +1252,12 @@ | |
| 1252 | char zTmDiff[20]; |
| 1253 | static const char *const azTimeFormats[] = { |
| 1254 | "0", "HH:MM", |
| 1255 | "1", "HH:MM:SS", |
| 1256 | "2", "YYYY-MM-DD HH:MM", |
| 1257 | "3", "YYMMDD HH:MM", |
| 1258 | "4", "(off)" |
| 1259 | }; |
| 1260 | login_check_credentials(); |
| 1261 | if( !g.perm.Setup ){ |
| 1262 | login_needed(); |
| 1263 | } |
| @@ -1294,12 +1299,12 @@ | |
| 1299 | }else{ |
| 1300 | @ %s(zTmDiff) hours ahead of UTC.</p> |
| 1301 | } |
| 1302 | |
| 1303 | @ <hr /> |
| 1304 | multiple_choice_attribute("Per-Item Time Format", "timeline-date-format", |
| 1305 | "tdf", "0", ArraySize(azTimeFormats)/2, azTimeFormats); |
| 1306 | @ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown |
| 1307 | @ in a separate box (using CSS class "timelineDate") whenever the date changes. |
| 1308 | @ With the "YYYY-MM-DD HH:MM" and "YYMMDD ..." formats, the complete date |
| 1309 | @ and time is shown on every timeline entry (using the CSS class "timelineTime").</p> |
| 1310 | |
| 1311 |
+13
-6
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -212,13 +212,11 @@ | ||
| 212 | 212 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 213 | 213 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 214 | 214 | static Stmt qbranch; |
| 215 | 215 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 216 | 216 | int vid = 0; /* Current checkout version */ |
| 217 | - int dateFormat = 0; /* 0: HH:MM 1: HH:MM:SS | |
| 218 | - 2: YYYY-MM-DD HH:MM | |
| 219 | - 3: YYMMDD HH:MM */ | |
| 217 | + int dateFormat = 0; /* 0: HH:MM (default) */ | |
| 220 | 218 | |
| 221 | 219 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){ |
| 222 | 220 | vid = db_lget_int("checkout", 0); |
| 223 | 221 | } |
| 224 | 222 | zPrevDate[0] = 0; |
| @@ -285,20 +283,30 @@ | ||
| 285 | 283 | } |
| 286 | 284 | prevWasDivider = 1; |
| 287 | 285 | continue; |
| 288 | 286 | } |
| 289 | 287 | prevWasDivider = 0; |
| 288 | + /* Date format codes: | |
| 289 | + ** (0) HH:MM | |
| 290 | + ** (1) HH:MM:SS | |
| 291 | + ** (2) YYYY-MM-DD HH:MM | |
| 292 | + ** (3) YYMMDD HH:MM | |
| 293 | + ** (4) (off) | |
| 294 | + */ | |
| 290 | 295 | if( dateFormat<2 ){ |
| 291 | 296 | if( fossil_strnicmp(zDate, zPrevDate, 10) ){ |
| 292 | 297 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 293 | 298 | @ <tr><td> |
| 294 | 299 | @ <div class="divider timelineDate">%s(zPrevDate)</div> |
| 295 | 300 | @ </td><td></td><td></td></tr> |
| 296 | 301 | } |
| 297 | 302 | memcpy(zTime, &zDate[11], 5+dateFormat*3); |
| 298 | 303 | zTime[5+dateFormat*3] = 0; |
| 299 | - }else if(3==dateFormat){ | |
| 304 | + }else if( 2==dateFormat ){ | |
| 305 | + /* YYYY-MM-DD HH:MM */ | |
| 306 | + sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate); | |
| 307 | + }else if( 3==dateFormat ){ | |
| 300 | 308 | /* YYMMDD HH:MM */ |
| 301 | 309 | int pos = 0; |
| 302 | 310 | zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */ |
| 303 | 311 | zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */ |
| 304 | 312 | zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */ |
| @@ -306,12 +314,11 @@ | ||
| 306 | 314 | zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */ |
| 307 | 315 | zTime[pos++] = ':'; |
| 308 | 316 | zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */ |
| 309 | 317 | zTime[pos++] = 0; |
| 310 | 318 | }else{ |
| 311 | - /* YYYY-MM-DD HH:MM */ | |
| 312 | - sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate); | |
| 319 | + zTime[0] = 0; | |
| 313 | 320 | } |
| 314 | 321 | if( rid == vid ){ |
| 315 | 322 | @ <tr class="timelineCurrent"> |
| 316 | 323 | }else { |
| 317 | 324 | @ <tr> |
| 318 | 325 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -212,13 +212,11 @@ | |
| 212 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 213 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 214 | static Stmt qbranch; |
| 215 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 216 | int vid = 0; /* Current checkout version */ |
| 217 | int dateFormat = 0; /* 0: HH:MM 1: HH:MM:SS |
| 218 | 2: YYYY-MM-DD HH:MM |
| 219 | 3: YYMMDD HH:MM */ |
| 220 | |
| 221 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){ |
| 222 | vid = db_lget_int("checkout", 0); |
| 223 | } |
| 224 | zPrevDate[0] = 0; |
| @@ -285,20 +283,30 @@ | |
| 285 | } |
| 286 | prevWasDivider = 1; |
| 287 | continue; |
| 288 | } |
| 289 | prevWasDivider = 0; |
| 290 | if( dateFormat<2 ){ |
| 291 | if( fossil_strnicmp(zDate, zPrevDate, 10) ){ |
| 292 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 293 | @ <tr><td> |
| 294 | @ <div class="divider timelineDate">%s(zPrevDate)</div> |
| 295 | @ </td><td></td><td></td></tr> |
| 296 | } |
| 297 | memcpy(zTime, &zDate[11], 5+dateFormat*3); |
| 298 | zTime[5+dateFormat*3] = 0; |
| 299 | }else if(3==dateFormat){ |
| 300 | /* YYMMDD HH:MM */ |
| 301 | int pos = 0; |
| 302 | zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */ |
| 303 | zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */ |
| 304 | zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */ |
| @@ -306,12 +314,11 @@ | |
| 306 | zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */ |
| 307 | zTime[pos++] = ':'; |
| 308 | zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */ |
| 309 | zTime[pos++] = 0; |
| 310 | }else{ |
| 311 | /* YYYY-MM-DD HH:MM */ |
| 312 | sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate); |
| 313 | } |
| 314 | if( rid == vid ){ |
| 315 | @ <tr class="timelineCurrent"> |
| 316 | }else { |
| 317 | @ <tr> |
| 318 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -212,13 +212,11 @@ | |
| 212 | int fchngQueryInit = 0; /* True if fchngQuery is initialized */ |
| 213 | Stmt fchngQuery; /* Query for file changes on check-ins */ |
| 214 | static Stmt qbranch; |
| 215 | int pendingEndTr = 0; /* True if a </td></tr> is needed */ |
| 216 | int vid = 0; /* Current checkout version */ |
| 217 | int dateFormat = 0; /* 0: HH:MM (default) */ |
| 218 | |
| 219 | if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){ |
| 220 | vid = db_lget_int("checkout", 0); |
| 221 | } |
| 222 | zPrevDate[0] = 0; |
| @@ -285,20 +283,30 @@ | |
| 283 | } |
| 284 | prevWasDivider = 1; |
| 285 | continue; |
| 286 | } |
| 287 | prevWasDivider = 0; |
| 288 | /* Date format codes: |
| 289 | ** (0) HH:MM |
| 290 | ** (1) HH:MM:SS |
| 291 | ** (2) YYYY-MM-DD HH:MM |
| 292 | ** (3) YYMMDD HH:MM |
| 293 | ** (4) (off) |
| 294 | */ |
| 295 | if( dateFormat<2 ){ |
| 296 | if( fossil_strnicmp(zDate, zPrevDate, 10) ){ |
| 297 | sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate); |
| 298 | @ <tr><td> |
| 299 | @ <div class="divider timelineDate">%s(zPrevDate)</div> |
| 300 | @ </td><td></td><td></td></tr> |
| 301 | } |
| 302 | memcpy(zTime, &zDate[11], 5+dateFormat*3); |
| 303 | zTime[5+dateFormat*3] = 0; |
| 304 | }else if( 2==dateFormat ){ |
| 305 | /* YYYY-MM-DD HH:MM */ |
| 306 | sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate); |
| 307 | }else if( 3==dateFormat ){ |
| 308 | /* YYMMDD HH:MM */ |
| 309 | int pos = 0; |
| 310 | zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */ |
| 311 | zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */ |
| 312 | zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */ |
| @@ -306,12 +314,11 @@ | |
| 314 | zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */ |
| 315 | zTime[pos++] = ':'; |
| 316 | zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */ |
| 317 | zTime[pos++] = 0; |
| 318 | }else{ |
| 319 | zTime[0] = 0; |
| 320 | } |
| 321 | if( rid == vid ){ |
| 322 | @ <tr class="timelineCurrent"> |
| 323 | }else { |
| 324 | @ <tr> |
| 325 |