Fossil SCM

Merge in the csstree branch, providing a better look and more control over the tree-view.

drh 2014-01-06 03:19 trunk merge
Commit 1264375bb13316f69e6e19ebdeb519825f8b3903
3 files changed +35 -38 +35 -38 +69
+35 -38
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386386
pNew->isLast = 1;
387387
while( zPath[i]=='/' ){ i++; }
388388
pParent = pNew;
389389
}
390390
}
391
-
392
-/*
393
-** Render parent lines for pNode
394
-*/
395
-static void tree_indentation(FileTreeNode *p){
396
- if( p==0 ) return;
397
- tree_indentation(p->pParent);
398
- if( p->isLast ){
399
- cgi_append_content(" ", 4);
400
- }else{
401
- cgi_append_content("│ ", 11);
402
- }
403
-}
404
-
405391
406392
/*
407393
** WEBPAGE: tree
408394
**
409395
** Query parameters:
@@ -422,16 +408,16 @@
422408
Manifest *pM = 0;
423409
int nFile = 0; /* Number of files */
424410
int linkTrunk = 1; /* include link to "trunk" */
425411
int linkTip = 1; /* include link to "tip" */
426412
const char *zRE; /* the value for the re=REGEXP query parameter */
427
- char *zPrefix; /* Prefix on all filenames */
428413
char *zREx = ""; /* Extra parameters for path hyperlinks */
429414
ReCompiled *pRE = 0; /* Compiled regular expression */
430415
FileTreeNode *p; /* One line of the tree */
431416
FileTree sTree; /* The complete tree of files */
432417
HQuery sURI; /* Hyperlink */
418
+ char *zProjectName = db_get("project-name", 0);
433419
434420
if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
435421
memset(&sTree, 0, sizeof(sTree));
436422
login_check_credentials();
437423
if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
474460
if( zD ){
475461
url_add_parameter(&sURI, "name", zD);
476462
blob_append(&dirname, "within directory ", -1);
477463
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
478464
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
479
- zPrefix = mprintf("%T/", zD);
480465
style_submenu_element("Top-Level", "Top-Level", "%s",
481466
url_render(&sURI, "name", 0, 0, 0));
482467
}else{
483468
if( zRE ){
484469
blob_appendf(&dirname, "matching \"%s\"", zRE);
485470
}
486
- zPrefix = "";
487471
}
488472
if( zCI ){
489473
style_submenu_element("All", "All", "%s",
490474
url_render(&sURI, "ci", 0, 0, 0));
491475
}
@@ -521,11 +505,11 @@
521505
|| pFile->zName[nD-1]!='/')
522506
){
523507
continue;
524508
}
525509
if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
526
- db_bind_text(&ins, ":f", &pFile->zName[nD]);
510
+ db_bind_text(&ins, ":f", pFile->zName);
527511
db_bind_text(&ins, ":u", pFile->zUuid);
528512
db_step(&ins);
529513
db_reset(&ins);
530514
}
531515
db_finalize(&ins);
@@ -542,11 +526,11 @@
542526
const char *z = db_column_text(&q, 0);
543527
if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
544528
continue;
545529
}
546530
if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
547
- tree_add_node(&sTree, z+nD, 0);
531
+ tree_add_node(&sTree, z, 0);
548532
nFile++;
549533
}
550534
db_finalize(&q);
551535
}
552536
@@ -562,39 +546,52 @@
562546
563547
564548
/* Generate a multi-column table listing the contents of zD[]
565549
** directory.
566550
*/
567
- @ <pre>
551
+ @ <div class="filetree"><ul>
568552
if( nD ){
569
- cgi_printf("%.*h\n", nD, zD);
570
- }else{
571
- @ .
572
- }
573
- for(p=sTree.pFirst; p; p=p->pNext){
574
- tree_indentation(p->pParent);
575
- if( p->isLast ){
576
- cgi_append_content("&#x2514;&#x2500;&#x2500; ", 25);
577
- }else{
578
- cgi_append_content("&#x251c;&#x2500;&#x2500; ", 25);
579
- }
553
+ char *zLink = href("%s", url_render(&sURI, "name", 0, 0, 0));
554
+ @ <li class="dir">
555
+ @ %z(zLink)%h(zProjectName)</a>
556
+ }else{
557
+ @ <li class="dir subdir">
558
+ @ <a>%h(zProjectName)</a>
559
+ }
560
+ @ <ul>
561
+ for(p=sTree.pFirst; p; p=p->pNext){
580562
if( p->isDir ){
581
- char *zName = mprintf("%s%T", zPrefix, p->zFullName);
582
- char *zLink = href("%s", url_render(&sURI, "name", zName, 0, 0));
583
- fossil_free(zName);
584
- @ %z(zLink)%h(p->zName)</a>
563
+ if( nD && strlen(p->zFullName)==nD-1 ){
564
+ @ <li class="dir subdir">
565
+ }else{
566
+ @ <li class="dir">
567
+ }
568
+ if( fossil_strcmp(p->zFullName, zD)==0 ){
569
+ @ <a>%h(p->zName)</a>
570
+ }else{
571
+ char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
572
+ @ %z(zLink)%h(p->zName)</a>
573
+ }
574
+ @ <ul>
585575
}else{
586576
char *zLink;
587577
if( zCI ){
588578
zLink = href("%R/artifact/%s",p->zUuid);
589579
}else{
590
- zLink = href("%R/finfo?name=%s%T",zPrefix,p->zFullName);
580
+ zLink = href("%R/finfo?name=%T",p->zFullName);
591581
}
592
- @ %z(zLink)%h(p->zName)</a>
582
+ @ <li class="%z(fileext_class(p->zName))">%z(zLink)%h(p->zName)</a>
583
+ }
584
+ if( p->isLast ){
585
+ int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
586
+ while( nClose-- > 0 ){
587
+ @ </ul>
588
+ }
593589
}
594590
}
595
- @ </pre>
591
+ @ </ul>
592
+ @ </ul></div>
596593
style_footer();
597594
598595
/* We could free memory used by sTree here if we needed to. But
599596
** the process is about to exit, so doing so would not really accomplish
600597
** anything useful. */
601598
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386 pNew->isLast = 1;
387 while( zPath[i]=='/' ){ i++; }
388 pParent = pNew;
389 }
390 }
391
392 /*
393 ** Render parent lines for pNode
394 */
395 static void tree_indentation(FileTreeNode *p){
396 if( p==0 ) return;
397 tree_indentation(p->pParent);
398 if( p->isLast ){
399 cgi_append_content(" ", 4);
400 }else{
401 cgi_append_content("&#x2502; ", 11);
402 }
403 }
404
405
406 /*
407 ** WEBPAGE: tree
408 **
409 ** Query parameters:
@@ -422,16 +408,16 @@
422 Manifest *pM = 0;
423 int nFile = 0; /* Number of files */
424 int linkTrunk = 1; /* include link to "trunk" */
425 int linkTip = 1; /* include link to "tip" */
426 const char *zRE; /* the value for the re=REGEXP query parameter */
427 char *zPrefix; /* Prefix on all filenames */
428 char *zREx = ""; /* Extra parameters for path hyperlinks */
429 ReCompiled *pRE = 0; /* Compiled regular expression */
430 FileTreeNode *p; /* One line of the tree */
431 FileTree sTree; /* The complete tree of files */
432 HQuery sURI; /* Hyperlink */
 
433
434 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
435 memset(&sTree, 0, sizeof(sTree));
436 login_check_credentials();
437 if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
474 if( zD ){
475 url_add_parameter(&sURI, "name", zD);
476 blob_append(&dirname, "within directory ", -1);
477 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
478 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
479 zPrefix = mprintf("%T/", zD);
480 style_submenu_element("Top-Level", "Top-Level", "%s",
481 url_render(&sURI, "name", 0, 0, 0));
482 }else{
483 if( zRE ){
484 blob_appendf(&dirname, "matching \"%s\"", zRE);
485 }
486 zPrefix = "";
487 }
488 if( zCI ){
489 style_submenu_element("All", "All", "%s",
490 url_render(&sURI, "ci", 0, 0, 0));
491 }
@@ -521,11 +505,11 @@
521 || pFile->zName[nD-1]!='/')
522 ){
523 continue;
524 }
525 if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
526 db_bind_text(&ins, ":f", &pFile->zName[nD]);
527 db_bind_text(&ins, ":u", pFile->zUuid);
528 db_step(&ins);
529 db_reset(&ins);
530 }
531 db_finalize(&ins);
@@ -542,11 +526,11 @@
542 const char *z = db_column_text(&q, 0);
543 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
544 continue;
545 }
546 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
547 tree_add_node(&sTree, z+nD, 0);
548 nFile++;
549 }
550 db_finalize(&q);
551 }
552
@@ -562,39 +546,52 @@
562
563
564 /* Generate a multi-column table listing the contents of zD[]
565 ** directory.
566 */
567 @ <pre>
568 if( nD ){
569 cgi_printf("%.*h\n", nD, zD);
570 }else{
571 @ .
572 }
573 for(p=sTree.pFirst; p; p=p->pNext){
574 tree_indentation(p->pParent);
575 if( p->isLast ){
576 cgi_append_content("&#x2514;&#x2500;&#x2500; ", 25);
577 }else{
578 cgi_append_content("&#x251c;&#x2500;&#x2500; ", 25);
579 }
580 if( p->isDir ){
581 char *zName = mprintf("%s%T", zPrefix, p->zFullName);
582 char *zLink = href("%s", url_render(&sURI, "name", zName, 0, 0));
583 fossil_free(zName);
584 @ %z(zLink)%h(p->zName)</a>
 
 
 
 
 
 
 
 
585 }else{
586 char *zLink;
587 if( zCI ){
588 zLink = href("%R/artifact/%s",p->zUuid);
589 }else{
590 zLink = href("%R/finfo?name=%s%T",zPrefix,p->zFullName);
591 }
592 @ %z(zLink)%h(p->zName)</a>
 
 
 
 
 
 
593 }
594 }
595 @ </pre>
 
