Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Propose tree-view enhancement. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | csstree |
| Files: | files | file ages | folders |
| SHA1: |
377a4f2d534f733f3bbd71e36ccd6309 |
| User & Date: | joel 2014-01-02 12:47:40.727 |
Context
|
2014-01-02
| ||
| 18:50 | Fix incorrect insertion of closing UL tags. ... (check-in: 417d18082b user: joel tags: csstree) | |
| 12:47 | Propose tree-view enhancement. ... (check-in: 377a4f2d53 user: joel tags: csstree) | |
| 12:36 | Add portion of MANIFEST_UUID to TH1 URL variables. ... (check-in: daa43661dd user: joel tags: trunk) | |
Changes
Changes to src/browse.c.
| ︙ | ︙ | |||
384 385 386 387 388 389 390 |
pNew->iLevel = pParent ? pParent->iLevel+1 : 0;
pNew->isDir = zPath[i]=='/';
pNew->isLast = 1;
while( zPath[i]=='/' ){ i++; }
pParent = pNew;
}
}
| < < < < < < < < < < < < < < | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
pNew->iLevel = pParent ? pParent->iLevel+1 : 0;
pNew->isDir = zPath[i]=='/';
pNew->isLast = 1;
while( zPath[i]=='/' ){ i++; }
pParent = pNew;
}
}
/*
** WEBPAGE: tree
**
** Query parameters:
**
** name=PATH Directory to display. Optional
|
| ︙ | ︙ | |||
420 421 422 423 424 425 426 | char *zUuid = 0; Blob dirname; Manifest *pM = 0; int nFile = 0; /* Number of files */ int linkTrunk = 1; /* include link to "trunk" */ int linkTip = 1; /* include link to "tip" */ const char *zRE; /* the value for the re=REGEXP query parameter */ | < > > | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
char *zUuid = 0;
Blob dirname;
Manifest *pM = 0;
int nFile = 0; /* Number of files */
int linkTrunk = 1; /* include link to "trunk" */
int linkTip = 1; /* include link to "tip" */
const char *zRE; /* the value for the re=REGEXP query parameter */
char *zREx = ""; /* Extra parameters for path hyperlinks */
ReCompiled *pRE = 0; /* Compiled regular expression */
FileTreeNode *p; /* One line of the tree */
FileTree sTree; /* The complete tree of files */
HQuery sURI; /* Hyperlink */
int iDepth = 0; /* <ul> depth */
char *zProjectName = db_get("project-name", 0);
if( strcmp(PD("type",""),"flat")==0 ){ page_dir(); return; }
memset(&sTree, 0, sizeof(sTree));
login_check_credentials();
if( !g.perm.Read ){ login_needed(); return; }
while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; }
style_header("File List");
|
| ︙ | ︙ | |||
472 473 474 475 476 477 478 |
/* Compute the title of the page */
blob_zero(&dirname);
if( zD ){
url_add_parameter(&sURI, "name", zD);
blob_append(&dirname, "within directory ", -1);
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
| < < | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
/* Compute the title of the page */
blob_zero(&dirname);
if( zD ){
url_add_parameter(&sURI, "name", zD);
blob_append(&dirname, "within directory ", -1);
hyperlinked_path(zD, &dirname, zCI, "tree", zREx);
if( zRE ) blob_appendf(&dirname, " matching \"%s\"", zRE);
style_submenu_element("Top-Level", "Top-Level", "%s",
url_render(&sURI, "name", 0, 0, 0));
}else{
if( zRE ){
blob_appendf(&dirname, "matching \"%s\"", zRE);
}
}
if( zCI ){
style_submenu_element("All", "All", "%s",
url_render(&sURI, "ci", 0, 0, 0));
}
if( linkTrunk ){
style_submenu_element("Trunk", "Trunk", "%s",
|
| ︙ | ︙ | |||
517 518 519 520 521 522 523 |
if( nD>0
&& (fossil_strncmp(pFile->zName, zD, nD-1)!=0
|| pFile->zName[nD-1]!='/')
){
continue;
}
if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
| | | > | < > > | > > < | < > > > | < < < < | < | > > > | | > > > | > > | > | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
if( nD>0
&& (fossil_strncmp(pFile->zName, zD, nD-1)!=0
|| pFile->zName[nD-1]!='/')
){
continue;
}
if( pRE && re_match(pRE, (const u8*)pFile->zName, -1)==0 ) continue;
db_bind_text(&ins, ":f", pFile->zName);
db_bind_text(&ins, ":u", pFile->zUuid);
db_step(&ins);
db_reset(&ins);
}
db_finalize(&ins);
db_prepare(&q, "SELECT x, uuid FROM filelist ORDER BY x");
while( db_step(&q)==SQLITE_ROW ){
tree_add_node(&sTree, db_column_text(&q,0), db_column_text(&q,1));
nFile++;
}
db_finalize(&q);
}else{
Stmt q;
db_prepare(&q, "SELECT name FROM filename ORDER BY name COLLATE nocase");
while( db_step(&q)==SQLITE_ROW ){
const char *z = db_column_text(&q, 0);
if( nD>0 && (fossil_strncmp(z, zD, nD-1)!=0 || z[nD-1]!='/') ){
continue;
}
if( pRE && re_match(pRE, (const u8*)z, -1)==0 ) continue;
tree_add_node(&sTree, z, 0);
nFile++;
}
db_finalize(&q);
}
if( zCI ){
@ <h2>%d(nFile) files of
@ check-in [%z(href("vinfo?name=%T",zUuid))%S(zUuid)</a>]
@ %s(blob_str(&dirname))</h2>
}else{
int n = db_int(0, "SELECT count(*) FROM plink");
@ <h2>%d(nFile) files from all %d(n) check-ins
@ %s(blob_str(&dirname))</h2>
}
/* Generate a multi-column table listing the contents of zD[]
** directory.
*/
@ <ul class="filetree root">
@ <li class="dir">
if( nD ){
char *zLink = href("%s", url_render(&sURI, "name", 0, 0, 0));
@ %z(zLink)%h(zProjectName)</a>
}else{
@ <a>%h(zProjectName)</a>
}
@ <ul class="filetree">
iDepth = 2;
for(p=sTree.pFirst; p; p=p->pNext){
if( p->isDir ){
@ <li class="dir">
if( fossil_strcmp(p->zFullName, zD)==0 ){
@ <a>%h(p->zName)</a>
}else{
char *zLink = href("%s", url_render(&sURI, "name", p->zFullName, 0, 0));
@ %z(zLink)%h(p->zName)</a>
}
@ <ul class="filetree">
iDepth++;
}else{
char *zLink;
if( zCI ){
zLink = href("%R/artifact/%s",p->zUuid);
}else{
zLink = href("%R/finfo?name=%T",p->zFullName);
}
@ <li class="file">%z(zLink)%h(p->zName)</a>
}
if( p->isLast && !p->isDir ){
@ </ul>
iDepth--;
}
}
while( iDepth-- > 0 ) {
@ </ul>
}
style_footer();
/* We could free memory used by sTree here if we needed to. But
** the process is about to exit, so doing so would not really accomplish
** anything useful. */
}
|
| ︙ | ︙ |
Changes to src/style.c.
| ︙ | ︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
},
{ "ul.browser",
"format for the list in the file browser",
@ margin-left: 0.5em;
@ padding-left: 0.5em;
@ white-space: nowrap;
},
{ "table.login_out",
"table format for login/out label/input table",
@ text-align: left;
@ margin-right: 10px;
@ margin-left: 10px;
@ margin-top: 10px;
},
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
},
{ "ul.browser",
"format for the list in the file browser",
@ margin-left: 0.5em;
@ padding-left: 0.5em;
@ white-space: nowrap;
},
{ ".filetree",
"file tree",
@ padding-left: 0;
@ list-style: none;
},
{
".filetree li",
"file tree list items",
@ margin: .2em 0;
},
{ ".filetree ul",
"file tree subdirectory lists",
@ margin-left: 7px;
@ padding-left: 12px;
@ border-left: 2px dotted #aaa;
},
{
".filetree a:before",
"file tree link icons",
@ margin-right: 5px;
@ vertical-align: middle;
},
{ ".filetree .dir > a:before",
"file tree directory link icons",
@ content: url(data:image/gif;base64,R0lGODlhEAAQAJEAAP/WVCIiIv\/\/\/wAAACH5BAEHAAIALAAAAAAQABAAAAInlI9pwa3XYniCgQtkrAFfLXkiFo1jaXpo+jUs6b5Z/K4siDu5RPUFADs=);
},
{ ".filetree .file > a:before",
"file tree file link icons",
@ content: url(data:image/gif;base64,R0lGODlhDQAQAJEAAP\/\/\/yIiIv\/\/\/wAAACH5BAEHAAIALAAAAAANABAAAAIhjI+iyLYBYmTCyAnZBc3eDm0SIo5HiXklibLr2cIvSNMFADs=);
},
{ "table.login_out",
"table format for login/out label/input table",
@ text-align: left;
@ margin-right: 10px;
@ margin-left: 10px;
@ margin-top: 10px;
},
|
| ︙ | ︙ |