Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks!

My question is about if someone ever worked or seeing a Perl Clickable Navigation Tree Menu script that, would allow selections of file(s) once found from a checkbox? Like:


server root:
 dir1-<all directories collaps if clicked>
   dir1-file1
   dir1-file2
      dir1-file2-somefile2
   dir1-file3

 dir2
 dir3
 dir4
 somefile

I hope you understand what I am trying to explain.

Any help or ideas from someone? Thanks a lot!!!!

Replies are listed 'Best First'.
Re: Clickable Tree Menu using Perl
by planetscape (Chancellor) on Jul 07, 2006 at 17:32 UTC
Re: Clickable Tree Menu using Perl
by jdtoronto (Prior) on Jul 07, 2006 at 18:00 UTC
    At least one of my large clients insists that we do his Web applications without using ANY client side scripting at all (no JS, no cookies). So we need to do this for function menues on his applications. I dont have code I can extract to show you. However I can tell you that we use HTML::Template. In the template each branch of the tree is wrapped in an IF block. Of course you can next the IF's to get the tree depth. In your case, say dir1 gets clicked, you toggle the state of dir1 on the server side and when the page gets rebuilt the branch is either displayed or not.

    In the past we have constructed complex data structures to make it all work, this usually means that each branch is fully populated all the time by the templating engine, only the IF parameters get changed. The HTML produced that way is pretty compact. Combine that with some spiffy CSS, such as that found at listamatic2 will give you the idea of how to generate the layout. It isn't trivial, but it ain't rocket science either.

    If I could figure it out I am sure you can!

    jdotornto

    Update I was just doing some more browsing and saw this one - a complete pop-up list with just HTML and CSS here.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Clickable Tree Menu using Perl
by scmason (Monk) on Jul 07, 2006 at 17:01 UTC
    If I understand you correctly, you want a GUI element that allows for a tree view of a directory structure? If so:

    Tk::DirTree

    This is a directory tree just like you describe. If you want something more generic, see

    Tk::Tree

    Hope this helps!

    "Never take yourself too seriously, because everyone knows that fat birds dont fly" -FLC
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Clickable Tree Menu using Perl
by Anonymous Monk on Jul 08, 2006 at 08:35 UTC
      Interesting collection! Looks like some stuff worth investigating there. Thanks AM!

      jdtoronto

Re: Clickable Tree Menu using Perl
by zentara (Cardinal) on Jul 08, 2006 at 12:56 UTC
    If you are willing to switch back to Tk, you could try my Tk::CanvasDirTree. It is a single-click dir tree browser with floating background image. It has a few demos to show it's usage.

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum