Skip to content

Last Login Tag

March 31, 2008

Three methods in liferay –

* page html load,
* each portlet load
* complete page load

jQuery(document).ready(
/* This function gets loaded when all the HTML, not including the portlets, is loaded. */

function() { LiferayJedi.init(); } );

Liferay.Portlet.ready(
/* This function gets loaded after each and every portlet on the page. portletId:
the current portlet’s id jQueryObj: the jQuery wrapped object of the current portlet
*/ function(portletId, jQueryObj) { } );

jQuery(document).last(
/* This function gets loaded when everything, including the portlets, is on the page. */ function() { } );

To REFRESH Portlet after a given frequency:

CODE to – update the last login time. used with JOURNAL CONTENT PORTLET.
3 dom api used getElementById , createTextNode, appendChild
=========================================

jQuery(document).ready(
function()
{
var datasend = ‘group=’ + themeDisplay.getUserId();
var lastLogin=”;
jQuery.ajax({
url: “/html/common/test.jsp”,
data:datasend ,
type: “POST”,
processData:false,
success: function(data)
{
lastLogin = data;
alert (lastLogin);
txt = document.createTextNode(lastLogin);
document.getElementById(‘updatedLogin’).appendChild(txt);
}
});

// not working? –>> jQuery(‘updatedLogin’).append(lastLogin);
//end of s-ready
});

UserLocalServiceUtil

Issues:1. group was not being used in the page
got the userid from the themedisplay js element
from userid used UserLocalService and got the User object
then -> jquery.post method did not work so used jquery.ajax instead.
Now – issue of appending the text to the div element.- used normal dom api of getElementById and createTextNode and appendChild.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: