Fossil SCM

Add a new timeline date format "(off)" which omits all date and time stamps.

drh 2014-11-08 19:20 trunk
Commit e5176d9473a7c5d59857fff7a30f4ac39649fcc7
2 files changed +8 -3 +13 -6
+8 -3
--- src/setup.c
+++ src/setup.c
@@ -19,10 +19,14 @@
1919
*/
2020
#include "config.h"
2121
#include <assert.h>
2222
#include "setup.h"
2323
24
+#if INTERFACE
25
+#define ArraySize(x) (sizeof(x)/sizeof(x[0]))
26
+#endif
27
+
2428
/*
2529
** The table of web pages supported by this application is generated
2630
** automatically by the "mkindex" program and written into a file
2731
** named "page_index.h". We include that file here to get access
2832
** to the table.
@@ -1248,11 +1252,12 @@
12481252
char zTmDiff[20];
12491253
static const char *const azTimeFormats[] = {
12501254
"0", "HH:MM",
12511255
"1", "HH:MM:SS",
12521256
"2", "YYYY-MM-DD HH:MM",
1253
- "3", "YYMMDD HH:MM"
1257
+ "3", "YYMMDD HH:MM",
1258
+ "4", "(off)"
12541259
};
12551260
login_check_credentials();
12561261
if( !g.perm.Setup ){
12571262
login_needed();
12581263
}
@@ -1294,12 +1299,12 @@
12941299
}else{
12951300
@ %s(zTmDiff) hours ahead of UTC.</p>
12961301
}
12971302
12981303
@ <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);
13011306
@ <p>If the "HH:MM" or "HH:MM:SS" format is selected, then the date is shown
13021307
@ in a separate box (using CSS class "timelineDate") whenever the date changes.
13031308
@ With the "YYYY-MM-DD&nbsp;HH:MM" and "YYMMDD ..." formats, the complete date
13041309
@ and time is shown on every timeline entry (using the CSS class "timelineTime").</p>
13051310
13061311
--- 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&nbsp;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&nbsp;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 @@
212212
int fchngQueryInit = 0; /* True if fchngQuery is initialized */
213213
Stmt fchngQuery; /* Query for file changes on check-ins */
214214
static Stmt qbranch;
215215
int pendingEndTr = 0; /* True if a </td></tr> is needed */
216216
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) */
220218
221219
if( fossil_strcmp(g.zIpAddr, "127.0.0.1")==0 && db_open_local(0) ){
222220
vid = db_lget_int("checkout", 0);
223221
}
224222
zPrevDate[0] = 0;
@@ -285,20 +283,30 @@
285283
}
286284
prevWasDivider = 1;
287285
continue;
288286
}
289287
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
+ */
290295
if( dateFormat<2 ){
291296
if( fossil_strnicmp(zDate, zPrevDate, 10) ){
292297
sqlite3_snprintf(sizeof(zPrevDate), zPrevDate, "%.10s", zDate);
293298
@ <tr><td>
294299
@ <div class="divider timelineDate">%s(zPrevDate)</div>
295300
@ </td><td></td><td></td></tr>
296301
}
297302
memcpy(zTime, &zDate[11], 5+dateFormat*3);
298303
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 ){
300308
/* YYMMDD HH:MM */
301309
int pos = 0;
302310
zTime[pos++] = zDate[2]; zTime[pos++] = zDate[3]; /* YY */
303311
zTime[pos++] = zDate[5]; zTime[pos++] = zDate[6]; /* MM */
304312
zTime[pos++] = zDate[8]; zTime[pos++] = zDate[9]; /* DD */
@@ -306,12 +314,11 @@
306314
zTime[pos++] = zDate[11]; zTime[pos++] = zDate[12]; /* HH */
307315
zTime[pos++] = ':';
308316
zTime[pos++] = zDate[14]; zTime[pos++] = zDate[15]; /* MM */
309317
zTime[pos++] = 0;
310318
}else{
311
- /* YYYY-MM-DD HH:MM */
312
- sqlite3_snprintf(sizeof(zTime), zTime, "%.16s", zDate);
319
+ zTime[0] = 0;
313320
}
314321
if( rid == vid ){
315322
@ <tr class="timelineCurrent">
316323
}else {
317324
@ <tr>
318325
--- 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

Keyboard Shortcuts

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