Liferay Portal6: Build WAP sites and Integrate with CRM and Netvibes widgets

Exclusive offer: get 50% off this eBook here
Liferay Portal 6 Enterprise Intranets

Liferay Portal 6 Enterprise Intranets — Save 50%

Build and maintain impressive corporate intranets with Liferay

$35.99    $18.00
by Jonas X. Yuan | May 2010 | Open Source

In the first article of this article series, we've covered Employ federated search, OpenSearch, CSZ search,maps search and Web Content search

In the second article of this article series, we've covered how to search with the pluggable enterprise and how to manage plugins

In this article by Jonas X. Yuan,author of Liferay Portal 6 Enterprise Intranets,we will address WAP sites, CRM integration, widgets, reporting, and auditing in detail.

(Read more interesting articles on Liferay Portal 6 here.)

WAP

Liferay goes mobile! As smart-phones continue to impede the space between dialing a number, taking a picture, or discovering new music, mobile browsers offer us the next frontier in the previously desktop-exclusive market of web design. A mobile browser is a web browser designed for use on a mobile device such as a mobile phone, PDA, iPhone, which is optimized to display web content most effectively for small screens on portable devices. A WAP browser provides all of the basic services of a web browser, but is simplified to operate within the restrictions of a mobile phone, such as its smaller view screen. The websites generated by the portal go with mobile browsers, or any WAP browsers. Thus you can browse portal websites, called WAP sites, through mobile devices.

Themes (look and feel of websites or WAP sites) in the portal will detect mobile devices dynamically. As mentioned earlier, each site may have its own look and feel and each page could have its own look and feel. Under the tab Look and Feel, you would see Regular Browsers and Mobile Devices, where available themes will appear.

Of course, you can develop your mobile themes or WAP themes depending on your own requirements. Here we're going to discuss several existing mobile themes or WAP themes, and going further, see what themes are and how they work.

Jedi Mobile theme

The theme Jedi Mobile has been applied on the home page of the community Guest. As you can see, the theme Jedi Mobile takes the original Jedi theme and packs it int a bite-sized, smart-phone punch.

Structure

The theme Jedi Mobile has the following folder structure at $AS_WEB_APP_HOME/jedi-mobile-theme.

  • CSS: CSS files
  • images: Image files
  • javascripts: JavaScript files
  • templates: Velocity template files
  • WEB-INF: Web info specification includes sub-folders classes, lib, and tld

As you can see, web-info specification covers liferay-look-and-feel.xml,liferay-plugin-package.properties, liferay-plugin-package.xml, and web.xml. Knowing the structure of the theme would be helpful to customize that theme.

How does it work?

You could bring the theme Jedi Mobile Theme into the portal by following these steps:

Then apply the theme as the current look and feel of pages.

What's happening?

The theme Jedi Mobile has specified the following script at $AS_WEB_APP_HOME/jedi-mobile-theme/templates/portal_normal.vm.

<script type="text/javascript">
iPhone = function() {
setTimeout("window.scrollTo(0,1) ", 100)
}
if (navigator.userAgent.indexOf('iPhone') != -1) {
addEventListener("load", iPhone, false)
addEventListener("onorientationchange", iPhone, false)
}
</script>

As shown in the preceding code, it detects the navigator, whether it is an iPhone or not.

iPhone theme

The theme iPhone takes a much more direct approach to web applications. With its indigenous appearance and feel, the WAP site starts to feel like a playlist, user experience appears native, and navigation comes naturally.

How does it work?

You can bring the iPhone Theme into the portal by following these steps:

  1. Download the WAR file ${iphone.theme.war} from http://liferay.cignex.com/palm_tree/book/0387/chapter12/iphone-theme-6.0.0.1.war
  2. Drop the WAR file ${iphone.theme.war} to the folder $LIFERAY_HOME/deploy swhen the portal is running.

Then apply the theme as the current look and feel of pages.

What's happening?

The theme iPhone introduces a new browser detection mechanism for specialized mobile functionality. If you visit the site on an iPhone, you get the bare minimum—JavaScript, HTML, and CSS. If you visit the site on a regular browser, you get all the more advanced UI features.

The theme iPhone has specified the following script at $AS_WEB_APP_HOME/iphonetheme/templates/portal_normal.vm.

#set ($isIphone = $request.getHeader("User-Agent").toLowerCase().
indexOf("iphone") != -1)
<!-- ignore details -->
#if ($isIphone)
<!-- ignore details -->
#else
$theme.include($top_head_include)
#end
</head>
<!-- ignore details -->

iPhone Redirect theme

