Wednesday, October 28, 2009

Configuring Alfresco Share's "Change Type" Dialogue

A quick summary of the configuration of "Change Type" Document Action.

***************************************************
Environment:

Testing on Alfresco Labs 3.2
Application server: tomcat 6.0.18
OS: Ubuntu 9.04 x64
Linux kernel: 2.6.28-11-server

***************************************************


Code Trace


The values for the "Change Type" document action are driven from a slingshot webscript. The code trace goes as follows:

1. Share executes the change-type webscript from /share/service/script/org/alfresco/modules/documentlibrary/change-type.get

2. Within the js for the above webscript, there is a remote call to the types webscript from /alfresco/service/slingshot/doclib/types/node/{store-type}/{store_id}/{id}

3. The configuration file for this webscript is types.get.config.xml. The configurations are entered into an overridden version of this file. In the future, this configuration will be rolled into a centralized Share configuration file.

It appears that only static references are currently allowed, but it would be nice to see either some sort of model-based attribute that can allow for inherited values or webscript-based dynamic include.

an example modification would be the addition of:

<type name="ts:doc">
<subtype name="ts:webasset"/>
</type>

"ts:doc" = the qualified content type name
"ts:webasset" = the qualified target type name

Although it may be obvious, when the document being viewed matches the qualified content type, the available subtypes will populate the "Change Type" drop-down list.

It doesn't appear that the name could be re-labeled into a more human-readable form. The code only takes the name attribute of the subtype element and passes that directly into the freemarker template which replaces the ":" with "_". Hopefully there will be a labeling system implemented in the future as well. If not, it wouldn't be a complex modification to the ootb javascript to allow for the inclusion of the text value of the subtype element. That would allow a label to be included as follows:

<subtype name="ts:webasset">ThoughtSpring Web Asset</subtype>

Code Deployment


I have created my own copy of types.get.config.xml within my Alfresco development project. I deployed this file to the Alfresco server's tomcat classloader, which is where (ideally) all Alfresco customizations will live.

I'm using an ant scp task to copy my file to the following directory:

/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/slingshot/documentlibrary

At this point, you'll need to restart Alfresco to allow tomcat to load the file.

1 comment:

  1. Nice to see somebody blog on this subject - I'm just considering implementing a image preview file picker.

    Its a shame the Dojo version is so old.

    ReplyDelete