Index: lib/TWiki/Plugins/TreeBrowserPlugin.pm =================================================================== --- lib/TWiki/Plugins/TreeBrowserPlugin.pm (revision 11391) +++ lib/TWiki/Plugins/TreeBrowserPlugin.pm (working copy) @@ -31,6 +31,7 @@ # ========================= package TWiki::Plugins::TreeBrowserPlugin; + # ========================= use vars qw( $web $topic $user $installWeb $VERSION $pluginName @@ -95,6 +96,9 @@ my $open1 = &TWiki::Func::extractNameValuePair( $theAttr, "openTo" ); my $open2 = &TWiki::Func::extractNameValuePair( $theAttr, "openAll" ); my $shared = &TWiki::Func::extractNameValuePair( $theAttr, "shared" ); + my $useLines = &TWiki::Func::extractNameValuePair( $theAttr, "uselines" ); + my $useStatusText = &TWiki::Func::extractNameValuePair( $theAttr, "usestatustext" ); + my $closeSameLevel = &TWiki::Func::extractNameValuePair( $theAttr, "closesamelevel" ); my $icons = 0; $icons = 1 if ($type eq "icon"); my $wrap = 0; @@ -104,12 +108,12 @@ my $opento = 0; $opento = $open1 if (!$openall && $open1); - return $thePre . &renderTreeView( $type, $params, $theTitle, $icons, $shared, $openall, $opento, $theList ); + return $thePre . &renderTreeView( $type, $params, $useLines, $useStatusText, $closeSameLevel, $theTitle, $icons, $shared, $openall, $opento, $theList ); } sub renderTreeView { - my ( $theType, $theParams, $theTitle, $icons, $shared, $openAll, $openTo, $theText ) = @_; + my ( $theType, $theParams, $useLines, $useStatusText, $closeSameLevel, $theTitle, $icons, $shared, $openAll, $openTo, $theText ) = @_; $theText =~ s/^[\n\r]*//os; my @tree = (); @@ -169,6 +173,12 @@ # $text .= "$var.icon.node=\'$docicon\';\n"; $text .= "$var.config.useIcons=false;\n" unless $icons; $text .= "$var.config.shared=true;\n" if $shared; + $text .= "$var.config.useLines=false;\n" if ($useLines=~/false|0|off/i); + $text .= "$var.config.closeSameLevel=true;\n" if ($closeSameLevel=~/true|1|on/i); + + $text .= "$var.config.useStatusText=false;\n"; #Broken due to dtree usage if ($useStatusText=~/true|1|on/i); + $text .= "$var.config.useSelection=false;\n"; #Broken due to dtree usage + $text .= "$var.config.folderLinks=false;\n"; #Broken due to dtree usage $theTitle = &TWiki::Func::renderText( $theTitle, $web ); $theTitle =~ s/\"/\\\"/go; $text .= "$var.add(0,-1,\"$theTitle\");\n"; Index: pub/TWiki/TreeBrowserPlugin/dtree.css =================================================================== --- pub/TWiki/TreeBrowserPlugin/dtree.css (revision 11391) +++ pub/TWiki/TreeBrowserPlugin/dtree.css (working copy) @@ -9,6 +9,7 @@ font-size: 11px; color: #666; white-space: nowrap; + line-height:100%; } .dtree img { border: 0px; Index: pub/TWiki/TreeBrowserPlugin/dtree.js =================================================================== --- pub/TWiki/TreeBrowserPlugin/dtree.js (revision 11391) +++ pub/TWiki/TreeBrowserPlugin/dtree.js (working copy) @@ -1 +1,312 @@ -/*--------------------------------------------------| | dTree 2.05 | www.destroydrop.com/javascript/tree/ | |---------------------------------------------------| | Copyright (c) 2002-2003 Geir Landrö | | | | This script can be used freely as long as all | | copyright messages are intact. | | | | Updated: 17.04.2003 | | Updated: 04 Sep 2005 Thomas Weigert | |--------------------------------------------------*/ // Node object function Node(id, pid, name, url, title, target, icon, iconOpen, open) { this.id = id; this.pid = pid; this.name = name; this.url = url; this.title = title; this.target = target; this.icon = icon; this.iconOpen = iconOpen; this._io = open || false; this._is = false; this._ls = false; this._hc = false; this._ai = 0; this._p; };// Tree object function dTree(objName) { this.config = { target : null, folderLinks : true, useSelection : true, useCookies : true, useLines : true, useIcons : true, useStatusText : false, closeSameLevel : false, inOrder : false, iconPath : '', shared : false } this.icon = { root : 'base.gif', folder : 'folder.gif', folderOpen : 'folderopen.gif', node : 'page.gif', empty : 'empty.gif', line : 'line.gif', join : 'join.gif', joinBottom : 'joinbottom.gif', plus : 'plus.gif', plusBottom : 'plusbottom.gif', minus : 'minus.gif', minusBottom : 'minusbottom.gif', nlPlus : 'nolines_plus.gif', nlMinus : 'nolines_minus.gif' }; this.obj = objName; this.aNodes = []; this.aIndent = []; this.root = new Node(-1); this.selectedNode = null; this.selectedFound = false; this.completed = false; };// Must be called if iconPath was changed dTree.prototype.updateIconPath = function() { this.icon = { root : this.config.iconPath + 'base.gif', folder : this.config.iconPath + 'folder.gif', folderOpen : this.config.iconPath + 'folderopen.gif', node : this.config.iconPath + 'page.gif', empty : this.config.iconPath + 'empty.gif', line : this.config.iconPath + 'line.gif', join : this.config.iconPath + 'join.gif', joinBottom : this.config.iconPath + 'joinbottom.gif', plus : this.config.iconPath + 'plus.gif', plusBottom : this.config.iconPath + 'plusbottom.gif', minus : this.config.iconPath + 'minus.gif', minusBottom : this.config.iconPath + 'minusbottom.gif', nlPlus : this.config.iconPath + 'nolines_plus.gif', nlMinus : this.config.iconPath + 'nolines_minus.gif' }; }// Adds a new node to the node array dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) { this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open); };// Open/close all nodes dTree.prototype.openAll = function() { this.oAll(true); }; dTree.prototype.closeAll = function() { this.oAll(false); };// Outputs the tree to the page dTree.prototype.toString = function() { var str = '
\n'; if (document.getElementById) { if (this.config.useCookies) this.selectedNode = this.getSelected(); str += this.addNode(this.root); } else str += 'Browser not supported.'; str += '
'; if (!this.selectedFound) this.selectedNode = null; this.completed = true; return str; };// Creates the tree structure dTree.prototype.addNode = function(pNode) { var str = ''; var n=0; if (this.config.inOrder) n = pNode._ai; for (n; n'; } if (node.url) { str += ''; str += node.name; if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += ''; str += ''; if (node._hc) { str += '
'; str += this.addNode(node); str += '
'; } this.aIndent.pop(); return str; };// Adds the empty and line icons dTree.prototype.indent = function(node, nodeId) { var str = ''; if (this.root.id != node.pid) { for (var n=0; n'; (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); if (node._hc) { str += ''; } else str += ''; } return str; };// Checks if a node has any children and if it is the last sibling dTree.prototype.setCS = function(node) { var lastId; for (var n=0; n'; + } + str += node.name; + str += ''; + if (node._hc) { + str += '
'; + str += this.addNode(node); + str += '
'; + } + this.aIndent.pop(); + return str; +};// Adds the empty and line icons +dTree.prototype.indent = function(node, nodeId) { + var str = ''; + if (this.root.id != node.pid) { + for (var n=0; n'; + (node._ls) ? this.aIndent.push(0) : this.aIndent.push(1); + if (node._hc) { + str += ''; + } else str += ''; + } + return str; +};// Checks if a node has any children and if it is the last sibling +dTree.prototype.setCS = function(node) { + var lastId; + for (var n=0; n