The theme iPhone Redirect takes the browser detection mechanism and takes intelligent redirection. The theme iPhone Redirect is an unstyled theme, coming with a custom initialization feature—that is, it can detect an iPhone browser visiting the page, check for a Mobile community, and automatically redirect the iPhone user to that community if found. Moreover, it will work with a virtual host.

How does it work?

You could bring the theme iPhone Redirect Theme into the portal by following these steps:

  1. Download the WAR file ${iphone.redirect.theme.war} fromhttp://liferay.cignex.com/palm_tree/book/0387/chapter12/so-theme-6.0.0.1.war
  2. Drop the WAR file ${iphone. redirect.theme.war} to the folder$LIFERAY_HOME/deploy when the portal is running.

 

Then apply the theme as the current look and feel of pages.

What's happening?

The theme iPhone Redirect has the following code specified at $AS_WEB_APP_HOME/iphone-detect-theme/templates/init_custom.vm.

//ignore details
#set ($isIphone = $request.getHeader("User-Agent").toLowerCase().
indexOf("iphone") != -1)
#if ($isIphone && $mobileGroup && $group_id != $mobileGroup.groupId)
<script type="text/javascript">
window.location.href = '${layoutSet.virtualHost}' ? 'http://' +
'${layoutSet.virtualHost}' + ((window.location.port) ? ':' + window.
location.port : '') : '/web${mobileGroup.friendlyURL}'
</script>
#end

Of course, you could customize the preceding themes according to your own requirements.

Reporting

JasperReports is an open source Java reporting tool that can write to screen, a printer, or to PDF, HTML, Microsoft Excel, RTF, ODT, CSV (Comma Separated Value) formats, and XML files. It can be used in Java-enabled applications, including Java EE or Web applications to generate dynamic content. It reads its instructions from an XML or .jasper file. Refer to http://www.jasperforge.org/jasperreports for more information.

The portal provides full integration of JasperReports with the reporting framework—a web called reporting-jasper-web and a portlet called reports-console-portlet. The portal provides the ability to schedule reports and deliver them via Document Library and e-mail. In addition, the portal has added support for Jasper XLS data source to a reporting framework.

JasperReports Engine

The Liferay JasperReports Report Engine provides implementation of Liferay BI using Jasper. You can bring the web Reporting Jasper into the portal by following these steps:

Note that the current integration of JasperReports version is 3.6.2. You will be able to upgrade it to the latest version of JasperReports anytime.

The Reports portlets

The plugin Reports Console defines two portlets: Reports Console at Control Panel and Reports Display. The portlet Reports Display is instanceable—that is, you can add more than one instance of the portlet on a page.

You could bring the plugin Reports Console into the portal by following these steps:

  1. Download the WAR file ${reports.console.portlet.war} from http://liferay.cignex.com/palm_tree/book/0387/chapter12/reports-console-portlet-6.0.0.1.warr
  2. Drop the WAR file ${reports.console.portlet.war} to the folder$LIFERAY_HOME/deploy when the portal is running.

As shown in the following screenshot, the portlet Reports Display provides the ability to search for reports and display search results with pagination. Search results will be displayed with a set of columns: Report Definition Name, Report Format, Requested Date, and Reporting Date.

Build WAP sites and Integrate with CRM and Netvibes widgets

As you can see, you can search for reports via basic search or advanced search. The advanced search would cover the following items:

  • Match All of the following fields: All or Any
  • Definition Name: User's input
  • Datasource Name: Jasper Empty, Portal
  • Format: csv, excel, HTML, pdf, rtf, Text, and XML
  • Requesting User Name:User's input
  • Start date:A date
  • End date:A date
  • Active: Yes or No

The portlet Reports Console provides the abilities to manage reports in the Control Panel. By going to Content | Reports Console under the Control Panel, you can search for generated reports under the tab Generated Reports. You can also create report definitions under the tab Report Definitions.

Build WAP sites and Integrate with CRM and Netvibes widgets

Under the tab Report Definition, you would be able to search report definitions via basic search or advanced search. The advanced search would cover the following items:

  • Match All of the following fields: All or Any
  • Definition Name: User's input
  • Description: User's input
  • Datasource Name: Multiple checkboxes, Jasper Empty or Portal

Of course, you could add definitions with the following items:

  • Definition Name: Input required
  • Description: User's input
  • Datasource Name: Empty or Portal
  • Template: Uploading template file (required)
  • Report Parameters: Multiple pair (key, value)
  • Key: User's input; optionally, it is bound to Report parameters
  • Value: User's input
  • Permissions: A checkbox—Public permissions configuration.
