Commits

Anonymous committed 9cffd69

Converted to the navigation menu code.

Comments (0)

Files changed (3)

 
 SUBDIRS_DEST = $(addprefix $(TARGET)/,$(SUBDIRS))
 
-WML_FLAGS += --passoption=2,-X --passoption=7,"-S imgsize" -DROOT~.
+WML_FLAGS += --passoption=2,-X --passoption=3,-I../lib/ --passoption=7,"-S imgsize" -DROOT~.
 
 RSYNC = rsync --progress --verbose --rsh=ssh 
 
+package MyNavData;
+
+my $hosts =
+{
+    'berlios' => 
+    {
+        'base_url' => "http://perl-begin.berlios.de/",
+    },
+};
+
+my $tree_contents =
+{
+    'host' => "berlios",
+    'value' => "Perl Beginners' Site",
+    'title' => "A useful Portal for People New to Perl",
+    'expand_re' => "",
+    'subs' =>
+    [
+        {
+            'value' => "Home",
+            'url' => "",
+        },
+        {
+            'value' => "About",
+            'url' => "about.html",
+        },
+        {
+            'value' => "News",
+            'url' => "news/",
+            'title' => "Previous News Item",
+        },
+        {
+            'value' => "Online Tutorials",
+            'url' => "tutorials/",
+            'subs' =>
+            [
+                {
+                    'value' => "In Other Languages",
+                    'url' => "tutorials/localized/",
+                    'title' => "Tutorials in languages other than English",
+                },
+            ],
+        },
+        {
+            'value' => "Books",
+            'url' => "books/",
+            'subs' =>
+            [
+                {
+                    'url' => "books/advanced/",
+                    'value' => "Advanced Books",
+                    'title' => "Books that contain more information about Perl than the basics",
+                },
+                {
+                    'url' => "books/topics/",
+                    'value' => "Topic-related Books",
+                    'title' => "Books that cover certain topics in detail",
+                },
+            ],
+        },
+        {
+            'url' => "core-doc/",
+            'value' => "Core Documentation",
+        },
+        {
+            'url' => "articles/",
+            'value' => "Article Collections",
+        },
+        {
+            'separator' => 1,
+            'skip' => 1,
+        },
+        {
+            'value' => "Mailing Lists",
+            'url' => "mailing-lists/",
+            'title' => "Ask questions and receive answers about Perl by E-mail",
+        },
+        {
+            'value' => "Web Forums",
+            'url' => "web-forums/",
+            'title' => "Ask questions and receive answers by using a web-browser",
+        },
+        {
+            'value' => "IRC Channels",
+            'url' => "irc/",
+            'title' => "Chat online about Perl using the Internet Relay Chat (IRC)",
+        },
+        {
+            'value' => "Site Resources",
+            'url' => "site-resources/",
+            'role' => "header",
+            'show_always' => 1,
+            'subs' =>
+            [
+                {
+                    'value' => "Mailing List",
+                    'url' => "site-resources/mailing-list/",
+                    'title' => "A mailing list for helping Beginners",
+                },
+                {
+                    'value' => "Wiki",
+                    'title' => "A sub-site that can be freely edited with any information",
+                    'url' => "site-resources/wiki/",
+                },
+                {
+                    'value' => "Web Forum",
+                    'url' => "site-resources/web-forum/",
+                    'title' => "A web-based forum where you can post messages",
+                },
+            ],
+        },
+        {
+            'value' => "Platforms",
+            'url' => "platforms/",
+            'role' => "header",
+            'show_always' => 1,
+            'subs' =>
+            [
+                {
+                    'value' => "Mac OS",
+                    'url' => "platforms/mac/",
+                    'title' => "Macintosh and PowerPC/PowerMac Platforms",
+                },
+                {
+                    'value' => "UNIX/Linux",
+                    'url' => "platforms/unix/",
+                },
+                {
+                    'value' => "Windows",
+                    'url' => "platforms/windows/",
+                },
+            ],
+        },
+        {
+            'value' => "Uses",
+            'url' => "uses/",
+            'title' => "Common Uses for Perl",
+            'role' => "header",
+            'show_always' => 1,
+            'subs' =>
+            [
+                {
+                    'value' => "Bio-Informatics",
+                    'url' => "uses/bio-info/",
+                },
+                {
+                    'value' => "QA and Testing",
+                    'url' => "uses/qa/",
+                },
+                {
+                    'value' => "Sys Admin",
+                    'title' => "Using Perl for System Administration",
+                    'url' => "uses/sys-admin/",
+                },
+                {
+                    'value' => "Web/CGI",
+                    'url' => "uses/web/",
+                },
+            ],
+        },
+        {
+            'value' => "Contribute",
+            'url' => "contribute/",
+            'title' => "Contribute new content or corrections to this site",
+            'role' => "header",
+            'show_always' => 1,
+            'subs' =>
+            [
+                {
+                    'value' => "Site's Source Code",
+                    'url' => "source/",
+                },
+            ],
+        },
+    ],
+};
+
+sub get_params
+{
+    return 
+        (
+            'hosts' => $hosts,
+            'tree_contents' => $tree_contents,
+        );
+}
+
+1;
 # #use wml::des::navbar
 
