Fossil

Check-in [49007ece]
Login

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

Overview
Comment:Do not show a blank table on the /uvlist page if the server contains no unversioned files. Instead show a message explaining that no unversioned files are present.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | unversioned-files
Files: files | file ages | folders
SHA1: 49007ecedf53f21971951d1f95bfbb77cb8b601f
User & Date: drh 2016-08-17 09:57:09
Context
2016-08-17
11:53
The admin and setup users automatically get the write-unversioned ('y') permission. check-in: 0480400c user: drh tags: unversioned-files
09:57
Do not show a blank table on the /uvlist page if the server contains no unversioned files. Instead show a message explaining that no unversioned files are present. check-in: 49007ece user: drh tags: unversioned-files
09:28
Add the /uvlist webpage. check-in: 52860aa6 user: drh tags: unversioned-files
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/unversioned.c.

352
353
354
355
356
357
358

359
360
361
362
363
364
365
...
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
...
400
401
402
403
404
405
406


407
408
409
410
411
412



413
414
** Display a list of all unversioned files in the repository.
*/
void uvstat_page(void){
  Stmt q;
  sqlite3_int64 iNow;
  sqlite3_int64 iTotalSz = 0;
  int cnt = 0;

  char zSzName[100];

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  style_header("Unversioned Files");
  if( !db_table_exists("repository","unversioned") ){
    @ No unversioned files on this server
................................................................................
     "   name,"
     "   mtime,"
     "   hash IS NULL,"
     "   sz"
     " FROM unversioned"
   );
   iNow = db_int64(0, "SELECT strftime('%%s','now');");
   @ <div class="uvlist">
   @ <table cellpadding="2" cellspacing="0" border="1" id="uvtab">
   @ <thead><tr>
   @   <th> Name
   @   <th> Age
   @   <th> Size
   @ </tr></thead>
   @ <tbody>
   while( db_step(&q)==SQLITE_ROW ){
     const char *zName = db_column_text(&q, 0);
     sqlite3_int64 mtime = db_column_int(&q, 1);
     int isDeleted = db_column_int(&q, 2);
     int fullSize = db_column_int(&q, 3);
     char *zAge = human_readable_age((iNow - mtime)/86400.0);










     if( isDeleted ){
       sqlite3_snprintf(sizeof(zSzName), zSzName, "<i>Deleted</i>");
       fullSize = 0;
     }else{
       approxSizeName(sizeof(zSzName), zSzName, fullSize);
       iTotalSz += fullSize;
       cnt++;
................................................................................
     @ <tr>
     @ <td> <a href='%R/uv/%T(zName)'>%h(zName)</a> </td>
     @ <td data-sortkey='%016llx(-mtime)'> %s(zAge) </td>
     @ <td data-sortkey='%08x(fullSize)'> %s(zSzName) </td>
     @ </tr>
     fossil_free(zAge);
   }


   approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
   @ </tbody>
   @ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)</tfoot>
   @ </table></div>
   db_finalize(&q);
   output_table_sorting_javascript("uvtab","tKk",1);



   style_footer();
}







>







 







<
<
<
<
<
<
<
<






>
>
>
>
>
>
>
>
>
>







 







>
>
|
|
|
|
<
|
>
>
>


352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
...
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
...
403
404
405
406
407
408
409
410
411
412
413
414
415

416
417
418
419
420
421
** Display a list of all unversioned files in the repository.
*/
void uvstat_page(void){
  Stmt q;
  sqlite3_int64 iNow;
  sqlite3_int64 iTotalSz = 0;
  int cnt = 0;
  int n = 0;
  char zSzName[100];

  login_check_credentials();
  if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
  style_header("Unversioned Files");
  if( !db_table_exists("repository","unversioned") ){
    @ No unversioned files on this server
................................................................................
     "   name,"
     "   mtime,"
     "   hash IS NULL,"
     "   sz"
     " FROM unversioned"
   );
   iNow = db_int64(0, "SELECT strftime('%%s','now');");








   while( db_step(&q)==SQLITE_ROW ){
     const char *zName = db_column_text(&q, 0);
     sqlite3_int64 mtime = db_column_int(&q, 1);
     int isDeleted = db_column_int(&q, 2);
     int fullSize = db_column_int(&q, 3);
     char *zAge = human_readable_age((iNow - mtime)/86400.0);
     if( (n++)==0 ){
       @ <div class="uvlist">
       @ <table cellpadding="2" cellspacing="0" border="1" id="uvtab">
       @ <thead><tr>
       @   <th> Name
       @   <th> Age
       @   <th> Size
       @ </tr></thead>
       @ <tbody>
     }
     if( isDeleted ){
       sqlite3_snprintf(sizeof(zSzName), zSzName, "<i>Deleted</i>");
       fullSize = 0;
     }else{
       approxSizeName(sizeof(zSzName), zSzName, fullSize);
       iTotalSz += fullSize;
       cnt++;
................................................................................
     @ <tr>
     @ <td> <a href='%R/uv/%T(zName)'>%h(zName)</a> </td>
     @ <td data-sortkey='%016llx(-mtime)'> %s(zAge) </td>
     @ <td data-sortkey='%08x(fullSize)'> %s(zSzName) </td>
     @ </tr>
     fossil_free(zAge);
   }
   db_finalize(&q);
   if( n ){
     approxSizeName(sizeof(zSzName), zSzName, iTotalSz);
     @ </tbody>
     @ <tfoot><tr><td><b>Total over %d(cnt) files</b><td><td>%s(zSzName)</tfoot>
     @ </table></div>

     output_table_sorting_javascript("uvtab","tKk",1);
   }else{
     @ No unversioned files on this server.
   }
   style_footer();
}