Menus

Build 1501 on 14/Nov/2017  This topic last edited on: 22/Mar/2016, at 16:39

There are four types of menus: “Global Menu”, “Search Context Menu”, “Context Menu” and “Properties Menu”.

Global menu

It is configured through the element I4Config/globalMenu and is always accessible in the application header bar. The commands associated to this menu do not apply to any specific object or search context.

Note that if the I4Config/globalMenu element is not empty (i.e. it features at least one menuItem sub-element), then it completely replaces the eventual I4Config/globalMenu elements configured in any of the included configuration file.

i4_a3

Search context menu

They are associated to a specific search context and are configured through the I4Config/searchContexts/searchContext/menu element.

The menu items displayed are the merge of the menu items configured in I4Config/searchContexts/searchContext/menu/menuItem, plus all the items of the context menu associated to the common ancestor of all the types of the objects currently selected.

The search context menu is displayed in the header bar of any result widget associated to the search context.

i4_a4

Context menu

A context menu is configured through an element I4Config/contextMenus/contextMenu and is associated to one or more search context and one object type, respectively through the properties @searchContext and @objectTypeName.

It is rendered in the result widget, for a specific object of the list:

i4_a5

The property @searchContext is optional, this is a list of search contexts (comma separated list) that the menu is associated with, and if it is not set then the context menu is available independently of the search context associated to the result list. The property @objectTypeName is mandatory, and the context menu is available for objects of the specified type, as well as for objects of any type descending from the specified value.

When rendering the context menu for a specific object of a list, the system determines the I4Config/contextMenus/contextMenu configuration element that matches the best the type of the object and the search context associated to the result list. Note that the search context has a higher priority compared to the object type, so we get the best match among the contextMenu elements for which contextMenu/@searchContext matches, and if there is none of them, among the contextMenu elements for which contextMenu/@searchContext is not set.

The contents of a context menu can be partially dynamically controlled by the user. It is possible to configure a core set of menu items that are always displayed, together with five most recently used menu items selected from a larger set. In this situation, a "More..." link is displayed on the context menu which when selected displays all the possible menu items; selecting an item from this menu activates the command and adds it to the most recently used, ousting older items if the list is over five. 
 
The addition of a "displayMode" attribute to the "menuItem" configuration element controls how the associated element is displayed. Possible values are:
* "Fixed": the associated menu item will always be displayed. This is the default.
* "OnDemand": the associated menu item is optional and will appear on the "More..." menu.
* "Initial": the associated menu item is optional but will initially appear in the most recently used list.
By default, the "displayMode" is "Fixed" and so all the menu items will be displayed.
The following example shows a menu item that will appear in the "More..." menu and the most recently used entries, but will not be displayed initially:
<menuItem name="Set as Current Article" iconName="fa-edit" command="setCurrentObject" displayMode="OnDemand">
The most recently used information is stored in the workspace and is indexed by the search context and object type.

Properties menu

A properties menu is configured through an element I4Config/propertiesMenus/propertiesMenu and is associated to one or more search contexts and one object type, respectively through the properties @searchContext and @objectTypeName.

It is rendered in the properties widget, and applies to all the objects being rendered with that widget.

i4_a6

The property @searchContext is optional, this is a list of search contexts (comma separated list) that the menu is associated with, and if it is not set then the context menu is available independently of the search context associated to the result list. The property @objectTypeName is mandatory, and the properties menu is available for objects of the specified type, as well as for objects of any type descending from the specified value.

When rendering the properties menu for a properties widget, the system determines the I4Config/propertiesMenus/propertiesMenu configuration element that matches the best the common ancestor of the types of the object(s) and the current search context. Note that the search context has a higher priority compared to the object type, so we get the best match among the propertiesMenu elements for which propertiesMenu/@searchContext matches, and if there is none of them, among the propertiesMenu elements for which propertiesMenu /@searchContext is not set.

Menu items

Each menu item is configured with a menuItem element, and are associated to a command. There are three kinds of commands: built-in commands, workflow commands and url commands.

Text and icon

menuItem elements have two attributes @name and @iconName that determine how the menu item is rendered. The text displayed is the value of the menuItem/@name attribute, translated using StringScope.Normal.

