Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Reshmi Yeldo
Setting an expando value after a aui dialog button click
August 18, 2012 8:28 AM
Answer

Reshmi Yeldo

Rank: New Member

Posts: 5

Join Date: July 26, 2010

Recent Posts

I am maintaining an enterprise application in Liferay with Alloy UI. After login, after loading the portal ( in top_head.jsp via hook), we display a modal Alloy UI dialog with two buttons accept and decline. Accept bring the user to the home and decline logs him out.

I have a requirement to do a audit when he clicks the any of the buttons. Also I need to store the time when he clicked the buttons. I have created a custom attribute for user for storing time and a utility jar to audit. I need to call these classes on button click. I tried using scriptlets but they are executed every time page loads. JSP redirect will make the page refresh. How can I call the java utils?

Exisitng code is as below:

<aui:script use="aui-dialog,liferay-dockbar,aui-overlaycontext-hidden,liferay-session">
var warnBox = new A.Dialog({
bodyContent: 'Content',
modal: true,
close: false,
stack: true,
title: 'Warning',
buttons:
[
{
cssClass: 'css1',
text: 'Accept',
handler: function(){
var options = {
secure: A.UA.secure
};
A.Cookie.set('userid', 'warned', options);
this.close();
}
},
{
cssClass: 'css2',
text: 'Cancel',
handler: function(){
location.href = '<%=signOutUrl %>';
}
}
]
}).render();
}
</aui:script>

ExpandoValueLocalServiceUtil.addValue(company.getCompanyId(), "com.liferay.portal.model.User", "CUSTOM_FIELDS",
"AGREEDATE", themeDisplay.getUserId(), DateUtil.newDate());
Audit.doAudit(companyWebId, themeDisplay.getUserId());