Adding Functionality

 

Desktop Actions Defined

Enfold Desktop lets you edit content, metadata and workflow states for built-in Plone content types.

If you are a developer or administrator, you also have the ability to enhance the functionality of Enfold Desktop for users by creating Desktop actions.

A desktop action is a way to extend the functionality of Enfold Desktop with a Portal Action configured by the Zope Management Interface (ZMI). It appears as a right-click option when a Desktop user clicks on a content item.

To go to the menu to configure portal actions, you will need to have an Administrator/Manager account and the ability to access the ZMI. Generally, the path will be ZMI --> (name of Plone site) --> portal Actions --> Click the tab labeled "Actions". Depending on your specific configuration, you should see several actions already configured and active.

images/remove_view_in_ed.png

Each action has several fields: Title, ID, URL (Expression), Condition (Expression), Permission, Category, Visible. (See bottom for a reference about how to configure this form).

Two of the actions (View in Enfold Desktop, Lock Manager) are document_actions (available via a URL inside the web browser). However, you should see another action called View in Browser which is relevant here. "View in Browser" is actually a Desktop action which appears whenever you right-click on a content item inside Enfold Desktop. (you will note that the category says "Desktop Actions"). If you changed the title of this Desktop Action to View in Firefox (for example) and saved, people who used Enfold Desktop would see that instead of View in Browser the right-click option would say View in Firefox instead.

That is just a cosmetic change of course. URL (Expression) and Condition (Expression) contain a description of the action produced and a condition to see if the Desktop Action ought to apply.

Other Uses

Here are some possible uses for Desktop actions:

  • A Desktop action could send the user to a URL to notify the original creator about a change.
  • A Desktop action could let you view a custom URL associated with this document (such as a listing of reader comments about the document).
  • A Desktop action could create a PDF/RTF/ version of the document for download.
  • A Desktop action could let you add additional metadata (like keywords, etc) about a particular document or file.

The example shows in the next section lets you view the history of a document or file.

Example: Making a "View History" Desktop Action

To demonstrate how Desktop Actions work, let's make another Desktop action titled View History. When you right-click on it, it will take you to the history page of a Plone content item. (The history page lists the different versions of a document and lets you revert to previous versions, view Change Logs and view differences between versions. (See this important note about Enfold Desktop and Versioning ).

images/desktop_action.png
  1. Go to /plonesite/portal_actions in ZMI. Choose the Actions tab at the top.

  2. Enter these values:

    • Title: View History

    • ID: view_history

    • URL(Expression)

      python: '/' + object.portal_url.getRelativeUrl(object)+ '/versions_history_form'
      
    • Condition(Expression): leave blank

    • Permission: View

    • Category: desktop_action

    • Visible? (yes; check this)

After you complete this, press the Save button underneath it.

When in Enfold Desktop, refresh the view of your current folder by hitting F5. Assuming that you have entered your data correctly, you should see one more menu item on the right-click menu called View History.

images/viewhistory_context.png

After you choose View History, your browser will open up in the history tab of a document. If you have made one or more versions using Kupu, the history tab should show some information about the different versions of the document. Note that Enfold Desktop does not create change notes and/or keep versions of consecutive checkins, so it's usefulness may be limited if it hasn't been edited previously in Kupu.

Action Reference Guide

(This comes from the Zope documentation for CMFCore-Actions). For information about how to construct TALES expression, see http://wiki.zope.org/ZPT/TALES ( http://wiki.zope.org/ZPT/TALES ).

Actions generate links to views of content, or to specific methods of the site. They can be filtered via their conditions.

The Actions tab is the place to add or modify actions. The following fields are available to describe an action:

  • Title -- The freely selectable title will show up as the link text for the linked action in the portal.

  • Id -- An ID uniquely identifies an action in its action category (see below) and thus should be unique among the other action IDs in the same category.

  • URL (Expression) -- A TALES expression that is used to construct the link target for the action. The following bound names are available to your expression:

    • object -- The current object
    • object_url -- The URL for the current object
    • folder -- The current object's containing folder
    • folder_url -- The URL for the current object's containing folder
    • portal -- The portal object
    • portal_url -- The URL for the portal
    • isAnonymous -- A boolean evaluating to a truth value if the current user is an anonymous site visitor and false if the user is authenticated
    • user_id -- The current user's ID
  • Condition (Expression) -- A TALES expression that determines whether the described action should be shown or not. The expression namespace contains the same members as described under URL (Expression)

  • Permission -- Select a permission to limit the action to visitors who have the selected permission

  • Category -- The action category, which is used to subdivide the available actions into logical groups. The category can be arbitrary or one of the commonly-used categories, such as object or folder etc.

  • Visible -- Toggle to enable or disable showing the action link in case the Permission and Condition restrictions are met, but the action is not supposed to show up at all.