The attribute @iconName is optional, and interpreted as follow:

-If it is set to a non empty string, then the 26 pixels database icon named cmd_xxx is displayed, where xxx is the value of @iconName.

-If it is not present or set to an empty string, then it defaults to the value of the @name attribute, and then the 26 pixels database icon named cmd_xxx is displayed, where xxx is the value of @name.

-In both case above, if the database does not contain a 26 pixels icon named cmd_xxx, then the dummy 26 pixels database icon named cmd applies.

It is recommended to choose properly the name of menu items, so that minimum configuration is required.

Menu separator

It is possible to insert separators within a context menu, by configuring a menu item without name, like this:

<menuItem />

Command name and parameters

The command to be executed when clicking on a context menu item is indicated by the menuItem/@command attribute. The command with either be a built-in command or the name of an element in the I4Config/commandDefs section.

It is possible to pass parameters through the menuItem/params/add elements. The syntax is as follow:

<menuItem . . .>

 <params>

   <add key="keyParam1" value="valueParam1" />

   <add key="keyParam2" value="valueParam2" />

   <add key="keyParam3" value="valueParam3" />

   . . .

 </params>

</menuItem>

 

Built in commands

The following built-in commands are available:

delete/spike

The “delete” and “spike” built-in commands serves to spike (i.e. logical delete) gn4 objects. The command is available when one or more object is selected.

Possible parameters

code

Code specifying the type of spiking. Possible values are “Normal” (Standard spiking), “Black” (Black copy) and “Auto” (Automatic spiking of sub-objects no longer used).

extend

Comma-separated list of attribute types - specified as <object type name>.<attribute name>. Spike also all the objects that reference the specified ones via these attributes.

extendunref

Comma-separated list of attribute types - specified as <object type name>.<attribute name>. Either spike or un-reference the objects that reference the specified ones via the attributes in this list - depending on the corresponding setting in the objects partition.

recurse

If true spike also the object that reference the ones matching the condition indirectly via the attributes specified by the Extend property (reference a referencing object etc.). Ignored if the parameter Extend is not set.

unref

Comma-separated list of attribute types - specified as <object type name>.<attribute name>. Remove all the objects to be spiked from these reference (single or multiple) attributes.

purge

Specifies for how long the objects will be kept in the system before they are purged (permanently deleted). If not specified the objects will be kept for the default time defined at system level.

Example: 4:30 for 4 hours and 30 minutes, 2.06:00 for 2 days and 6 hours.

deleteKeyword

The deleteKeyword built-in command displays a dialog allowing the selected nav:keyword objects (as displayed in a navSerachContext results) to be removed from their associated keywordSet.

newKeyword

The newKeyword built-in command displays a dialog allowing a new keyword to be added to the selected keywordSet object.

renameKeyword

The editKeyword built-in command displays a dialog allowing the selected nav:keyword object (as displayed in a navSearchContext results) to be renamed.

 

unspike

The “unspike” built-in command serves to unspike (i.e. logical undelete) gn4 objects. The command is available when one or more object is selected.

Possible parameters

extend

Comma-separated list of attribute types - specified as <object type name>.<attribute name>. Unspike also all the objects that reference the specified ones via these attributes.

recurse

If true unspike also the object that reference the ones matching the condition indirectly via the attributes specified by the Extend property (reference a referencing object etc.). Ignored if the parameter Extend is not set.

unref

Comma-separated list of attribute types - specified as <object type name>.<attribute name>. Restore all the objects to be unspiked from these reference (single or multiple) attributes.

purge

Description

The “purge” built-in command serves to purge gn4 objects. The command is available when one or more object is selected.

infoPopup

The “infoPopup” built-in command allows displaying the selected object in a modal dialog. The command is available when one and only one object is selected.

Possible parameters

tile

The preview is generated using the I4Config/tiles/tile element with @name attribute set to the value of the “tile” command parameter.

width

The width in pixels of the modal dialog. If not set, then it defaults to 600.

maxheight

The maximum height of the modal dialog. If not set, then it defaults to 500.

Example:

