[Check out our newest module for email management and archiving with Alfresco]
[See here about our even newer module for automatic trashcan management with Alfresco]
This blog post will explain in depth a way to add custom site presets to Alfresco share as nice as possible. Nice here means, to play well with others:
- use the extension mechanism
- do not overwrite any existing configuration files
- do not overwrite any Alfresco Spring beans
Currently, as of Alfresco 4.0dCE and 4.0.1EE it is not possible to add presets through the share extension mechanism alone.
What is a share site preset?
How to create a share site preset?
- Create a preset file containing the XML configuration of your site : my-custom-presets.xml. A good starting point is to copy the existing presets.xml and remove all unnecessary configuration
- Create an extension to augment the presets UI dialog controller with your new site data.
- Add our new presets file to the list of preset files that the share preset manager recognizes.
<bean id="webframework.presets.manager" class="org.springframework.extensions.surf.PresetsManager">
<property name="modelObjectService" ref="webframework.service.modelobject" />
<property name="searchPath" ref="webframework.presets.searchpath" />
<property name="files">
<list>
<value>presets.xml</value>
</list>
</property>
</bean>
<property name="beanName" value="webframework.presets.manager" />
<property name="propertyName" value="files" />
<property name="position" value="-1" />
<property name="additionalProperties">
<list>
<value>my-custom-presets.xml</value>
</list>
</property>
</bean>
A module using this tooling plays nice with others, because no overwriting as taken place.
Back to step 2, creating the share extension to augment the site creation controller with the new site:
Place a file my-custom-extension.xml into alfresco/site-data/extensions/ with the following contents. It is a share extension with a single package customization.Back to step 1, creating the presets description file:
Quite some lengthy steps, to sum up:
- a presets file describing your site preset configuration
- a share extension configuration
- a spring bean definition to use the Spring AddToListPropertyPostProcessor
Let me know if it works - but also if it not works of course;)
One thing that comes to mind - the share extension has to be activated. To activate the module automatically on share startup, add this to your shared/classes/alfresco/web-extension/share-config-custom.xml file:
<config evaluator="string-compare" condition="WebFramework">
<web-framework>
<module-deployment>
<mode>manual</mode>
<enable-auto-deploy-modules>true</enable-auto-deploy-modules>
</module-deployment>
</web-framework>
</config>

