Documentation
Liferay provides a rich store of resources and knowledge to help our community better use and work with our technology.
OpenSocial integration
OpenSocial is a framework designed for creating applications, called gadgets that function on any social networking site that supports them. There are many existing gadgets available, and anyone can create their own gadgets. With Liferay, you can integrate any OpenSocial gadget into a Liferay page, and you can easily manage which gadgets are currently in use or available. You can also create your own OpenSocial Gadget using the Liferay's OpenSocial development environment.
Using OpenSocial gadgets
The OpenSocial plugin is included with Liferay Community Edition, and can be installed through Liferay Marketplace on Liferay EE. Installing the OpenSocial plugin will enable you to add OpenSocial gadgets to pages directly, and to integrate them into your portal like a portlet to added or removed by users as desired.
In some cases, you'll want to simply add a gadget to a single page. To this, go to a page, go to the Add → More menu, and add OpenSocial Gadget to the page. Initially, the portlet simply displays with a link saying Configure a gadget to be displayed in this portlet. Click on this link, enter the URL for your gadget in the URL field (try Todo List Gadget for an easy example), and click Save. That gadget will now be displayed as a portlet on your page. If, at any point, you want to change which gadget is displayed there, you can click on the configuration icon for the portlet, and replace the URL with a new one. The OpenSocial Gadget portlet options allow you to change the permissions for who can view or edit the portlet, as well as options to share the contents of the portlet, just like you can with any other Liferay portlet.
Figure 8.8: OpenSocial Gadget displayed on a page
In addition to configuring individual gadgets, you can specify gadgets that are listed in the Add → More list from the Control Panel. Click on OpenSocial Gadget Publisher in the Portal section of the Control Panel. On this page there is a list of any gadgets that have been installed as well as buttons labeled Publish Gadget and Refresh Gadgets. Click on Publish Gadget and you'll see a form to enter a URL and choose a category. Enter the URL for an OpenSocial gadget (you can use the todo list from earlier) and click Save. The gadget will now be displayed in the list, and you can add it to any page on your portal.
Figure 8.9: OpenSocial Gadget in your application list
Clicking Actions next to the gadget will enable you to edit, delete, change permissions, or refresh the gadget. Edit allows you to change the URL or category; Permissions gives you the basic View, Update, Delete, and Permissions options; Delete will remove the listing for the gadget; and the refresh option manually refreshed the gadget cache for cases where changes have been made to the gadget, but they are not displaying in the portlet.
Creating and editing OpenSocial gadgets
OpenSocial gadgets are XML documents, so as part of Liferay's OpenSocial integration, a gadget editor is included. The gadget editor is a complete development environment for gadgets, and provides syntax highlighting, a preview function, undo/redo options, and built in tabs for working on multiple gadgets at once. You can also organize and manage gadgets through a simple file manager embedded into the portlet. To access the gadget editor, go to the control panel, and click on OpenSocial Gadget Editor in the content section.
Once you have created and saved a gadget using the editor, click on the wrench next to the file to rename, delete, publish, or get the URL for your gadget. If you want to display your gadget somewhere, you can click Publish to choose a category and display your gadget in the application menu, or click on Show URL to get a URL to display your gadget on any site that supports OpenSocial.
Now that you've got all these social applications running on your system, the next question becomes: how do I measure social interaction? How do I make it clear who are the best contributors to my site? Liferay has an answer: social activity measurements.