Logo Help Center

Adding custom context menu commands to Content Station 9

 

Adding custom context menu commands to Content Station 9

Custom functionality can be added to Content Station by adding commands to the context menu of a file or selected text. These commands can be linked to specific actions.

Example: You can add functionality such as printing a file, sending selected text to Google Translate or Twitter, storing text in a dictionary, and so on.

Note: The context menu is accessed by right-clicking a file or a selection of text.

In the following video, text is sent to Google Translate:

Areas to add commands to

Custom context menu commands can be added to the following areas in Content Station:

How actions are provided

The action that is performed should be provided by one of the following:

  • For files:
  • A script. This can be any file such as a .php file.
  • For selected text:
  • An Enterprise Server plug-in
  • An external Web site

Where to get the actions from

The actions need to be created or obtained yourself; they are not provided by WoodWing (although sometimes actions are made available on WoodWing Labs, such as the script for Printing an article or image as a PDF to a local printer).

Tip: Use the Content Station forum to ask the Community if the scripts that you are after already exist.

Adding custom context menu commands to files

Adding custom context menu commands to files is done by defining them between the following tags in the WWSettings.xml file:

<ObjectContextMenuActions>
   <ObjectContextMenuAction your action here />
</ObjectContextMenuActions>

The following syntax is used:

<ObjectContextMenuAction label="Command Name" url="{SERVER_URL}Action.php?ticket={SESSION_ID}&id={DOSSIER_ID}" objtypes="object type, object type" silent="true"/>

  • Command Name The name of the command as it should appear in the context menu

  • url The path to the action that should be executed. The following variables can be used:
  • Supported wildcards for all object types:
  • {SERVER_URL} The path to the current Server. It is automatically filled in by Content Station.
  • {SESSION_ID} The current ticket. It is automatically filled in by Content Station.
  • {DOSSIER_ID} (Requires Content Station 9.8.3 or higher) The ID of the Dossier. It is automatically filled in by Content Station. ID 0 (zero) is used when the object is selected outside of the Dossier.
  • {OBJECT_IDS} Comma-separated list of object IDs.
  • Supported wildcards for placements:
  • {WORKSPACE_ID} The ID of the workspace in which the preview is loaded.
  • {LAYOUT_ID} The ID of the layout for which a preview is generated.
  • {EDITION_ID} The ID of the Edition in which the preview is generated.
  • {SPLINE_ID} The ID of the spline of the frame.
  • Supported wildcards for pages in the Publication Overview Application:1
  • {PAGE_NUMBER} The number of the page that was right-clicked.
  • Action.php The name of the script that performs the action.
  • Object type The name of the object type for which the command should appear. Multiple object types can be defined (separated by a comma). Use any of the following file types:
  • Advert
  • Archive
  • Article
  • ArticleTemplate
  • Audio
  • Dossier
  • DossierTemplate
  • Hyperlink
  • Image
  • Layout
  • LayoutModule
  • LayoutModuleTemplate
  • LayoutTemplate
  • Library
  • Other
  • Page 1, 2
  • Presentation
  • PublishForm
  • PublishFormTemplate
  • Spreadsheet
  • Task
  • Video

1 Requires Content Station 9.8.4 or higher.

2 A page in the Publication Overview Application.

  • silent (Content Station 9.0 only) Indicates whether the URLs need to be executed silently, meaning that any dialog boxes or referenced Web sites are suppressed and do not appear. Possible values: "true" or "false".
  • external (Content Station AIR 9.0 only) When set to true the URL is opened in the system Web browser.
  • users (Requires Content Station 9.8.3 or higher) A comma-separated list of users that can see the context menu command. When empty, all users can see the command.

Note: Use the name that is entered in the 'User' field of the user's profile, not the name in the 'Full Name' field.

  • userGroups (Requires Content Station 9.8.3 or higher) A comma-separated list of user groups that can see the context menu command. When empty, all users in all groups can see the command.
  • strong>statuses (Requires Content Station 9.8.3 or higher) A comma-separated list of Workflow Status names. When empty, items in all Statuses can see the command.

Note: Be aware that the same Status names can be used across different Brands.

  • brands (Requires Content Station 9.8.3 or higher) A comma-separated list of Brand names. When empty, items in all Brands can see the command.
  • displayMode: (Requires Content Station 9.1 or higher) defines whether the URL is opened in Content Station or in the default Web browser. Possible values:
  • internal: (Content Station AIR only, default behavior) In a new tab, including a URL address bar and a Refresh button.
  • internalNoNavigation: (Content Station AIR only) In a new tab, without a URL address bar or a Refresh button.
  • external: For Content Station AIR: in the system browser; for Content Station Web: in the same browser.
  • silent: The URL is not opened; any text that is returned is shown in an alert dialog.

Example: Here, a Print action is attached to a context menu command named "Print Articles, Images" to objects of type article and image.

<ObjectContextMenuActions>
   <ObjectContextMenuAction label="Print Articles, Images" url="{SERVER_URL}printarticles.php?ticket={SESSION_ID}" objtypes="Article,Image"/>
</ObjectContextMenuActions>

Notes about the url definition

  • The definition following "url=" will be opened in a new Application tab. The ID’s of the selected objects will be appended to the URL (for example {SERVER_URL}printImage.php?ids=1,2)
  • Any data that is returned will be displayed as plain text to the user in a dialog box

Important: Make sure to validate the WWSettings.xml file for correct content. See Validating the WWSettings.xml file.

Adding custom context menu commands to text

Adding custom context menu commands to text in the Multi-Channel Text Editor is done by defining them between the following tags in the WWSettings.xml file:

Important: Make sure to validate the WWSettings.xml file for correct content. See Validating the WWSettings.xml file.

