Blogroll

The New Domino Admin

A great source of information for Lotus Domino administrators

ecmarchitect.com

Jeff Potts' excellent ECM/Portal blog

Jared Ottley

Lots of very useful Alfresco articles

Looking for web hosting?  I have been using DreamHost for years and have found them to be reliable, inexpensive and very good at what they do!  Click below to sign up, use promo code 'unorganized' to get a free domain registration and 10 bucks off your first year of hosting!

 

dreamhostBadge

Home Software and Tech Software Development Integrating Alfresco Content into a Drupal Site
Integrating Alfresco Content into a Drupal Site PDF Print E-mail
Written by Nathan McMinn   
Thursday, 26 August 2010 19:04

I've been on a bit of a tear with CMIS lately.  Every time I have a project requirement that mentions document storage or a document library, I think "hey, let's use Alfresco, that CMIS interface is pretty nifty".  I have heard some people grumble that CMIS isn't ready for "prime time" (whatever that means), but my experience suggests otherwise.  So far I have used Alfresco's CMIS interface in iPad / iPhone applications, Python scripts (running in Jython) and a few J2EE web applications.

 

Well, let's add another one.  My company makes extensive use of Drupal for internal and external web sites.  It's lightweight, pretty easy to train content owners to use, is dead simple to host and has LOTS of support among the various designers and agencies we work with.  I'm not a huge fan of PHP personally, but I like the modularity and simplicity Drupal offers.  One of the Drupal sites I have been called on to improve is a communication portal for a large internal project.  The portal is pretty simple, with just a few menus and a couple of custom content types.  The project participants are already using Alfresco to manage many of their internal documents, and they want to expose two Alfresco Share document libraries to the portal.  One of these sites contains general project information and the other contains training materials.  Sound like a use case for CMIS?  You bet.

 

There are a few options available for integrating CMIS content into a PHP web application.  The first way I explored was writing my own module using phpclient from the Apache Chemistry project.  I have used this in the past and found it to be a solid implementation of CMIS for PHP.  However, there is a better solution out there for Drupal users.  There is a CMIS API module that encompasses a CMIS query tool, a repository browser, content synchronization and a few other goodies.  Let's step through setting it up.

 

First, download the module package and add it to your Drupal installation.  Installing a Drupal module is as simple as unpacking it into <drupal_base>/sites/all/modules/contributed.  Once you have the module installed, open up your settings.php (I use the site-specific config file in <drupal_base>/sites/<hostname>/settings.php), and configure a new repository by adding the following bit of PHP to the end of your settings file.  If you like, you can configure multiple repositories by adding multiple entries like the 'default' entry to the outer array:

 

1
2
3
4
5
6
7
8
9
10
/**
 * CMIS repository configuration
 */
$conf['cmis_repositories'] = array(
'default' => array (
'user' => 'alfresco_username',
'password' => 'alfresco_password',
'url' => 'http://my.server/alfresco/service/cmis'
)
);

 

Now that the module is installed and a repository is configured, log into Drupal with an Administrator account and go to the module list.  At this point you should see a new section in the list for CMIS modules.

 

drupal_cmis_modules

 

There are a few modules here that are of particular interest.  The CMIS module has to be enabled, as it is required by the rest of the modules in the package.  Other modules I have found useful are the CMIS Browser and CMIS Query modules.   I haven't had a occasion to use the headerswing, Dev or Sync modules, but I went ahead and enabled them anyway for evaluation.  Check the requisite boxes and click "Save" at the bottom of the page to enable the modules you want to use.  Once enabled, you have some new functionality to explore.  Let's take a quick look at the CMIS Browser module first.

 

The browser can be accessed at http://your.server.com/yourdrupalpath/cmis/browser.  It provides a navigable, "explorer-like" view of your CMIS repository, as well as actions for creating content and folders:

 

drupal_cmis_browser

 

The Browser module can also be directed to a specific repository path by appending that path to the end of the URL.  For example, if you want to see the contents of the "Sites" folder displayed, just append "Sites" to the end of your URL, like so:  http://your.server.com/yourdrupalpath/cmis/browser/Sites. This is very handy if you want to link to the CMIS browser from a Drupal menu and drop into a specific folder in your repository.

 

The query module works in a similar fashion.  It provides a CQL (Content Query Language) interface to the configured repository.  You can access the query module at http://your.server.com/yourdruplapath/cmis/query.  Just enter a valid CQL query and click "Run":

 

drupal_cmis_query

 

Like the browser module, the query module can take the specific query as a part of the URL.  If you append the query after the base URL, the module will be displayed with the query already executed. 

 