Liferay Portal 6 Enterprise Intranets Build and maintain impressive corporate intranets with Liferay
Published: May 2010
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

(Read more interesting articles on Liferay Portal 6 here.)

Setup

The Data Source Setting and Mail Setting of the portlet Reports Console are configurable. Clicking on Content | Report Console under the Control Panel, you would be able to configure the Data Source setting and Mail Setting. You would be able to configure following items under the Data Source setting.

  • Datasource Name: Company or community selecting the scope to search for knowledge base articles when selecting Community, it will list groups like organizations and communities – where you could choose multiple groups
  • Datasource Type: csv, jdbc, xls, xml
  • Datasource File: Uploading data source file
  • Column Names: Columns
  • Charset Name: Character set name
  • Permissions: A checkbox Public permissions configuration. Note that you may use button Test to test database connection.

Obviously, you would be able to search the data source by basic search or advanced search. Data source search results will appear with a set of columns like Data Source ID, Data Source Name, and Data Source Type. In addition, you would be able to configure the following items on Mail Setting.

  • Mail From Name: David Berger, for example
  • Mail From Address: david@bookpub.com, for example
  • Notification Subject: Subject of e-mail notification
  • Notification By: Body of e-mail notification
  • Delivery Subject: Subject of e-mail delivery
  • Delivery By: Body of e-mail delivery

Structure

The plugin Reports Console has the following folder structure at $AS_WEB_APP_HOME/reports-console-portlet:

  • CSS: CSS files
  • datasource: JSP files for data source
  • definition: JSP files for reporting definition
  • js: JavaScript files
  • mail: JSP files for mail settings
  • META-INF: context.xml
  • request: JSP files for requests
  • WEB-INF: web-info specification, includes sub-folders, classes, lib, service,sql, src, and tld

As you can see, web-info specification covers liferay-display.xml, liferayplugin-package.properties, liferay-plugin-package.xml, portlet.xml,service.xml and web.xml. Knowing the structure of the portlet would be helpful to customize the portlet.

Assign permissions

There are two portlets in the plugin Reports Console: Reports Console and Reports Display. Generally speaking, there are five-levels of permissions—permissions on portlets, permissions on Reports Data Source, permissions on Reports Definition, permissions on Requested Report, and permissions on Reports Date Source.

The following table shows permissions on the portlet Reports Console. The role Community Member may set up all permissions (marked as 'X'): View, Configuration, Add Data Source, Add Definition, Edit mail Setting, Permissions, and Access in Control Panel. On the other hand, the role Guest will only have the permission View. By default, the role Community Member has the permission actions (marked as '*') View, Add Data Source, Add Definition, Edit mail Setting, and Permissions, whereas the role Guest only has the permission action View.

Action Description Community Guest
View Ability to view the portlet X, * X, *
Configuration Ability to configure the portlet X  
Access in Control Panel Ability to access the portlet in Control Panel X  
Add Data Source Ability to add data source X, *  
Add Definition Ability to add definition X, *  
Edit Mail Setting Ability to edit e-mail setting X. *  
Permissions Ability to assign permissions on all the mentioned actions X, *  

There are permission actions View, Configuration, Add to Page set in the portlet Report Display. The role Community Member has the permission action View, by default, just as that of the role Guest.

The following table shows permissions on Report Data Source. The role Community Member may set up permissions (marked as 'X'): View, Delete, Permissions, and Update. On the other hand, the role Guest may set up the permission View. By default, the role Community Member has the permission action (marked as '*') View.

Action Description Community Guest
View Ability to view a definition X, * X,*
Delete Definition Ability to delete a definition X  
Permissions Ability to assign permissions on a definition X  
Update Ability to update a definition X  
Generate Report Ability to generate a report X  

The following table shows permissions on Requested Report. The role Community Member may set up permissions (marked as 'X'): View, Delete Definition, Permissions, Archive Request, Delete Report, Download Report, Un-schedule, and Update. On the other hand, the role Guest may set up the permission View. By default, the role Community Member has the permission actions (marked as '*') View and Download Report, whereas the role Guest only has permission action View.

Action

Description

Community

Guest

View

Ability to view a requested report

X, *

X,*

Delete

Ability to delete a requested report

X

 

Permissions

Ability to assign permissions on a requested report

X

 

Update

Ability to update a requested report

X

 

Archive Request

Ability to archive a requested report

X

 

Delete Report

Ability to delete a report

X

 

Download Report

Ability to download a report

X, *

 

Un-schedule

Ability to un-schedule a report

X

 