596 style_footer();
597
598 /* We could free memory used by sTree here if we needed to. But
599 ** the process is about to exit, so doing so would not really accomplish
600 ** anything useful. */
601
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386 pNew->isLast = 1;
387 while( zPath[i]=='/' ){ i++; }
388 pParent = pNew;
389 }
390 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
392 /*
393 ** WEBPAGE: tree
394 **
395 ** Query parameters:
@@ -422,16 +408,16 @@
408 Manifest *pM = 0;
409 int nFile = 0; /* Number of files */
410 int linkTrunk = 1; /* include link to "trunk" */
411 int linkTip = 1; /* include link to "tip" */
412 const char *zRE; /* the value for the re=REGEXP query parameter */
 
413 char *zREx = ""; /* Extra parameters for path hyperlinks */
414 ReCompiled *pRE = 0; /* Compiled regular expression */
415 FileTreeNode *p; /* One line of the tree */
416 FileTree sTree; /* The complete tree of files */
417 HQuery sURI; /* Hyperlink */
418 char *zProjectName = db_get("project-name", 0);
419
420 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
421 memset(&sTree, 0, sizeof(sTree));
422 login_check_credentials();
423 if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
460 if( zD ){
461 url_add_parameter(&sURI, "name", zD);
462 blob_append(&dirname, "within directory ", -1);
463 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
464 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
 
465 style_submenu_element("Top-Level", "Top-Level", "%s",
466 url_render(&sURI, "name", 0, 0, 0));
467 }else{
468 if( zRE ){
469 blob_appendf(&dirname, "matching \"%s\"", zRE);
470 }
 
471 }
472 if( zCI ){
473 style_submenu_element("All", "All", "%s",
474 url_render(&sURI, "ci", 0, 0, 0));
475 }
@@ -521,11 +505,11 @@
505 || pFile->zName[nD-1]!='/')
506 ){
507 continue;
508 }
509 if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
510 db_bind_text(&ins, ":f", pFile->zName);
511 db_bind_text(&ins, ":u", pFile->zUuid);
512 db_step(&ins);
513 db_reset(&ins);
514 }
515 db_finalize(&ins);
@@ -542,11 +526,11 @@
526 const char *z = db_column_text(&q, 0);
527 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
528 continue;
529 }
530 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
531 tree_add_node(&sTree, z, 0);
532 nFile++;
533 }
534 db_finalize(&q);
535 }
536
@@ -562,39 +546,52 @@
546
547
548 /* Generate a multi-column table listing the contents of zD[]
549 ** directory.
550 */
551 @ <div class="filetree"><ul>
552 if( nD ){
553 char *zLink = href("%s", url_render(&sURI, "name", 0, 0, 0));
554 @ <li class="dir">
555 @ %z(zLink)%h(zProjectName)</a>
556 }else{
557 @ <li class="dir subdir">
558 @ <a>%h(zProjectName)</a>
559 }
560 @ <ul>
561 for(p=sTree.pFirst; p; p=p->pNext){
 
 
562 if( p->isDir ){
563 if( nD && strlen(p->zFullName)==nD-1 ){
564 @ <li class="dir subdir">
565 }else{
566 @ <li class="dir">
567 }
568 if( fossil_strcmp(p->zFullName, zD)==0 ){
569 @ <a>%h(p->zName)</a>
570 }else{
571 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
572 @ %z(zLink)%h(p->zName)</a>
573 }
574 @ <ul>
575 }else{
576 char *zLink;
577 if( zCI ){
578 zLink = href("%R/artifact/%s",p->zUuid);
579 }else{
580 zLink = href("%R/finfo?name=%T",p->zFullName);
581 }
582 @ <li class="%z(fileext_class(p->zName))">%z(zLink)%h(p->zName)</a>
583 }
584 if( p->isLast ){
585 int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
586 while( nClose-- > 0 ){
587 @ </ul>
588 }
589 }
590 }
591 @ </ul>
592 @ </ul></div>
593 style_footer();
594
595 /* We could free memory used by sTree here if we needed to. But
596 ** the process is about to exit, so doing so would not really accomplish
597 ** anything useful. */
598
+35 -38
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386386
pNew->isLast = 1;
387387
while( zPath[i]=='/' ){ i++; }
388388
pParent = pNew;
389389
}
390390
}
391
-
392
-/*
393
-** Render parent lines for pNode
394
-*/
395
-static void tree_indentation(FileTreeNode *p){
396
- if( p==0 ) return;
397
- tree_indentation(p->pParent);
398
- if( p->isLast ){
399
- cgi_append_content(" ", 4);
400
- }else{
401
- cgi_append_content("&#x2502; ", 11);
402
- }
403
-}
404
-
405391
406392
/*
407393
** WEBPAGE: tree
408394
**
409395
** Query parameters:
@@ -422,16 +408,16 @@
422408
Manifest *pM = 0;
423409
int nFile = 0; /* Number of files */
424410
int linkTrunk = 1; /* include link to "trunk" */
425411
int linkTip = 1; /* include link to "tip" */
426412
const char *zRE; /* the value for the re=REGEXP query parameter */
427
- char *zPrefix; /* Prefix on all filenames */
428413
char *zREx = ""; /* Extra parameters for path hyperlinks */
429414
ReCompiled *pRE = 0; /* Compiled regular expression */
430415
FileTreeNode *p; /* One line of the tree */
431416
FileTree sTree; /* The complete tree of files */
432417
HQuery sURI; /* Hyperlink */
418
+ char *zProjectName = db_get("project-name", 0);
433419
434420
if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
435421
memset(&sTree, 0, sizeof(sTree));
436422
login_check_credentials();
437423
if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
474460
if( zD ){
475461
url_add_parameter(&sURI, "name", zD);
476462
blob_append(&dirname, "within directory ", -1);
477463
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
478464
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
479
- zPrefix = mprintf("%T/", zD);
480465
style_submenu_element("Top-Level", "Top-Level", "%s",
481466
url_render(&sURI, "name", 0, 0, 0));
482467
}else{
483468
if( zRE ){
484469
blob_appendf(&dirname, "matching \"%s\"", zRE);
485470
}
486
- zPrefix = "";
487471
}
488472
if( zCI ){
489473
style_submenu_element("All", "All", "%s",
490474
url_render(&sURI, "ci", 0, 0, 0));
491475
}
@@ -521,11 +505,11 @@
521505
|| pFile->zName[nD-1]!='/')
522506
){
523507
continue;
524508
}
525509
if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
526
- db_bind_text(&ins, ":f", &pFile->zName[nD]);
510
+ db_bind_text(&ins, ":f", pFile->zName);
527511
db_bind_text(&ins, ":u", pFile->zUuid);
528512
db_step(&ins);
529513
db_reset(&ins);
530514
}
531515
db_finalize(&ins);
@@ -542,11 +526,11 @@
542526
const char *z = db_column_text(&q, 0);
543527
if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
544528
continue;
545529
}
546530
if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
547
- tree_add_node(&sTree, z+nD, 0);
531
+ tree_add_node(&sTree, z, 0);
548532
nFile++;
549533
}
550534
db_finalize(&q);
551535
}
552536
@@ -562,39 +546,52 @@
562546
563547
564548
/* Generate a multi-column table listing the contents of zD[]
565549
** directory.
566550
*/
567
- @ <pre>
551
+ @ <div class="filetree"><ul>
568552
if( nD ){
569
- cgi_printf("%.*h\n", nD, zD);
570
- }else{
571
- @ .
572
- }
573
- for(p=sTree.pFirst; p; p=p->pNext){
574
- tree_indentation(p->pParent);
575
- if( p->isLast ){
576
- cgi_append_content("&#x2514;&#x2500;&#x2500; ", 25);
577
- }else{
578
- cgi_append_content("&#x251c;&#x2500;&#x2500; ", 25);
579
- }
553
+ char *zLink = href("%s", url_render(&sURI, "name", 0, 0, 0));
554
+ @ <li class="dir">
555
+ @ %z(zLink)%h(zProjectName)</a>
556
+ }else{
557
+ @ <li class="dir subdir">
558
+ @ <a>%h(zProjectName)</a>
559
+ }
560
+ @ <ul>
561
+ for(p=sTree.pFirst; p; p=p->pNext){
580562
if( p->isDir ){
581
- char *zName = mprintf("%s%T", zPrefix, p->zFullName);
582
- char *zLink = href("%s", url_render(&sURI, "name", zName, 0, 0));
583
- fossil_free(zName);
584
- @ %z(zLink)%h(p->zName)</a>
563
+ if( nD && strlen(p->zFullName)==nD-1 ){
564
+ @ <li class="dir subdir">
565
+ }else{
566
+ @ <li class="dir">
567
+ }
568
+ if( fossil_strcmp(p->zFullName, zD)==0 ){
569
+ @ <a>%h(p->zName)</a>
570
+ }else{
571
+ char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
572
+ @ %z(zLink)%h(p->zName)</a>
573
+ }
574
+ @ <ul>
585575
}else{
586576
char *zLink;
587577
if( zCI ){
588578
zLink = href("%R/artifact/%s",p->zUuid);
589579
}else{
590
- zLink = href("%R/finfo?name=%s%T",zPrefix,p->zFullName);
580
+ zLink = href("%R/finfo?name=%T",p->zFullName);
591581
}
592
- @ %z(zLink)%h(p->zName)</a>
582
+ @ <li class="%z(fileext_class(p->zName))">%z(zLink)%h(p->zName)</a>
583
+ }
584
+ if( p->isLast ){
585
+ int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
586
+ while( nClose-- > 0 ){
587
+ @ </ul>
588
+ }
593589
}
594590
}
595
- @ </pre>
591
+ @ </ul>
592
+ @ </ul></div>
596593
style_footer();
597594
598595
/* We could free memory used by sTree here if we needed to. But
599596
** the process is about to exit, so doing so would not really accomplish
600597
** anything useful. */
601598
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386 pNew->isLast = 1;
387 while( zPath[i]=='/' ){ i++; }
388 pParent = pNew;
389 }
390 }
391
392 /*
393 ** Render parent lines for pNode
394 */
395 static void tree_indentation(FileTreeNode *p){
396 if( p==0 ) return;
397 tree_indentation(p->pParent);
398 if( p->isLast ){
399 cgi_append_content(" ", 4);
400 }else{
401 cgi_append_content("&#x2502; ", 11);
402 }
403 }
404
405
406 /*
407 ** WEBPAGE: tree
408 **
409 ** Query parameters:
@@ -422,16 +408,16 @@
422 Manifest *pM = 0;
423 int nFile = 0; /* Number of files */
424 int linkTrunk = 1; /* include link to "trunk" */
425 int linkTip = 1; /* include link to "tip" */
426 const char *zRE; /* the value for the re=REGEXP query parameter */
427 char *zPrefix; /* Prefix on all filenames */
428 char *zREx = ""; /* Extra parameters for path hyperlinks */
429 ReCompiled *pRE = 0; /* Compiled regular expression */
430 FileTreeNode *p; /* One line of the tree */
431 FileTree sTree; /* The complete tree of files */
432 HQuery sURI; /* Hyperlink */
 
