Tuesday, March 29, 2011 at 1:07 AM.
river2Suite.viewMenu
on viewMenu (flnotmobile=true) {
<<Changes
<<3/28/11; 7:56:55 AM by DW
<<Support new cookie-based membership.
<<1/31/11; 4:57:19 PM by DW
<<If displaying the menu for a non-main user, don't show certain menu items.
<<4/27/10; 2:12:57 PM by DW
<<Treat the page named "feeds" the same as the page named "subscriptions."
<<3/18/10; 10:59:49 AM by DW
<<If pta^.river2.flStaticBuild is defined and true that means this is for a static rendering. Right now that's just for the home page, none of the subordinate pages are rendered, so there's no need for a menu. We just return the empty string. See river2Suite.static.buildOnePage for the other side of this.
<<Also, add the <div> and </div> here, instead of in the template. This way when we generate an empty menu, it takes up no vertical space.
<<12/28/09; 10:28:22 PM by DW
<<Add optional flnotmobile param, default true.
<<12/2/09; 2:16:45 PM by DW
<<If pta^.adruser is non-nil, add a user=xxx param string.
<<9/16/09; 11:42:13 AM by DW
<<Include product name and version info next to the menu.
<<9/10/09; 12:28:07 PM by DW
<<The URL for the prefs page is hard-coded for 127.0.0.1 which doesn't work if you're accessing River2 over the next (i.e. the server isn't running on your machine).
<<9/8/09; 10:00:59 AM by DW
<<Include a "photos" link if the pictures sub-table of enclosures is not empty.
<<9/6/09; 3:27:33 PM by DW
<<For prefs, go to the OPML Editor prefs website, River2 page. We didn't need a multi-page prefs system as it turns out, it's much simpler this way, and we have other fish to fry right now.
<<9/3/09; 3:25:19 AM by DW
<<Include a link to the Docs in the menu.
<<9/2/09; 1:42:02 PM by DW
<<Prefs command is implemented in the River2 website.
<<8/27/09; 12:24:50 PM by DW
<<Change "Preferences" to "Prefs".
<<8/27/09; 12:21:09 PM by DW
<<Change "Subscriptions" to "Feeds" -- more compact.
<<8/20/09; 10:42:05 AM by DW
<<Add a link to the Podcasts page.
<<8/10/09; 7:30:24 AM by DW
<<Add a link for the Log page.
<<6/21/09; 5:29:44 AM by DW
<<Cribbed from photoFanWebsite.["#tools"].menu.
local (pta = html.getpagetableaddress (), flhascookie, username);
if defined (pta^.river2.flStaticBuild) { //3/18/10 by DW
if pta^.river2.flStaticBuild {
return ("")}};
bundle { //set flhascookie
flhascookie = opmlEditor.member.checkCookie ("", @username, false)};
local (pagename = nameof (pta^.adrobject^), adrdata = river2suite.init (), flmainuser = true);
local (htmltext = "", indentlevel = 0, paramstring = "");
on add (s) {
htmltext = htmltext + string.filledstring ("\t", indentlevel) + s + "\r"};
bundle { //set paramstring, 12/2/09 by DW
if pta^.adruser != nil {
paramstring = "?user=" + nameof (pta^.adruser^);
flmainuser = false}}; //1/31/11 by DW
on additem (title, thispagename, url=nil, fllast=false) {
add ("");
if pagename == "feeds" { //4/27/10 by DW
pagename = "subscriptions"};
if pagename == thispagename {
add ("<b>" + string.upper (title) + "</b>")}
else {
if url == nil {
url = thispagename + paramstring};
add ("<a href=\"" + url + "\">" + title + "</a>")};
if not fllast {
add ("|")}};
if flhascookie {
additem ("Home", "index");
if flnotmobile {
additem ("Feeds", "subscriptions");
if flmainuser {
additem ("Prefs", "prefs", url:"../opmlEditor/prefs?title=river2")}; //9/10/09 by DW
<<additem ("Prefs", "prefs", url:river2Suite.data.urls.prefsPage) //9/2/09 by DW
if flmainuser {
additem ("Log", "log")}}; //8/10/09 by DW
additem ("Podcasts", "podcasts"); //8/20/09 by DW
if sizeof (adrdata^.enclosures.pictures) > 0 {
additem ("Photos", "photos")}; //9/8/09 by DW
if flnotmobile {
additem ("Docs", "docs", url:river2Info.homePageUrl)};
additem ("Sign-out", "signout");
if flmainuser {
additem ("Scan", "scan", fllast:true)}}
else {
additem ("Sign-in", "signin", fllast:true)};
if htmltext endswith "|\r" { //3/16/10 by DW
htmltext = string.delete (htmltext, sizeof (htmltext)-1, 2)};
return ("<div class=\"navMenu\"><b>" + river2info.name + " v" + river2info.version + "</b>: " + htmltext + "</div>")};
bundle { //test code
webbrowser.displaytext (navigationMenu ())}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.