Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:22
disabling menu items
Poster: gaucho
Dated: Wednesday August 6 2003 - 16:33:17 BST
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
Poster: Hergio
Dated: Wednesday August 6 2003 - 20:33:45 BST
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...
Poster: gaucho
Dated: Thursday August 7 2003 - 12:59:12 BST
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