<EditorContextMenuActions>
   <EditorContextMenuAction Your action here>
      <Areas>
         <Area The Content Station area here/>
      </Areas>
   </EditorContextMenuAction>
</EditorContextMenuActions>

Commands can be added by referencing one of the following:

  • An action script, using the following syntax:
<EditorContextMenuActions>
   <EditorContextMenuAction label=Command Name url="{SERVER_URL}config/CSscripts/Actions/Action.php?ticket={SESSION_ID}" silent="true">
      <Areas>
         <Area name="ALL" />
      </Areas>
   </EditorContextMenuAction>
</EditorContextMenuActions>
  • A Web site, using the following syntax:
<EditorContextMenuActions>
   <EditorContextMenuAction label=Command Name url="http://www.website.com/#auto|en|{SELECTED_TEXT}" silent="true" external="true">
      <Areas>
         <Area name="ALL" />
      </Areas>
   </EditorContextMenuAction>
</EditorContextMenuActions>
  • A Server plug-in, using the following syntax:
<EditorContextMenuActions>
   <EditorContextMenuAction label="&lt;Command Name&gt;" url="{SERVER_URL}/config/plugins/myplugin.php?sessionid={SESSION_ID}&id={OBJECT_IDS}" silent="true" external="true">
      <Areas>
         <Area name="ALL" />
      </Areas>
   </EditorContextMenuAction>
</EditorContextMenuActions>
  • Command Name is the name of the command as it should appear in the context menu
  • url is the path to the action that should be executed. The following variables can be used:
  • {SERVER_URL}: the path to the current Server; it is automatically filled in by Content Station.
  • {SESSION_ID}: the current ticket; it is automatically filled in by Content Station.
  • {OBJECT_IDS}: the ID of the article; ID 0 (zero) is used for new articles.
  • {DOSSIER_IDS}: the ID of the Dossier; ID 0 (zero) is used when the article is opened outside a Dossier.
  • [SELECTED_TEXT}: the selected text or the word in which the text cursor is currently placed.
  • Action.php: the name of the script that performs the action.
  • silent (Content Station AIR 9.0 only) indicates whether the URLs need to be executed silently, meaning that any dialog boxes or referenced Web sites are suppressed and do not appear. Possible values: "true" or "false".
  • external: (Content Station AIR 9.0 only) defines whether the URL is opened in Content Station or in the default Web browser. Possible values: "true" or "false".
  • {SELECTED_TEXT} The selected text, in case of a misspelled word the misspelled word, else the word.
  • {NUMBER_OF_TOTAL_CHARACTERS} (Requires Content Station 9.8.8 or higher) The current number of total characters in the article.
  • {NUMBER_OF_TOTAL_WORDS} (Requires Content Station 9.8.8 or higher) The current number of total words in the article.
  • {NUMBER_OF_TOTAL_PARAGRAPHS} (Requires Content Station 9.8.8 or higher) The current number of total paragraphs in the article.
  • {NUMBER_OF_CHARACTERS_IN_COMPONENT} (Requires Content Station 9.8.8 or higher) The current number of characters in the component the focus is in.
  • {NUMBER_OF_WORDS_IN_COMPONENT} (Requires Content Station 9.8.8 or higher) The current number of words in the component the focus is in.
  • {NUMBER_OF_PARAGRAPHS_IN_COMPONENT} (Requires Content Station 9.8.8 or higher) The current number of paragraphs in the component the focus is in.
  • displayMode: (Requires Content Station 9.1 or higher) defines whether the URL is opened in Content Station or in the default Web browser. Possible values:
  • internal: (Content Station AIR only, default behavior) In a new tab, including a URL address bar and a Refresh button.
  • internalNoNavigation: (Content Station AIR only) In a new tab, without a URL address bar or a Refresh button.
  • external: For Content Station AIR: in the system browser; for Content Station Web: in the same browser.
  • silent: The URL is not opened; any text that is returned is shown in an alert dialog.
  • Area: the area in which the command should be used:
  • ALL: the command appears for all words: those that are spelled correctly and those that are spelled incorrectly.
  • TEXT: the command only appears for words that are spelled correctly
  • SPELLCHECK: the command only appears for words that are spelled incorrectly

Notes:

  • Areas have to be included.
  • Areas need to be added between the <EditorContextMenuAction> </EditorContextMenuAction> tags.
  • The preceding <EditorContextMenu> tag should not end with a forward slash.
  • escape. (Requires Content Station 9.4.3 or higher or Content Station 9.5.1 or higher): defines if the text should be 'escaped' or not, meaning that Unicode characters in the URL will either be converted or left untouched. Possible values: "true" or "false".

Example: The text in the URL contains the character 'ž'.

  • When escape="true", ž comes out as %U017D%.
  • When escape="false", ž comes out as ž.

Example: Here, text is opened in Google Translate.

<EditorContextMenuActions>
   <EditorContextMenuAction label="Google Translate" url="{SERVER_URL}config/CSscripts/Actions/GoogleTranslate.php?ticket={SESSION_ID}">
      <Areas>
         <Area name="ALL" />
      </Areas>
   </EditorContextMenuAction>
</EditorContextMenuActions>

Document history

  • 23 January 2017: Added the following options to custom context menu commands for text:
  • {NUMBER_OF_TOTAL_CHARACTERS}
  • {NUMBER_OF_TOTAL_WORDS}
  • {NUMBER_OF_TOTAL_PARAGRAPHS}
  • {NUMBER_OF_CHARACTERS_IN_COMPONENT}
  • {NUMBER_OF_WORDS_IN_COMPONENT}
  • {NUMBER_OF_PARAGRAPHS_IN_COMPONENT}
Was this article helpful?
0 out of 0 found this helpful / Created: / Updated:
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.