The following table shows permissions on Report Date Source. The role Community Member may set up permissions (marked as 'X'), namely, View and Update, whereas the role Guest may set up the permission View. By default, the role Community Member has the permission action (marked as '*') View.




<!--[if gte mso 9]> Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 <![endif]--><!--[if gte mso 9]> <![endif]-->

<!--[if gte mso 10]> <! /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} --> <!--[endif]-->

Action

Description

Community

Guest

View

Ability to view date source

X, *

X

Update

Ability to update date source

X

 

What's happening?

The portlet Reports Console has the following portlet specification at $AS_WEB_APP_HOME/reports-console-portlet/WEB-INF/liferay-portlet.xml.

<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight>14.0</control-panel-entry-weight>

As shown in the preceding code, the portlet Reports Console will appear in the category Content of the Control Panel at the position 14.

The portlet Reports Console also defined permission resources or actions in$AS_WEB_APP_HOME/reports-console-portlet/WEB-INF/classes/resourceactions/default.xml. These permission resources or actions get registered at $AS_WEB_APP_HOME/reports-console-portlet/WEB-INF/classes/portlet. properties as follows:

resource.actions.configs=resource-actions/default.xml

The preceding code sets resource actions in plugins. Moreover, the portlet Reports Console specified custom SQL in $AS_WEB_APP_HOME/reports-console-portlet/WEB-INF/classes/custom-sql/default.xml.

In addition, the portlet has specified e-mail notification settings as follows. These permission resources or actions get registered at $AS_WEB_APP_HOME/reportsconsole-portlet/WEB-INF/classes/portlet.properties.

email.from.name=David Berger
email.from.address=david@bookpub.com
delivery.email.message.body=../dependencies/delivery_email_message_
body.tmpl
delivery.email.message.subject=../dependencies/delivery_email_message_
subject.tmpl
notifications.email.message.body=../dependencies/notifications_email_
message_body.tmpl
notifications.email.message.subject=../dependencies/notifications_
email_message_subject.tmpl

As shown in the preceding code, the property email.from.name was set as David Berger and email.from.address was set as david@bookpub.com. The delivery e-mail message and notification e-mail message are specified in a .tmpl file. This is the reason that when configuring e-mails, you would see the values of the e-mail subject and the e-mail body coming from these .tmpl file. You will be able to modify these .tmpl files according to your requirements.

Audit service

An audit trail of user actions is required by many organizations. Fortunately, the portal provides audit service: a pluggable way of storing the audit trail from the portal and plugins. Then the information processed by the audit service plugin can be stored into a log file or database. Note that audit services employ Liferay Lightweight Message Bus and Plugin architecture. The audit service itself is a plugin, handling the processing and logging of the audit messages sent through the Message Bus. Therefore, any plugin can then produce audit messages to the audit message bus destination.

Audit hook

An auditing framework has been added to the portal. The auditing framework will allow the system administrator to track a user's action in the portal. The portal has the following settings for the auditing framework in portal.properties.

com.liferay.portal.servlet.filters.audit.AuditFilter=false

As you can see, the auditing framework has been disabled by default. This is helpful to speed up the portal. To enable the auditing framework, you need to set the following in portal-ext.properties.

com.liferay.portal.servlet.filters.audit.AuditFilter=true

As shown in the preceding code, the audit filter populates the AuditRequestThreadLocal with the appropriate request values to generate audit requests. Note that if an administrator is impersonating another user, the audit records look as if the actions are performed by the impersonated user. The records should record the real user that performs an action

How does it work?

You could bring the hook Audit into the portal with the following steps:

  1. Download the WAR file ${audit.hook.war} from http://liferay.cignex.com/palm_tree/book/0387/chapter12/audit-hook-6.0.0.1.war
  2. Drop the WAR file ${audit.hook.war} to the folder $LIFERAY_HOME/deploy when the portal is running

What's happening?

The following events got audited:

  • Login, Logout, Login failure, and Impersonation
  • Role create, remove, and update
  • Role grant and revoke
  • User create, remove, and update
  • User Group create, remove, and update
  • User Group assign, and revoke

The hook Audit added the following hooks in $AS_WEB_APP_HOME/audit-hook/WEB-INF/liferay-hook.xml.

<hook>
<portal-properties>portal.properties</portal-properties>
</hook>

Furthermore, the hook Audit provided a hook in $AS_WEB_APP_HOME/audit-hook/WEB-INF/classes/portal.properties as follows:

