Web Client Model Configuration Guide Pre 1.2RC2

cancel
Showing results for 
Search instead for 
Did you mean: 

Web Client Model Configuration Guide Pre 1.2RC2

resplin
Intermediate
0 0 2,182

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Web Client Customization


Note


The following documentation is applicable for Release Candidate 2 through to 1.2RC1.

For versions 1.2RC2 through 1.2.1 refer here and for the latest version refer here.


Introduction


This page describes how to configure the Web Client for use with custom Types and Aspects. To define your own custom Types and Aspects, see here.


Customising the 'Add Aspect' Rule Action


Alfresco supports a Rule for applying an aspect to Content when it's introduced to a folder.  Within the rule definition UI, the user chooses which aspect to apply from a drop-down list.  The aspects within that list are configured in the xml file \projects\web-client\config\alfresco\web-client-config.xml.

The following configuration block specifies the list of aspects that are presented in the Rule definition UI.



   <config evaluator='string-compare' condition='Action Wizards'>
      <aspects>
         <aspect name='generalclassifiable' [displayLabel='Classifiable'] [displayLabelId='classifiable']/>
         <aspect name='complianceable'/>
         <aspect name='dublincore'/>
         <aspect name='effectivity'/>
         <aspect name='summarizable'/>
         <aspect name='versionable'/>
         <aspect name='templatable'/>
         <aspect name='translatable'/>
         <aspect name='localizable'/>
      </aspects>
      ...
   </config>

There are three options for specifying the displayLabel to display for each aspect (the same applies for the other items you can configure i.e. types, transformers). If no displayLabel is given it is retrieved from the data dictionary. To override the data dictionary title directly specify a 'displayLabel' attribute or to override using a localized string, specify the lookup key (into webclient.properties) via the 'displayLabelId' attribute.

To add the 'ImageClassification' aspect that was defined in the Data Dictionary Guide, the following line is introduced...



   <config evaluator='string-compare' condition='Action Wizards'>
      <aspects>
         <aspect name='my:imageClassification' displayLabel='Image Classification'/>
         ...

The application server needs to be restarted after making this change.


Viewing Aspect Properties in the Web Client Properties Page


The content of the Web Client properties page is data driven. Configuration allows the list of visible properties (and their order) to be specified on an Aspect by Aspect basis (and also Content Type basis).

The configuration is found in the xml file \projects\web-client\config\alfresco\web-client-config.xml.

Each Aspect is represented by the following snippet of xml:



   <config evaluator='aspect-name' condition='auditable'>
      <property-sheet>
         <show-property name='created' />
         <show-property name='modified' />
      </property-sheet>
   </config>

There are 3 options for specifying the display label. If nothing is specified (as in the example above) the display label will be taken from the data dictionary title for the property. To override the display label directly specify  a 'displayLabel' attribute or to override using a localized string, specify the lookup key (into webclient.properties) via the 'displayLabelId' attribute.

When the Properties page is displayed for a content object, the object is introspected and its aspects determined. A lookup in the configuration file is then made to retrieve all the <property-sheet> elements defined for the aspects applied to the object. It is not necessary to define a <property-sheet> for every aspect.

A list of properties to display for the object is then formulated from all the matching <property-sheet> definitions. Properties are displayed in the order they are defined in the configuration file.

To allow Web Client display of the Image Classification properties defined in the Data Dictionary Guide we can add the following to the xml file...



   <config evaluator='aspect-name' condition='my:imageClassification'>
      <property-sheet>
         <show-property name='my:width' displayLabel='Image Width' />
         <show-property name='my:height' displayLabel='Image Height' />
         <show-property name='my:resolution' displayLabel='Image Resolution' />
      </property-sheet>
   </config>

This informs the Properties page to display the three Image Classification properties whenever viewing a content object that has the Image Classification aspect applied to it.

The application server needs to be restarted after making this change.

To see this in action, setup a Content Rule to apply the Image Classification aspect, create some content that triggers the rule and then view its properties page.


Editing Aspect Properties in the Web Client Properties Page


The process for configuring the Web Client Edit Properties page is very similar to the View Properties page process.  The only difference is the xml file to edit; \projects\web-client\config\alfresco\web-client-config-edit-properties.xml.

To allow Web Client edit of the Image Classification properties defined in the Data Dictionary Guide we can add the following to the xml file...



   <config evaluator='aspect-name' condition='my:imageClassification'>
      <property-sheet>
         <show-property name='my:width' displayLabel='Image Width' />
         <show-property name='my:height' displayLabel='Image Height' />
         <show-property name='my:resolution' displayLabel='Image Resolution' />
      </property-sheet>
   </config>

The above is exactly the same as the View Properties configuration.

The application server needs to be restarted after making this change.

