Fossil

Check-in [13c71a97]
Login

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

Overview
Comment:Do not wait until the entire tree-view page has loaded before collapsing the tree, because that can cause flicker if the page is loaded incrementally over a slow wire. Collapse the tree using style= attributes as the page loads.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:13c71a97feb26586f75f88ba897aa761fc450e30
User & Date: drh 2014-01-07 02:38:52
Context
2014-01-07
03:24
Fix tree-view subdirectory pages check-in: 464fd0a4 user: joel tags: trunk
02:38
Do not wait until the entire tree-view page has loaded before collapsing the tree, because that can cause flicker if the page is loaded incrementally over a slow wire. Collapse the tree using style= attributes as the page loads. check-in: 13c71a97 user: drh tags: trunk
02:23
Document the "expand" query parameter for "tree" in the on-line help. check-in: 273dd2c0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/browse.c.

412
413
414
415
416
417
418

419
420
421
422
423
424
425
426
427
428
429

430
431
432
433
434
435
436
...
576
577
578
579
580
581
582

583



584
585
586
587
588
589
590
...
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
  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 */

  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");
  sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
                          pathelementFunc, 0, 0);
  url_initialize(&sURI, "tree");


  /* If a regular expression is specified, compile it */
  zRE = P("re");
  if( zRE ){
    re_compile(&pRE, zRE, 0);
    url_add_parameter(&sURI, "re", zRE);
    zREx = mprintf("&re=%T", zRE);
................................................................................
      }
      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>



    }else{
      char *zLink;
      if( zCI ){
        zLink = href("%R/artifact/%s",p->zUuid);
      }else{
        zLink = href("%R/finfo?name=%T",p->zFullName);
      }
................................................................................
  @   }
  @   if( style(a.parentNode, 'display')=='inline' ) return;
  @   var ul = a.nextSibling;
  @   while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
  @   ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
  @   return false;
  @ }
  if( P("expand")==0 ){
    /* Begin with the tree collapsed, unless the "expand" query parameter
    ** is present */
    @ toggleAll(outer_ul);
  }
  @ }())</script>
  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. */
}







>











>







 







>
|
>
>
>







 







<
<
<
<
<







412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
...
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
...
635
636
637
638
639
640
641





642
643
644
645
646
647
648
  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 startExpanded;       /* True to start out with the tree expanded */
  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");
  sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
                          pathelementFunc, 0, 0);
  url_initialize(&sURI, "tree");
  startExpanded = P("expand")!=0;

  /* If a regular expression is specified, compile it */
  zRE = P("re");
  if( zRE ){
    re_compile(&pRE, zRE, 0);
    url_add_parameter(&sURI, "re", zRE);
    zREx = mprintf("&re=%T", zRE);
................................................................................
      }
      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>
      }
      if( startExpanded ){
        @ <ul>
      }else{
        @ <ul style='display:none;'>
      }
    }else{
      char *zLink;
      if( zCI ){
        zLink = href("%R/artifact/%s",p->zUuid);
      }else{
        zLink = href("%R/finfo?name=%T",p->zFullName);
      }
................................................................................
  @   }
  @   if( style(a.parentNode, 'display')=='inline' ) return;
  @   var ul = a.nextSibling;
  @   while( ul && ul.nodeName!='UL' ) ul = ul.nextSibling;
  @   ul.style.display = style(ul, 'display')=='none' ? 'block' : 'none';
  @   return false;
  @ }





  @ }())</script>
  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. */
}