auth.failure=com.liferay.portal.audit.events.authentication.
LoginFailureAudit
login.events.post=com.liferay.portal.audit.events.authentication.
LoginAudit
logout.events.post=com.liferay.portal.audit.events.authentication.
LogoutAudit
// ignore details value.object.listener.com.liferay.portal.
model.UserGroupRole=com.liferay.portal.audit.events.user.
UserGroupRoleModificationAudit

When deploying the hook Audit, you would see a message saying, "The pluginAudit hook can not be deployed before audit portlet gets deployed.". Why? Thehook has specified the following in $AS_WEB_APP_HOME/audit-hook/WEB-INF/liferay-plugin-package.properties

required-deployment-contexts=\
audit-portlet

The Audit portlet

The portlet Audit provides the ability to manage audit reports. The portlet Audit willappear under the category Portal of the Control Panel. As shown in the followingscreenshot, you could search for audit events by Type, User Name, User ID,Resource Name, Resource ID, Session ID, Client IP, Server IP, Begin Date, andEnd Date.

Build WAP sites and Integrate with CRM and Netvibes widgets

As you can see, the search results would be displayed with a set of columns such as User Name, Resource Name, Resource ID, Type, Client IP, and Timestamp.

How does it work?

You could bring the portlet Audit into the portal by following these steps:

The Service model

The portlet stores the information processed by the audit service—a model called AuditEvent, with a package named com.liferay. portal.audit. The model is specified at $AS_WEB_APP_HOME/audit-portlet/WEB-INF/service.xml in detail.

As you can see, in service.xml, the entry AuditEvent covered the columns: event Id sas primary key, additional Info, class Name, class PK, client Host, client IP, company Id, message, server Name, server Port, session Id, timestamp, user Id, user Name, and the original Message. You can customize this service model and use Service Builder in plugins SDK to regenerate services.

What's happening?

The portlet Audit has the following portlet specification at $AS_WEB_APP_HOME/audit-portlet/WEB-INF/liferay-portlet.xml.

<control-panel-entry-category>portal</control-panel-entry-category>
<control-panel-entry-weight>15.0</control-panel-entry-weight>

As shown in the preceding code, the portlet Audit will appear in the category Portal of the Control Panel and at the position 15.

As mentioned earlier, the information processed by the audit service plugin can be stored into a log file or database. How? The information has been installed in the database via the data model AuditEvent. In addition, the Audit log CSV (commaseparated values) is configurable. The portlet Audit provided a property to configure the Audit log in $AS_WEB_APP_HOME/audit-portlet/WEB-INF/classes/portlet.properties as follows.

audit.log.csv.columns=companyId,userId,
userName,classPK,className,type,sessionID,
clientIP,serverIP,timestamp,additionalInfo

Of course, you can override the Audit log CSV directly.

Document Library Record

The plugin Document Library Record hook to audit who downloaded the special resources such as Document Library documents, Image Gallery images, and so on. The original purpose of the plugin is to audit who downloaded Document Library documents

The portlet Document Library Record appeared in the category Content of the Control Panel. There are two tabs: Resource and Trace Definition, where you can view all records.

How does it work?

The following is an option that can bring the portlet Document Library Record into the portal.

  1. Download the WAR file ${document.library.record.portlet.war} fromhttp://liferay.cignex.com/palm_tree/book/0387/chapter12/document-library-record-portlet-6.0.0.1.war
  2. Drop the WAR file ${document.library.record.portlet.war} to the folder $LIFERAY_HOME/deploy when the portal is running.

The Service model portlet

This portlet uses a set of models: DLRecordDifinition and DLRecordLog. As you can see, the portlet Document Library Record has specified services and models with a package named com.liferay.dlrecord. You will be able to find details at $AS_WEB_APP_HOME/document-library-record-portlet/WEB-INF/service.xml

The service.xml contains certain records specified as entries: DLRecordDifinition and DLRecordLog. The entry DLRecordDifinition includes columns definition Id as primary key, and other columns such as folder Id, group Id, company Id, user Id, create Date, modified By, modified Date, name, title, and sign-in Required. On the other hand, the entry DLRecordLog includes the columns: Log Id as the primary key, group Id, company Id, user Id, and create Date.

More interestingly, you could use Service Builder in plugins SDK to generate services against service.xml, plus XML files such as portlet-hbm.xml, portletmodel-hints.xml, portlet-spring.xml, base-spring.xml, dynamic-datasource- spring.xml, hibernate-spring.xml, and infrastructure-spring.xml under the folder $AS_WEB_APP_HOME/ document-library-record-portlet/WEBINF/classes/META-INF.

Of course, you could customize this service model and use Service Builder in the plugins SDK to regenerate services.

