create new tag
, view all tags

Archive of TreeBrowserPluginDev

Thomas, cool Plugin! cool! Thank you very much for sharing this with the TWikiCommunity!

I added some standard rows to the Plugin info table. Please fix as necessary. How about measuring and documenting the PluginBenchmarks?

Possible doc update: What is the behaviour if JavaScript is turned off? Ideally the whole tree is shown expanded.

-- PeterThoeny - 04 Sep 2005

Added the ability to share the state of the tree across different topics, which comes in handy if the tree was used in WebLeftBar (the nodes would remain their open status even if a new topic is looked at, as long as it shares this tree, which would be typically the case for all topics in the same web).

-- ThomasWeigert - 04 Sep 2005

Peter, thanks for the suggestion... I have now implemented this so that if JavaScript is turned off, the bulleted list will be shown as usual (sans the %TREEBROWSER% tag).

However, an idea would be to combine this plugin with RenderListPlugin, and give it the option to either render dynamically (as in this TreeBrowserPlugin) or statically (as in RenderListPlugin). The latter behavior would also be the fallback behavior when JavaScript is disabled.

We could make these to plugins generate the same appearance, so that their only difference is the dynamic vs. static nature.

-- ThomasWeigert - 04 Sep 2005

This is really excellent, and will please a lot of my users. Good job. Can anyone think of a way to make this work with the TreePlugin, or is there a better way to browse a hierarchy of TWiki documents these days ?

-- SteveJonesST - 05 Sep 2005

I'm having real difficulties gettting this to work. As an example, the following doesn't render at all in my installation (Cairo) :

   * One
      * One one
         * One one one
      * One two
   * Two

But this will :

   * One
      * One one
      * One two
   * Two

Also, I get the string <_script_> output to the browser before the first tree rendered.

These two symptoms are seen both in IE and Firefox. Let me know if you need more help to debug.


-- SteveJonesST - 06 Sep 2005

Steve, thanks. Reproduced the error re not-rendering example 1. I will fix today...

However, I do not see the problem with <_script_> being written to the browser. Are you sure you have patched lib/TWiki/UI/View.pm?

-- ThomasWeigert - 06 Sep 2005

