Child pages
  • Crafter Social Integration
Skip to end of metadata
Go to start of metadata

 

Summary

This app integrates Liferay with the state of the art open source Crafter Social (http://craftersoftware.com/products/crafter-social). Crafter Social is a multi-tenant, platform independent user-generated content management system for handling all actions related to user-generated content (UGC), including the creation, updating and moderation of the content. 

It is built on MongoDB and uses Crafter Profile for profile, tenant, roles management, and authentication.  Crafter Social is highly scalable in terms of both the users & data, and secures the generated content using Crafter Profile and the Crafter Profile Security library.  As a headless, RESTful application, Crafter Social allows for loosely coupled integration with the vertical applications using it.

Crafter Social offers two editions: 

  • Community Edition: Fully featured, free and open source (GPL v3) with community support.
  • Enterprise Edition Commercial license and enterprise support for a low annual subscription cost.

 

Overview

Crafter Social Integration app consists of a group of events, listeners and a hook. 

There are two events, a post login and a post logout. The post login checks if the Liferay user exists on Crafter Profile, if not creates a new profile using the current data of the Liferay user. If the user has the Administrator role, the Crafter profile would be created also with the proper admin role, otherwise, a regular Crafter profile would be created. After that, an encrypted cookie is created containing the profile ticket, this is needed to tell the Crafter Social API who is using it. The post logout event just delete the crafter cookie from the browser.

About the listeners, there are also two of them, a User listener and a Trash Entry listener. The User listener, activate or deactivate a Crafter Profile as happens on Liferay Portal. The Trash Entry listener deletes all the Crafter Social activity associated to a web content, if this is deleted from the Portal.

Finally we have a hook plugin that overrides the Portal Settings to add a new menu item called "Crafter Profile". There are two fields inside (Username and Password) and the purpose is to let the Liferay Administrator set a profile administrator on Crafter Profile to use it in the background for delete the comments on the Trash Entry listener. 

Installation

The installation steps are as follows:

  1. Download Crafter Social Bundle 2.3.1 from http://resources.rivetlogic.com/crafter-social-installer/crafterSocial-2.3.1.run.
  2. Create an empty folder.
  3. Give execute permissions (chmod +x crafterSocial-2.3.1.run) to crafterSocial-2.3.1.run.
  4. In the empty folder run crafterSocial-2.3.1.run.
  5. Say "yes" to all.
  6. On your empty folder you'll see a script named "ctlscript.sh", use it for view the status, stop or start MongoDB and the Apache server containing Crafter Social and Profile.
  7. Download Liferay portal CE GA2 from  http://sourceforge.net/projects/lportal/files/Liferay%20Portal/6.2.1%20GA2/liferay-portal-tomcat-6.2-ce-ga2-20140319114139101.zip/download.  Install CE GA2 under your choice of directory. 

  8. Obtain Crafter Social Integration app from the Liferay Marketplace.
  9. Deploy the app in your existing Liferay installation.

Socket Security

Why do we need it
  1. This app requires a connection to Crafter site to obtain the content. 
  2. Since the app is PACL enabled, the Crafter URL with which it connects need to be specified in liferay-plugin-package.properties of crafter-social-portlet.
  3. To understand Socket Security, click here
How to update the URL
  1. Go to the [Tomcat Home]/webapps/crafter-social-portlet/WEB-INF
  2. Replace the localhost (127.0.0.1:8080) with Crafter URL as show below in liferay-plugin-package.properties 

    security-manager-sockets-accept=\
        127.0.0.1:9666
     
    security-manager-sockets-connect=\
        127.0.0.1:9666 
  3. Restart the tomcat upon saving the changes.

Configuration 

1.  Create Structures:  create any structure that you need.

 


2. Create templates: create corresponding templates related to the structures that you need. If we want any field to be commentable with Crafter Social we have to wrap it in a DIV and set the ID attribute with the following structure: "commentable-{article-id}-{fieldName}". If we have a repeatable field, we can add an extra indicator to differentiate them, like: "commentable-{article-id}-{fieldName}-{index}". Finally we need to load the "crafter-comments.js" on the template. Let's say we have a simple structure with a repeatable HTML field that we name "HTML_TestArea". The FreeMarker template could be:


<#list HTML_TestArea.getSiblings() as testArea>	
	<div id="commentable-${.vars['reserved-article-id'].data}-${testArea.getName()}-${testArea_index}">
		${testArea.getData()}
	</div>
</#list>
<script src="/crafter-social-portlet/js/crafter-comments.js"></script>

 

And for the same structure the velocity template could be like:

 

#foreach( $testArea in $HTML_TestArea.getSiblings() )
<div id="commentable-${reserved-article-id.data}-${testArea.name}-${velocityCount}">$testArea.data</div>
#end
<script src="/crafter-social-portlet/js/crafter-comments.js"></script>

 

3. Create web contents: create a web content with the structures and the templates you have configured to use Crafter Social.

 

4. Add the web content to a page, refresh it, and then you'll see the Crafter Social feature available on the DIV's you have configured with the appropriate ID attribute. 

Other features

On the Crafter bundle you have previously install you can manage the profiles of Crafter Profile or the UGC's of Crafter Social with an administrator user that you can create it from Liferay. This user is also needed to delete the UGC's every time a web content is permanently deleted.

  1. First you go to Control Panel, Portal Settings, Crafter Profile. And set the fields

 

 2. Enter the URL of Crafter Apache server and look for the administration webapps, it would ask you to login, you can use the credentials you have just created. The administration for Crafter Profile is called "crafter-profile-admin-console" and the Crafter Social moderation dashboard is called "crafter-social-admin".

Crafter Profile Admin Console:


Crafter Social Moderation Dashboard:


Code repository

The latest source code is located at the following location:

https://github.com/rivetlogic/liferay-crafter-social

Contact Us

We welcome feature/bug reports concerning Crafter Social Integration app. Discussion helps to clarify the ways the app can be used and also helps define directions for future development. Please post your concerns at http://issues.rivetlogic.com/browse/LRA.

  • No labels