To see this in action, setup a Content Rule to apply the Image Classification aspect, create some content that triggers the rule and then click 'Edit' on its properties page.


Customising for Content Types


The viewing and editing of Content Type properties may be configured in exactly the same manner as Aspect properties.  The only difference is in the xml configuration; specify 'node-type' instead of 'aspect-name'.

For example, to add the 'SOP' type that was defined in the Data Dictionary Guide, the following XML is introduced...



   <config evaluator='node-type' condition='my:sop'>
      <property-sheet>
         <show-property name='name'/>
         <show-property name='mimetype' displayLabelId='mimetype' converter='org.alfresco.faces.MimeTypeConverter'/>
         <show-property name='title'/>
         <show-property name='description'/>
         <show-property name='size' displayLabelId='size' converter='org.alfresco.faces.ByteSizeConverter'/>
         <show-property name='my:publishedDate'/>
      </property-sheet>
   </config>

Creating Custom Content Types in the Web Client


Custom Content Types can be configured to appear in the Add and Create Content Wizards via the the xml file \projects\web-client\config\alfresco\web-client-config.xml.

The following configuration block specifies the list of object types to display in the content wizards.



   <config evaluator='string-compare' condition='Custom Content Types'>
      <content-types>
      </content-types>
   </config>

To allow creation of the SOP type defined in the Data Dictionary Guide we can add the following to the xml file...



   <type name='my:sop'/>

Associations in the Web Client


The viewing and editing of associations and child associations for types and aspects can be configured in the same manner as properties.

To display an association on a type or aspect add the following XML snippet to the property-sheet element.



   <show-association name='my:signOff'/>

To display a child association on a type or aspect add the following XML snippet to the property-sheet element.



   <show-child-association name='my:processSteps'/>

As with properties the XML file \projects\web-client\config\alfresco\web-client-config.xml allows configuration of the view details screen, whilst \projects\web-client\config\alfresco\web-client-config-edit-properties.xml allows configuration of the edit details screen.

Furthermore, the same rules for the displayLabel applies to associations and child associations. The absence of any attribute uses the title defined in the data dictionary, a 'displayLabel' attribute will use the specified label as is and a 'displayLabelId' will look up the value as a localised string in the webclient.properties message bundle.

So for example to configure a custom 'book' type that has an 'title' and 'author' property, a child association called 'chapters' and an association called 'references' the following XML would be used.

To add the associations defined on the 'SOP' type that was defined in the Data Dictionary Guide, the following XML can be added...



   <config evaluator='node-type' condition='my:sop'>
      <property-sheet>
         ...
         <show-association name='my:signOff'/>
         <show-child-association name='my:processSteps'/>
      </property-sheet>
   </config>

Full Example


After following the instructions above the file \projects\web-client\config\alfresco\web-client-config.xml will have the following XML...



   <config evaluator='node-type' condition='my:sop'>
      <property-sheet>
         <show-property name='name'/>
         <show-property name='mimetype' displayLabelId='mimetype' converter='org.alfresco.faces.MimeTypeConverter'/>
         <show-property name='title'/>
         <show-property name='description'/>
         <show-property name='size' displayLabelId='size' converter='org.alfresco.faces.ByteSizeConverter'/>
         <show-property name='my:publishedDate'/>
         <show-association name='my:signOff'/>
         <show-property name='my:authorisedBy'/>
         <show-child-association name='my:processSteps'/>
      </property-sheet>
   </config>
   <config evaluator='aspect-name' condition='my:imageClassification'>
      <property-sheet>
         <show-property name='my:width'/>
         <show-property name='my:height'/>
         <show-property name='my:resolution'/>
      </property-sheet>
   </config>
   <config evaluator='string-compare' condition='Custom Content Types'>
      <content-types>
         <type name='my:sop'/>
      </content-types>
   </config>

With these changes in place viewing the details of an SOP content node would look similar to the screenshot below...



Viewsop.jpg



Additionally, the file \projects\web-client\config\alfresco\web-client-config-edit-properties.xml will have the following XML...



   <config evaluator='node-type' condition='my:sop'>
      <property-sheet>
         <show-property name='my:publishedDate'/>
         <show-association name='my:signOff'/>
         <show-property name='my:authorisedBy'/>
         <show-child-association name='my:processSteps'/>
      </property-sheet>
   </config>
   <config evaluator='aspect-name' condition='my:imageClassification'>
      <property-sheet>
         <show-property name='my:width'/>
         <show-property name='my:height'/>
         <show-property name='my:resolution'/>
      </property-sheet>
   </config>

If the properties of an SOP content node are edited with these changes applied the result will look similar to the screenshot below...



Editsop.jpg


Advanced Property Sheet Configuration


A full reference guide to all the options available for property sheet configuration can be found here.