What's happening?

The portlet Document Library Record has the following portlet specification at$AS_WEB_APP_HOME/document-library-record-portlet/WEB-INF/liferay-portlet.xml.

<control-panel-entry-category>content</control-panel-entry-category>
<control-panel-entry-weight>15.0</control-panel-entry-weight>

As shown in the preceding code, the portlet Document Library Record will appear in the category Content of the Control Panel and at the position 15.

The portlet Document Library Record has added the following hooks in $AS_WEB_APP_HOME/document-library-record-portlet/WEB-INF/liferay-hook.xml.

<hook>
<portal-properties>portal.properties</portal-properties>
</hook>

Furthermore, the portlet Document Library Record provides a hook in $AS_WEB_APP_HOME/document-library-record-portlet/WEB-INF/classes/portal.properties as follows:

servlet.service.events.pre=com.liferay.
portal.events.DocumentLiraryRecordAction

In addition, the resource that got traced is configurable. The portlet Document Library Record provided a property to configure the traced resource's URI (Uniform Resource Identifier) in $AS_WEB_APP_HOME/document-library-recordportlet/WEB-INF/classes/portlet.properties as follows:

traceingURI=/c/document_library/get_file

As you can see, the property traceingURI has been specified with the value /c/document_library/get_file—that is, Document Library documents downloading URI.

Of course, you can trace other resources such as Image Gallery images. If you'regoing to trace who downloaded images, you can set the property in $AS_WEB_APP_HOME/document-library-record-portlet/WEB-INF/classes/portlet.properties as follows:

traceingURI=/image/image_gallery

Everything in the portal should be audited by the audit-hook, for example, adding a listener to Document Library. The Document Library Record portlet is a special usage of the audit-hook.

CRM

The portal provides the ability to integrate third-party systems smoothly. In this section, we're going to introduce you to integration of CRM.

CRM—Salesforce.com

Customer Relationship Management (CRM) can be described as methods that companies use to interact with customers, including employee training and specialpurpose CRM software, and handling incoming customer phone calls and e-mail, although the information collected by CRM software may also be used for promotion and surveys such as polling customer satisfaction.

Salesforce.com is one of the pioneers of the Software as a Service (SaaS) model of distributing business software, in which access to business software is purchased on a subscription basis and hosted offsite. Refer to http://www.salesforce.com for more information.

The included portlets should be Accounts, Opportunities, Contacts, Leads, Events, Tasks, and so on.

How does it work?

The following is an option that could bring the portlet salesforce into the portal

  1. Download the WAR file ${salesforce.portlet.war} from http://liferay.cignex.com/palm_tree/book/0387/chapter12/salesforce-portlet-6.0.0.1.war
  2. Drop the WAR file ${salesforce.portlet.war} to the folder $LIFERAY_HOME/deploy when the portal is running.

Note that the main functions of the portlet salesforce are incomplete. You can use it as a framework to integrate the main features of salesforce in depth. In the same or a similar way, you will be ableto integrate the portal with SugarCRM, by referring to http://www.sugarcrm.com/crm/, with MicroStrategy, by referring to http://www.microstrategy.com/, and so on.

Widgets and gadgets

In general, a widget is a piece of reusable code, pluggable into virtually any website. On the other hand, a gadget acts just like a widget, it's a small technological object that has a particular function.

Widgets—Netvibes

The plugin Netvibes Widget provides the capability to show any widget from Netvibes in websites. A widget is an element of a graphical user interface (GUI) that displays an information arrangement changeable by the user. Netvibes is a multilingual Ajax-based personalized start page or personal web portal. You could find an ecosystem at http://eco.netvibes.com/widgets, the largest widget directory.

Also, you can publish the widget Astrofiles.net, for example, in any page through the plugin Netvibes Widget. Here the widget Astrofiles.net in French: "Ayez toujours avec vous les dernières photos de la NASA (apod), le phénomène astronomique du jour, ainsiqu'un quiz d'astronomie !".

That is, it always provides you with the latest photographs of NASA (apod), the astronomic phenomenon of day, as well as a quiz on astronomy! As you can see, you can choose any widget, for example, "Bible Quotes".

How does it work?

The following is an option that could bring the portlet Netvibes Widgets into the portal.

The following is a sample: first, add the portlet Netvibes Widget to a page. Then go to More | Configuration | Setup | Current, search with the keyword "Astrofiles. net", and locate the widget "Astrofiles.net". Click on the button Choose next to the widget "Astrofiles.net". Finally, click on the icon "Return to Full Page". That's it!

Setup

