[PHPLIB-DEV] cvs commit From: sasha (phplib-dev <email protected>)
Date: 03/17/00

From: sasha
Date: Fri Mar 17 23:05:45 2000
Modified files:
      php-lib/doc/sgml/05-menu2.sgml
      php-lib/php/menu2.inc

Log message:
Updated Menu2 to enable user to unfold menu tree to the specified depth.

Index: php-lib/doc/sgml/05-menu2.sgml
diff -u php-lib/doc/sgml/05-menu2.sgml:1.1 php-lib/doc/sgml/05-menu2.sgml:1.2
--- php-lib/doc/sgml/05-menu2.sgml:1.1 Fri Feb 25 00:33:02 2000
+++ php-lib/doc/sgml/05-menu2.sgml Fri Mar 17 23:05:44 2000
@@ -1,4 +1,4 @@
-<!-- $Id: 05-menu2.sgml,v 1.1 2000/02/24 23:33:02 sasha Exp $ -->
+<!-- $Id: 05-menu2.sgml,v 1.2 2000/03/17 22:05:44 sasha Exp $ -->
 
 <sect1>Menu2
 <p>
@@ -7,17 +7,21 @@
 
 Menu2 will generate a hierarchical menu of clickable items suitable as a
 navigation bar. Menu2 takes a tree definition of items as the basis for
-this navigation bar, and can produce manus in a variety of different
+this navigation bar, and can produce menus in a variety of different
 formats (currently 3): tree (cascading), stacked rows, or a popular
 "you are here" format.
 
 Menu2 uses the current URL defined by <tt/PHP&lowbar;SELF/ to determine
 the current position in the menu automatically.
 
-Menu2 does not rely on the actual al organization of files on disk or in
+Menu2 does not rely on the actual organization of files on disk or in
 URL-space to generate a menu hierarchy. It uses a predefined mapping hash
 that maps menu items to their respective positions in the menu hierarchy.
 
+Menu2 by default keeps all subtrees folded except for one whose leaves
+are being accessed. User may choose to alter this by specifying a depth
+to which the tree should be unfolded.
+
 <sect2>Instance variables
 <p>
 
@@ -39,6 +43,10 @@
 $type<colsep>String. Defines the format of menu that will be generated.
 By default it is set to "tree", but can be set to one of "tree", "rows",
 or "urhere" by user. <rowsep>
+
+$subtree<colsep>Number. Defines the depth to which the tree should
+be unfolded if <tt>$type</tt> "tree" is chosen. The top menu level is
+considered depth zero (0).<rowsep>
 
 $str<colsep>String. Contains generated HTML code for the menu. <rowsep>
 
Index: php-lib/php/menu2.inc
diff -u php-lib/php/menu2.inc:1.1 php-lib/php/menu2.inc:1.2
--- php-lib/php/menu2.inc:1.1 Fri Feb 25 00:33:04 2000
+++ php-lib/php/menu2.inc Fri Mar 17 23:05:44 2000
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 1999,2000 Alex Vorobiev sasha <email protected>
  *
- * $Id: menu2.inc,v 1.1 2000/02/24 23:33:04 sasha Exp $
+ * $Id: menu2.inc,v 1.2 2000/03/17 22:05:44 sasha Exp $
  *
  */
 
@@ -24,6 +24,9 @@
   # type - type of menu (tree, urhere, rows), default to tree
   var $type = "tree";
 
+ # subtree - depth of tree to unfold by default
+ var $subtree = "";
+
   # str - final HTML code
   var $str = "";
 
@@ -104,6 +107,9 @@
           }
 
           $this->str .= $this->get_cell($k,$v,$d,$found);
+
+ # unfold subtrees if necessary
+ if (!$found && ($this->subtree > $d)) $found = 1;
 
           # recurse only if matched menu subtree
           if ($found && ($v[sub])) {

-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.