osCaddie: Deeper Integration Between Drupal and Alfresco

August 29
blog author

Appno Blogger

Appnovation Coop

With osCaddie, we try to continuously improve the Drupal - Alfresco integration. Traditionally, Alfresco is used as a back-end document repository, and Drupal as the front-end. Drupal is a flexible CMS, and this is a very good tool for creating a nice, dynamic and ergonomic user interface. On the other side, Alfresco is a very powerful document management system, but it’s not trivial to deeply tweak the UI. The classic osCaddie integration is based on the CMIS standard : Alfresco is used as a CMIS server, while Drupal is set as a CMIS browser. This provides a way to manage documents stored in Alfresco, from Drupal. In an attempt to push the integration further, we wanted to create an integration at the UI level : We wanted to integrate a custom Alfresco document view inside a iframe, on the Drupal side. We thought it would greatly improve the user experience, as it would allow users to manage documents the same way they would do from Alfresco Share, without having to connect to another webapp. They would be able to trigger actions from Alfresco Share & Drupal from the same page. In order to do that, we first needed to create a custom Alfresco Share page. This is an easy task, and the Alfresco wiki is well documented about that : http://wiki.alfresco.com/wiki/Share_Custom_Pages We needed to create a new “Page definition”, “template instance” and “template”. Since we just wanted to simplify the “document-details” page, we copied those 3 files for this page, renamed them and removed the unnecessary parts, to create our “custom-document-details” page. This custom page only had to include those 3 elements from the original document details page :
  • Preview
  • Actions
  • Versions
The “Preview” and “Versions” parts of the page didn’t need any customization, as we wanted the exact same details as in the original document page, but for the “Actions” part, we wanted to restrict them to a selected subset, to expose only few actions on this custom page. Alfresco 4.x makes it flexible to declare a new custom set of action (action group). Here are the different needed steps :
  • Passing the “view” argument to the “Actions” component of the page, in the “template-instance” page. This parameter should match the “action group” name. As the original “document-details” page uses the “document-details” action group name, we chose to create a new “document-customdetails” action group name.
  • Create a new DoclistActionGroupResolver (Java Class) by overriding the DefaultDoclistActionGroupResolver, and declare it as “resolver.doclib.customActionGroup” in the spring context. This new CustomDoclistActionGroupResolver is responsible to give the “action-group” name as an output from the node details and the “view” argument received as input. In our case, we want to return “document-customdetails” when input string “view” equals “customdetails”.
  • Edit the share-custom-config.xml to :
    • Use that new CustomDoclistActionGroupResolver, instead of the DefaultDoclistActionGroupResolver
    • Set the different actions available in that custom action group “document-customdetails”
    Here are the code added to the share-custom-config for that part : <config evaluator="string-compare" condition="DocLibActions"> <actionGroupResolver>resolver.doclib.customActionGroup>/actionGroupResolver> <actionGroups> <actionGroup id="document-customdetails"> <action index="100" id="document-download" /> <action index="110" id="document-view-content" /> </actionGroup> </actionGroups> </config>
The next challenge was to set a single-sign-on between Drupal and Alfresco. We chose to use the Jasig CAS authentication server. That way, as soon as we are logged into Drupal, we are logged into Alfresco as well, and we don’t need to re-type the credentials again inside the iframe. Please find attached a snapshot of the resulting page. The advantage of this integration is the flexibility it provides. From there, we can create other new custom pages if we want to access some other actions from Drupal (Manage a workflow, Add category/tag, ...). That way, we have the possibility of directly integrating a functionality from Alfresco to Drupal at the UI level without having to re-create the UI in Drupal and the custom web-scripts needed in Alfresco.