Drupal Wcm Ttl

Embed Size (px)

Citation preview

  • 8/4/2019 Drupal Wcm Ttl

    1/15

    Alfresco Drupal Integration

    Richard McKnight

    [email protected]

    Alfresco Software, Inc.

  • 8/4/2019 Drupal Wcm Ttl

    2/15

    Review of IntegrationUse Cases

    Alfresco as a document repository Documents are managed In Alfresco DM Documents exposed to Drupal via CMIS via one of following

    alternatives: 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

    deployed

  • 8/4/2019 Drupal Wcm Ttl

    3/15

    Types of Web CMS

    Wiki Style Web CMS Publishing Style Web CMS

    Single system for both authoring anddelivery

    Separate authoring and delivery systems

    Content = page or page fragment.Presentation typically controlled bytheming capabilities

    Separation of content and presentation.Typically theming is not part of the WCMsystem.

    In-place editing of live web pages Editing of separate editorial copy of

    contentLightweight approval process. Configurable approval / editorial process

    Historically used for smaller sites or thosemanaged by individuals / small teams

    Historically used for larger sites or thosemanaged by large teams

    Examples: Wikis JoomlaDrupal PHPNuke Portal server CM portlets

    Examples:Alfresco Interwoven Vignette Day

  • 8/4/2019 Drupal Wcm Ttl

    4/15

    Use Case Rationale

    Targeted at organizations with large constituencies.

    User generated content managed in Drupal using Drupalscommunity functionality

    Institutional content managed in Alfresco with its rich work flow.

    Alfresco managed content takes advantage of Alfrescoscontent modeling capabilities, interfaces and functionality

    Content deployed to Drupal and imported into Drupal asnodes.

    Content deployed to Drupal can take advantage of all ofDrupals functionality e. g. views.

  • 8/4/2019 Drupal Wcm Ttl

    5/15

    Alfrescos Model for WCM

    Low traffic

    Read / write

    Alfresco focuses on:

    Ease of content entry

    Content QA (workflow / approval)

    Version control / rollback

    High traffic

    Read mostly

    Alfresco focuses on:

    Deployment Flexibility

    Technology agnosticism

    Performance / scalability

  • 8/4/2019 Drupal Wcm Ttl

    6/15

    Comparing Drupal Nodesand Alfresco Nodes

    Drupal nodes can have multiple attachements while Alfresconodes can have only one content stream

    Drupal node implement HTML/XML/Text content by storing it inthe database rather than an attachment.

    Drupal also has the concept of Files which is used to trackcontent that is stored as files

  • 8/4/2019 Drupal Wcm Ttl

    7/15

    Functionality in Demo

    Alfresco deploys to an FSR

    Post Commit Runnable posts content to Drupal viaxmlrpc

    Drupal module accepts the content, strips out the

    content and metadata from the xml and creates orupdates nodes.

    Module associates pathname with nid via a customtable and hook_nodeapi (pathname is the uniqueidentifier in the AVM).

  • 8/4/2019 Drupal Wcm Ttl

    8/15

    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

    Drupal. An alternate approach might be to map Drupal CCK back into Alresco

    XML. Leveraging DeploymentTarget functionality in 3.2

    Leveraging the content definition improvements in Drupal 7.

  • 8/4/2019 Drupal Wcm Ttl

    9/15

    System Architecture

    AlfrescoRepository

    FSR DrupalXMLRPCRMI

  • 8/4/2019 Drupal Wcm Ttl

    10/15

    Code SnippetsPost Commit Code

    for (DeployedFile file : fDeployment){

    objs[1] = file.getPath();objs[2] = =URLEncoder.encode(readTextFile(file.getPath()));client.execute("alfresco_deployment.save_node",objs);

    }

  • 8/4/2019 Drupal Wcm Ttl

    11/15

    Code SnippetsNode Creation Code Part 1

    function alfresco_deployment_save_node($remote_id,$xml_) {$xml=urldecode($xml_);

    $doc = new DOMDocument();$doc >loadXML($xml);$node_type_ = $doc >documentElement >tagName;/* code to strip off namespace omitted */$nid=_alfresco_deployment_get_nid_from_remote_id($remote_id);$pre_nid=$nid;$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;

    }}

  • 8/4/2019 Drupal Wcm Ttl

    12/15

    Code SnippetsNode 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['nid']=$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);node_save($node);return $node;

    }

  • 8/4/2019 Drupal Wcm Ttl

    13/15

    Code SnippetsNode 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, butmay be used by administrators or could be used by other functionsload 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));}break;

    }}

  • 8/4/2019 Drupal Wcm Ttl

    14/15

    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

    defined A Drupal instance with the alfresco_deployment module

    installed.

    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

    updated

    Wh t Y ill N d t T

  • 8/4/2019 Drupal Wcm Ttl

    15/15

    What You will Need to TryThis

    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