If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

inanda.menezes
Hi,

We are using Orbeon Form Builder (3.9.0.201105152053 PE) + Orbeon Proxy Portlet + Liferay. The Liferay runs in one Tomcat and the Orbeon in another one.

When Liferay session expires, the user is redirected to the login page, so that the form data is not gonna be visible.

The problem is that if the user was filling a Orbeon form, which runs in Orbeon Proxy Portlet, a alert is shown when Liferay tries to redirect to the login page. If the user press cancel button, he can still see the data that was filled and this isn't safe.


Any idea about how could we avoid showing this alert message only when Liferay session has expired?
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

Erik Bruchez
Administrator
The Orbeon alert you are mentioning is a way to prevent unintended
navigation away from the page (and therefore losing data).

Your question comes down to knowing whether it is possible in
JavaScript to know whether the Liferay session has expired. If so, we
would have a solution to your problem. But I don't have the answer to
that question!

-Erik

On Wed, Sep 19, 2012 at 3:54 AM, inanda.menezes <[hidden email]> wrote:

> Hi,
>
> We are using Orbeon Form Builder (3.9.0.201105152053 PE) + Orbeon Proxy
> Portlet + Liferay. The Liferay runs in one Tomcat and the Orbeon in another
> one.
>
> When Liferay session expires, the user is redirected to the login page, so
> that the form data is not gonna be visible.
>
> The problem is that if the user was filling a Orbeon form, which runs in
> Orbeon Proxy Portlet, a alert is shown when Liferay tries to redirect to the
> login page. If the user press cancel button, he can still see the data that
> was filled and this isn't safe.
>
>
> Any idea about how could we avoid showing this alert message only when
> Liferay session has expired?
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/If-Liferay-session-has-expired-it-should-nt-show-alert-to-warn-users-leaving-a-form-without-saving-tp4655756.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

inanda.menezes
There is a way to know if liferay session has expired by javascript: Liferay.Session._currentTime = 0. But the alert is shown as soon as liferay redirects the page after the session expires.
Alert stops execution of a script, so I guess I wouldn't be able to check if the session is expired by javascript after it happens.


Maybe I should find a way to trigger a function a second before the session expires and save the form or set xxforms:instance('fr-persistence-instance')/data-safe-override" to true before it expires. So, orbeon would think the form is saved and it would not show the alert.

Or maybe another would be that orbeon would show this alert only after checking if the session has expired. Where is this alert triggered?
 
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

inanda.menezes
Hi,

It's already solved. I could solve it by changing orbeon script to check the liferay session before showing the alert.
Reply | Threaded
Open this post in threaded view
|

Re: Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

Erik Bruchez
Administrator
Inanda,

Great to hear this and thanks for sharing!

-Erik

On Mon, Sep 24, 2012 at 12:33 AM, inanda.menezes <[hidden email]> wrote:

> Hi,
>
> It's already solved. I could solve it by changing orbeon script to check the
> liferay session before showing the alert.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/If-Liferay-session-has-expired-it-should-nt-show-alert-to-warn-users-leaving-a-form-without-saving-tp4655756p4655765.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

tanajilondhe
In reply to this post by inanda.menezes
Hi Inanda,
I am facing same problem.
May I know how do you check session is active or expire using JavaScript.

--
View this message in context: http://discuss.orbeon.com/If-Liferay-session-has-expired-it-should-nt-show-alert-to-warn-users-leaving-a-form-without-saving-tp4655756p4657076.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].


Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

tanajilondhe
This post was updated on .
In reply to this post by inanda.menezes
Hi Inanda,
I am facing same problem.
May I know how can I do this in Liferay.
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

Alessandro  Vernet
Administrator
In reply to this post by tanajilondhe
Hi Tanaji,

I imagine Inanda editing the script in check-dirty-script.xhtml not to show the message if Liferay.Session._currentTime = 0.

https://github.com/orbeon/orbeon-forms/blob/4.2-ce/src/resources/apps/fr/includes/check-dirty-script.xhtml

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

tanajilondhe
Hi Alessandro,

Thanks for reply.

I think Inanda uses Liferay.Session._currentTime = 0 in script, thats why I want see how she had done this, (I want check immediately liferay session is expire or not ), but its different for me.
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

inanda.menezes
Hi Tanaji

In check-dirty-script function, there is a condition and I've added the following:
&& Liferay.Session._currentTime>5000

I did not put Liferay.Session._currentTime=0, because I was getting problem still with that. So When Liferay.Session._currentTime is less than 5000 it means it is missing too few to get expired. THis way worked fine for me.

Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

tanajilondhe
Hi Inanda,

Thanks for your reply.
Here I am not using orbeon script. I want to check this is in velocity file(portal_normal.vm).
You means if Liferay.Session._currentTime>5000 is true means session is expire.
I solved this simply hit the ajax request to server and check response. Depending response I find out session is expire or not.

Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

Alessandro  Vernet
Administrator
In reply to this post by inanda.menezes
Hi Inanda,

I was trying to find some documentation about Liferay.Session._currentTime, but didn't find anything useful. Just curious about how this works: this is in milliseconds? So it gets automatically updated after the page is loaded? I.e. Liferay has some JavaScript using setTimeout to update this value?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

inanda.menezes
Hi Alessandro,

I also did not find any documentation related to it. I know this is about the session expiration because after login to orbeon, you can watch the value of Liferay.Session._currentTime from Firebug and see that it is decreasing until the session gets expired. So, I believe Liferay has some JavaScript setting this value.
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

Alessandro  Vernet
Administrator
Hi Inanda,

Interesting technique. I can see this could be used in other scenarios where, for instance, an app separate from Orbeon Forms "sends" users to fill out a from in the Orbeon Forms web app, but you wouldn't want users to spend more than a given amount of time on the forms side, otherwise they will find that their app session has expired when they "come back".

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: If Liferay session has expired, it should'nt show alert to warn users leaving a form without saving

tanajilondhe
In reply to this post by inanda.menezes
Hi  Inanda,

Thanks for sharing your knowledge. Its very helpful.....