Adding a navigation menu selection, which can be accessed be

Archived from the Web Auction Discussion forum.

evlthecat — Tue Oct 16, 2007 8:28 pm

Would it be possible to add navigation menu selection/s, which can display information to all users without the necessity of logging in?

Would someone point me to the proper tutorials/documentation on this. I have skimmed many but would like someone with the knowledge to help me cut to the chase!

What I want to do:

When any user comes to my auction site I want an “About” tab which will allow me to give general history as well as the rules I have outlined for all auctions. Currently I can only add this tab and have it accessible to the admin.

How do we separate pre-login navigation from post-login navigation?

Thanks in advance for any help!


shannah — Sun Oct 21, 2007 1:06 am

Nav menu is handled in the /templates/Dataface_Application_Menu.html file. Notice how the whole thing is wrapped in {if isLoggedIn()} tags? If you add stuff outside of those tags, it will show up for all users.

-Steve


kedoin — Thu Apr 10, 2008 5:21 pm

In 1.0-beta2, the navigation menu is showing when the user is logged out. I looked in Dataface_Main_Template.html but I didn’t see any reference to isLoggedIn.

The “fix” I came up with was to change lines 126 and 186 to include a check for $ENV.username:

Code: Select all
126   {if ($ENV.prefs.horizontal_tables_menu and $ENV.prefs.show_tables_menu) and $ENV.username} [...] 186   {if (!$ENV.prefs.horizontal_tables_menu and $ENV.prefs.show_tables_menu) and $ENV.username}

Please let me know if this is a valid change or if I missed something in how I could have turned off the nav menu for logged out users.

Thank you,

-Rob


shannah — Fri Apr 11, 2008 9:28 am

Is this in web auction, or another dataface application.

I believe that this thread was referring to the web auction users menu (as opposed to the tables menu). True, the tables menu does show up when users are logged in. The fix that you describe is valid for disabling this.

The normal way that I hide parts of the user interface is to implement a getPreferences() method in the application delegate class to return different preferences depending on the current environment (including who is logged in).

A simple example might be:

Code: Select all
function getPrefernces(){     if ( !isLoggedIn() ){         return array('show_tables_menu'=>0);     } else {         return array(); }

Of course this assumes that you have defined the isLoggedIn() function to indicate whether a user is logged in. Such as function is defined in web auction.

Best regards

Steve


kedoin — Fri Apr 11, 2008 10:15 am

Steve:

Thank you very much for the quick reply. Yes, I was talking about a Dataface application, not the Web Auction application.

I hadn’t yet learned about getPreferences, but your fixed worked perfectly!

-Rob