Hi Thomas. Looking back, I notice my patch command had one hunk rejected (looks like your View.pm has some extra stuff about jscalendar that I don't have... I've manually applied the patch, and the <_script_> tags are gone - Thanks.

-- SteveJonesST - 06 Sep 2005

I have uploaded a new version which

  • Fixes the defect discovered by SteveJonesST
  • Moves the location of the change to lib/UI/View.pm so that it is less likely that the patch fails on different versions of TWiki
  • Adopted the theme styles from RenderListPlugin.

Please be aware that the last enhancement required a change in the %TREEBROWSER% tag calling conventions. You need to use the theme attribute to select the style of the tree (see the documentation). This makes this plugin more consistent with RenderListPlugin. (Sorry for the change in calling convention.)

-- ThomasWeigert - 06 Sep 2005

This works perfectly, and is a valuable addition - thanks very much Thomas for your work here. The users here are really enthusiastic about what you've done.

-- SteveJonesST - 07 Sep 2005

Agreed, very nice work, and in line with the TWikiMission.

-- PeterThoeny - 07 Sep 2005

I like TreeBrowserPlugin very much (thanx for the work!). We use it in the WebLeftBar, but I had to adopt it, cos our WebLeftBar has a dark blue background with white fonts (corporate identity with our other intranet pages :-(). But now the TreeBrowserPlugin cannot be used in Topics any more (white fonts!).

Do you have an idea how this can be fixed, appart from having two plugins, one for dark background and one for light ones. I think about themes for color of text and differnt images for the tree.

-- MatthiasThullner - 10 Sep 2005

You could try the following: There is a style for the JavaScript generated. We could add the style as a parameter to the %TREEBROWSER% tag and you would add in the style sheet a style where the fonts are white to be used on dark background. We could also have that as part of the theme. Can you experiment with using styles here. Alternatively, we would have to set the font color manually and take that from a theme definition.

-- ThomasWeigert - 11 Sep 2005

isn't it possible to inherit the font style from the current position? That would propably the best solution (for me). I tried to remove the color from the style, but then I got the default link-color, not the one thats used in the WebLeftBar. I did not work much on the stylesheet, cos I am not familiar with that, but I will try that next week if I find the time. The tree images (line.gif, plus.gif, minus.gif, ...) should be part of the theme, but that works at the moment with gray lines, they are visible on white and dark backgrounds.

Do you plan further development on that plugin?

-- MatthiasThullner - 11 Sep 2005

Hi. I just tried to use the openAll and openTo paramters, but they don't seem to work for me. Anybody else get this difficulty ?

-- SteveJonesST - 15 Sep 2005

I tried openAll as well, didn't work frown

-- MatthiasThullner - 15 Sep 2005

Sorry for that. Fixed typos introduced when pushing some functionality into a function call. It works now.

-- ThomasWeigert - 17 Sep 2005

Cheers, Thomas. I confirm that openAll is working properly. Thanks for a prompt fix.

-- SteveJonesST - 19 Sep 2005

Managed to install and successfully run the example but can't make any of the other themes work. How do I do it. i.e. I tried %TREEBROWSER{"tree"... but that just renders bullet points. Also, where do I set up the preferences? Some examples would be great. Thanks

-- DavidBaker - 02 Nov 2005

Ah! now I get it. For a new Theme I just need to edit the TREEBROWSERPLUGIN topic itself to add a new theme - and it works! However I still don't understand what's meant by icon and tree. There don't appear to be icon or tree themes in the preferences. Does it simply mean that if icon is chosen a fully expandable/collapsable tree is displayed and if tree is chosen then a fully opened tree is shown which is not expandable/collapsable?

-- DavidBaker - 02 Nov 2005

Anyone know where these changes should be made in Dakar's View.pm? I search all text files for TWiki::UI::writeDebugTimes but can't find it.

Index: View.pm
RCS file: /e/www/CVS/twiki-cairo/lib/TWiki/UI/View.pm,v
retrieving revision 1.4
diff -c -r1.4 View.pm
*** View.pm   19 Feb 2005 23:41:41 -0000   1.4
--- View.pm   6 Sep 2005 18:23:49 -0000
*** 325,330 ****
--- 325,334 ----
    TWiki::UI::writeDebugTimes( "view - checked access permissions" );
+   my $script = "";
+   $tmpl =~ s/<_script_>(.*?)<\/_script_>/&lift($1,$script)/geos;
+   $tmpl =~ s/<\/head>/$script<\/head>/i;
    # Write header based on "contenttype" parameter, used to produce
    # MIME types like text/plain or text/xml, e.g. for RSS feeds.
    if( $contentType ) {
*** 349,352 ****
--- 353,363 ----
    TWiki::UI::writeDebugTimes( "view - done" );
+ sub lift {
+   my ($script) = @_;
+   $_[1] .= $script;
+   return '';
+ }
-- RyanKnoll - 02 Mar 2006

I've tried adding it in right at the very end of $tmpl processing, which compiled without error, but did not work. Here's my diff from Dakar:

*** lib/TWiki/UI/View.pm.orig   2006-02-07 10:08:46.000000000 -0500
--- lib/TWiki/UI/View.pm        2006-03-14 19:01:24.405520259 -0500
*** 238,243 ****
--- 238,248 ----
      $tmpl =~ s/%REVINFO%/$ri/go;
      $tmpl =~ s/%REVISIONS%/$revs/go;

+     # Attempt to manually apply hunk #1 of TreeBrowserPlugin patch
+     my $script = "";
+     $tmpl =~ s/<_script_>(.*?)<\/_script_>/&lift($1,$script)/geos;
+     $tmpl =~ s/<\/head>/$script<\/head>/i;
      # extract header and footer from the template, if there is a
      # %TEXT% tag marking the split point
      my( $start, $end );
*** 389,392 ****
--- 394,404 ----
      return $mimeType;

+ sub lift {
+   my ($script) = @_;
+   $_[1] .= $script;
+   return '';
+ }
I did notice an error in the InstalledPlugins page. The plugin was listed as using startRenderingHandler, with the error This handler is deprecated - please check for updated versions of the plugins that use it!

I'm a Perl programmer but I've never worked on the TWiki code before, so I'm unsure how to proceed from here. Is anyone working on an update to this plugin for Dakar?

-- RyanMartin - 15 Mar 2006

I don't have time to work on this right now, but I would start with HandlingCairoDakarPluginDifferences.

-- IanTegebo - 16 Mar 2006

I also tried applying the patch to View.pm on the Dakar release and did not have any luck. I am unsure if the plug-in just does not work with Dakar or if it is because the patch doesn't work.

-- AndreaWells - 23 Mar 2006

Don't apply patch. Change this in TreeBrowserPlugin.pm:

++   $_[0] =~ s/ {3}/\t/gs if $_[0] =~/%TREEBROWSER/;
    $_[0] =~ s/%TREEBROWSER{(.*?)}%(([\n\r]+[^\t]{1}[^\n\r]*)*?)(([\n\r]+\t[^\n\r]*)+)/&handleTreeView($1, $2, $4)/ges;

   if ( $js == 1 ) {
++      return $script . $text;
    } else {
      return $text;

tested on 4.0.1 and 4.0.2

-- PavelKotrc - 11 Apr 2006

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2006-04-14 - SteffenPoulsen
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.