As you can see, the portlet Netvibes Widget is configurable. Before using it, you are required to configure this portlet to make it visible to all users—electing a widget from the widget repository. By going to More | Configuration | Setup | Current, you will be able to configure the following items:

  • Search
  • Sort: Most Recent, Most Popular
  • Category: All, News, and so on
  • Region: All, Canada, Germany, and so on.
  • Search Keyword Input Box: An input box
  • Search: A button to search widgets—search results are displayed with pagination
  • Choose: A button to select the widget and to attach the selected widget
  • Netvibes Widget URL
  • URL Input Box: An input box
  • Netvibes Widget URL: A button to attach the URL

Once a widget is selected, you will have a chance to update the following IFrame properties: alt, frameborder, height-maximized, height-normal, hspace, scrolling, vspace, and width .

What's happening?

The portlet has specified the following portlet parameters at $AS_WEB_APP_HOME/ netvibes-widget-portlet/WEB-INF/liferay-portlet.xml.

<configuration-action-class>com.liferay.netvibeswidget.action.
ConfigurationActionImpl</configuration-action-class>
<instanceable>true</instanceable>
<ajaxable>false</ajaxable>

As shown in the preceding code, in the portlet Netvibes Widget, ajaxable is set to false, that is, the portlet can never be displayed via Ajax. The portlet sets the instanceable value to true, so that the portlet can appear multiple times on a page. In addition, the portlet sets the configuration-action-class to com.liferay.netvibeswidget.action.ConfigurationActionImpl, called to allow users to configure the portlet at runtime. This is the main reason that you can go to More | Configuration | Setup | Current, and configure the portlet at runtime.

Netvibes regions have been hardcoded at the API NetvibesWidgetUtil. Netvibes categories are retrieved dynamically from the NetvibesCategoriesWebCacheItem service in the API:

http://api.eco.netvibes.com/categories?format=json

The search results of widgets are coming from the NetvibesWidgetsWebCacheItem service at the API:

http://api.eco.netvibes.com/search?category=...

You will be interested in customizing the portlet Netvibes Widget by modifying the view JSP file and configuration JSP file. You can find the view JSP file view.jsp and the configuration JSP file configuration.jsp in the folder $AS_WEB_APP_HOME/netvibes-widget-portlet.

Mash-ups

A mash-up is a web page or application, combining data or functionality from two or more external sources to create a new service. In fact, the application Astrofiles.net, a widget, could be shared through a piece of JavaScript code. In order to share the application Astrofiles.net on any website, you have to just copy the code (that is, piece of JavaScript) as follows and paste it into the web page, and the application Astrofiles.net will show up:

<script type="text/javascript"
src='//dgdsbygo8mp3h.cloudfront.net/sites/default/files/blank.gif' data-original="http://cdn.widgetserver.com/syndication/
subscriber/InsertWidget.js">
</script>
<script>
if (WIDGETBOX) WIDGETBOX.
renderWidget('9ed9b0f2-a417-4ed6-aec6-e8abbd558c44')
</script>
<noscript>Get the
<a href="http://www.widgetbox.com/widget/biblequotes">Bible Quotes</
a> widget and many other
<a href="http://www.widgetbox.com/">great free widgets</a> at
<a href="http://www.widgetbox.com">Widgetbox</a>!
Not seeing a widget? (<a href="http://docs.widgetbox.com
/using-widgets/installing-widgets/why-cant-i-see-my-widget/">
More info</a>)
</noscript>

In addition, you can first create web content, and then paste the preceding code into content source, and finally publish it in the portlet Web Content Display. The application Astrofiles.net will show up in the portlet Web Content Display in a given page.

In general, the portal includes two portlets to mash-up content from iGoogle (google-gadget-portlet) and Netvibes (netvibes-widget-portlet). If you want to mash-up content from other sites, you only need to choose the proper widget type and paste the URL.

As mentioned earlier, the portal allows for external mash-ups, capabilities to share portlets in any websites via widgets. Under the tab More | Configuration | Sharing of any portlet, you could find the widget, a piece of JavaScript code. To share the portlet on any website, you have to just copy the widget code and paste it into a web page, and the portlet will show up in that web page. To share the portlet on Google Gadget, you can use the Google Gadget URL to create a Google Gadget such as the URL for the portlet Sign in (portlet ID) on the home page http://localhost:8080/google_gadget/web/guest/home/-/58 to share the portlet on Netvibes, you could use the Netvibes Widget URL to create a Netvibes Widget such as a URL for the portlet Sign in on the home page http://localhost:8080/netvibes/web/guest/home/-/58

