[dw-free] Redo menu items to be a separate file for site schemes to use
[commit: http://hg.dwscoalition.org/dw-free/rev/7b9b976225fd]
http://bugs.dwscoalition.org/show_bug.cgi?id=321
Move navigation/menu logic to dw-free.
Patch by
sophie.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=321
Move navigation/menu logic to dw-free.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/upgrading/en.dat
- cgi-bin/bml/scheme/global.look
-------------------------------------------------------------------------------- diff -r ae827840b675 -r 7b9b976225fd bin/upgrading/en.dat --- a/bin/upgrading/en.dat Wed Mar 04 08:15:41 2009 +0000 +++ b/bin/upgrading/en.dat Wed Mar 04 08:20:01 2009 +0000 @@ -2143,6 +2143,58 @@ lynx.nav.siteopts=Browse Options lynx.nav.update=Update Journal +menunav.create=Create + +menunav.create.createaccount=Create Account + +menunav.create.createcommunity=Create Community + +menunav.create.editjournal=Edit Entries + +menunav.create.editprofile=Edit Profile + +menunav.create.updatejournal=Update Journal + +menunav.create.uploaduserpics=Upload Icons ([[num]] of [[max]]) + +menunav.explore=Explore + +menunav.explore.directorysearch=Directory Search + +menunav.explore.faq=FAQ + +menunav.organize=Organize + +menunav.organize.customizestyle=Customize Style + +menunav.organize.manageaccount=Manage Account + +menunav.organize.managecommunities=Manage Communities + +menunav.organize.managefilters=Manage Filters + +menunav.organize.managerelationships=Manage Circle + +menunav.organize.managetags=Manage Tags + +menunav.organize.selectstyle=Select Style + +menunav.read=Read + +menunav.read.inbox.nounread=Inbox + +menunav.read.inbox.unread=Inbox ([[num]]) + +menunav.read.profile=Profile + +menunav.read.readinglist=Reading Page + +menunav.read.recentcomments=Recent Comments + +menunav.read.syndicatedfeeds=Syndicated Feeds + +menunav.read.tags=Tags + notification_method.email.title=Email notification_method.im.title=IM diff -r ae827840b675 -r 7b9b976225fd cgi-bin/bml/scheme/global.look --- a/cgi-bin/bml/scheme/global.look Wed Mar 04 08:15:41 2009 +0000 +++ b/cgi-bin/bml/scheme/global.look Wed Mar 04 08:20:01 2009 +0000 @@ -26,6 +26,9 @@ REQUIREPOST=><?_ml bml.requirepost _ml?> LOAD_PAGE_INFO<= <?_code +### PLEASE NOTE: This block is deprecated. To print the menu navigation in a scheme, +### use the <?menunav?> block. + #line 3 @sidebar = ({ 'name' => 'Home', 'uri' => '/', @@ -268,3 +271,38 @@ BREADCRUMBS<= return "<div id='ljbreadcrumbs'>" . join(" : ", @ret) . "</div>"; _code?> <=BREADCRUMBS + +# Dreamwidth menu structure +menunav<= +<?_code +{ + use DW::Logic::MenuNav; + + my $ret; + + $ret .= "<ul>\n"; + + my $nav_links = DW::Logic::MenuNav->get_menu_navigation; # defaults to remote + + foreach my $cathash ( @{ $nav_links } ) { + my $cat = $cathash->{name}; + my @submenu = @{ $cathash->{items} }; + my @displayed = (); + foreach my $item ( @submenu ) { + push @displayed, "<li class='subnav'><a href='$item->{url}'>" . BML::ml( "$item->{text}", $item->{text_opts} ) . "</a></li>" if $item->{display}; + } + if ( @displayed ) { # only display a top-level menu if any of its items are displayed + $ret .= "<li id='${cat}_topnav' class='topnav'><a href='$LJ::SITEROOT/nav.bml?cat=$cat'>$ML{\"menunav.$cat\"}</a>\n"; + $ret .= "<ul id='${cat}_subnav' class='subnav_container'>\n"; + $ret .= join( "\n", @displayed ) . "\n"; + $ret .= "</ul>\n"; + $ret .= "</li>\n"; + } + } + + $ret .= "</ul>\n"; + + return $ret; +} +_code?> +<=menunav --------------------------------------------------------------------------------