Fossil

Check-in [7915bd06]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the text description on the "ntimeline" page.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7915bd0665fb2f22c5fd2198750f4708976ab7b9
User & Date: drh 2008-02-26 17:32:52
Context
2008-02-26
17:57
Cut over to the new timeline code. Remove the older timeline. check-in: 82fc5abb user: drh tags: trunk
17:32
Improvements to the text description on the "ntimeline" page. check-in: 7915bd06 user: drh tags: trunk
16:48
Work on a new timeline implementation. Currently implemented as "ntimeline" since it is not yet ready to replace the existing timeline. check-in: e6aa1612 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/timeline.c.

342
343
344
345
346
347
348


349



350
351

352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372


373
374
375
376
377
378
379
380

381
382
383
384
385
386























387
388
389
390
391
392
393
        db_multi_exec("%s", blob_str(&sql));
      }
    }
    blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
                 g.zBaseURL, zUuid, zUuid);
    db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC");
  }else{


    const char *zEType = "event";



    if( zType ){
      blob_appendf(&sql, " AND event.type=%Q", zType);

      if( zType[0]=='c' ){
        zEType = "checkin";
      }else if( zType[0]=='w' ){
        zEType = "wiki edit";
      }else if( zType[0]=='t' ){
        zEType = "ticket change";
      }
    }
    blob_appendf(&desc, "Timeline of up to %d %s", nEntry, zEType);
    if( zUser ){
      blob_appendf(&sql, " AND event.user=%Q", zUser);
      blob_appendf(&desc, " by user %h", zUser);
    }
    if( zAfter ){
      while( isspace(zAfter[0]) ){ zAfter++; }
      if( zAfter[0] ){
        blob_appendf(&sql, 
           " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
           " ORDER BY event.mtime ASC", zAfter);
        blob_appendf(&desc, " occurring on or after %h", zAfter);
        zBefore = 0;


      }
    }else if( zBefore ){
      while( isspace(zBefore[0]) ){ zBefore++; }
      if( zBefore[0] ){
        blob_appendf(&sql, 
           " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
           " ORDER BY event.mtime DESC", zBefore);
        blob_appendf(&desc, " occurring on or before %h", zBefore);

      }
    }else{
      blob_appendf(&sql, " ORDER BY event.mtime DESC");
    }
    blob_appendf(&sql, " LIMIT %d", nEntry);
    db_multi_exec("%s", blob_str(&sql));























  }
  blob_zero(&sql);
  db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC");
  @ <h2>%b(&desc)</h2>
  blob_reset(&desc);
  blob_zero(&scriptInit);
  www_print_timeline(&q, 0, 0, save_parentage_javascript, &scriptInit);







>
>

>
>
>


>








<


|







<

>
>







|
>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365

366
367
368
369
370
371
372
373
374
375

376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
        db_multi_exec("%s", blob_str(&sql));
      }
    }
    blob_appendf(&desc, " of <a href='%s/info/%s'>[%.10s]</a>",
                 g.zBaseURL, zUuid, zUuid);
    db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC");
  }else{
    int n;
    Blob url;
    const char *zEType = "event";
    const char *zDate;
    blob_zero(&url);
    blob_appendf(&url, "%s/ntimeline?n=%d", g.zBaseURL, nEntry);
    if( zType ){
      blob_appendf(&sql, " AND event.type=%Q", zType);
      blob_appendf(&url, "&y=%T", zType);
      if( zType[0]=='c' ){
        zEType = "checkin";
      }else if( zType[0]=='w' ){
        zEType = "wiki edit";
      }else if( zType[0]=='t' ){
        zEType = "ticket change";
      }
    }

    if( zUser ){
      blob_appendf(&sql, " AND event.user=%Q", zUser);
      blob_appendf(&url, "&u=%T", zUser);
    }
    if( zAfter ){
      while( isspace(zAfter[0]) ){ zAfter++; }
      if( zAfter[0] ){
        blob_appendf(&sql, 
           " AND event.mtime>=(SELECT julianday(%Q, 'utc'))"
           " ORDER BY event.mtime ASC", zAfter);

        zBefore = 0;
      }else{
        zAfter = 0;
      }
    }else if( zBefore ){
      while( isspace(zBefore[0]) ){ zBefore++; }
      if( zBefore[0] ){
        blob_appendf(&sql, 
           " AND event.mtime<=(SELECT julianday(%Q, 'utc'))"
           " ORDER BY event.mtime DESC", zBefore);
       }else{
        zBefore = 0;
      }
    }else{
      blob_appendf(&sql, " ORDER BY event.mtime DESC");
    }
    blob_appendf(&sql, " LIMIT %d", nEntry);
    db_multi_exec("%s", blob_str(&sql));

    n = db_int(0, "SELECT count(*) FROM timeline");
    if( zAfter==0 && zBefore==0 ){
      blob_appendf(&desc, "%d most recent %ss", n, zEType);
    }else{
      blob_appendf(&desc, "%d %ss", n, zEType);
    }
    if( zUser ){
      blob_appendf(&desc, " by user %h", zUser);
    }
    if( zAfter ){
      blob_appendf(&desc, " occurring on or after %h.<br>", zAfter);
    }else if( zBefore ){
      blob_appendf(&desc, " occurring on or before %h.<br>", zBefore);
    }
    if( zAfter || n==nEntry ){
      zDate = db_text(0, "SELECT min(timestamp) FROM timeline");
      blob_appendf(&desc, " <a href='%b&b=%s'>[older]</a>", &url, zDate);
    }
    if( zBefore || (zAfter && n==nEntry) ){
      zDate = db_text(0, "SELECT max(timestamp) FROM timeline");
      blob_appendf(&desc, " <a href='%b&a=%s'>[more recent]</a>", &url, zDate);
    }
  }
  blob_zero(&sql);
  db_prepare(&q, "SELECT * FROM timeline ORDER BY timestamp DESC");
  @ <h2>%b(&desc)</h2>
  blob_reset(&desc);
  blob_zero(&scriptInit);
  www_print_timeline(&q, 0, 0, save_parentage_javascript, &scriptInit);