Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Facebook Portlet

Facebook is a social networking site that students use regularly (most seem to use it multiple times per day). Our motivation behind a Facebook portlet is to make students' lives easier by providing them access to campus information and services while simultaneously allowing them to connect with a social service. We believe that the adoption rate of the portal will increase with the addition of this portlet.

 Technical Information

When the user authenticates, the portlet establishes a session with Facebook that lasts for 24 hours (or forever, depending on what the user would like). The session information is stored in the portal database and is retained until it is timed-out by Facebook. By caching the session in the portal database, the session is tied to the portal & user and not the system/IP being used. A user will remain logged into the portlet regardless of when or where the user logs into the portal (as long as the session is valid).

The user has the option to specify which notifications to view (see the last screenshot), and to remove the Facebook session altogether ("Logout of Facebook").

 Download

 Download Version 0.1 

 Installation & Configuration

FacebookPortletis a simple GenericPortlet with JSP views. For simplicity's sake, the portlet uses the same jdbc context as uPortal. To accomplish this, you need to make that context available to the entire tomcat. See the uPortal wiki for instructions on how to do this.

You will then need to create 2 tables in your PortalDb database (if you use MySQL, just execute the following):

 CREATE TABLE IF NOT EXISTS `UPC_FACEBOOK` (
  `UID` varchar(128) NOT NULL,
  `SESSION` varchar(255) DEFAULT NULL,
  `PREFERENCES` text,
  PRIMARY KEY (`UID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `UPC_FACEBOOK_PREFS` (
  `UID` varchar(128) NOT NULL,
  `PREF_NM` varchar(128) DEFAULT NULL,
  `PREF_VAL` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

You will also need to create a Facebook API and "secret" key. If you don't have a Facebook account, create one and then go to the developers sectionto sign up for an API key (it's free). When signing up, make sure you enter the full URL of your portal as the Callback URL and set the Application Type to website.

Once you get your keys, change the values in edu.uci.vcsa.portal.portlets.FacebookPortlet.

Almost done! You will want to update the URLs for the icons in the JSP files. The icons are located in a zip file in the main directory of the portlet. Unzip them onto your web server and edit the image URLs in the appropriate JSPs in /webpages/WEB-INF/jsp/.

Run ant deploy to compile and package.

Deploy to uPortal like any other portlet, ant deployPortletApp -DportletApp=/path/to/dir/build/Facebook.war. Use the Channel Manager to add a new Portlet with ID: Facebook.FacebookPortlet.

 Screenshots

Before Logging In 

Associating your Facebook account with your portal account 

Primary portlet view

Editing preferences

 Considerations

This portlet has not been thoroughly tested under heavy load and should not be placed into a production environment without doing so first. Enjoy!

  • No labels