Alfresco Drupal Integration by Irfanawan1990

VIEWS: 159 PAGES: 15

More Info
									     Alfresco Drupal Integration

    Richard McKnight
  Alfresco Software, Inc.
                                      Review of Integration
                                                 Use Cases
● Alfresco as a document repository
   ● Documents are managed In Alfresco DM
   ● Documents exposed to Drupal via CMIS via one of following
      •   Documents are imported into Drupal as nodes.
      •   Alfresco repository is queried but documents stay in Alfresco
● Alfresco as an SVN replacement
   ● Images, HTML files, css files managed in Alfresco
   ● Snapshots deployed as a unit.
   ● New design can be deployed to staging server
● Alfresco to manage web content
   ● Web forms for content are managed in Alfresco
   ● Content deployed to FSR and forwarded Drupal
   ● Content can be reviewed on staging server before being
                                                       Types of Web CMS
“Wiki Style” Web CMS                           “Publishing Style” Web CMS

Single system for both authoring and           Separate authoring and delivery systems
Content = page or page fragment.               Separation of content and presentation.
Presentation typically controlled by           Typically theming is not part of the WCM
theming capabilities                           system.
In-place editing of live web pages             Editing of separate editorial copy of
Lightweight approval process.                  Configurable approval / editorial process

Historically used for smaller sites or those   Historically used for larger sites or those
managed by individuals / small teams           managed by large teams

Examples:                                      Examples:
• Wikis                                        • Alfresco
• Joomla                                       • Interwoven
• Drupal                                       • Vignette
• PHPNuke                                      • Day
• Portal server CM portlets
                                        Use Case Rationale

● Targeted at organizations with large constituencies.
● User generated content managed in Drupal using Drupal’s
  community functionality
● Institutional content managed in Alfresco with its rich work flow.
● Alfresco managed content takes advantage of Alfresco’s
  content modeling capabilities, interfaces and functionality
● Content deployed to Drupal and imported into Drupal as
● Content deployed to Drupal can take advantage of all of
  Drupal’s functionality e. g. views.
                                          Alfresco’s Model for WCM

●   Low traffic                             ●   High traffic
●   Read / write                            ●   Read mostly
●   Alfresco focuses on:                    ●   Alfresco focuses on:
     ● Ease of content entry                     ● Deployment Flexibility
     ● Content QA (workflow / approval)          ● Technology agnosticism
     ● Version control / rollback                ● Performance / scalability
                                Comparing Drupal Nodes
                                    and Alfresco Nodes

● Drupal nodes can have multiple attachements while Alfresco
  nodes can have only one content stream
● Drupal node implement HTML/XML/Text content by storing it in
  the database rather than an attachment.
● Drupal also has the concept of Files which is used to track
  content that is stored as files
                             Functionality in Demo

● Alfresco deploys to an FSR
● Post Commit Runnable posts content to Drupal via
● Drupal module accepts the content, strips out the
  content and metadata from the xml and creates or
  updates nodes.
● Module associates pathname with nid via a custom
  table and hook_nodeapi (pathname is the unique
  identifier in the AVM).
                                                  Unfinished Business
● Missing Functionality
   ●   Full refresh
   ●   Delete
   ●   Images
   ●   File attachments
   ●   Authenticating the FSR when it connects via XMLRPC to post content.
● Planned Improvements
   ●   Framework for mapping XML to Drupal CCK fields
   ●   Content type definition from XSD files.
        •   Create tables/columns
        •   Provide same integration that CCK does (for view and other functionality).
        •   Integration into Drupal widgets optional (only if content to be managed in
   ●   An alternate approach might be to map Drupal CCK back into Alresco
   ●   Leveraging DeploymentTarget functionality in 3.2
   ●   Leveraging the content definition improvements in Drupal 7.
                         System Architecture

 Alfresco    RMI          XMLRPC
                   FSR             Drupal
                                                Code Snippets
                                          Post Commit Code

for (DeployedFile file : fDeployment)
    objs[1] = file.getPath();
    objs[2] = =URLEncoder.encode(readTextFile(file.getPath()));
                                            Code Snippets
                           Node Creation Code Part 1
function alfresco_deployment_save_node($remote_id,$xml_) {
   $doc = new DOMDocument();
   $node_type_ = $doc­>documentElement­>tagName;
   /* code to strip off namespace omitted */
   $save_node_func="alfresco_deployment_save_node_" . $node_type;
   $node = null;
   if (function_exists($save_node_func)) {
       $node = call_user_func($save_node_func,$nid,$remote_id,$doc);
   } else {
       drupal_set_message("Could Not Process Form","error");
   if ($node && $node­>nid) {
       $ok=db_query("REPLACE INTO {alfresco_deployment_id_match}
           (nid,remote_id) VALUES (%d,'%s')",$node­>nid,$remote_id);
       return $node;
   } else {
       watchdog('alfresco_deployment', "TROUBLE ADDING NODE");
       return false;
                                                   Code Snippets
                                Node Creation Code Part 2
function alfresco_deployment_save_node_news_flash($nid,$remote_id,$doc) {
     //Get XML Information
    $title = $doc­>getElementsByTagName("title")­>item(0)­>nodeValue;
    $body = $doc­>getElementsByTagName("body")­>item(0)­>nodeValue;
    $edit = array();
    $edit['type'] = "alfresco_web_content";
    if ($nid) {
        $edit['log'] = "Automatic Update Of Node”;
        $edit['revision'] = 1;
    } else {
        $edit['uid'] = 1;
        $edit['name'] = "richmck";
        $edit['log'] = "Automatic Creation Of Node”;
        $edit['promote'] = 0;
        $edit['comment'] = 0;
        $edit['revision'] = 1;
        $edit['format'] = 1;
        $edit['status'] = 1;
    $edit['title'] = $title;
    $edit['body'] = $body;
    $node = node_submit($edit);
    return $node;
                                                 Code Snippets
                                                 Node API Code


     This code adds the remote ID to the node when it is being loaded.
     This information would probably not be seen by site visitors, but
     may be used by administrators or could be used by other functions
     load the node.

function alfresco_deployment_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
    switch($op) {
        case "load":
            $alfresco_node_ref=db_result(db_query("SELECT remote_id from 
                {alfresco_deployment_id_match} WHERE nid=%d",$node­>nid));
            if ($alfresco_node_ref) {
                return array('alfresco_deployment' => 
                    array("remote_id" => $alfresco_node_ref));
                                              Demo Steps

● Start with the following:
   ● An Alfresco Repository with WCM enabled
   ● An Alfresco FSR configured with the deployment runnable.
   ● A WCM Project that already has a content type news flash
   ● A Drupal instance with the alfresco_deployment module
● Create a few news flashes using the web forms
● Deploy the news flashes
● View the news flashes on the Drupal site
● Update the news flashes and create new articles
● Look at the updated content.
● Look at the version history on the new flashes that were
                                What You will Need to Try

● Download Bundle which includes
   ●   Deployment Runnable
   ●   alfresco_deployment Drupal Module
   ●   Import file for Drupal NewsFlash
   ●   XSD for newsflash.
   ●   application-context.xml with Post Deployment Runnable Sample config
   ●   README File with instructions
● Alfresco 3.1 SP1 (Enterprise or Community)
● One of the following
   ●   Drupal 6.x+LAMP Stack
   ●   Aqcuia stack

To top