433
434 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
435 memset(&sTree, 0, sizeof(sTree));
436 login_check_credentials();
437 if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
474 if( zD ){
475 url_add_parameter(&sURI, "name", zD);
476 blob_append(&dirname, "within directory ", -1);
477 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
478 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
479 zPrefix = mprintf("%T/", zD);
480 style_submenu_element("Top-Level", "Top-Level", "%s",
481 url_render(&sURI, "name", 0, 0, 0));
482 }else{
483 if( zRE ){
484 blob_appendf(&dirname, "matching \"%s\"", zRE);
485 }
486 zPrefix = "";
487 }
488 if( zCI ){
489 style_submenu_element("All", "All", "%s",
490 url_render(&sURI, "ci", 0, 0, 0));
491 }
@@ -521,11 +505,11 @@
521 || pFile->zName[nD-1]!='/')
522 ){
523 continue;
524 }
525 if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
526 db_bind_text(&ins, ":f", &pFile->zName[nD]);
527 db_bind_text(&ins, ":u", pFile->zUuid);
528 db_step(&ins);
529 db_reset(&ins);
530 }
531 db_finalize(&ins);
@@ -542,11 +526,11 @@
542 const char *z = db_column_text(&q, 0);
543 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
544 continue;
545 }
546 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
547 tree_add_node(&sTree, z+nD, 0);
548 nFile++;
549 }
550 db_finalize(&q);
551 }
552
@@ -562,39 +546,52 @@
562
563
564 /* Generate a multi-column table listing the contents of zD[]
565 ** directory.
566 */
567 @ <pre>
568 if( nD ){
569 cgi_printf("%.*h\n", nD, zD);
570 }else{
571 @ .
572 }
573 for(p=sTree.pFirst; p; p=p->pNext){
574 tree_indentation(p->pParent);
575 if( p->isLast ){
576 cgi_append_content("&#x2514;&#x2500;&#x2500; ", 25);
577 }else{
578 cgi_append_content("&#x251c;&#x2500;&#x2500; ", 25);
579 }
580 if( p->isDir ){
581 char *zName = mprintf("%s%T", zPrefix, p->zFullName);
582 char *zLink = href("%s", url_render(&sURI, "name", zName, 0, 0));
583 fossil_free(zName);
584 @ %z(zLink)%h(p->zName)</a>
 
 
 
 
 
 
 
 
585 }else{
586 char *zLink;
587 if( zCI ){
588 zLink = href("%R/artifact/%s",p->zUuid);
589 }else{
590 zLink = href("%R/finfo?name=%s%T",zPrefix,p->zFullName);
591 }
592 @ %z(zLink)%h(p->zName)</a>
 
 
 
 
 
 
593 }
594 }
595 @ </pre>
 