When running the menu item configured as follow, the list of the current checkouts for the object selected is generated using the I4Config/tiles/tile element with  @name set to ‘CheckOutList’, and displayed in a modal dialog:

<menuItem name="CheckOutList" command="infoPopup">

 <params>

   <add key="tile" value="CheckOutList"/>

 </params>

</menuItem>

 

Note also that the title bar of the modal dialog in which the preview is displayed is set to the value of the “tile” parameter, translated using StringScope.Default.

properties

The “properties” built-in command allows displaying the property window of the selected object(s). That form is made of an eventual preview of the object selected, plus an eventual tab set, each tab containing either an editing form or another preview of the object. The command is available when one or more object is selected.

Possible parameters

config

By default, the editing form is generated using the I4Config/propertiesConfigList/propertiesConfig element with @name attribute set to “Properties” that matches the best the type of the object(s) of which the properties windows must be displayed. But it is possible to use another I4Config/propertiesConfigList/propertiesConfig element by specifying its name through a command parameter “name”.

propertiesPopup

The “propertiesPopup” built-in command allows displaying the property window of the selected object(s).  This is show in a dialog It has all the same config as the properties command.

renameKeyword

The “renameKeyword” built-in command displays a dialog allowing the renaming of the selected nav:keyword object (as displayed via a navSearchContext)

search

The “search” built-in command allows displaying the search object.

Possible parameters

searchContextName

The searchContext used to search the trashcan.

xpath

The extra xpath to use. The xpath can optionally contain the parameter specifier $p0 which will be substituted with the selected id.

label

The label.

title

The title.

sortName

The sort name to use.

dirStyleName

The directory style name to use.

dirStyleKind

The directory style kind to use.

Example:

The following shows how to navigate to the results of a search that returns other articles in the same folder as the one currently selected:

<menuItem name="Navigate Folder" iconName="fa-edit" command="search">

  <params>

    <add key="searchContextName" value="Articles"/>

    <add key="dirStyleKind" value="0"/>

    <add key="dirStyleName" value="ArticleList"/>

    <add key="xpath" 

      value="[gn4:folderRef/@idref = /gn4:article[@id=$p0]/gn4:folderRef/@idref]"/>

  </params>

</menuItem>

 

searchPopup

The “searchPopup” built-in command allows displaying the search object in a modal dialog.

Possible parameters

searchContext

The searchContext used to search the trashcan.

xpath

The extra xpath to use.

label

The label.

sortName

The sort name to use.

dirStyleName

The directory style name to use.

dirStyleKind

The directory style kind to use.

width

The width in pixels of the modal dialog. If not set, then it defaults to 600.

height

The height of the modal dialog. If not set, then it defaults to 400.

title

The title of the modal dialog.

 

trashcan

The “trashcan” built-in command allows displaying the search object in a modal dialog. Apart from the default searchContext  and default title this is the same as the ‘searchPopup’ command.

Possible parameters

searchContext

The searchContext used to search the trashcan, default is ‘TrashCan’.

width

The width in pixels of the modal dialog. If not set, then it defaults to 600.

height

The height of the modal dialog. If not set, then it defaults to 400.

title

The title of the model dialog, default is ‘Trash Can’

unlock

Displays a dialog containing check-out info on the selected items, optionally allowing the user to unlock aspects of the items. Refreshes the results listing after successfully unlocking.

workspace

The workspace built-in command creates a new workspace. Optionally you can specify a name property that is used as the title of the new workspace. Also, you can optionally specify a workspacetemplatename property that identifies the workspaceTemplate used to create the workspace.

Possible parameters

name

The title of the workspace to create. If this is not specified, the name will be Workspace translated using the Default string scope.

workspacetemplatename

Identified the workspaceTemplate to be used to create the workspace. If the name parameter is not specified, this value will be used as the name of the workspace translated using the Default string scope.

edit

The “edit” built-in commands serves to edit gn4 objects with a designer, i.e. the article designer. The command is available when one object is selected.

Possible parameters

showpreview

Shows the preview in the editor, this is the start state of the preview in the article editor. The default value is true.

editPopup

The “editPopup” built-in commands serves to edit gn4 objects with a designer, i.e. the article designer. The command is available when one object is selected. This is show in a dialog. It has all the same config as the edit command.

