Creating a module with an administration item

When you change to the administration view, a number of icons such as Project Administration or User Administration are displayed. This section describes how to add your own item there.

Please note that a detailed description of how to write modules with an administration point is outside the scope of this documentation!

You will need an icon as GIF image that fits in terms of size and style. If you would like to have a variant for an inactive item, the image for the inactive item should have the same name with the addition  _in (for inactive) at the end of the filename. Put this image in the folder /system/modules/org.opencms.mymodule/pics/ and ensure that it's owner and group are one of the three standard users and groups. For every item that should be displayed, a new directory has to be created in the /system/modules/org.opencms.mymodule/administration/ directory. Then give the folder /system/modules/org.opencms.mymodule/administration/mymodule/ new properties by selecting 'Properties' from the context menue:

Property Description
NavPos This real number determines the order of the icons in the administration view. The icons are ordered by increasing NavPos. To add your icon at the end select a value greater than the highest of all NavPos values in the other folders in the directory /system/workplace/administration/ .
NavText The tag for the subtitle of the icon in the language files you provide. You will have to provide one or more language files with this subtitle in each language. The tag should be the same in all language files.
Title The name of the GIF file of the icon that is used in the Administration view without the extension .gif .
visiblemethod Visiblemethod is a method that returns a boolean value. It returns true when the icon is displayed to the current user in the current project. If it returns false, the icon is not displayed. If you do not specify this method the icon will always be visible.
activemethod Activemethod is a method that returns a boolean value. It returns true when the icon is active, i.e. clickable. If false, the icon is still displayed but in an inactive style, and without a link to the icon. If you do not specify this method the icon will always be active.

Here is an example for the properties:

NavPos = 7
NavText = mymodule.administration.icon.paybyclick
Title = paybyclick
visiblemethod = com.opencms.workplace.CmsWorkplaceDefault.isNotOnlineProject

In the subfolder mymodule, create a page with the name index.html. This is the page that will be displayed when the item is clicked. It is possible to display several administration items when your item is clicked, as for example when you open User Administration or Project Administration. Simply add new sub- folders in the /system/modules/org.opencms.mymodule/administration/mymodule/ directory, give these sub- folders the same properties as above, and add icons and an index.html page to each sub- folder. Please note that every directory that is created within the administration/ directory will be added as an administration item by the module mechanism and an error will occur if you add directories here that don't follow these conventions.

In the administration view there is an additional frame admin_head for navigation just below the toolbar. If you only want to use the standard frame with the blue back button then let this frame be updated when your index.html is displayed by adding the following onLoad JavaScipt to your body tag:

<bodyonLoad="window.top.body.admin_head.location.href='[path 
to the /system/workplace/action/ folder]/administration_head.html';">

To create your own admin_head frame, please have a look on the templates of the image or download galleries as examples.

]]>