596 style_footer();
597
598 /* We could free memory used by sTree here if we needed to. But
599 ** the process is about to exit, so doing so would not really accomplish
600 ** anything useful. */
601
--- src/browse.c
+++ src/browse.c
@@ -386,24 +386,10 @@
386 pNew->isLast = 1;
387 while( zPath[i]=='/' ){ i++; }
388 pParent = pNew;
389 }
390 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
392 /*
393 ** WEBPAGE: tree
394 **
395 ** Query parameters:
@@ -422,16 +408,16 @@
408 Manifest *pM = 0;
409 int nFile = 0; /* Number of files */
410 int linkTrunk = 1; /* include link to "trunk" */
411 int linkTip = 1; /* include link to "tip" */
412 const char *zRE; /* the value for the re=REGEXP query parameter */
 
413 char *zREx = ""; /* Extra parameters for path hyperlinks */
414 ReCompiled *pRE = 0; /* Compiled regular expression */
415 FileTreeNode *p; /* One line of the tree */
416 FileTree sTree; /* The complete tree of files */
417 HQuery sURI; /* Hyperlink */
418 char *zProjectName = db_get("project-name", 0);
419
420 if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
421 memset(&sTree, 0, sizeof(sTree));
422 login_check_credentials();
423 if( !g.perm.Read ){ login_needed(); return; }
@@ -474,18 +460,16 @@
460 if( zD ){
461 url_add_parameter(&sURI, "name", zD);
462 blob_append(&dirname, "within directory ", -1);
463 hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
464 if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
 
465 style_submenu_element("Top-Level", "Top-Level", "%s",
466 url_render(&sURI, "name", 0, 0, 0));
467 }else{
468 if( zRE ){
469 blob_appendf(&dirname, "matching \"%s\"", zRE);
470 }
 
471 }
472 if( zCI ){
473 style_submenu_element("All", "All", "%s",
474 url_render(&sURI, "ci", 0, 0, 0));
475 }
@@ -521,11 +505,11 @@
505 || pFile->zName[nD-1]!='/')
506 ){
507 continue;
508 }
509 if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
510 db_bind_text(&ins, ":f", pFile->zName);
511 db_bind_text(&ins, ":u", pFile->zUuid);
512 db_step(&ins);
513 db_reset(&ins);
514 }
515 db_finalize(&ins);
@@ -542,11 +526,11 @@
526 const char *z = db_column_text(&q, 0);
527 if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
528 continue;
529 }
530 if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
531 tree_add_node(&sTree, z, 0);
532 nFile++;
533 }
534 db_finalize(&q);
535 }
536
@@ -562,39 +546,52 @@
546
547
548 /* Generate a multi-column table listing the contents of zD[]
549 ** directory.
550 */
551 @ <div class="filetree"><ul>
552 if( nD ){
553 char *zLink = href("%s", url_render(&sURI, "name", 0, 0, 0));
554 @ <li class="dir">
555 @ %z(zLink)%h(zProjectName)</a>
556 }else{
557 @ <li class="dir subdir">
558 @ <a>%h(zProjectName)</a>
559 }
560 @ <ul>
561 for(p=sTree.pFirst; p; p=p->pNext){
 
 
562 if( p->isDir ){
563 if( nD && strlen(p->zFullName)==nD-1 ){
564 @ <li class="dir subdir">
565 }else{
566 @ <li class="dir">
567 }
568 if( fossil_strcmp(p->zFullName, zD)==0 ){
569 @ <a>%h(p->zName)</a>
570 }else{
571 char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
572 @ %z(zLink)%h(p->zName)</a>
573 }
574 @ <ul>
575 }else{
576 char *zLink;
577 if( zCI ){
578 zLink = href("%R/artifact/%s",p->zUuid);
579 }else{
580 zLink = href("%R/finfo?name=%T",p->zFullName);
581 }
582 @ <li class="%z(fileext_class(p->zName))">%z(zLink)%h(p->zName)</a>
583 }
584 if( p->isLast ){
585 int nClose = p->iLevel - (p->pNext ? p->pNext->iLevel : 0);
586 while( nClose-- > 0 ){
587 @ </ul>
588 }
589 }
590 }
591 @ </ul>
592 @ </ul></div>
593 style_footer();
594
595 /* We could free memory used by sTree here if we needed to. But
596 ** the process is about to exit, so doing so would not really accomplish
597 ** anything useful. */
598
+69
--- src/style.c
+++ src/style.c
@@ -771,10 +771,79 @@
771771
"format for the list in the file browser",
772772
@ margin-left: 0.5em;
773773
@ padding-left: 0.5em;
774774
@ white-space: nowrap;
775775
},
776
+ { ".filetree",
777
+ "",
778
+ @ margin: 1em 0;
779
+ @ line-height: 1.5;
780
+ },
781
+ { ".filetree ul",
782
+ "file tree lists",
783
+ @ display: inline;
784
+ @ margin: 0;
785
+ @ padding: 0;
786
+ },
787
+ { ".filetree li",
788
+ "file tree list items",
789
+ @ display: inline;
790
+ },
791
+ { ".filetree .subdir ul",
792
+ "file tree lists below subdir",
793
+ @ position: relative;
794
+ @ display: block;
795
+ @ margin: 0 0 0 21px;
796
+ @ padding: 0;
797
+ },
798
+ { ".filetree .subdir li",
799
+ "file tree lists items below subdir",
800
+ @ position: relative;
801
+ @ display: block;
802
+ @ margin: 0;
803
+ @ padding: 0;
804
+ },
805
+ { ".filetree .subdir li:before",
806
+ "file tree node lines",
807
+ @ content: '';
808
+ @ position: absolute;
809
+ @ top: -.8em;
810
+ @ left: -14px;
811
+ @ width: 14px;
812
+ @ height: 1.5em;
813
+ @ border-left: 2px solid #aaa;
814
+ @ border-bottom: 2px solid #aaa;
815
+ },
816
+ { ".filetree .subdir > ul ul:before",
817
+ "file tree directory lines",
818
+ @ content: '';
819
+ @ position: absolute;
820
+ @ top: -1.5em;
821
+ @ bottom: 0;
822
+ @ left: -35px;
823
+ @ border-left: 2px solid #aaa;
824
+ },
825
+ { ".filetree .subdir li:last-child > ul:before",
826
+ "",
827
+ @ display: none;
828
+ },
829
+ { ".filetree a",
830
+ "file tree links",
831
+ @ position: relative;
832
+ @ z-index: 1;
833
+ @ display: inline-block;
834
+ @ min-height: 16px;
835
+ @ margin-right: .5em;
836
+ @ padding-left: 21px;
837
+ @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP\/\/\/yEhIf\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmgOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);
838
+ @ background-position: center left;
839
+ @ background-repeat: no-repeat;
840
+ },
841
+ { ".filetree .dir > a",
842
+ "file tree directory link",
843
+ @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIiIv\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXpo+jUs6b5Z/K4siDu5RPUFADs=);
844
+ },
776845
{ "table.login_out",
777846
"table format for login/out label/input table",
778847
@ text-align: left;
779848
@ margin-right: 10px;
780849
@ margin-left: 10px;
781850
--- src/style.c
+++ src/style.c
@@ -771,10 +771,79 @@
771 "format for the list in the file browser",
772 @ margin-left: 0.5em;
773 @ padding-left: 0.5em;
774 @ white-space: nowrap;
775 },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
776 { "table.login_out",
777 "table format for login/out label/input table",
778 @ text-align: left;
779 @ margin-right: 10px;
780 @ margin-left: 10px;
781
--- src/style.c
+++ src/style.c
@@ -771,10 +771,79 @@
771 "format for the list in the file browser",
772 @ margin-left: 0.5em;
773 @ padding-left: 0.5em;
774 @ white-space: nowrap;
775 },
776 { ".filetree",
777 "",
778 @ margin: 1em 0;
779 @ line-height: 1.5;
780 },
781 { ".filetree ul",
782 "file tree lists",
783 @ display: inline;
784 @ margin: 0;
785 @ padding: 0;
786 },
787 { ".filetree li",
788 "file tree list items",
789 @ display: inline;
790 },
791 { ".filetree .subdir ul",
792 "file tree lists below subdir",
793 @ position: relative;
794 @ display: block;
795 @ margin: 0 0 0 21px;
796 @ padding: 0;
797 },
798 { ".filetree .subdir li",
799 "file tree lists items below subdir",
800 @ position: relative;
801 @ display: block;
802 @ margin: 0;
803 @ padding: 0;
804 },
805 { ".filetree .subdir li:before",
806 "file tree node lines",
807 @ content: '';
808 @ position: absolute;
809 @ top: -.8em;
810 @ left: -14px;
811 @ width: 14px;
812 @ height: 1.5em;
813 @ border-left: 2px solid #aaa;
814 @ border-bottom: 2px solid #aaa;
815 },
816 { ".filetree .subdir > ul ul:before",
817 "file tree directory lines",
818 @ content: '';
819 @ position: absolute;
820 @ top: -1.5em;
821 @ bottom: 0;
822 @ left: -35px;
823 @ border-left: 2px solid #aaa;
824 },
825 { ".filetree .subdir li:last-child > ul:before",
826 "",
827 @ display: none;
828 },
829 { ".filetree a",
830 "file tree links",
831 @ position: relative;
832 @ z-index: 1;
833 @ display: inline-block;
834 @ min-height: 16px;
835 @ margin-right: .5em;
836 @ padding-left: 21px;
837 @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP\/\/\/yEhIf\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAIvlIKpxqcfmgOUvoaqDSCxrEEfF14GqFXImJZsu73wepJzVMNxrtNTj3NATMKhpwAAOw==);
838 @ background-position: center left;
839 @ background-repeat: no-repeat;
840 },
841 { ".filetree .dir > a",
842 "file tree directory link",
843 @ background-image: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIiIv\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXpo+jUs6b5Z/K4siDu5RPUFADs=);
844 },
845 { "table.login_out",
846 "table format for login/out label/input table",
847 @ text-align: left;
848 @ margin-right: 10px;
849 @ margin-left: 10px;
850

Keyboard Shortcuts

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