openLocal

The “openLocal” built-in commands serves to open the open in app on the desktop, i.e. fred4.

If fred4 or ted4 are used with clickonce then in the appsettings on the server set fred4.clickonce to the fred4 url and ted4.clickonce to the ted4 url.

Possible parameters

protocol

This is the urlprotocol to use, the only ones to be support are ‘fred4’, ‘ted4’, ‘Photoshop’ and ‘InDesign’, Photoshop and InDesign have to be running and logged in to work.

articleSaveAs

The “articleSaveAs” built-in command serves to copy the article and all txts and any local txt geometry.

When the article has been copied it will show the article Designer for the new article so that it can be edited.

Workflow commands

Workflow commands are configured through I4Config/commandDefs/workflowCommandDef elements.

Example

The following example shows how to configure a “rotate” workflow command that allows executing the wf_rotate interactive workflow, used by two distinct “RotateRight” and “RotateLeft” context menu items.

<I4Config>

 . . .

 <commandDefs>

   <workflowCommandDef name="rotate" enable="Some" />

   . . .

 </commandDefs>

 . . .

 <contextMenus>

   <contextMenu objectTypeName="image">

     <menuItem name="RotateRight" command="rotate">

       <params>

         <add key="direction" value="right"/>

       </params>

     </menuItem>

     <menuItem name="RotateLeft" command="rotate">

       <params>

         <add key="direction" value="left"/>

       </params>

     </menuItem>

     . . .

   </contextMenu>        

 </contextMenus>

</I4Config>

Attributes

name

The name of the workflow command  i.e. the value of workflowCommandDef/@name.

wf

The name of the workflow to be executed. If not set, it defaults to the value of the name attribute.

enable

A value indicating the condition for the command to be enabled. The possible values are “Any” (the command is always enabled), “One” (the command is enabled if one and only one object is selected), “More” (the command is enabled if more than one object is selected), “Some” (the command is enabled if one or more object is selected) and “Zero” (the command is enabled only if NO object is selected).

autoClose

Indicates the conditions for the modal dialog in which the workflow is running to be closed automatically. The possible values are “No”, “WhenNoLog” (Default), “WhenNoErrorNorWarning”, “WhenNoError” and “Yes”.

 

Command parameters

The workflow will be passed the parameters configured through I4Config/contextMenus/contextMenu/menuItem/params. In order to know the parameters expected by a specific workflow, please refer to the documentation of the workflow itself.

Url commands

Url commands are configured through I4Config/commandDefs/urlCommandDef elements.

Example

The following example shows how to configure a “print” url command that allow opening a print preview of the selected object(s) in a new window.

<I4Config>

 . . .

 <commandDefs>

   <urlCommandDef

    name="print"

    url="{serverUrl}/{appName}/do.ashx?cmd=feed&amp;ids={ids}&amp;name={feedName}"

    enable="Some" />

   . . .

 </commandDefs>

 . . .

 <contextMenus>

   <contextMenu objectTypeName="folderObject">

     <menuItem name="Preview (GNPortal)" iconName="Print" command="print">

       <params>

         <add key="feedName" value="Display"/>

       </params>

     </menuItem>

     . . .

   </contextMenu>        

 </contextMenus>

</I4Config>

Attributes

name

The name of the url command, i.e. the value of urlCommandDef/@name.

url

The url to navigate to. It can features {paramName} place holders, where paramName is either “ids”, “searchContext”, “serverUrl”, or the name of a parameter provided through I4Config/contextMenus/contextMenu/menuItem/@params.

See the example above.

enable

A value indicating the condition for the command to be enabled. The possible values are “Any” (the command is always enabled), “One” (the command is enabled if one and only one object is selected), “More” (the command is enabled if more than one object is selected), “Some” (the command is enabled if one or more object is selected) and “Zero” (the command is enabled only if NO object is selected).

Command parameters

It is possible to provide command parameters through I4Config/contextMenus/contextMenu/menuItem/params. Read documentation of “url” attribute above for details.

Possible parameters

target

The value of the html target attribute, e.g. _blank, _self opening the url in a new window or current window respectively.