Anonymous avatar Anonymous committed 159fd36

Converted the code to use HTML::Widgets::NavMenu::HeaderRole (from
HTML::Widgets::NavMenu version 0.1.15, soon - 0.2.0).

All the results are the same.

Comments (0)

Files changed (2)

 my $tree_contents =
 {
     'host' => "berlios",
-    'value' => "Perl Beginners' Site",
+    'text' => "Perl Beginners' Site",
     'title' => "A useful Portal for People New to Perl",
-    'expand_re' => "",
     'subs' =>
     [
         {
-            'value' => "Home",
+            'text' => "Home",
             'url' => "",
         },
         {
-            'value' => "About",
+            'text' => "About",
             'url' => "about.html",
         },
         {
-            'value' => "News",
+            'text' => "News",
             'url' => "news/",
             'title' => "Previous News Item",
         },
         {
-            'value' => "Online Tutorials",
+            'text' => "Online Tutorials",
             'url' => "tutorials/",
             'subs' =>
             [
                 {
-                    'value' => "In Other Languages",
+                    'text' => "In Other Languages",
                     'url' => "tutorials/localized/",
                     'title' => "Tutorials in languages other than English",
                 },
             ],
         },
         {
-            'value' => "Books",
+            'text' => "Books",
             'url' => "books/",
             'subs' =>
             [
                 {
                     'url' => "books/advanced/",
-                    'value' => "Advanced Books",
+                    'text' => "Advanced Books",
                     'title' => "Books that contain more information about Perl than the basics",
                 },
                 {
                     'url' => "books/topics/",
-                    'value' => "Topic-related Books",
+                    'text' => "Topic-related Books",
                     'title' => "Books that cover certain topics in detail",
                 },
             ],
         },
         {
             'url' => "core-doc/",
-            'value' => "Core Documentation",
+            'text' => "Core Documentation",
         },
         {
             'url' => "articles/",
-            'value' => "Article Collections",
+            'text' => "Article Collections",
         },
         {
             'separator' => 1,
             'skip' => 1,
         },
         {
-            'value' => "Mailing Lists",
+            'text' => "Mailing Lists",
             'url' => "mailing-lists/",
             'title' => "Ask questions and receive answers about Perl by E-mail",
         },
         {
-            'value' => "Web Forums",
+            'text' => "Web Forums",
             'url' => "web-forums/",
             'title' => "Ask questions and receive answers by using a web-browser",
         },
         {
-            'value' => "IRC Channels",
+            'text' => "IRC Channels",
             'url' => "irc/",
             'title' => "Chat online about Perl using the Internet Relay Chat (IRC)",
         },
         {
-            'value' => "Site Resources",
+            'text' => "Site Resources",
             'url' => "site-resources/",
             'role' => "header",
             'show_always' => 1,
             'subs' =>
             [
                 {
-                    'value' => "Mailing List",
+                    'text' => "Mailing List",
                     'url' => "site-resources/mailing-list/",
                     'title' => "A mailing list for helping Beginners",
                 },
                 {
-                    'value' => "Wiki",
+                    'text' => "Wiki",
                     'title' => "A sub-site that can be freely edited with any information",
                     'url' => "site-resources/wiki/",
                 },
                 {
-                    'value' => "Web Forum",
+                    'text' => "Web Forum",
                     'url' => "site-resources/web-forum/",
                     'title' => "A web-based forum where you can post messages",
                 },
             ],
         },
         {
-            'value' => "Platforms",
+            'text' => "Platforms",
             'url' => "platforms/",
             'role' => "header",
             'show_always' => 1,
             'subs' =>
             [
                 {
-                    'value' => "Mac OS",
+                    'text' => "Mac OS",
                     'url' => "platforms/mac/",
                     'title' => "Macintosh and PowerPC/PowerMac Platforms",
                 },
                 {
-                    'value' => "UNIX/Linux",
+                    'text' => "UNIX/Linux",
                     'url' => "platforms/unix/",
                 },
                 {
-                    'value' => "Windows",
+                    'text' => "Windows",
                     'url' => "platforms/windows/",
                 },
             ],
         },
         {
-            'value' => "Uses",
+            'text' => "Uses",
             'url' => "uses/",
             'title' => "Common Uses for Perl",
             'role' => "header",
             'subs' =>
             [
                 {
-                    'value' => "Bio-Informatics",
+                    'text' => "Bio-Informatics",
                     'url' => "uses/bio-info/",
                 },
                 {
-                    'value' => "QA and Testing",
+                    'text' => "QA and Testing",
                     'url' => "uses/qa/",
                 },
                 {
-                    'value' => "Sys Admin",
+                    'text' => "Sys Admin",
                     'title' => "Using Perl for System Administration",
                     'url' => "uses/sys-admin/",
                 },
                 {
-                    'value' => "Web/CGI",
+                    'text' => "Web/CGI",
                     'url' => "uses/web/",
                 },
             ],
         },
         {
-            'value' => "Contribute",
+            'text' => "Contribute",
             'url' => "contribute/",
             'title' => "Contribute new content or corrections to this site",
             'role' => "header",
             'subs' =>
             [
                 {
-                    'value' => "Site's Source Code",
+                    'text' => "Site's Source Code",
                     'url' => "source/",
                 },
             ],
 
 <:{
 use MyNavData;
-use Shlomif::NavMenu;
+use HTML::Widgets::NavMenu::HeaderRole;
 
 my $filename = "$(FILENAME)";
 $filename =~ s!index\.html$!!;
 $filename = "/$filename";
 
-my $nav_bar = Shlomif::NavMenu->new(
+my $nav_bar = HTML::Widgets::NavMenu::HeaderRole->new(
     'path_info' => $filename,
     'current_host' => "berlios",
     MyNavData::get_params(),
+    'ul_classes' => [ "navbarmain", ("navbarnested") x 10 ],
     );
 
-my $rendered_results = 
-        $nav_bar->render(
-            no_ie => 'true',
-            styles => 
-            {
-                'bar' => 'nav',
-                'level0' => 'navbarmain',
-                'level1' => 'navbarnested',
-                'level2' => "navbarnested",
-                'level3' => "navbarnested",
-                'level4' => "navbarnested",
-                'list' => "navbarmain",
-            },
-            );
+my $rendered_results = $nav_bar->render();
 
 use vars qw($nav_links);
 
 <:{
 use CGI qw();
 
-while (my ($key, $url) = each(%$nav_links))
+my @keys = (sort { $a cmp $b } keys(%$nav_links));
+foreach my $key (@keys)
 {
+    my $url = $nav_links->{$key};
     print "<link rel=\"$key\" href=\"" . CGI::escapeHTML($url) . "\" />\n"
 }
 }:>
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.