Eventually, when publishing a portlet as a widget or gadget, you aren't publishing a copy, but pointing to the portlet, so that you always get the latest version. Note that if you select iGoogle, then you need to configure everything to run on port 80, as Google removes the port information in URLs when adding widgets or gadgets.

The Widget Consumer portlet

The portlet Widget Consumer provides the ability to publish any widget code in the portal. For example, if you're going to publish World Clock widget in a page, you simply have to add the portlet Widget Consumer in the page first, then go to More | Configuration | Setup Current, paste in the widget code as follows, and click on the Save button.

<script src='//dgdsbygo8mp3h.cloudfront.net/sites/default/files/blank.gif' data-original="http://www.gmodules.com/ig/ifr?url=http://www.cheapparking.
net/world-clocks.xml&up_myTimeZone0=-5~EST-%20Eastern%20
Standard%20Time&up_myTimeZone1=-8~PST-%20Pacific%20Standard%20Time&syn
d=open&w=250&h=170&title=World+Clocks&border=%23ffffff%7C3px%2C1px+sol
id+%23999999&output=js"></script>

Of course, you could publish any kind of widget code. The only thing you need is to find the widget code and paste it into the portlet Widget Consumer.

How does it work?

The following is an option that could bring the portlet Widget Consumer into the portal:

  1. Download the WAR file ${widget.consumer.portlet.war} from http://liferay.cignex.com/palm_tree/book/0387/chapter12/widgetconsumer-portlet-6.0.0.1.war
  2. Drop the WAR file ${widget.consumer.portlet.war} to the folder $LIFERAY_HOME/deploy when the portal is running.

Summary

This article introduced us to employing federated search and integrating search against content from plugins first. Then it discussed how to use the CSZ search and Map Search portlets. In particular, it discussed the OpenSearch concept. It also introduced us to Web Content search and how to configure sitemap and pluggable enterprise search. Finally, it discussed plugins management, WAP sites, reporting, auditing, CRM, and widgets.

In this article, we have learned how to:

  • Employ federated search, OpenSearch, CSZ search, and Maps search
  • Employ Web Content search
  • Configure sitemap for search engines and pluggable enterprise search
  • Manage plugins
  • Build WAP sites
  • Report and Audit
  • Integrate with CRM and Netvibes widgets

If you have read this article you may be interested to view:


Liferay Portal 6 Enterprise Intranets Build and maintain impressive corporate intranets with Liferay
Published: May 2010
eBook Price: $35.99
Book Price: $59.99
See more
Select your format and quantity:

About the Author :


Jonas X. Yuan

Jonas X. Yuan is a Chief Architect of ForgeLife LLC and an expert on Liferay Portal, e-commerce, and Content Management Systems (CMS). As an open source community contributor, he has published five Liferay books from 2008 to 2012. He is also an expert on Liferay integration with Ad Server OpenX, different search engines, enterprise content including videos, audio, images, documents, and web contents, and other technologies, such as BPM Intalio and Business Intelligence Pentaho, LDAP, and SSO. He holds a Ph.D. in Computer Science from the University of Zurich, where he focused on Integrity Control in federated database systems.

He earned his M.S. and B.S. degrees from China, where he conducted research on expert systems for predicting landslides. Previously, he worked as a Project Manager and a Technical Architect in Web GIS (Geographic Information System).
He is experienced in Systems Development Lifecycle (SDLC) and has deep, hands-on skills in J2EE technologies. He developed a BPEL (Business Process Execution Language) engine called BPELPower from scratch at the NASA data center. As the chief architect, Dr. Yuan successfully led and launched several large-scale Liferay/Alfresco e-commerce projects for millions of users each month.

He has worked on the following books: Liferay Portal Enterprise Intranets, 2008; Liferay Portal 5.2 Systems Development, 2009; Liferay Portal 6 Enterprise Intranets, 2010; Liferay User Interface Development, 2010; Liferay Portal Systems Development, 2012.

Books From Packt


Drupal 6 Social Networking
Drupal 6 Social Networking

Alfresco Developer Guide
Alfresco Developer Guide

Learning Joomla! 1.5 Extension Development
Learning Joomla! 1.5 Extension Development

Joomla! Web Security
Joomla! Web Security

OpenCms 7 Development
OpenCms 7 Development

WordPress Plug-in Development (Beginner's Guide)
WordPress Plug-in Development (Beginner's Guide)

Apache OFBiz Development: The Beginner's Tutorial
Apache OFBiz Development: The Beginner's Tutorial

Drupal for Education and E-Learning
Drupal for Education and E-Learning


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software