+<:{
+use MyNavData;
+use Shlomif::NavMenu;
+
+my $nav_bar = Shlomif::NavMenu->new(
+    'path_info' => "$(FILENAME)",
+    'current_host' => "berlios",
+    MyNavData::get_params(),
+    );
+
+my $rendered_results = 
+        $nav_bar->render(
+            no_ie => 'true',
+            styles => 
+            {
+                'bar' => 'nav',
+                'level0' => 'navbarmain',
+                'level1' => 'navbarnested',
+                'level2' => "navbarnested",
+                'level3' => "navbarnested",
+                'level4' => "navbarnested",
+                'list' => "navbarmain",
+            },
+            );
+
+use vars qw($nav_links);
+
+$nav_links = $rendered_results->{nav_links};
+
+use vars qw($nav_html);
+
+$nav_html = $rendered_results->{html};
+
+}:>
+
 <define-tag email:link>
 <a href="mailto:%0">%0</a>
 </define-tag>
 </head>
 <body>
 
+
 <define-tag rellink whitespace="delete">
 <preserve url />
 <set-var %attributes />
 <restore title />
 </define-tag>
 
-
-<define-tag links:group endtag="required">
-<preserve myclass />
-<set-var myclass="<if "<match "%0" "nested" />" "navbarnested" "navbarmain" />" />
-<ul class="<get-var myclass />">
-%body
-</ul>
-<restore myclass />
-</define-tag>
-
 <define-tag wiki:link whitespace="delete">
 <preserve url />
 <set-var %attributes />
 
 <define-tag nothing></define-tag>
 
-<define-tag navbar:head>
-<preserve href />
-<preserve title />
-<preserve hint />
-<set-var %attributes />
-<set-var title:attr="<if "<get-var hint />" <attributes-quote title=<get-var hint /> /> <nothing /> />" />
-<h2><a href="<get-var href />" <get-var title:attr />><get-var title /></a></h2>
-<restore hint />
-<restore title />
-<restore href />
-</define-tag>
-
-<define-tag navbar:menu:books>
-<links:group "nested">
-<li>
-<navbarlink "books/advanced/" "Advanced Books" title="Books that contain more information about Perl than the basics" />
-</li>
-<li>
-<navbarlink "books/topics/" "Topic-related Books" title="Books that cover certain topics in detail" />
-</li>
-</links:group>
-</define-tag>
-
-<define-tag navbar:menu:is:book><match "$(FILENAME)" "^books/" action="report" /></define-tag>
-
-<define-tag navbar:menu:tutorials>
-<links:group "nested">
-<li>
-<navbarlink "tutorials/localized/" "In Other Languages" title="Tutorials in Other Languages" />
-</li>
-</links:group>
-</define-tag>
-
-<define-tag navbar:menu:is:tutorials><match "$(FILENAME)" "^tutorials/" action="report" /></define-tag>
-
 <table summary="Layout Table: The first cell contains a navigation bar, the second the main page" border="0" width="99%">
 <tr>
 <td valign="top" class="navbar" style="width:20%">
 
