In our application we used the approach to create it flexible by storing the information in database, bascially it consists of 4 tables
User
UserToRole - Assigns roles to users
MenuItems
ItemToRole - Assigns roles to menuitems
MenuItems may link themselves to upper level items for creating the menu structure. It also contains the ordering of the items. If the menu is built top level items are displayed according to user roles. If the toplevel items have subelements the same check is done again. Each menuItem holds the corresponding links to the jsp pages.
To implement a custom Ribbon element we have to describe it using an XML file defined by the Microsoft CustomUI schema and load it using the Application.LoadCustomUI() procedure.
The root element of the XML file is customUI
. Inside of it there is the element ribbon
containing all the tabs, buttons etc.
A code snippet for loading of the xml file:
Dim f As Long
Dim strText As String
Dim strOut As String
f = FreeFile
Open "\customUI.xml" For Input As f
Do While Not EOF(f)
Line Input #f, strText
strOut = strOut & strText
Loop
Application.LoadCustomUI "AppRibbon_1", strOut
Sample XML file:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="Tab1" label="Tab1">
<group id="Group" label="Group">
<button id="MyButton1" label="Button1" imageMso="_1"
onAction="doSomeAction"/>
<button id="MyButton2" label="Button2" imageMso="_2"
onAction="doSomeAction2"/>
</group>
<group id="Group2" label="Group2">
<button id="MyButton3" label="Button3" imageMso="_1"
onAction="doSomeAction3"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>