掲示板

Setting an expando value after a aui dialog button click

11年前 に Reshmi Yeldo によって更新されました。

Setting an expando value after a aui dialog button click

New Member 投稿: 5 参加年月日: 10/07/26 最新の投稿
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());