disabling menu items

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
gaucho
Beginner
Beginner
Posts: 2
Joined: Wed Aug 06, 2003 4:27 pm

disabling menu items

Post by gaucho »

Hi,

I have created the menu with the respective links. However, the links should be enabled or accessible based on permissions available in a database. If a user does not have a profile for performing a specific task, that particular link should appear disabled or preferably on cliking the link is shown a javascript message saying something like no permissions..

So, is this possible?? Is there anyway I can send a parameter to the function for validation or any other way? I had a look at the function popup and got totally lost!

pl help!
thnx in adv,
sg
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

The menu does not "out-of-the-box" hook into a database to allow you to generate menus dynamically. Thats up to you to generate some sort of script that can generate the .js file on the fly. If you generate them on the fly, then you should be able to determine what to show and what not to show, or what to highlight or what to dim out, or where to put in a URL or when to put in a javascript call to a pop up that says 'no-no'.

Somebody has probably already made up some sort of database hook up, so if they have, they should post here for ya.

One last thing that comes to mind with this. Take into consideration that doing what you want to do is going to require that your database be queried for each and every time the menu is loaded on each and every page it is placed on. Depending on your user base, this might not scale very well. What I am currently trying to implement is a 'security matrix' where I query the database once for each user to determine what items they can view and generate an xml file from this. Then each time the menu is loaded for the user, it just uses the xml file. Anytime the database is changed for a particular users permissions, it automatically generates a new XML file for that user to determine what they can/cannot see. Its a work in progress...
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
gaucho
Beginner
Beginner
Posts: 2
Joined: Wed Aug 06, 2003 4:27 pm

Post by gaucho »

Hi,

Yes, agree with what you say.. quering the db everytime the menu is loaded is quite cumbersome and also the idea behind hving an XML file appears ideal..

However, am on a short timeframe and dunno if i hv the time to do it..

thought there would be some possibility of sending the emp id and a flag (0 or 1) to the functions to enable / disable the links.. guess this isnt possible huh...:(

hope someone has some implementation done?

thnx ,

sg
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Please keep this thread alive with suggestions :D

Want to change menu on Register/login to access links using PHP/MySQL and xpmenu.

Thank you
maz
Post Reply