Tech Alliant - Your technology ally

  • blogs
  • events
  • forums
  • training
  • contact us
Home › Blogs › John Hoffler's blog

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password

Navigation

  • Popular content

Search

Who's online

There are currently 0 users and 1 guest online.

Last viewed

  • Production and non-production in the Virtualization Age 22 sec ago
  • Old School Virtualization 47 sec ago
  • OK, You're finally an Architect........Now what? 1 min ago
more

Tag John Hoffler's blog

Feed Icon
Google
Delicious
Yahoo!
NetworkedBlogs
Furl
Simplify

Who's new

  • Marlon R. Rigaud
  • autocarrera
  • GeorgeSzynal
  • daemnant
  • lannsaby

A quick look at Liferay Portal Server

John Hoffler's picture

John Hoffler — Fri, 06/11/2010 - 12:54pm

I've started a development project on the Liferay Portal server. Liferay is a nice opensource Java Portal server with auser-friendly  Web-2.0 interface. For example adding or repositioning portlets on a page is a simple drag-n-drop affair. Liferay also ships with a lot of portlets, so it's easy to build a portal site with Wikis, RSS feeds, and discussion forums right out of the box. However, I did run into a few irritating issues with Liferay:

jQuery version clash

I decided to use a third-party date-time picker widget that's built upon the excellect jQuery JavaScript library. The bad news is that I was not able to get this widget to work with the version of jQuery that Liferay requires for its own user interface. Luckily, I found a blog post that explained how to use multiple versions of jQuery in the same web page.

After loading my version of jQuery I restore the global "$" variable from Liferay's version...

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-datepicker.js"></script>
<script type="text/javascript" src="js/date-en-US.js"></script>
<script type="text/javascript" src="js/newtimepicker.js"></script>
<script type="text/javascript">
    var jQuery_1_4_2 = $.noConflict(true);
</script>
 

Now my version's jQuery "$" variable is stored in "jQuery_1_4_2."  Everywhere in my code or the date-time picker code that references "$" has to be changed to reference "jQuery_1_4_2."  Ok, that worked around the problem, but it would have been much more efficient for Liferay to rename it's jQuery variable instead of forcing it's customers to rename theirs.

No-op CacheControl Object

The Java Portlet Specification defines a portlet content caching framework that can be programmatically controlled through a CacheControl object retrieved from the portlet container. Liferay's CacheControl object is just a plain Java bean with no connection to Liferay's caching facility. Portlet containers are not required to implement the caching portion of the specification, so Liferay has the right to return a useless CacheControl object. However, Java defines the java.lang.UnsupportedOperationException class specifically for the situation in which you don't implement an expected functionality. MimeReponse.getCacheControl() should return an UnsupportedOperationException in Liferay.

base.css Run Amok

Some of my new portlets needed to display data in HTML tables. For some reason the tables were ignoring my cellpadding attribute. In the end, I found that Liferay loads a bass.css style sheet that begins with:

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td {
    margin: 0;
    padding: 0;
}

Let me be clear - there is no cause for a portal vendor to globally override the style of HTML elements that will be used by portlet developers. These CSS attributes should have been assigned to a Liferay-specific class:

.nopadding{
    margin: 0;
    padding: 0;
}

Then that class could be added to Liferay's HTML. Instead, I have to add a css class to my HTML. Rather than add a class attribute to every <td> element, you can add a class attribute to tables, then add the following css: 

.myTableStyle tr  th, .myTableStyle tr td{

    padding: 5px;

 

}

  • caching
  • Java
  • Java
  • Technology
  • John Hoffler's blog
  • Add new comment
  • Share/Save

Liferay 6.x jQuery update

John Hoffler — Sat, 01/29/2011 - 8:49pm

It seems that just a month after my original post Liferay 6.x addressed my jQuery issues. Nate Cavanaugh from the Liferay development team wrote:

One of the biggest feature requests from Liferay 5.2 was the ability to upgrade the included version of jQuery. Many users would like to use third-party plugins, and most of those require the latest jQuery library (1.4.x as of this writing).

So for 6.0, we solved this a couple of different ways. First, we no longer include jQuery by default. We have rebuilt our UI to run off of AlloyUI which is built on top of YUI3. By moving off of jQuery, it's also allowed us to step out of the way of developers who wish to  use any version of jQuery that they need without worrying about conflicts with the core portal javascript.

The other way we solved this for the future was by creating our own namespace. Since we're still using a Javascript library (YUI3), we would still have the same risk of conflicts. So instead of calling YUI() in the portal, we created AUI(). By creating the "AUI" namespace, we are able to guarantee that our environment won't conflict with someone who wants to upgrade their version of YUI3 in the future.

I haven't tested this change, but I'm pretty confident it will work.

John Hoffler
Founder, Tech Alliant
http://www.techalliant.com/blogs/john-hoffler

  • reply

Log in to skip CAPTCHA

This site uses CAPTCHA as a challenge-response test within web forms to determine whether the user is human, you won't have to answer any CAPTCHA challenges when you're logged in.

Today's top pages

  • The Hot IT Skills of 2011 (13)
  • Have you checked your electric bill? (3)
  • #NotIntendedToBeAFactualStatement and Why so Many Projects Fail (3)
more

Recent blog posts

  • Embracing Diversity in the Information Age
  • #NotIntendedToBeAFactualStatement and Why so Many Projects Fail
  • The Hot IT Skills of 2011
  • Setting up a Xen Server
  • A quick look at Liferay Portal Server
  • Have you checked your electric bill?
  • Old School Virtualization
  • OK, You're finally an Architect........Now what?
  • Hammers and Screws - Know when you shouldn't use a technology
  • Virtualization: The Importance of a Story to Tell
more

Monthly archive

  • November 2009 (7)
  • December 2009 (8)
  • January 2010 (1)
  • March 2010 (1)
  • May 2010 (1)
  • June 2010 (1)
  • October 2010 (1)
  • January 2011 (2)
  • April 2011 (1)
  • February 2012 (1)

Recent comments

  • Liferay 6.x jQuery update
    1 year 15 weeks ago
  • Good stuff!!
    1 year 16 weeks ago
  • No story, no plot, no characters
    1 year 31 weeks ago
  • "It's the way we have always done it...."
    2 years 1 week ago
  • Yes, let's partner up
    2 years 21 weeks ago
  • Link Network Instruments Virtualization Study
    2 years 22 weeks ago
  • what a great opportunity!
    2 years 22 weeks ago
  • I don't even remember when I first heard it!
    2 years 22 weeks ago
  • Preconceived notions...
    2 years 22 weeks ago
  • "when you're holding a
    2 years 22 weeks ago

All Comments, © and ™ belong to their respective owners/posters
Other content © Copyright 2012 Tech Alliant Corporation, All Rights Reserved

  • blogs
  • events
  • forums
  • training
  • contact us