Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 826)
+++ trunk/CHANGELOG	(revision 827)
@@ -12,6 +12,7 @@
 
 ------------------------------------- 2.7.0 -------------------------------------
 14-Apr-2008 Christian Sommer
++	added show_menu2() to pre-installed WB modules (many thanks to Brodie Thiesfield for this great menu function replacment)
 !	allowed tags for multi-lingual module descriptions
 14-Apr-2008 Thomas Hornik
 #	fixed issue with multigroups (level 0 page-creation)
Index: trunk/wb/modules/show_menu2/info.php
===================================================================
--- trunk/wb/modules/show_menu2/info.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/info.php	(revision 827)
@@ -0,0 +1,47 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+    
+    THANKS
+    ======
+    Thanks to the following people:
+
+        Stuart Fraser
+          * Original request for a better menu system
+
+        Ezra Peisach
+          * Bug fixes
+
+        Thorn
+          * Added support for WB 2.7 multiple groups and publish by date
+    
+*/
+
+$module_directory = 'show_menu2';
+$module_name = 'show_menu2';
+$module_function = 'snippet';
+$module_version = '4.5';
+$module_platform = '2.6.x | 2.7.x';
+$module_author = 'Brodie Thiesfield';
+$module_license = 'GNU General Public License';
+$module_description = 'A code snippet for the Website Baker CMS providing a complete replacement for the builtin menu functions. See <a href="http://code.jellycan.com/show_menu2/" target="_blank">http://code.jellycan.com/show_menu2/</a> for details or view the <a href="' .WB_URL .'/modules/show_menu2/README" target="_blank">README</a> file.';
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/info.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/LICENCE
===================================================================
--- trunk/wb/modules/show_menu2/LICENCE	(nonexistent)
+++ trunk/wb/modules/show_menu2/LICENCE	(revision 827)
@@ -0,0 +1,278 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
Index: trunk/wb/modules/show_menu2/README_DE
===================================================================
--- trunk/wb/modules/show_menu2/README_DE	(nonexistent)
+++ trunk/wb/modules/show_menu2/README_DE	(revision 827)
@@ -0,0 +1,478 @@
+// $Id$
+
+show_menu2, version 4.5
+=======================
+Ist ein Code-Snippet für das CMS Website Baker. Es stellt einen kompletten Ersatz für die eingebaute Menüfuntionalität zur Verfügung. Alle für die Erzeugung des Menüs erforderlichen Daten werden durch eine einzige Datenbankabfrage erzeugt. Durch umfangreiche Anpassungsmöglichkeiten des erzeugten HTML-Code können alle möglichen Menüarten (Listen, Breadcrumbs, Sitemaps, usw.) erzeugt werden.
+
+---
+Deutsche Übersetzung von BerndJM. Dies ist eine weitgehend direkte Übersetzung des englischen Originals. Bei Übersetzungs- oder Interpretationsfehlern, bitte eine Email an bjm@wwnw.de.
+---
+
+INSTALLATION
+============
+1. Die aktuelle Version von http://code.jellycan.com/show_menu2/ herunterladen.
+2. In das Admin-Backend der Website Baker Installation einlogen.
+3. Erweiterungen -> Module aufrufen.
+4. Wenn bereits eine frühere Version von show_menu2 installiert ist, diese über "Modul deinstallieren" auswählen und deinstallieren.
+5. Im Abschnitt "Modul installieren" das im Schritt 1 heruntergeladene zip-File auswählen und installieren.
+
+   
+BENUTZUNG VON SHOW_MENU2
+========================
+Um show_menu2 zu benutzen muss das verwendete Template an den Stellen modifiziert werden, an denen das Menü erscheinen soll. Bitte beachten: Wenn alte Menüaufrufe ersetzt werden, müssen unbedingt auch die entsprechenden neuen Parameter verwendet werden die show_menu2 benötigt.
+
+In den meisten Fällen genügt bereits der Standardaufruf ohne weitere Parameter von show_menu2. In diesem Fall werden die Vorgabewerte verwendet, dies erzeugt ein Menü das die aktuelle Seite und die Unterseiten der aktuellen Seite anzeigt:
+    
+	show_menu2();
+    
+Bitte beachten: der Aufruf von show_menu2 ist PHP und muss normalerweise in PHP-Codezeichen eingeschlossen werden (ausser der Aufruf erfolgt bereits innerhalb von PHP Code):
+
+    <?php show_menu2(); ?>
+
+Dieses Vorgabe Menü erzeugt bereits ein komplettes Menü auf Listenbasis mit etlichen Klassen, die eine leichte Formatierung mittels CSS ermöglichen. Es wird z.B. die Klasse "menu-current" zu dem <li> Tag des aktuellen Menüpunktes hinzugefügt, zusätzlich erhält jeder Menüpunkt der Unterpunkte enthält die Klasse "menu-expand". Dies erlaubt es sehr differenzierte CSS Regeln für die einzelnen Menüpunkte aufzustellen.
+Zum Beispiel:
+
+    li.menu-expand  { font-weight: bold; }
+    li.menu-current { background: red; }
+
+Im Abschnitt "HTML-Ausgabe" findet sich eine detaillierte Beschreibung welche Klassen welchem Element zugeordnet werden. Durch die Verwendung von verschiedenen Parametern bei dem show_menu2 Funktionsaufruf lassen sich auch recht umfangreiche und unterschiedliche Menüstrukturen erzeugen. Um beispielsweise nur Menüpunkte aus der obersten Ebene der Menüstruktur darzustellen, könnte man folgenden Aufruf verwenden:
+
+    show_menu2(0, SM2_ROOT, SM2_START);
+    
+Oder um beispielsweise bis zu zwei Unterebenen der aktuellen Seite anzuzeigen:
+
+    show_menu2(0, SM2_CURR+1, SM2_CURR+2);
+
+Es gibt jede Menge Möglichkeiten, um die unterschiedlichten Menüstrukturen zu erzeugen, zahlreiche Beispiele dazu findet man auf der Demo-Website: http://code.jellycan.com/sm2test/
+
+
+FUNKTION
+========
+Der komplette Aufruf und die Vorgabe Parameterwerte für show_menu2 sind wie folgt:
+
+    show_menu2(
+        $aMenu          = 0,
+        $aStart         = SM2_ROOT,
+        $aMaxLevel      = SM2_CURR+1,
+        $aFlags         = SM2_TRIM,
+        $aItemOpen      = '[li][a][menu_title]</a>',
+        $aItemClose     = '</li>',
+        $aMenuOpen      = '[ul]',
+        $aMenuClose     = '</ul>',
+        $aTopItemOpen   = false,
+        $aTopMenuOpen   = false
+        )
+
+Im Abschnitt "Parameter" findet sich eine detaillierte Beschreibung jedes einzelnen Parameters.
+Ab $aItemOpen kann jedem Parameter der Wert false übergeben werden um den jeweiligen Vorgabewert zu erhalten.
+Dies kann beispielsweise verwendet werden um eine nummerierte Liste zu erzeugen, während für die einzelnen Menüpunkte trotzdem die Vorgabewerte Verwendung finden:
+
+show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, false, '<ol>', '</ol>');
+
+Bitte beachten: bis einschliessich $aFlags müssen alle Parameter explizit übergeben werden!
+
+
+HTML-AUSGABE
+============
+Die HTML-Ausgabe hängt wesentlich davon ab, welche Parameter an die Funktion übergeben werden. Unabhängig davon werden nachfolgende Klassen grundsätzlich für jedes Menü verwendet, wobei einzelne Menüpunkte, wenn erforderlich, auch mehrere Klassen erhalten können.
+
+    KLAssE          ZUORDNUNG
+    ------------    -------------------------------------------------------
+    menu-top        Nur der erste Menüpunkt
+    menu-parent     Jeder Hauptmenüpunkt.
+    menu-current    Nur der Menüpunkt der aktuellen Seite.
+    menu-sibling    Alle "Geschwister" der aktuellen Seite.
+    menu-child      Jedes Untermenü der aktuellen Seite.
+    menu-expand     Jedes Menü das Untermenüs hat.
+    menu-first      Der erste Punkt eines jeden Menüs oder Untermenüs.
+    menu-last       Der letzte Punkt eines jeden Menüs oder Untermenüs.
+
+    Folgende Klassen werden nur hinzugefügt, wenn das SM2_NUMCLAss flag gesetzt ist:
+
+    menu-N          Jeder Menüpunkt, wobei das N für die ABSOLUTE Menütiefe, 
+		    beginnend bei 0, des jeweiligen Menüpunktes steht.
+                    Die oberste Ebene ist also immer menu-0, die nächste
+                    Ebene menu-1 usw.
+    menu-child-N    Jedes Untermenü der aktuellen Seiten, wobei das N für die
+                    RELATIVE Tiefe des Untermenüs, beginnend bei 0, steht.
+        
+Beispiel einer HTML-Ausgabe:
+
+<ul class="menu-top menu-0">
+  <li class="menu-0 menu-first">  ... </li>
+  <li class="menu-0 menu-expand menu-parent">  ...
+  <ul class="menu-1">
+    <li class="menu-1 menu-expand menu-first">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-first">  ...
+      <li class="menu-2 menu-last">  ...
+    </ul>
+    </li>
+    <li class="menu-1 menu-expand menu-parent">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-expand menu-current menu-first">  ...      ** CURRENT PAGE **
+      <ul class="menu-3">
+        <li class="menu-3 menu-child menu-child-0 menu-first">  ...
+        <ul class="menu-4">
+          <li class="menu-4 menu-child menu-child-1 menu-first">  ... </li>
+          <li class="menu-4 menu-child menu-child-1 menu-last">  ... </li>
+        </ul>
+        </li>
+        <li class="menu-3 menu-child menu-child-0 menu-last">  ... </li>
+      </ul>
+      </li>
+      <li class="menu-2 menu-sibling menu-last">  ... </li>
+    </ul>
+    </li>
+    <li class="menu-1">  ... </li>
+    <li class="menu-1 menu-expand menu-last">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-first menu-last">  ... </li>
+    </ul>
+    </li>
+  </ul>
+  </li>
+  <li class="menu-0 menu-last">  ... </li>
+</ul>
+
+
+PARAMETER
+=========
+$aMenu      
+    Nummer des Menüs. Dies ist nützlich um mehrere Menüs auf einer Seite zu verwenden.
+    Menü Nummer 0 ist das Vorgabemenü der aktuellen Seite, SM2_ALLMENU gibt alle
+    im System verwendeten Menüs zurück.
+
+$aStart  
+    Gibt an, ab welcher Ebene die Erzeugung des Menüs beginnen soll. In den meisten
+    Fällen wird dies die oberste Ebene des anzuzeigenden Menüs sein. Es kann einer
+    der folgenden Werte verwendet werden:
+
+        SM2_ROOT+N  Beginnt N Ebenen unterhalb der obersten Ebene, z.B.:
+                      SM2_ROOT      Beginnt auf der obersten Ebene
+                      SM2_ROOT+1    Beginnt eine Ebene unterhalbe der obersten Ebene
+                      SM2_ROOT+2    Beginnt zwei Ebenen unterhalbe der obersten Ebene
+
+        SM2_CURR+N  Beginnt N Ebenen unterhalb der aktuellen Ebene, z.B.:
+                      SM2_CURR      Beginnt auf der aktuellen Ebene. Alle Geschwister
+                                    der aktuellen Ebene
+                      SM2_CURR+1    Beginnt eine Ebene unterhalb der aktuellen Ebene
+                                    mit allen Unterebenen
+
+        page_id     Verwendet die Seite mit der angegebenen page id als Elternelement.
+                    Alle Untermenüs dieser Seite werden angezeigt. (Die page id kann
+                    ermittelt werden, wenn man die Seite im Admin-Backend editiert,
+		    sie steht dann in der Adresszeile des Browsers:
+		    http://SITE/admin/pages/modify.php?page_id=35
+
+$aMaxLevel   
+    Die maximale Anzahl der Ebenen die angezeigt werden, die Anzeige
+    beginnt ab der in $aStart festgelegten Ebene bis hin zu der hier 
+    festgelegten Ebene.
+        
+	SM2_ALL      Keine Beschränkung, alle Ebenen werden angezeigt
+
+        SM2_CURR+N   Zeigt immer die aktuelle Seite + N Ebenen. 
+                        SM2_CURR      Aktuelle Ebene (keine Unterebene)
+                        SM2_CURR+3    Alle übergeordneten + aktuelle + 3 Unterebenen
+
+        SM2_START+N  Beginnt immer auf der Startebene + N Ebenen.
+                     Die Ebenen werden unabhängig davon angezeigt 
+                     auf welcher Ebene sich die aktuelle Seite befindet.
+		        SM2_START     Eine einzelne Ebene ab der Startebene
+                        SM2_START+1   Startebene + eine Ebene darunter
+
+        SM2_MAX+N    Zeigt höchstens N Ebenen ab der Startebene.
+                     Ebenen unterhalb der aktuellen Ebene werden nicht angezeigt.
+			SM2_MAX       Starting level only (same as SM2_START)
+                        SM2_MAX+1     Maximum of starting level and 1 level.
+
+$aFlags   
+    Spezielle Flags für verschiedene Menügenerierungs Optionen. Sie können mittels
+    einer ODER Verknüpfung (|) miteinander kombiniert werden. Um beispielsweise
+    sowohl TRIM als auch PRETTY zu definieren, verwendet man: SM2_TRIM|SM2_PRETTY.
+
+    GROUP 1
+    -------
+    Aus dieser Gruppe muss stets genau ein Flag angegeben werden. Diese Flags
+    bestimmen auf welche Weise die Geschwisterelemente im Menübaum in der
+    Ausgabe unterdrückt werden.
+    
+    SM2_ALL         Zeigt alle Zweige des Menübaums
+                        A-1 -> B-1 
+                            -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+                        A-2 -> B-3
+                            -> B-4
+
+    SM2_TRIM        Zeigt alle Geschwistermenüs der Seite im aktuellen Pfad.
+                    Alle Untermenüs von Elemnten die sich nicht im Pfad befinden
+                    werden entfernt.
+                        A-1 -> B-1 
+                            -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+                        A-2 
+
+    SM2_CRUMB       Zeigt den Breadcrumb Pfad des Menüs an, also den aktuellen
+                    Menüpunkt sowie alle Menüpunkte die dorthin führen.
+                        A-1 -> B-2 -> C-2 (CURRENT)
+
+    SM2_SIBLING     Wie SM2_TRIM, es werden aber nur Geschwistermenüs der aktuellen
+                    Seite angezeigt. Alle anderen Punkte werden unterdrückt.
+                        A-1 -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+
+    GROUP 2
+    -------
+    Diese Flags sind optional, sie können in beliebiger Anzahl kombiniert werden.
+
+    SM2_NUMCLAss    Fügt die nummerierten Menüklassen "menu-N" und 
+                    "menu-child-N hinzu.
+        
+    SM2_ALLINFO     Lädt alle Felder aus der Seitentabelle der Datenbank.
+                    Dies verursacht einen ziemlich hohen Speicherverbauch und sollte
+                    deshalb nur mit Bedacht verwendet werden.
+                    Dadurch werden z.B. die Keywords, die Seitenbeschreibung sowie
+                    all die anderen Informationen verfügbar, die normalerweise nicht
+                    geladen werden.
+                    Bitte beachten: dieses Flag muss beim ERSTEN Aufruf von schow_menu2
+                    für die jeweilige Menü ID verwendet werden, oder in Verbindung
+                    mit SM2_NOCACHE, sonst zeigt es keine Wirkung.
+    
+    SM2_NOCACHE     Die aus der Datenbank gelesenen Daten werden bei erneutem Aufruf von
+                    show_menu2 nicht wiederverwendet sondern erneut aus der Datenbank gelesen.
+    
+    SM2_PRETTY      Bringt die HTML-Ausgabe des Menüs mittels Leerzeichen und
+                    Zeilenumbrüchen in eine gut lesbare Form. Dies ist besonders nützlich
+                    beim Debuggen der Menüausgabe.
+    
+    SM2_BUFFER      Gibt den HTML-Code nicht direkt aus, sondern speichert ihn intern
+                    zwischen und gibt ihn al kompletten String aus.
+    
+    SM2_CURRTREE    Schliesst alle anderen Toplevelmenüs von der Betrachtung aus.
+                    Es werden nur Menüpunkte des aktuellen Menüzweiges dargestellt.
+                    Dieses Flag kann bei Bedarf mit jedem flag aus der Gruppe 1
+                    kombiniert werden.
+    
+    SM2_ESCAPE      Wendet htmlspecialchars auf den Menüstring an.
+                    Dies kann bei älteren Websitebaker Installationen erforderlich
+                    sein um eine valide HTML Ausgabe zu erzeugen.
+                        
+    SM2_NOESCAPE    Dies ist das Standarverhalten und existiert nur aus Gründen der 
+                    Abwärtskompatibiltät.                   
+
+$aItemOpen
+    Dies legt den Formatstring fest, mit dem jeder einzelne Menüeintrag begonnen
+    wird. Für den allerersten Menüeintrag kann mittels $aTopItemOpen ein anderer
+    Formatstring definiert werden.
+    Wenn dieser Parameter auf false gesetzt wird, wird der Vorgabe Formatstring
+    '[li][a][menu_title]</a>' verwendet um die Kompatibiltät zur Website Baker
+    Standardfunktion show_menu() zu gewährleiten.
+    Da die Formatierung mittels CSS-Klassen oftmals einfacher ist, wenn sie auf den 
+    <a> Tag angewendet werden, empfiehlt es sich hier folgenden Formatstring zu
+    verwenden: '<li>[ac][menu_title]</a>'.
+    
+    Dieser Parameter kann auch als Instanz eine Formatierungklasse für das Menü
+    verwendet werden. Im Abschnitt "Formatter" findet sich dazu eine detailierte 
+    Beschreibung. Wenn hier ein Formatter angegeben wird, werden alle Argumente
+    nach $aItenOpen ignoriert.
+
+$aItemClose
+    Dieser String schliesst jeden Menüpunkt ab. 
+    Bitte beachten: dies ist kein Formatstring und es werden keine Schlüsselworte
+    ersetzt!
+    Wenn dieser Parameter auf false gesetzt ist, wird die Vorgabe '</li>' verwendet.
+    
+$aMenuOpen
+    Mit diesem Formatstring wird eine Liste von Menüeinträgen geöffnet. Für das erste
+    Menü kann mittels $aTopMenuOpen ein davon abweichender Formatstring definiert
+    werden.
+    Wenn dieser Parameter auf false gesetzt ist wird der Vorgabewert '[ul]'
+    verwendet.
+    
+$aMenuClose
+    Dieser String schliesst jedes Menü ab. 
+    Bitte beachten: dies ist kein Formatstring und es werden keine Schlüsselworte
+    ersetzt!
+    Wenn dieser Parameter auf false gesetzt ist, wird die Vorgabe '</ul>' verwendet.
+
+$aTopItemOpen
+    Der Formatstring für den allerersten Menüpunkt. Wenn dieser Parameter auf false
+    gesetzt wird, wird der selbe Formatstring wie bei $aItemOpen verwendet.
+
+$aTopMenuOpen 
+    Der Formatstring für das erste Menü. Wenn dieser Parameter auf false
+    gesetzt wird, wird der selbe Formatstring wie bei $aMenuOpen verwendet.
+
+
+FORMAT STRINGS
+==============
+Die folgenden Tags können in den Formatstrings für $aItemOpen und $aMenuOpen
+verwendet werden und werden durch den entsprechenden Text ersetzt.
+
+[a]             <a> tag ohne Klasse:   '<a href="[url]" target="[target]">'
+[ac]            <a> tag mit Klasse:    '<a href="[url]" target="[target]" class="[class]">'
+[li]            <li> tag mit Klasse:   '<li class="[class]">'
+[ul]            <ul> tag mit Klasse:   '<ul class="[class]">'
+[class]         Liste der Klassen für diese Seite
+[menu_title]    Text des Menütitel (HTML entity escaped ausser das SM2_NOESCAPE Flag ist gesetzt)
+[page_title]    text des Seitentitel (HTML entity escaped ausser das SM2_NOESCAPE Flag ist gesetzt)
+[url]           die URL der Seiten für den <a> tag
+[target]        das Seitenziel für den <a> tag
+[page_id]       die Page ID des aktuellen Menüpunktes
+[parent]        die Page ID des übergeorneten Menüpunktes
+[level]         die Seitenebene, dies ist die gleiche Zahl die im "menu-N" CSS tag verwendet wird.
+[sib]           Anzahl der Geschwister des aktuellen Menüpunktes
+[sibCount]      Anzahl aller Geschwister in diesem Menü
+[if]            Bedingung (Details hierzu im Abschnitt "Bedingte Formatierung')
+
+Folgende tags sind nur verfügbar, wenn das SM2_ALLINFO flag gesetzt ist.
+
+[description]   Seitenbeschreibung
+[keywords]      Schlüsselworte der Seite
+
+
+BEDINGTE FORMATIERUNG
+=====================
+Die Anweisung für eine bedingte Formatierung kann eine der folgenden Formen haben:
+
+    [if(A){B}]
+    [if(A){B}else{C}]
+    
+    A   Die Bedingung. Details dazu, siehe unten.
+    
+    B   Der Ausdruck der verwendet wird, wenn die Bedingung erfüllt ist.
+        Dies kann ein beliebiger String sein, der jedoch nicht das Zeichen '}'
+        enthalten darf. Er kann jeden beliebigen Formatstring aus dem Abschnitt
+        'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das 
+        Zeichen '}' nicht erlaubt ist).
+    
+    C   Der Ausdruck der verwendet wird, wenn die Bedingung nicht erfüllt ist.
+        Dies kann ein beliebiger String sein, der jedoch nicht das zeichen '}'
+        enthalten darf. Er kann jeden beliebigen Formatstring aus dem Abschnitt
+        'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das 
+        Zeichen '}' nicht erlaubt ist).
+
+Die Bedingung ist eine Kombination von einem oder mehreren boolschen Vergleichen.
+Wenn mehr als ein Vergleich erforderlich ist, so muss dieser mit den anderen Vergleichen
+mittels || (boolsches oder - OR) oder && (boolsches und - AND) vernüpft werden.    
+
+Ein einzelner Vergleich besteht aus dem linken Operanden, dem Operator und dem rechten Operanden.
+z.B. X == Y  - hierbei ist X der linke Operand, == der Operator und Y der rechte Operand.
+    
+    Linker Operand. Muss eines der folgende Schlüsselworte sein:
+        class       Überprüfung ob diese Klasse existiert. Es sind nur die
+                    "==" and "!=" Operatoren erlaubt. In diesem Fall haben die Operatoren
+                    die Bedeutung von "enthält" bzw. "enthält nicht" an Stelle von
+                    "ist gleich" bzw. "ist nicht gleich"
+        level       Überprüfung der Seitenebene.
+        sib         Überprüfung der Geschwisteranzahl der aktuellen Seite.
+        sibCount    Überprüfung der Geamtanzahl der Geschwister im aktuellen Menü.
+        id          Überprüfung der page id.
+    
+    Operator. Muss einer der folgenden sein:
+        <           Kleiner als
+        <=          Kleiner oder gleich als
+        ==          Gleich
+        !=          Nicht gleich
+        >=          Grössr oder gleich als
+        >           grösser als
+    
+    Rechter Operand. Die Art dieses Operanden hängt von dem, für den linken Operanden
+                     verwendeten Schlüsselwort ab.
+        class       einer der "menu-*" Klassennamen wie sie im Abschnitt "Ausgabe"
+                    spezifiziert sind.
+        level       Überprüfung der Seitenebene gegen folgende Werte:
+                      <number>  die absolute Seitenebene
+                      root      die oberste Seitenebene
+                      granny    die Seitenebene über der übergeordneten Seitenebene
+                      parent    die übergeordnete Seitenebene
+                      current   die aktuelle Seitenebene
+                      child     die untergeornete Seitenebene
+        id          Überprüfung der page id gegen folgende Werte:
+                      <number>  die absolute page id
+                      parent    die übergeordnete page id
+                      current   die aktuelle page id
+        sib         Eine positive Integerzahl, oder "sibCount" um die Anzahl der
+                    Geschwister in diesem Menü zu überprüfen
+        sibCount    Eine positive Integerzahl
+        
+Folgende Beispiele ergeben "wahr" und der Ausdruck {exp} wird ausgeführt, wenn zutrifft:
+    
+    [if(class==menu-expand){exp}]   hat ein Untermenü
+    [if(class==menu-first){exp}]    ist der erste Eintrag in einem Menü
+    [if(class!=menu-first){exp}]    ist NICHT der erste Eintrag in einem Menü
+    [if(class==menu-last){exp}]     ist der letzte Eintrag in einem Menü
+    [if(level==0){exp}]             befindet sich auf der obersten Ebene
+    [if(level>0){exp}]              befindet sich NICHT auf der obersten Ebene
+    [if(sib==2){exp}]               ist der zweite Eintrag in einem Menü
+    [if(sibCount>1){exp}]           ist in einem Menü mit mehr als einem Eintrag
+    [if(sibCount!=2){exp}]          ist in einem Menü, das nicht genau 2 Einträge hat
+    [if(level>parent){exp}]         ist ine eine Geschwistermenü oder dem Untermenü eines Geschwistermenüs
+    [if(id==parent){exp}]           ist der übergeordnete Punkt der aktuellen id
+
+Wenn eine sonst-Klausel (else) hinzugefügt wird, so wird diese in allen anderen Fällen ausgeführt.
+Zum Beispiel wird "foo" immer dann ausgeführt, wenn die if Überprüfung falsch ergibt, also:
+
+    [if(sib==2){exp}else{foo}]      ist NICHT der zweite Eintrag im Menü
+    [if(sibCount>2){exp}else{foo}]  ist NICHT in einem Menü mit mehr als zwei Einträgen
+
+Bei mehrfach Vergleichen wird der Ausdruck "exp" nur ausgeführt, wenn:
+
+    [if(sib == 1 || sib > 3){exp}]  ist der erste Eintrag ODER ist der vierte oder höhere Eintrag im Menü    
+               
+    [if(id == current && class == menu-expand){exp}  ist der aktuelle Eintrag UND hat Untermenüs
+        
+Bitte beachten:
+Alle Überprüfungen werden in der Reihenfolge ausgeführt, in der sie notiert sind, denn:
+* es findet keine Überprüfung auf evtl. Schleifen statt (alle Überprüfungen werden immer ausgeführt)
+* Überprüfungen werden nicht gruppiert (eine Klammerung von Überprüfungen wird nicht unterstützt)
+* sowohl || als auch && haben die gleiche Wertigkeit
+
+FORMATTER
+=========
+Achtung: dies ist ein fortgeschrittenes und äusserst selten benötigtes Feature!
+
+Mit umfangreichen Kenntnissen in der PHP Programmierung ist es möglich den vordefinierten
+Formatierer von show_menu2 mit einem eigenen zu ersetzen.
+In der include.php von show_menu2 sieht man wie der Formatierer geschreiben werden muss.
+Die API die verwendet werden muss sieht wie folgt aus:
+
+(Anmerkung des Übersetzers: Kommentare nicht übersetzt, wer sich so weit vorwagt, sollte
+damit keine Probleme haben ;-)
+
+class SM2_Formatter
+{
+    // called once before any menu is processed to allow object initialization
+    function initialize() { }
+    
+    // called to open the menu list
+    function startList($aPage, $aUrl) { }
+    
+    // called to open the menu item
+    function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { }
+    
+    // called to close the menu item
+    function finishItem() { }
+    
+    // called to close the menu list
+    function finishList() { }
+    
+    // called once after all menu has been processed to allow object finalization
+    function finalize() { }
+    
+    // called once after finalize() if the SM2_NOOUTPUT flag is used
+    function getOutput() { }
+};
+
+
+

Property changes on: trunk/wb/modules/show_menu2/README_DE
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/languages/index.php
===================================================================
--- trunk/wb/modules/show_menu2/languages/index.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/languages/index.php	(revision 827)
@@ -0,0 +1,27 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+*/
+
+header('Location: ../index.php');
+
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/languages/index.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/languages/DE.php
===================================================================
--- trunk/wb/modules/show_menu2/languages/DE.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/languages/DE.php	(revision 827)
@@ -0,0 +1,28 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+*/
+
+// Deutsche Modulbeschreibung
+$module_description = 'Dieses Modul integriert die erweiterte Men&uuml;funktion <code>show_menu2()</code> in Website Baker. Detailierte Informationen gibt es auf <a href="http://code.jellycan.com/show_menu2/" target="_blank">http://code.jellycan.com/show_menu2/</a> oder in der <a href="{WB_URL}/modules/show_menu2/README_DE" target="_blank">README</a> Datei.';
+
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/languages/DE.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/include.php
===================================================================
--- trunk/wb/modules/show_menu2/include.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/include.php	(revision 827)
@@ -0,0 +1,770 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+
+    ***********************************************
+    ** Version 4.5: see README for documentation **
+    ***********************************************
+*/
+
+define('SM2_ROOT',       -1000);
+define('SM2_CURR',       -2000);
+define('SM2_ALLMENU',       -1);
+define('SM2_START',       1000);
+define('SM2_MAX',         2000);
+define('SM2_ALL',       0x0001); // bit 0 (group 1) (Note: also used for max level!)
+define('SM2_TRIM',      0x0002); // bit 1 (group 1)
+define('SM2_CRUMB',     0x0004); // bit 2 (group 1)
+define('SM2_SIBLING',   0x0008); // bit 3 (group 1)
+define('SM2_NUMCLASS',  0x0010); // bit 4
+define('SM2_ALLINFO',   0x0020); // bit 5
+define('SM2_NOCACHE',   0x0040); // bit 6
+define('SM2_PRETTY',    0x0080); // bit 7
+define('SM2_ESCAPE',    0x0100); // bit 8
+define('SM2_NOESCAPE',       0); // NOOP, unnecessary with WB 2.6.7+
+define('SM2_BUFFER',    0x0200); // bit 9
+define('SM2_CURRTREE',  0x0400); // bit 10
+
+define('_SM2_GROUP_1',  0x000F); // exactly one flag from group 1 is required
+
+
+// Implement support for page_menu and show_menu using show_menu2. If you remove
+// the comments characters from the beginning of the following include, all menu
+// functions in Website Baker will be implemented using show_menu2. While it is
+// commented out, the original WB functions will be used.
+//include('legacy.php');
+
+// This class is the default menu formatter for sm2. If desired, you can 
+// create your own formatter class and pass the object into show_menu2 
+// as $aItemFormat.
+define('SM2_CONDITIONAL','if\s*\(([^\)]+)\)\s*{([^}]*)}\s*(?:else\s*{([^}]*)}\s*)?');
+define('SM2_COND_TERM','\s*(\w+)\s*(<|<=|==|=|=>|>|!=)\s*([\w\-]+)\s*');
+class SM2_Formatter
+{
+    var $output;
+    var $flags;
+    var $itemOpen;
+    var $itemClose;
+    var $menuOpen;
+    var $menuClose;
+    var $topItemOpen;
+    var $topMenuOpen;
+    
+    var $isFirst;
+    var $page;
+    var $url;
+    var $currSib;
+    var $sibCount;
+    var $currClass;
+    var $prettyLevel;
+
+    // output the data
+    function output($aString) {
+        if ($this->flags & SM2_BUFFER) {
+            $this->output .= $aString;
+        }
+        else {
+            echo $aString;
+        }
+    }
+    
+    // set the default values for all of our formatting items
+    function set($aFlags, $aItemOpen, $aItemClose, $aMenuOpen, $aMenuClose, $aTopItemOpen, $aTopMenuOpen) {
+        $this->flags        = $aFlags;
+        $this->itemOpen     = is_string($aItemOpen)    ? $aItemOpen    : '[li][a][menu_title]</a>';
+        $this->itemClose    = is_string($aItemClose)   ? $aItemClose   : '</li>';
+        $this->menuOpen     = is_string($aMenuOpen)    ? $aMenuOpen    : '[ul]';
+        $this->menuClose    = is_string($aMenuClose)   ? $aMenuClose   : '</ul>';
+        $this->topItemOpen  = is_string($aTopItemOpen) ? $aTopItemOpen : $this->itemOpen;
+        $this->topMenuOpen  = is_string($aTopMenuOpen) ? $aTopMenuOpen : $this->menuOpen;
+    }
+
+    // initialize the state of the formatter before anything is output
+    function initialize() {
+        $this->output = '';
+        $this->prettyLevel = 0;
+        if ($this->flags & SM2_PRETTY) {
+            $this->output("\n<!-- show_menu2 -->");
+        }
+    }
+
+    // start a menu     
+    function startList(&$aPage, &$aUrl) {
+        $currClass = '';
+        $currItem = $this->menuOpen;
+        
+        // use the top level menu open if this is the first menu
+        if ($this->topMenuOpen) {
+            $currItem = $this->topMenuOpen;
+            $currClass .= ' menu-top';
+            $this->topMenuOpen = false;
+        }
+        
+        // add the numbered menu class only if requested
+        if (($this->flags & SM2_NUMCLASS) == SM2_NUMCLASS) {
+            $currClass .= ' menu-'.$aPage['level'];
+        }
+        
+        $this->prettyLevel += 1;
+        
+        // replace all keywords in the output
+        if ($this->flags & SM2_PRETTY) {
+            $this->output("\n".str_repeat(' ',$this->prettyLevel).
+                $this->format($aPage, $aUrl, $currItem, $currClass));
+        }
+        else {
+            $this->output($this->format($aPage, $aUrl, $currItem, $currClass));
+        }
+        
+        $this->prettyLevel += 3;
+    }
+    
+    // start an item within the menu
+    function startItem(&$aPage, &$aUrl, $aCurrSib, $aSibCount) {
+        // generate our class list
+        $currClass = '';
+        if (($this->flags & SM2_NUMCLASS) == SM2_NUMCLASS) {
+            $currClass .= ' menu-'.$aPage['level'];
+        }
+        if (array_key_exists('sm2_has_child', $aPage)) {
+            // not set if false, so existence = true
+            $currClass .= ' menu-expand';
+        }
+        if ($aPage['page_id'] == PAGE_ID) {
+            $currClass .= ' menu-current';
+        }
+        elseif (array_key_exists('sm2_is_parent', $aPage)) { 
+            // not set if false, so existence = true
+            $currClass .= ' menu-parent';
+        }
+        elseif (array_key_exists('sm2_is_sibling', $aPage)) {
+            // not set if false, so existence = true
+            $currClass .= ' menu-sibling';
+        }
+        elseif (array_key_exists('sm2_child_level',$aPage)) {
+            // not set if not a child
+            $currClass .= ' menu-child';
+            if (($this->flags & SM2_NUMCLASS) == SM2_NUMCLASS) {
+                $currClass .= ' menu-child-'.($aPage['sm2_child_level']-1);
+            }
+        }
+        if ($aCurrSib == 1) {
+            $currClass .= ' menu-first';
+        }
+        if ($aCurrSib == $aSibCount) {
+            $currClass .= ' menu-last';
+        }
+
+        // use the top level item if this is the first item
+        $currItem = $this->itemOpen;
+        if ($this->topItemOpen) {
+            $currItem = $this->topItemOpen;
+            $this->topItemOpen = false;
+        }
+
+        // replace all keywords in the output
+        if ($this->flags & SM2_PRETTY) {
+            $this->output("\n".str_repeat(' ',$this->prettyLevel));
+        }
+        $this->output($this->format($aPage, $aUrl, $currItem, $currClass, $aCurrSib, $aSibCount));
+    }
+    
+    // find and replace all keywords, setting the state variables first
+    function format(&$aPage, &$aUrl, &$aCurrItem, &$aCurrClass, 
+        $aCurrSib = 0, $aSibCount = 0) 
+    {
+        $this->page      = &$aPage;
+        $this->url       = &$aUrl;
+        $this->currClass = trim($aCurrClass);
+        $this->currSib   = $aCurrSib;
+        $this->sibCount  = $aSibCount;
+        
+        $item = $this->format2($aCurrItem);
+        
+        unset($this->page);
+        unset($this->url);
+        unset($this->currClass);
+        
+        return $item;
+    }
+    
+    // find and replace all keywords
+    function format2(&$aCurrItem) {
+        if (!is_string($aCurrItem)) return '';
+        return preg_replace(
+            '@\[('.
+                'a|ac|/a|li|/li|ul|/ul|menu_title|page_title|url|target|page_id|'.
+                'parent|level|sib|sibCount|class|description|keywords|'.
+                SM2_CONDITIONAL.
+            ')\]@e', 
+            '$this->replace("\1")', $aCurrItem);
+    }
+    
+    // replace the keywords
+    function replace($aMatch) {
+        switch ($aMatch) {
+        case 'a':
+            return '<a href="'.$this->url.'" target="'.$this->page['target'].'">';
+        case 'ac':
+            return '<a href="'.$this->url.'" target="'.$this->page['target'].'" class="'.$this->currClass.'">';
+        case '/a':
+            return '</a>';
+        case 'li':
+            return '<li class="'.$this->currClass.'">';
+        case '/li':
+            return '</li>';
+        case 'ul':
+            return '<ul class="'.$this->currClass.'">';
+        case '/ul':
+            return '</ul>';
+        case 'url':
+            return $this->url;
+        case 'sib':
+            return $this->currSib;
+        case 'sibCount':
+            return $this->sibCount;
+        case 'class':
+            return $this->currClass;
+        default:
+            if (array_key_exists($aMatch, $this->page)) {
+                if ($this->flags & SM2_ESCAPE) {
+                    return htmlspecialchars($this->page[$aMatch], ENT_QUOTES);
+                }
+                else {
+                    return $this->page[$aMatch];
+                }
+            }
+            if (preg_match('/'.SM2_CONDITIONAL.'/', $aMatch, $rgMatches)) {
+                return $this->replaceIf($rgMatches[1], $rgMatches[2], $rgMatches[3]);
+            }
+        }
+        return "[$aMatch=UNKNOWN]";
+    }
+    
+    // conditional replacement
+    function replaceIf(&$aExpression, &$aIfValue, &$aElseValue) {
+        // evaluate all of the tests in the conditional (we don't do short-circuit
+        // evaluation) and replace the string test with the boolean result
+        $rgTests = preg_split('/(\|\||\&\&)/', $aExpression, -1, PREG_SPLIT_DELIM_CAPTURE);
+        for ($n = 0; $n < count($rgTests); $n += 2) {
+            if (preg_match('/'.SM2_COND_TERM.'/', $rgTests[$n], $rgMatches)) {
+                $rgTests[$n] = $this->ifTest($rgMatches[1], $rgMatches[2], $rgMatches[3]);
+            }
+            else {
+                error_log("show_menu2 error: conditional expression is invalid!");
+                $rgTests[$n] = false;
+            }
+        }
+
+        // combine all test results for a final result
+        $ok = $rgTests[0];
+        for ($n = 1; $n+1 < count($rgTests); $n += 2) {
+            if ($rgTests[$n] == '||') {
+                $ok = $ok || $rgTests[$n+1];
+            }
+            else {
+                $ok = $ok && $rgTests[$n+1];
+            }
+        }
+        
+        // return the formatted expression if the test succeeded
+        return $ok ? $this->format2($aIfValue) : $this->format2($aElseValue);
+    }
+
+    // conditional test
+    function ifTest(&$aKey, &$aOperator, &$aValue) {
+        global $wb;
+        
+        // find the correct operand
+        $operand = false;
+        switch($aKey) {
+        case 'class':
+            // we need to wrap the class names in spaces so we can test for a unique
+            // class name that will not match prefixes or suffixes. Same must be done
+            // for the value we are testing.
+            $operand = " $this->currClass "; 
+            break;
+        case 'sib':
+            $operand = $this->currSib;
+            if ($aValue == 'sibCount') {
+                $aValue = $this->sibCount;
+            }
+            break;
+        case 'sibCount':
+            $operand = $this->sibCount;
+            break;
+        case 'level':
+            $operand = $this->page['level'];
+            switch ($aValue) {
+            case 'root':    $aValue = 0; break;
+            case 'granny':  $aValue = $wb->page['level']-2; break;
+            case 'parent':  $aValue = $wb->page['level']-1; break;
+            case 'current': $aValue = $wb->page['level'];   break;
+            case 'child':   $aValue = $wb->page['level']+1; break;
+            }
+            if ($aValue < 0) $aValue = 0;
+            break;
+        case 'id':
+            $operand = $this->page['page_id'];
+            switch ($aValue) {
+            case 'parent':  $aValue = $wb->page['parent'];  break;
+            case 'current': $aValue = $wb->page['page_id']; break;
+            }
+            break;
+        default:
+            return '';
+        }
+
+        // do the test        
+        $ok = false;
+        switch ($aOperator) { 
+        case '<':
+            $ok = ($operand < $aValue); 
+            break;
+        case '<=':
+            $ok = ($operand <= $aValue); 
+            break;
+        case '=':
+        case '==':
+        case '!=':
+            if ($aKey == 'class') {
+                $ok = strstr($operand, " $aValue ") !== FALSE;
+            }
+            else {
+                $ok = ($operand == $aValue); 
+            }
+            if ($aOperator == '!=') {
+                $ok = !$ok;
+            }
+            break;
+        case '>=':
+            $ok = ($operand >= $aValue); 
+        case '>':
+            $ok = ($operand > $aValue); 
+        }
+        
+        return $ok;
+    }
+    
+    // finish the current menu item
+    function finishItem() {
+        if ($this->flags & SM2_PRETTY) {
+            $this->output(str_repeat(' ',$this->prettyLevel).$this->itemClose);
+        }
+        else {
+            $this->output($this->itemClose);
+        }
+    }
+    
+    // finish the current menu
+    function finishList() {
+        $this->prettyLevel -= 3;
+        
+        if ($this->flags & SM2_PRETTY) {
+            $this->output("\n".str_repeat(' ',$this->prettyLevel).$this->menuClose."\n");
+        }
+        else {
+            $this->output($this->menuClose);
+        }
+        
+        $this->prettyLevel -= 1;
+    }
+    
+    // cleanup the state of the formatter after everything has been output
+    function finalize() {
+        if ($this->flags & SM2_PRETTY) {
+            $this->output("\n");
+        }
+    }
+
+    // return the output
+    function getOutput() {
+        return $this->output;
+    }
+};
+
+function show_menu2(
+    $aMenu          = 0,
+    $aStart         = SM2_ROOT,
+    $aMaxLevel      = -1999, // SM2_CURR+1
+    $aFlags         = SM2_TRIM,
+    $aItemOpen      = false,
+    $aItemClose     = false,
+    $aMenuOpen      = false,
+    $aMenuClose     = false,
+    $aTopItemOpen   = false,
+    $aTopMenuOpen   = false
+    )
+{
+    global $wb;
+
+    // ensure we have our group 1 flag, we don't check for the "exactly 1" part, but 
+    // we do ensure that they provide at least one.
+    if (0 == ($aFlags & _SM2_GROUP_1)) {
+        error_log("show_menu2 error: no flags from group 1 supplied! Exactly one flag is required!");
+        $aFlags |= SM2_TRIM; // default to TRIM
+    }
+    
+    // fix up the menu number to default to the menu number
+    // of the current page if no menu has been supplied
+    if ($aMenu == 0) {
+        $aMenu = $wb->page['menu'] == '' ? 1 : $wb->page['menu'];
+    } 
+
+    // Set some of the $wb->page[] settings to defaults if not set
+    $pageLevel = $wb->page['level'] == '' ? 0 : $wb->page['level'];
+    $pageParent = $wb->page['parent'] == '' ? 0 : $wb->page['parent'];
+    
+    // adjust the start level and start page ID as necessary to
+    // handle the special values that can be passed in as $aStart
+    $aStartLevel = 0;
+    if ($aStart < SM2_ROOT) {   // SM2_CURR+N
+        if ($aStart == SM2_CURR) {
+            $aStartLevel = $pageLevel;
+            $aStart =  $pageParent;
+        }
+        else {
+            $aStartLevel = $pageLevel + $aStart - SM2_CURR;
+            $aStart = PAGE_ID; 
+        }
+    }
+    elseif ($aStart < 0) {   // SM2_ROOT+N
+        $aStartLevel = $aStart - SM2_ROOT;
+        $aStart = 0;
+    }
+
+    // we get the menu data once and store it in a global variable. This allows 
+    // multiple calls to show_menu2 in a single page with only a single call to 
+    // the database. If this variable exists, then we have already retrieved all
+    // of the information and processed it, so we don't need to do it again.
+    if (($aFlags & SM2_NOCACHE) != 0
+        || !array_key_exists('show_menu2_data', $GLOBALS) 
+        || !array_key_exists($aMenu, $GLOBALS['show_menu2_data'])) 
+    {
+        global $database;
+
+        // create an array of all parents of the current page. As the page_trail
+        // doesn't include the theoretical root element 0, we add it ourselves.
+        $rgCurrParents = split(',', '0,'.$wb->page['page_trail']);
+        array_pop($rgCurrParents); // remove the current page
+        $rgParent = array();
+
+        // if the caller wants all menus gathered together (e.g. for a sitemap)
+        // then we don't limit our SQL query
+        $menuLimitSql = ' AND menu = ' .$aMenu;
+        if ($aMenu == SM2_ALLMENU) {
+            $menuLimitSql = '';
+        }
+
+        // we only load the description and keywords if we have been told to,
+        // this cuts the memory load for pages that don't use them. Note that if
+        // we haven't been told to load these fields the *FIRST TIME* show_menu2
+        // is called (i.e. where the database is loaded) then the info won't
+        // exist anyhow.
+        $fields = 'parent,page_id,menu_title,page_title,link,target,level,visibility,viewing_groups';
+        if(version_compare(WB_VERSION, '2.7', '>=')) { // WB 2.7+
+            $fields .= ',viewing_users';
+        }
+        if ($aFlags & SM2_ALLINFO) {
+            $fields = '*';
+        }
+        
+        // get this once for performance. We really should be calling only need to
+        // call $wb->get_group_id() but that outputs a warning notice if the 
+        // groupid isn't set in the session, so we check it first here.
+        $currGroup = array_key_exists('GROUP_ID', $_SESSION) ? 
+            ','.$wb->get_group_id().',' : 'NOGROUP';
+        
+        // we request all matching rows from the database for the menu that we 
+        // are about to create it is cheaper for us to get everything we need 
+        // from the database once and create the menu from memory then make 
+        // multiple calls to the database. 
+        $sql = "SELECT $fields FROM ".TABLE_PREFIX.
+               "pages WHERE $wb->extra_where_sql $menuLimitSql ".
+               'ORDER BY level ASC, position ASC';
+        $oRowset = $database->query($sql);
+        if (is_object($oRowset) && $oRowset->numRows() > 0) {
+            // create an in memory array of the database data based on the item's parent. 
+            // The array stores all elements in the correct display order.
+            while ($page = $oRowset->fetchRow()) {
+				// ignore all pages that the current user is not permitted to view
+                if(version_compare(WB_VERSION, '2.7', '>=')) { // WB >= 2.7
+                    // 1. all pages with no active sections (unless it is the top page) are ignored
+                    if(!$wb->page_is_active($page) && $page['link'] != $wb->default_link && !INTRO_PAGE) {
+                      continue; 
+                    }
+                    // 2. all pages not visible to this user (unless always visible to registered users) are ignored
+                    if(!$wb->page_is_visible($page) && $page['visibility'] != 'registered') {
+                        continue;
+                    }
+
+                }
+                else {  // WB < 2.7
+                    // We can't do this in SQL as the viewing_groups column contains multiple 
+                    // values which are hard to process correctly in SQL. Essentially we add the
+                    // following limit to the SQL query above:
+                    //  (visibility <> "private" OR $wb->get_group_id() IN viewing_groups)
+                    if ($page['visibility'] == 'private' 
+                        && false === strstr(",{$page['viewing_groups']},", $currGroup)) 
+                    {
+                        continue;
+                    }
+                }
+
+                // ensure that we have an array entry in the table to add this to
+                $idx = $page['parent'];
+                if (!array_key_exists($idx, $rgParent)) {
+                    $rgParent[$idx] = array();
+                }
+
+                // mark our current page as being on the current path
+                if ($page['page_id'] == PAGE_ID) {
+                    $page['sm2_on_curr_path'] = true;
+                }
+
+                // mark parents of the current page as such
+                if (in_array($page['page_id'], $rgCurrParents)) {
+                    $page['sm2_is_parent'] = true;
+                    $page['sm2_on_curr_path'] = true;
+                }
+                
+                // add the entry to the array                
+                $rgParent[$idx][] = $page;
+            }
+        }    
+        unset($oRowset);
+
+        // mark all elements that are siblings of any element on the current path
+        foreach ($rgCurrParents as $x) {
+            if (array_key_exists($x, $rgParent)) {
+                foreach (array_keys($rgParent[$x]) as $y) {
+                    $mark =& $rgParent[$x][$y];
+                    $mark['sm2_path_sibling'] = true;
+                    unset($mark);
+                }
+            }
+        }
+
+        // mark all elements that have children and are siblings of the current page
+        $parentId = $pageParent;
+        foreach (array_keys($rgParent) as $x) {
+            $childSet =& $rgParent[$x];
+            foreach (array_keys($childSet) as $y) {
+                $mark =& $childSet[$y];
+                if (array_key_exists($mark['page_id'], $rgParent)) {
+                    $mark['sm2_has_child'] = true;
+                }
+                if ($mark['parent'] == $parentId && $mark['page_id'] != PAGE_ID) {
+                    $mark['sm2_is_sibling'] = true;
+                }
+                unset($mark);
+            }
+            unset($childSet);
+        }
+        
+        // mark all children of the current page. We don't do this when 
+        // PAGE_ID is 0, as 0 is the parent of everything. PAGE_ID == 0 
+        // occurs on special pages like search results.
+        if (PAGE_ID != 0) {
+            sm2_mark_children($rgParent, PAGE_ID, 1);
+        }
+        
+        // store the complete processed menu data as a global. We don't 
+        // need to read this from the database anymore regardless of how 
+        // many menus are displayed on the same page.
+        if (!array_key_exists('show_menu2_data', $GLOBALS)) {
+            $GLOBALS['show_menu2_data'] = array();
+        }
+        $GLOBALS['show_menu2_data'][$aMenu] =& $rgParent;
+        unset($rgParent);
+    }
+
+    // adjust $aMaxLevel to the level number of the final level that 
+    // will be displayed. That is, we display all levels <= aMaxLevel.
+    if ($aMaxLevel == SM2_ALL) {
+        $aMaxLevel = 1000;
+    }
+    elseif ($aMaxLevel < 0) {   // SM2_CURR+N
+        $aMaxLevel += $pageLevel - SM2_CURR;
+    }
+    elseif ($aMaxLevel >= SM2_MAX) { // SM2_MAX+N
+        $aMaxLevel += $aStartLevel - SM2_MAX;
+        if ($aMaxLevel > $pageLevel) {
+            $aMaxLevel = $pageLevel;
+        }
+    }
+    else {  // SM2_START+N
+        $aMaxLevel += $aStartLevel - SM2_START;
+    }
+
+    // generate the menu
+    $retval = false;
+    if (array_key_exists($aStart, $GLOBALS['show_menu2_data'][$aMenu])) {
+        $formatter = $aItemOpen;
+        if (!is_object($aItemOpen)) {
+            static $sm2formatter;
+            if (!isset($sm2formatter)) {
+                $sm2formatter = new SM2_Formatter;
+            }
+            $formatter = $sm2formatter;
+            $formatter->set($aFlags, $aItemOpen, $aItemClose, 
+                $aMenuOpen, $aMenuClose, $aTopItemOpen, $aTopMenuOpen);
+        }
+        
+        // display the menu
+        $formatter->initialize();
+        sm2_recurse(
+            $GLOBALS['show_menu2_data'][$aMenu],
+            $aStart,    // parent id to start displaying sub-menus
+            $aStartLevel, $aMaxLevel, $aFlags, 
+            $formatter);
+        $formatter->finalize();
+        
+        // if we are returning something, get the data
+        if (($aFlags & SM2_BUFFER) != 0) {
+            $retval = $formatter->getOutput();
+        }
+    }
+
+    // clear the data if we aren't caching it
+    if (($aFlags & SM2_NOCACHE) != 0) {
+        unset($GLOBALS['show_menu2_data'][$aMenu]);
+    }
+    
+    return $retval;
+}
+
+function sm2_mark_children(&$rgParent, $aStart, $aChildLevel)
+{
+    if (array_key_exists($aStart, $rgParent)) {
+        foreach (array_keys($rgParent[$aStart]) as $y) {
+            $mark =& $rgParent[$aStart][$y];
+            $mark['sm2_child_level'] = $aChildLevel;
+            $mark['sm2_on_curr_path'] = true;
+            sm2_mark_children($rgParent, $mark['page_id'], $aChildLevel+1);
+        }
+    }
+}
+
+function sm2_recurse(
+    &$rgParent, $aStart, 
+    $aStartLevel, $aMaxLevel, $aFlags, 
+    &$aFormatter
+    )
+{
+    global $wb;
+
+    // on entry to this function we know that there are entries for this 
+    // parent and all entries for that parent are being displayed. We also 
+    // need to check if any of the children need to be displayed too.
+    $isListOpen = false;
+    $currentLevel = $wb->page['level'] == '' ? 0 : $wb->page['level'];
+    
+    // get the number of siblings so we can check pass this and check if the 
+    // item is first or last
+    $sibCount = count($rgParent[$aStart]);
+    $currSib = 0;
+    foreach ($rgParent[$aStart] as $page) {
+        $currSib++;
+
+        // skip any elements that are lower than the maximum level
+        $pageLevel = $page['level'];
+        if ($pageLevel > $aMaxLevel) {
+            continue;
+        }
+        
+        // this affects ONLY the top level
+        if ($aStart == 0 && ($aFlags & SM2_CURRTREE)) {
+            if (!array_key_exists('sm2_on_curr_path', $page)) { // not set if false, so existence = true
+                continue;
+            }
+            $sibCount = 1;
+        }
+        
+        // trim the tree as appropriate
+        if ($aFlags & SM2_SIBLING) {
+            // parents, and siblings and children of current only
+            if (!array_key_exists('sm2_on_curr_path', $page)      // not set if false, so existence = true
+                && !array_key_exists('sm2_is_sibling', $page)     // not set if false, so existence = true
+                && !array_key_exists('sm2_child_level', $page)) { // not set if false, so existence = true
+                continue;
+            }
+        }
+        else if ($aFlags & SM2_TRIM) {
+            // parents and siblings of parents
+            if (!array_key_exists('sm2_on_curr_path', $page)    // not set if false, so existence = true
+                && !array_key_exists('sm2_path_sibling', $page)) {  // not set if false, so existence = true
+                continue;
+            }
+        }
+        elseif ($aFlags & SM2_CRUMB) {
+            // parents only
+            if (!array_key_exists('sm2_on_curr_path', $page)    // not set if false, so existence = true
+                || array_key_exists('sm2_child_level', $page)) {  // not set if false, so existence = true
+                continue;
+            }
+        }
+
+        // depth first traverse
+        $nextParent = $page['page_id'];
+
+        // display the current element if we have reached the start level
+        if ($pageLevel >= $aStartLevel) {
+            // massage the link into the correct form
+            if(!INTRO_PAGE && $page['link'] == $wb->default_link) {
+                $url = WB_URL;
+            }
+            else {
+                $url = $wb->page_link($page['link']);
+            }
+                    
+            // we open the list only when we absolutely need to
+            if (!$isListOpen) {
+                $aFormatter->startList($page, $url);
+                $isListOpen = true;
+            }
+
+            $aFormatter->startItem($page, $url, $currSib, $sibCount);
+        }
+        
+        // display children as appropriate
+        if ($pageLevel + 1 <= $aMaxLevel 
+            && array_key_exists('sm2_has_child', $page)) {  // not set if false, so existence = true
+            sm2_recurse(
+                $rgParent, $nextParent, // parent id to start displaying sub-menus
+                $aStartLevel, $aMaxLevel, $aFlags, 
+                $aFormatter);
+        }
+        
+        // close the current element if appropriate
+        if ($pageLevel >= $aStartLevel) {
+            $aFormatter->finishItem($pageLevel, $page);
+        }
+    }
+
+    // close the list if we opened one
+    if ($isListOpen) {
+        $aFormatter->finishList();
+    }
+}
+
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/include.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/legacy.php
===================================================================
--- trunk/wb/modules/show_menu2/legacy.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/legacy.php	(revision 827)
@@ -0,0 +1,196 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+*/
+
+/*
+    This file provides backward compatibility between show_menu2 and the
+    old functions show_menu() and menu(). Note that it is highly recommended 
+    for you to update your templates to use show_menu2 directly.
+ */    
+
+/* ----------------------------------------------------------------------------
+   show_menu
+   
+ From: http://forum.websitebaker.org/index.php/topic,2251.msg13978.html#msg13978  
+ 
+ * By calling it multiple times, you can have one menu just
+ * showing the root level, one for the sub-pages, and so on
+ * The order of the arguments has been changed compared
+ * to the page_menu() function, so read carefully the list
+ * of arguments!
+ * To just display the standard menu, use
+ * <?php show_menu(); ?> within your template's html code.
+ * You don't normally need anymore than the first four arguments.
+ * Usual calls would be (inside php code!)
+ * show_menu(1,0,-1,false); - displays the complete page tree
+ * show_menu(1,1,1); - show only first sub level
+ * show_menu(1,1,-1); -    show an expanding/collapsing menu tree starting at level 1
+ * Have fun experimenting!
+ *
+ * Full list of arguments:
+ * 1. $menu_number:   With activitated "multiple menu" feature
+ *                  you can choose which menu will be displayed
+ *                  default: 1
+ * 2. $start_level: The depth level of the root of the displayed
+ *               menu tree. Defaults to '0', which is the top level.
+ *                  '1' will show all pages starting from the first sub level.
+ * 3. $recurse:     Gives the maximum number of levels to be displayed. Default
+ *                  is '-1' which means 'all'.
+ * 4. $collapse:    Specifies, whether the menu tree shall be
+ *               expandable/collapsible (if set to 'true')
+ *               or complete (all pages being displayed) if set to 'false'
+ * 5. $item_template: Gives the possibility to specify the html code that is
+ *                  displayed before displaying sub-pages
+ * 6. $item_footer: The html code to appear after sub-pages were displayed.
+ * 7. $menu_header: The html code to appear before the entire menu code and each
+ *               sub tree.
+ * 8. $menu_footer: The html code to appear after the entire menu code and each
+ *               sub tree.
+ * 9. $default_class: The (CSS) class of every menu item except the currently viewed page
+ * 10. $current_class: The class of the currently viewed page
+ * 11. $parent:    (used internally) The page_id of the menu's root node, defaults is '0' (root level)
+ */
+ 
+class SM2_ShowMenuFormatter
+{
+    var $output;
+    var $itemTemplate;
+    var $itemFooter;
+    var $menuHeader;
+    var $menuFooter;
+    var $defaultClass;
+    var $currentClass;
+    
+    function output($aString) {
+        if ($this->flags & SM2_BUFFER) {
+            $this->output .= $aString;
+        }
+        else {
+            echo $aString;
+        }
+    }
+    function initialize() { $this->output = ''; }
+    function startList($aPage, $aUrl) { 
+        echo $this->menuHeader;
+    }
+    function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { 
+        // determine the class string to use
+        $thisClass = $this->defaultClass;
+        if ($aPage['page_id'] == PAGE_ID) {
+            $thisClass = $this->currentClass;
+        }
+        
+        // format and display this item
+        $item = str_replace( 
+                array(
+                    '[a]','[/a]','[menu_title]','[page_title]','[url]',
+                    '[target]','[class]'
+                    ),
+                array(
+                    "<a href='$aUrl' target='".$aPage['target']."'>", '</a>',
+                    $aPage['menu_title'], $aPage['page_title'], $aUrl, 
+                    $aPage['target'], $thisClass
+                    ),
+                $this->itemTemplate);
+        echo $item;
+    }
+    function finishItem() { 
+        echo $this->itemFooter;
+    }
+    function finishList() { 
+        echo $this->menuFooter;
+    }
+    function finalize() { }
+    function getOutput() {
+        return $this->output;
+    }
+}
+
+function show_menu(
+    $aMenu          = 1, 
+    $aStartLevel    = 0, 
+    $aRecurse       = -1, 
+    $aCollapse      = true,
+    $aItemTemplate  = '<li><span[class]>[a][menu_title][/a]</span>',
+    $aItemFooter    = '</li>',
+    $aMenuHeader    = '<ul>',
+    $aMenuFooter    = '</ul>',
+    $aDefaultClass  = ' class="menu_default"',
+    $aCurrentClass  = ' class="menu_current"',
+    $aParent        = 0
+    )
+{
+    static $formatter;
+    if (!isset($formatter)) {
+        $formatter = new SM2_ShowMenuFormatter;
+    }
+    
+    $formatter->itemTemplate  = $aItemTemplate;
+    $formatter->itemFooter    = $aItemFooter;  
+    $formatter->menuHeader    = $aMenuHeader;  
+    $formatter->menuFooter    = $aMenuFooter;  
+    $formatter->defaultClass  = $aDefaultClass;
+    $formatter->currentClass  = $aCurrentClass;
+    
+    $start = SM2_ROOT + $aStartLevel;
+    if ($aParent != 0) {
+        $start = $aParent;
+    }
+
+    $maxLevel = 0;
+    if ($aRecurse == 0) {
+        return;
+    }
+    if ($aRecurse < 0) {
+        $maxLevel = SM2_ALL;
+    }
+    else {
+        $maxLevel = SM2_START + $aRecurse - 1;
+    }
+    
+    $flags = $aCollapse ? SM2_TRIM : SM2_ALL;
+    
+    // special case for default case
+    if ($aStartLevel == 0 && $aRecurse == -1 && $aCollapse) {
+        $maxLevel = SM2_CURR + 1;
+    }
+
+    show_menu2($aMenu, $start, $maxLevel, $flags, $formatter);
+}
+
+function page_menu(
+    $aParent = 0, 
+    $menu_number = 1, 
+    $item_template = '<li[class]>[a][menu_title][/a]</li>', 
+    $menu_header = '<ul>', 
+    $menu_footer = '</ul>', 
+    $default_class = ' class="menu_default"', 
+    $current_class = ' class="menu_current"', 
+    $recurse = LEVEL    // page['level']
+    ) 
+{
+    show_menu($menu_number, 0, $recurse+2, true, $item_template, '', 
+        $menu_header, $menu_footer, $default_class, $current_class, $aParent);
+}
+
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/legacy.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/README
===================================================================
--- trunk/wb/modules/show_menu2/README	(nonexistent)
+++ trunk/wb/modules/show_menu2/README	(revision 827)
@@ -0,0 +1,474 @@
+// $Id$
+
+show_menu2, version 4.5
+=======================
+A code snippet for the Website Baker CMS software. It provides a complete 
+replacement for the builtin menu functions. All menu data is retrieved using 
+a single database query, all types of menu styles (lists, breadcrums, sitemaps) 
+can be generated with extensive customisation of the resulting HTML.
+
+
+INSTALLATION
+============
+1. Download the latest version from http://code.jellycan.com/show_menu2/
+2. Log into your WebsiteBaker installation
+3. Go to Addons -> Modules
+4. If a previous version of show_menu2 is already installed, select it from
+   the "Uninstall Module" list and choose the "Uninstall" button.
+5. In the "Install Module" section, enter the path to the show_menu2 zip file
+   that you downloaded in step 1, and choose the "Install" button.
+   
+   
+USING SHOW_MENU2
+================
+You need to modify the PHP files of your template to call show_menu2 where you 
+wish to have the menu displayed. Remember when you replace calls to the old
+menu functions to use the new parameters that show_menu2 requires. 
+
+Often times the default menu generated by show_menu2 is all that you need.
+This menu shows the current page and children of the current page. It is
+generated by just calling show_menu2 with no parameters. For example:
+
+    show_menu2();
+    
+Note that the call to show_menu2 is PHP, so you usually need to wrap it in the
+PHP code brackets so that it will execute. Like this:
+
+    <?php show_menu2(); ?>
+
+This default menu generates a complete list based menu with many classes that
+allow easy CSS styling. For example, the current menu item will have the
+"menu-current" class added to the <li> tag. Additionally, every menu item with
+a sub-menu will have the "menu-expand" class added to the <li> tag. This allows 
+you to create CSS rules to style those menu items differently. For example:
+
+    li.menu-expand  { font-weight: bold; }
+    li.menu-current { background: red; }
+
+See the "Output" section for details of exactly what classes are added to each 
+element. More elaborate and different menu structures are able to be created by 
+supplying parameters to the show_menu2 function call. For example, to show only 
+menu items from the top level of the menu you use:
+
+    show_menu2(0, SM2_ROOT, SM2_START);
+    
+Alternatively, to show up to two levels of the child menus of the current page:
+
+    show_menu2(0, SM2_CURR+1, SM2_CURR+2);
+
+There are many more possible menus that can be generated by show_menu2. See the
+demonstration website at http://code.jellycan.com/sm2test/ for more examples. 
+
+
+FUNCTION
+========
+
+The complete call signature and default parameter value for show_menu2 is:
+
+    show_menu2(
+        $aMenu          = 0,
+        $aStart         = SM2_ROOT,
+        $aMaxLevel      = SM2_CURR+1,
+        $aFlags         = SM2_TRIM,
+        $aItemOpen      = '[li][a][menu_title]</a>',
+        $aItemClose     = '</li>',
+        $aMenuOpen      = '[ul]',
+        $aMenuClose     = '</ul>',
+        $aTopItemOpen   = false,
+        $aTopMenuOpen   = false
+        )
+
+See the "Parameters" section for detailed descriptions of each parameter.
+Note that every parameter from $aItemOpen onwards can be supplied as false
+in order to get the default value, this allows (for example) a numbered list
+to be used while still using the the default menu parameters for the items.
+Note that all parameters up to $aFlags need to be explicitly supplied.
+For example:
+
+show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, false, '<ol>', '</ol>');
+
+
+OUTPUT
+======
+The menu is output differently depending on what parameters have been 
+supplied to the function, however in general the following classes are used 
+for each menu. Note that items will have multiple classes when relevant.
+
+    CLASS           ATTACHED TO
+    ------------    -------------------------------------------------------
+    menu-top        First menu tag only
+    menu-parent     Every parent menu item of the current page.
+    menu-current    Only the menu item for the current page.
+    menu-sibling    Every sibling of the current page.
+    menu-child      Every sub-menu of the current page.
+    menu-expand     Every menu item with children.
+    menu-first      First item in any menu or sub-menu.
+    menu-last       Last item in any menu or sub-menu.
+
+    The following classes are added only if SM2_NUMCLASS flag has been used.
+
+    menu-N          Every menu item. The N is replaced with the ABSOLUTE 
+                    menu depth of the item starting with 0. The root level 
+                    menu is always menu-0, the next level is menu-1, etc.
+    menu-child-N    Every sub-menu of the current page, the N is replaced 
+                    with the relative depth of the submenu starting at 0.
+
+
+<ul class="menu-top menu-0">
+  <li class="menu-0 menu-first">  ... </li>
+  <li class="menu-0 menu-expand menu-parent">  ...
+  <ul class="menu-1">
+    <li class="menu-1 menu-expand menu-first">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-first">  ...
+      <li class="menu-2 menu-last">  ...
+    </ul>
+    </li>
+    <li class="menu-1 menu-expand menu-parent">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-expand menu-current menu-first">  ...      ** CURRENT PAGE **
+      <ul class="menu-3">
+        <li class="menu-3 menu-child menu-child-0 menu-first">  ...
+        <ul class="menu-4">
+          <li class="menu-4 menu-child menu-child-1 menu-first">  ... </li>
+          <li class="menu-4 menu-child menu-child-1 menu-last">  ... </li>
+        </ul>
+        </li>
+        <li class="menu-3 menu-child menu-child-0 menu-last">  ... </li>
+      </ul>
+      </li>
+      <li class="menu-2 menu-sibling menu-last">  ... </li>
+    </ul>
+    </li>
+    <li class="menu-1">  ... </li>
+    <li class="menu-1 menu-expand menu-last">  ...
+    <ul class="menu-2">
+      <li class="menu-2 menu-first menu-last">  ... </li>
+    </ul>
+    </li>
+  </ul>
+  </li>
+  <li class="menu-0 menu-last">  ... </li>
+</ul>
+
+
+
+PARAMETERS
+==========
+$aMenu      
+    Menu number to use. This is useful when you are using multiple menus. 
+    Supplying a menu number of 0 will use the default menu for the current 
+    page. Supplying SM2_ALLMENU will return all menus in the system.
+
+$aStart  
+    Specify where the menu generation should start from. This is most
+    times the parent item of the menu to display. It must be one of the 
+    following values:
+        SM2_ROOT+N  Start N levels down from the root. e.g.
+                      SM2_ROOT      Starting at the root menu 
+                      SM2_ROOT+1    Start 1 level below the root
+                      SM2_ROOT+2    Start 2 levels below the root
+        SM2_CURR+N  Start N levels down from the current page level. e.g.
+                      SM2_CURR      Starts at the current page level. All
+                                    sibling menus to the current page.
+                      SM2_CURR+1    Starts 1 level down from the current
+                                    page with the children menus.
+        page_id     Display using the specific page as the parent. All
+                    child menus of that page will be displayed. The 
+                    page_id can be found by editing the page in WB admin 
+                    interface. The page_id is included in the URL like: 
+                        http://SITE/admin/pages/modify.php?page_id=35
+
+$aMaxLevel   
+    Maximum menu level to display. Menus are displayed from the start
+    level down to this level.
+        SM2_ALL     No limit, all levels are displayed
+        SM2_CURR+N  Always show to the current page + N levels. 
+                      SM2_CURR      Current (no children)
+                      SM2_CURR+3    All parents + current + 3 children
+        SM2_START+N Always show from the starting level + N levels. The
+                    levels of menu will always be displayed regardless of
+                    what level the current page is.
+                      SM2_START     Single level of menus from starting level
+                      SM2_START+1   Starting level and 1 level down
+        SM2_MAX+N   Show at most N levels from the starting level. Levels 
+                    won't be shown if they are below the current level.
+                      SM2_MAX       Starting level only (same as SM2_START)
+                      SM2_MAX+1     Maximum of starting level and 1 level.
+
+$aFlags   
+    Specify flags for different generation options for the menu. The flags
+    may be combined together using bitwise OR (|). For example, to specify
+    both TRIM and PRETTY you should use, SM2_TRIM|SM2_PRETTY.
+
+    GROUP 1
+    -------
+    Exactly one flag from this group must always be supplied. These flags 
+    affect how the siblings in the tree are removed from the output. 
+
+    SM2_ALL         Show all branches of the menu tree
+                        A-1 -> B-1 
+                            -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+                        A-2 -> B-3
+                            -> B-4
+    SM2_TRIM        Show all sibling menus of pages on the current path. 
+                    All sub-menus of elements that are not on the path 
+                    are removed.
+                        A-1 -> B-1 
+                            -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+                        A-2 
+    SM2_CRUMB       Show only the breadcrumb trail, i.e. the current
+                    menu and all of it's ancestor menus.
+                        A-1 -> B-2 -> C-2 (CURRENT)
+    SM2_SIBLING     The same as SM2_TRIM however only sibling menus of 
+                    the current page are displayed. All other menus are 
+                    trimmed to show only the path.
+                        A-1 -> B-2 -> C-1
+                                   -> C-2 (CURRENT)
+                                          -> D-1
+                                          -> D-2
+                                   -> C-3
+
+    GROUP 2
+    -------
+    All of these flags are optional. Any number of them may be combined.
+
+    SM2_NUMCLASS    Add the numbered menu classes to the menu. If this 
+                    flag is supplied, the "menu-N" and "menu-child-N" 
+                    classes will be added.
+    SM2_ALLINFO     Load all fields from the page table of the database.
+                    This will result in quite a lot of memory being used
+                    and is not recommended, however it will make keywords,
+                    descriptions, and other fields available. This data
+                    is not loaded by default.
+                    NOTE: This flag must be used on the *FIRST* call to
+                    show_menu2 *for this menu ID*, or in combination with
+                    SM2_NOCACHE otherwise it will have no effect.
+    SM2_NOCACHE     Do not reuse or store the data read from the database
+                    between calls to show_menu2. 
+    SM2_PRETTY      Pretty print the menu HTML with spacing and newlines
+                    for debugging purposes.
+    SM2_BUFFER      Do not output the menu HTML but instead buffer it 
+                    internally and return it as a string from show_menu2.
+    SM2_CURRTREE    Exclude all other top level menus from being considered. 
+                    Only items in the current menu tree will be output.
+                    This can be combined with any of the Group 1 flags as
+                    necessary.
+    SM2_ESCAPE      Call htmlspecialchars on the menu strings. This may be
+                    required with older installations of WB. By escaping the
+                    raw database strings, it permits menus to have HTML 
+                    formatting in them that would cause otherwise cause
+                    pages to fail validation. 
+    SM2_NOESCAPE    Default behaviour. Exists only for backwards compatibility.                    
+
+
+$aItemOpen
+    Format string to use for creating each individual menu item entry.
+    A different format string may be used for the very first entry by 
+    supplying a different format string for $aTopItemOpen. When set to 
+    false, it uses the default of '[li][a][menu_title]</a>' to maintain
+    compatibility with show_menu(). Note however that CSS formatting is
+    often easier if the classes are added to the <a> tag. Use the format
+    string of '<li>[ac][menu_title]</a>' for this style of tag.
+
+    This parameter may also be specified as an instance of a formatting 
+    class for the menu. See the section "Formatter" below for details of
+    the API this class must expose. When a formatter is supplied, all 
+    arguments after $aItemOpen are ignored.
+
+$aItemClose
+    String used to close each item. Note that this is not a format
+    string and no keywords will be replaced. When set to false, it uses 
+    the default of '</li>'.
+
+$aMenuOpen
+    Format string to use for opening a list of menu item entries. A 
+    different format string may be used for the very first menu by 
+    supplying a different format string for $aTopMenuOpen. When set to 
+    false, it uses the default of '[ul]'.
+
+$aMenuClose
+    String used to close each menu. Note that this is not a format
+    string and no keywords will be replaced. When set to false, it uses 
+    the default of '</ul>'.
+
+$aTopItemOpen
+    Format string for the first item. When set to false, it uses the same 
+    format as $aItemOpen.
+
+$aTopMenuOpen 
+    Format string for the first menu. When set to false, it uses the same 
+    format as $aMenuOpen.
+        
+
+
+FORMAT STRINGS
+==============
+The following tags may be included in the format strings for $aItemOpen and 
+$aMenuOpen and will be replaced with the appropriate text.
+
+[a]             <a> tag (no class):         '<a href="[url]" target="[target]">'
+[ac]            <a> tag including class:    '<a href="[url]" target="[target]" class="[class]">'
+[li]            <li> tag including class:   '<li class="[class]">'
+[ul]            <ul> tag including class:   '<ul class="[class]">'
+[class]         List of classes for that page
+[menu_title]    Menu title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
+[page_title]    Page title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
+[url]           Page URL for the <a> tag
+[target]        Page target for the <a> tag
+[page_id]       Page ID of the current menu item
+[parent]        Page ID of the parent menu item
+[level]         Page level, the same number as is used for the "menu-N" CSS tag.
+[sib]           Current menu sibling number
+[sibCount]      Total number of siblings in this menu
+[if]            Conditional test (see section CONDITIONAL FORMATTING)
+
+The following tags are only available when the SM2_ALLINFO flag is used.
+
+[description]   Page description
+[keywords]      Page keywords
+
+
+CONDITIONAL FORMATTING
+======================
+The conditional formatting directive takes one of the following forms:
+
+    [if(A){B}]
+    [if(A){B}else{C}]
+    
+    A   Conditional test. See below for more details.
+    
+    B   Expression emitted when the if-test is true. This may be any string 
+        that does NOT include the '}' character. It may include any of the 
+        format strings described in the section FORMAT STRINGS with the 
+        exception of the conditional test (because '}' is not permitted).
+        
+    C   Expression emitted when the if-test is false. This may be any string 
+        that does NOT include the '}' character. It may include any of the 
+        format strings described in the section FORMAT STRINGS with the 
+        exception of the conditional test (because '}' is not permitted).
+    
+The conditional test is a combination of one or more boolean tests.
+If more than one test is supplied, it must be combined with other tests
+using either || (boolean OR) or && (boolean AND). 
+
+A single test is made up of the left operand, operator and right operand.
+e.g. X == Y where X is the left operand, == is the operator and Y is the
+right operand.
+    
+    Left operand. It must be one of the following keywords:
+        class       Test for existence of one of the classes. Only the
+                    "==" and "!=" operators are permitted. In this case
+                    these operators have the meaning of "includes" 
+                    instead of "equals".
+        level       Test against the page level.
+        sib         Test against the current page sibling number.
+        sibCount    Test against the number of siblings in the menu.
+        id          Test against the page id.
+    
+    Operator. It must be one of the following:
+        <           Less Than
+        <=          Less Than Equals
+        ==          Equals
+        !=          Not Equal
+        >=          Greater Than Equals
+        >           Greater Than
+    
+    Right operand. The type of this operand depends on the keyword used
+    for the left operand:
+        class       One of the "menu-*" class names as listed in the 
+                    section "OUTPUT".
+        level       Test the page level against the following values:
+                      <number>  absolute page level
+                      root      the root page level
+                      granny    the grand-parent page level
+                      parent    the parent page level
+                      current   the current page level
+                      child     the child page level
+        id          Test the page id against the following values:
+                      <number>  absolute page id
+                      parent    the parent page id
+                      current   the current page id
+        sib         A positive integer, or "sibCount" to test against
+                    the count of siblings in this menu.
+        sibCount    A positive integer.
+        
+For example, valid tests are expression "exp" is emitted only when the menu item:
+    
+    [if(class==menu-expand){exp}]   has a sub-menu
+    [if(class==menu-first){exp}]    is first item in a menu
+    [if(class!=menu-first){exp}]    is NOT first item in a menu
+    [if(class==menu-last){exp}]     is last item in a menu
+    [if(level==0){exp}]             is at the root
+    [if(level>0){exp}]              is not at the root
+    [if(sib==2){exp}]               is the second item in a menu
+    [if(sibCount>1){exp}]           is in a menu with more than 1 entry
+    [if(sibCount!=2){exp}]          is in a menu which doesn't have exactly
+    [if(level>parent){exp}]         is in a sibling menu or child of a sibling
+    [if(id==parent){exp}]           is the parent of the current page
+
+If an else-clause was added, then the expression for the else would be 
+emitted in all other cases. For example the expression "foo" is emitted
+whenever the if-test is false, so therefore:
+
+    [if(sib==2){exp}else{foo}]          is NOT the second item in a menu
+    [if(sibCount>2){exp}else{foo}]      is NOT in a menu with more than 2 entries
+
+For multiple tests, the expression "exp" is emitted only when the menu item:
+
+    [if(sib == 1 || sib > 3){exp}]      
+        [is the first item] OR [is the 4th or larger item] in the menu
+        
+    [if(id == current && class == menu-expand){exp}
+        [is the current item] AND [it has children]
+
+Note that all tests are evaluated in the order listed because:
+ * there is no short-circuit evaluation (all individual tests are always evaluated)
+ * there is no grouping of tests (i.e. no support for parenthesis)
+ * both || and && are considered the same level 
+
+
+
+FORMATTER
+=========
+Note: This is an advanced and rarely needed feature!
+
+If you are capable of extensive PHP programming, it is possible to replace the 
+predefined menu formatter that show_menu2 is uses with a custom module. See the
+include.php file of show_menu2 for an example of how the menu formatter must be 
+written. The API it must use is:
+
+class SM2_Formatter
+{
+    // called once before any menu is processed to allow object initialization
+    function initialize() { }
+    
+    // called to open the menu list
+    function startList($aPage, $aUrl) { }
+    
+    // called to open the menu item
+    function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { }
+    
+    // called to close the menu item
+    function finishItem() { }
+    
+    // called to close the menu list
+    function finishList() { }
+    
+    // called once after all menu has been processed to allow object finalization
+    function finalize() { }
+    
+    // called once after finalize() if the SM2_NOOUTPUT flag is used
+    function getOutput() { }
+};
+
+
+

Property changes on: trunk/wb/modules/show_menu2/README
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: trunk/wb/modules/show_menu2/index.php
===================================================================
--- trunk/wb/modules/show_menu2/index.php	(nonexistent)
+++ trunk/wb/modules/show_menu2/index.php	(revision 827)
@@ -0,0 +1,27 @@
+<?php
+
+// $Id$
+
+/*
+    show_menu2: show_menu replacement for Website Baker 
+    Copyright (C) 2006-2008, Brodie Thiesfield
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License
+    as published by the Free Software Foundation; either version 2
+    of the License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
+    02110-1301, USA.
+*/
+
+header('Location: ../index.php');
+
+?>
\ No newline at end of file

Property changes on: trunk/wb/modules/show_menu2/index.php
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
