Definition of a Menu Command

The Content Navigator can be extended by additional commands to ease the work of editors and administrators.

Next to the Tcl or Java code that implements the functions of a custom command, the properties of such a command such as its name, multilingual titles, or required permissions need to be defined. Where and in which form this is done is described in this document. Finally, the command needs to be integrated into the menu or the toolbar or into the preview of the Content Navigator so that it can be used.

Three types of custom commands exist:

Custom Command Type   Short Description
Tcl procedure Tcl Script whose output is displayed in the browser
Wizard Tcl script that creates and controls GUI dialogs
Servlet call JSP or servlet that runs in the session and may read-access its data.

Custom commands can be made available globally, i. e. independently of files, for exactly one file, and for any number of files. Every command is a bean entry in the itemRegistry.xml to be found in the config directory of the the GUI web application, or in the contentMenu.xml configuration file located in the instance-specific config directory. An example:

<bean id="editImageWizard"
    class="com.infopark.cm.htmlgui.browse.menuaction.CustomCommand">
  <property name="titles"><map>
    <entry key="en"><value>Image Editing</value></entry>
    <entry key="de"><value>Bildbearbeitung</value></entry> </map>
  </property>
  <property name="selectionType"><value>single</value></property>
  <property name="requiredObjectPermissions"><set>
    <value>write</value>
    <value>createChildren</value></set>
  </property>
  <property name="command">
    <value>editImage::render</value>
  </property>
  <property name="dialog"><value>true</value></property>
  <property name="objectTypes"><set>
    <value>image</value></set>
  </property>
  <property name="necessaryPermission">
    <value>wizardPermission</value>
  </property>
</bean>

The elements and attributes in such a definition have the following meaning:

  • bean: Defines the custom command. The class to specify is the same for all commands.
    • id: a unique identifier.
    • class: must be com.infopark.cm.htmlgui.browse.menuaction.CustomCommand.
  • property name="titles": defines in the map subelement the titles displayed in the GUI in the available languages. These languages are specified in the localizer.xy.xml files (replace xy with the language code) the share directory.
  • property name="selectionType": Defines the scope of the command. In the value sublement one of the following values can be specified:
    • none for global commands,
    • single for commands that can be applied to exactly one file,
    • extended for commands that can be applied to any number of files.
  • property name="requiredObjectPermissions": defines the file-specific permissions according to which file-specific menu commands (of the single or extended selectionType ) are filtered. single menu commands are not offered if the permissions have not been granted, extended menu commands are offered, however the filtered and not the original file list is passed to the corresponding command script. The permissions write, root, and createChildren can be specified.
  • property name="necessaryPermission": defines in the value subelement the global permission which user must have been granted for being offered this command. You can specify one of the predefined global permissions well as any custom global permission such as wizardPermission, for example.
  • property name="command": Defines in the value subelement the name of the Tcl procedure to execute when the custom command is called. The procedure needs to be located in the instance-specific script/cm/serverCmds directory or in the corresponding directory below FionaDir/share.
  • property name="objectClasses": Defines in the set subelement a set of file formats to which the command is to be restricted. Inside set, each format is specified in a value element. If no file formats are specified then the command is not restricted to particular file formats.
  • property name="objectTypes": Analogous to the restriction to file formats, commands can be restricted to a selection of the five file types.
  • property name="servletURI": Specifies that the command has been implemented as a servlet. The URI of the servlet, relative to the GUI web applikation, is specified in the value subelement. A property element with name="dialog" must not exist at the same time.
  • property name="dialog": Determines that the command has been implemented as a wizard. A property element with name="servletURI" must not exist at the same time. The Tcl procedure that implements the wizard needs to be placed in the instance-specific script/cm/serverCmds directory or in the corresponding directory below FionaDir/share.
  • property name="dialogSize": Determines the size of the dialog window. Possible values are:
    • tiny: see the dialog for changing the user's password as an example
    • small: see the dialog for specifying the locally installed applications as an example
    • large: see the window that is displayed when the Help -> About Infopark CMS Fiona menu command is selected from the menu
    • parent: the same size as the window from which the wizard was opened – normally the main window
    • none: no window; all output of the wizard is ignored
  • property name="outputsHtml": Specified whether the Tcl code returns HTML text (true or false ). If true HTML-specific characters are not converted and the html, body, and head elements must not be present.
  • property name="displayHeaderAndFooter": Specifies whether the header and footer areas are to be displayed or not (true or false, respectively). If this item is missing, true is assumed and the header and footer areas are displayed. If the header and footer areas are suppressed, not only the standard buttons but also the footer area buttons generated using the npsButton tags (inButtonArea) are not present.
  • property name="descriptions" and property name="sortKey": These optional elements change the way in which a wizard is listed on the Wizard Selection start area. As with titles, descriptions define the subtitles displayed in the available languages according to the map subelement. By applying a sortKey, you can modify the order of the wizards in the selection list.