Both of these modules are very handy for exploring and searching a repository, but I need something a bit simpler.  I just want to display a table of folders and documents that my users can click through.  No tree views, no queries, no breadcrumb trail, no actions.  Just a simple little file/folder list.  To that end, I grabbed some of the code from the existing query and browser modules (thanks guys, I love open source!) and created a simple CMIS Display module:

 

drupal_cmis_display

 

The CMIS Display module works much like the CMIS Browser module.  It will display any repository path that is appended to the URL.  So, if you wanted to display everything in your "Sites" folder in the repository, this is the URL you would use:  http://your.server.com/yourdrupalpath/cmis/display/Sites.  It's simiple, clean and easy to use.  The CMIS Display module isn't part of the CMIS module package, but if you want to add it to your Drupal installation, just download the zip file here, and unzip it into your CMIS module installation directory.  This will create a cmis_display directory alongside your cmis_browser and cmis_query directories.  If you install it after the rest of your CMIS module is installed, don't forget to go to the Drupal Modules list and activate it.  Big thank you to all of the Drupal CMIS module contributors for making my life a little easier!

 

Enjoy!

Last Updated on Friday, 27 August 2010 11:55
 

Comments  

 
#17 Geiber 2012-05-12 10:28
Hola estoy trabajando con el módulo de drupal CMIS. Megustaria saber si existe la posibilidad de configurar un repositorio CMIS, en este caso, Alfresco que no sea añadiendo las siguientes líneas en el fichero “settings.php“:
view sourceprint?
$conf['cmis_repositori es'] = array(
‘default’ => array(
‘user’ => ‘cmisuser’,
‘password’ => ‘contraseña’,
‘url’ => ‘http://servidor:8080/alfresco/s/cmis’
)
);
Es que asi solamente se puede conectar el usuario “admin” y me gustaría que se conectaran otros ususario que cumplan con estos requisitos.
Gracias.
 
 
#16 Geiber 2012-05-12 10:27
Hola estoy trabajando con el módulo de drupal CMIS. Megustaria saber si existe la posibilidad de configurar un repositorio CMIS, en este caso, Alfresco que no sea añadiendo las siguientes líneas en el fichero “settings.php“:
view sourceprint?
$conf['cmis_repositori es'] = array(
‘default’ => array(
‘user’ => ‘cmisuser’,
‘password’ => ‘contraseña’,
‘url’ => ‘http://servidor:8080/alfresco/s/cmis’
)
);
Es que asi solamente se puede conectar el usuario “admin” y me gustaría que se conectaran otros ususario que cumplan con estos requisitos.
Gracias.
 
 
#15 2011-04-12 10:03
Christopher, thanks for the heads up about the Drupal 7 support for the main CMIS module. I haven't looked at adding Drupal 7 support for the display module yet, but really should. 7 seems to have a crazy fast adoption rate.
 
 
#14 2011-04-11 19:25
Great job, Nathan! I really like the CMIS Display module!

Have you noticed that there is a new version of CMIS API for Drupal 7? Have you ever thought about making the Display module compatible with Drupal 7?
 
 
#13 2011-03-18 09:57
Igor, I'm willing to bet that your PHP installation is missing the Curl library. Check php.ini and see if Curl is installed.
 
 
#12 2011-03-17 09:43
I have the following problem please help me
Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs \montexel\modul es\cmis_common\ cmis_common.module on line 56
 
 
#11 2011-03-06 11:24
Andrew,

It will show up in the module list as CMIS Display, in the block of modules titled CMIS. If it isn't showing up, make sure you installed the whole CMIS module from the Drupal site. Then unzip my extension into the CMIS module directory. The zip file available here is only an extension to the existing CMIS module, not a complete module on its own.
 
 
#10 2011-03-03 07:15
I wanted to toy around with some of the code in your display module so I copied and pasted it into a new folder then tried to enable it. It's not showing up in the module list :( How would I get it to show as a new module?
 
 
#9 2011-02-24 08:41
I'm a bit new to Drupal myself, but I think I'm going to take a crack at building a block display for CMIS content.

Stay tuned
 
 
#8 2011-02-20 23:42
I'm with Nathan on that one. A block would be fantastic! If I wasn't such a drupal noob I would have a go myself
 
RSS Feed Icon

About Me

 

My profile picture

 

My name is Nathan McMinn.  I'm a software engineer, beer geek, wannabe adventurer and genuinely curious guy.  Find me on Facebook, Linkedin or Twitter

Latest Comments