Developer Notes

Plone Translation Hub class diagram

Overview

The PloneXL8 Archetypes-based product was created using Poseidon UML version 3.2 CE and ArchGenXML . Note that as of this writing ArchGenXML was not working properly with the latest version of Poseidon, version 4.0. Given that I'll be looking for collaborators on this project, it is probably not ideal to require use of a particular tool, particularly a closed-source (though freely downloadable) one like Poseidon UML Community Edition (though theoretically any XMI-compliant UML tool--like the open-source ArgoUML--ought to work).

The primary sources of help in creating the project with ArchGenXML were:

  • Poi , a Plone issue tracker created with ArchGenXML and distributed with a .zuml file for viewing the model.
  • ArchGenXML Getting started , an excellent and complete tutorial.

Class Model

There are two main classes, TranslationDoc and TranslationCenter:

TranslationDoc

This is the class for both source documents for subsequent translations and the translations themselves. It extends the ATDocument class from Archetypes (hence the "stub" stereotype and generalization relationship), and as of this writing adds a single attribute: a text field for "TranslatorsNotes". (Note: In addition to applying the "stub" stereotype, you need to add one tagged value to the ATDocument class: import_from: Products.ATContentTypes.content.document)

Important tagged values:

  • creation_roles: python:('Manager', 'Member') -- so that any registered user of the system can actually create a document or translation
  • i18ncontent: linguaplone -- this gives LinguaPlone translation ability to the content (i.e., inserts the necessary lines in your Archetypes class as per LinguaPlone documentation)

TranslationCenter

A container class for the TranslationDoc, with which it shares a relationship of composition: a DocumentTranslationCenter is composed of one or more TranslationDocs. It has a "large" stereotype, which makes it extend BaseBTreeFolder so that it can contain a large number of items more efficiently. It also has a "view" operation with the "action" stereotype, which I think was necessary to be able to create a custom view using the new template I created for viewing the items inside a DocumentTranslationCenter (see below):

Important tagged values:

  • content_icon: dtc.gif -- must be inside skins/PloneXL8
  • imports: from Products.CMFCore import CMFCorePermissions -- this is necessary for the view operation mentioned above (which has its own tagged value to indicate who can execute the operation)
  • imports: from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin -- this enables use of a custom view template
  • additional_parents: BrowserDefaultMixin -- see above: part of the same issue
  • default_view: dtc_view -- points the view action on the class to to dtc_view.pt, which was put in the skins/PloneXL8 directory

Default values common to both classes

  • archetype_name -- the human readable name for your class
  • typeDescription -- description, appears in various templates in Plone, isn't just Python documentation
  • use_portal_factory: 1 -- set to one to avoid stray unsaved objects
  • rename_after_creation: 1 -- to give the object a name based on the title
  • creation_roles: python:('Manager', 'Member') for TranslationDoc, python:('Manager',) for TranslationCenter
  • creation_permission: I'm actually not sure right now if creating a custom "creation_permission" was necessary for either class.

Workflows

Common tagged values on workflow states

  • initial_state: 1 -- used on the state a new object starts in
  • label -- the human-readable label you want to show up in the app interface
  • view, modify, and access: include a comma-separated list of the roles that perform do each of these actions on an object in the relevant state

Common modifications to workflow transitions

  • "Guard" -- either restrict when the transition can take place by roles, permissions or expressions (see ArchGenXML tutorial)
  • "Effect" -- which script to run when the transition is executed. The function skeleton will be placed in the generated code, and you'll have to fill it in.

TranslationCenter

Container class workflow

A simple workflow with only two states: "open" and "closed".

Only Managers and Owner can effect a transition on TranslationCenter objects, hence the guard_roles:Manager;Owner expression in "guard".

Similarly, an "Add portal content" tagged value is included in both states, indicating the only Managers and Owners can add content when the object is "closed," but adds that privilege to Members when the object is "open".

TranslationDoc

Translation document workflow

A more complex workflow here with the following states labeled:

  • Open -- this is the initial state. Note,
  • In progress
  • Partially complete
  • Review
  • Complete

Attachments