-<links:group>
-<li><navbarlink "" "Home" /></li>
-<li><navbarlink "about.html" "About" /></li>
-<li><navbarlink "news/" "News" 
-    title="News about new things in this site" /></li>
-<li><navbarlink "tutorials/" "Online Tutorials" />
-<if "<navbar:menu:is:tutorials />" "<br /><navbar:menu:tutorials />" />
-</li>
-<li><navbarlink "books/" "Books" />
-<if "<navbar:menu:is:book />" "<br /><navbar:menu:books />" />
-</li>
-<li><navbarlink "core-doc/" "Core Documentation" /></li>
-<li><navbarlink "articles/" "Article Collections" /></li>
-</links:group>
-<links:group>
-<li><navbarlink "mailing-lists/" "Mailing Lists" title="Ask Questions and Receive Answers about Perl by E-mail" /></li>
-<li><navbarlink "web-forums/" "Web Forums" /></li>
-<li><navbarlink "irc/" "IRC Channels" title="Chat online about Perl using the Internet Relay Chat (=IRC)" /></li>
-</links:group>
-<links:group>
-<li><navbarlink "links/" "Links" /></li>
-</links:group>
-
-<navbar:head href="$(ROOT)/site-resources/" title="Site Resources" />
-
-<ul class="navbarmain">
-<li><a href="<mailing:list:link />" title="A mailing list for helping Beginners">Mailing List</a></li>
-<li><a href="<wiki:link />" title="A sub-site that can be freely edited with any information">Wiki</a></li>
-<li><a href="<web:forum:link />" title="A web-based forum where you can post messages.">Web Forum</a></li>
-</ul>
-
-<navbar:head href="$(ROOT)/platforms/" title="Platforms" />
-
-<ul class="navbarmain">
-<li><a href="$(ROOT)/platforms/mac/" title="Macintosh and PowerPC/PowerMac platforms">Mac OS</a></li>
-<li><a href="$(ROOT)/platforms/unix/">UNIX/Linux</a></li>
-<li><a href="$(ROOT)/platforms/windows/">Windows</a></li>
-</ul>
-
-<define-tag uses:link>
-<preserve href />
-<preserve caption />
-<preserve title />
-<preserve hide />
-<set-var %attributes />
-<set-var t="<if "<get-var title />" <attributes-quote title=<get-var title /> /> "" />" />
-<if "<ifeq "<get-var hide />" "1" "<match "$(FILENAME)" "^uses/" action="report" />" "1" />"
-    "<li><navbarlink "<get-var href />" "<get-var caption />" <get-var t /> /></li>"
-    ""
-    />
-<restore hide />
-<restore title />
-<restore caption />
-<restore href />
-</define-tag>
-
-<navbar:head href="$(ROOT)/uses/" title="Uses" hint="Common Uses for Perl" />
-<links:group>
-<uses:link href="uses/bio-info/" title="Perl for Bio-Informatics" caption="Bio-Informatics" hide="1" />
-<uses:link href="uses/qa/" title="Perl for Testing and Quality Assurance" caption="QA and Testing" hide="1" />
-<uses:link href="uses/sys-admin/" title="System Administration" caption="Sys Admin" />
-<uses:link href="uses/web/" title="Perl for the Web (CGI, etc.)" caption="Web/CGI" />
-</links:group>
-
-
-<navbar:head href="$(ROOT)/contribute/" title="Contribute" />
-<links:group>
-<li><navbarlink "source/" "Site's Source Code" /></li>
-</links:group>
-
+<:{ print join("\n", @$nav_html); }:>
 
 <define-tag validhtml>
 <br /><br /><br /><br />
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.