Liferay's messages - extend duration - liferay

is it possible to extend time when Liferay's Sesssion Messages (and Session Errors) are displayed on the page ? Normally it lasts like 8 seconds and it's not enough for me.
I use Liferay 6.1.1.

What king of message are you speaking about?
If you (example) add your message in SessionMessages...
SessionMessages.add(actionRequest, "request_processed", "this-is-my-custom-success-message")
...and show it usign taglib inside your JSP
<liferay-ui:success />
It should appear in a green-backgrounded div, with success icon (for SessionErrors it is analogous).
They should not disappear.
Please, let me know more about...

Related

Wait message with full refresh in xpages

I am developing an application on xpages and would like to put a wait message while there is an ongoing processing. There are several articles that indicate how to do, but this only functional with partial update. I need the message, preferably with lock and an animated gif to work with the full update.
Problem is that a full refresh will reload the page, to get this working you need to load the page inside an iframe and place the standby code in the top page.
If you do something you need to call parent.window.dothestandby()
and in onload on the page inside the iframe call parent.window.hidestandy()
Take a look at this NotesIn9 video by David Leedy and watch from 5 minutes and see if it helps:
http://www.notesin9.com/2016/02/19/notesin9-188-adding-a-please-wait-to-xpages/
What I did was use the technique described in the link below, from an article by Brad Balassaits. In the various techniques mentioned, I implemented the one that inserts the waiting animated gif into the triggered button. From the techniques suggested and researched this was the one that would least impact when there are changes of adjustments in the application.
Brad Balassaiti article

"Please wait" message for <h:CommandButton>

How to show "Please wait" message for <h:commandButton> ? . I knew how to show this modalPanel for <a4j:____Button>. This request for an existing application which has close to 40 pages , out of 40, 10 of them implemented using a4j:commandButton and remaining h:commandButton . Adding common a4j:status in default layout (tiles) solve for all a4j:commandbutton.
Converting <h:commandbutton> to <a4j:commandButton> and add <redirect> would solve this issue, but is there any other way to accomplish this ? Any issues apart from increasing load ( two request for single submit) ?
Another Solution would be Adding
`onclick = "Richfaces.showModalPanel('progressWaitModalPanel')"`
in All h:CommandButton
where progressWaitModalPanel is the modalPanel for "Please wait" - Any issues with this approach?
I would like to implement in one place and slight modification in each page if required, but not interested in refactor the entire application.
Thanks for your time.
environment :
Richfaces 3.1.6 , myfaces 1.1.7
As I understood you: When a user clicks a h:commandButton, the "please wait" panel shall be shown.
You are right, on Ajax-Requests, the a4j:status component gets triggered and shows the mentioned message. I don't know any comparable mechanism for a normal/non-AJAX page-request (nothing more is a h:commandButton in the end).
Personally I would either go with your mentioned onclick-solution (lots of buttons to be changed, I guess) or would try playing around with something like
<h:form onsubmit="Richfaces.showModalPanel('progressWaitModalPanel')">
...
</form>
which might reduce the number of places to be changed.
Hope it helps...

Send parameter from Portlet doView to portal_normal.vm

I'm trying to send a parameter from Portlet doView function to portal_normal.vm
Is it possible? How can I send and receive it?
Sorry, but I can't see the way to do through request.
In doView I wrote
HttpServletRequest httpRequest = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest));
httpRequest.setAttribute("hola", "hola");
And in the portal normal I tried with:
#set ($holas =$request.get('attributes').get('hola'))
#set ($holas2 = $request.getSession().getAttribute("hola"))
$holas
$holas2
but Velocity only shows $holas $holas2
This sounds like an overly specific plan to display some information outside of the portlet - but also well outside the portlet spec. Is it possible? Yes. Does it have limitations? Yes.
I didn't try it, but I'd argue that you don't have any guarantee that all render phases of all portlets have been finished before portal_normal.vm starts to be evaluated. Technically it's only necessary to have them finished once they are actually about to render. Render is not allowed to change any state - and you're implying that in your case it might do - because on render something else will be displayed.
It might make sense to rather assume that your theme has some DOM element that is available on the page. Then render some javascript that manipulates this DOM element. The dependency on the theme is the same, but you could also fall back to some default rendering in case you can't find the DOM element.
Alternatively, if you insist on your mode of operation. you might try to go through the servlet-session (portlet session won't help) as you have access to the HttpServletRequest from portal_normal.vm. Be warned though: Access to HttpServletRequest is nonstandard and not really portal-thinking

Reloading the content script

I'm creating an extension for a site so that when a user types :) it changes to a graphical emotion. It all works fine when I refresh the page.
The problem is, when a user on the site types a message it's done using ajax, so there is no page load. I need a way to reload the content script, or to change the ASCII emotion to an image without reloading the page.
Is this possible?
You can listen for keyup events on the textarea or form submits if you only want to change the emotion at the end. jQuery().on() should let you do this. For example $('#textarea').on('keyup', changeEmot) or $('#form').on('submit', changeEmot). You may have to play around with the selectors and the events you get the gist.

IceFaces: inputRichText - session timeout while typing

I'm using the inputRichText component for composing HTML-formatted messages in a system I'm working on.
I've encountered a problem, however. It seems the session times out, even when the user is working in the editor.
I tried setting the session timeout parameter in web.xml to 1 minute and started typing in the editor. After 1 minute the "User session expired" dialog box appeared. Is there any way to make the rich text editor component keep the session alive? It's pretty annoying to work on something for a while only to loose it to a session time out, event though you haven't been inactive.
This is the code I use to display the component in the page:
<ice:inputRichText height="250" toolbar="MyToolbar" customConfigPath="/FCKconfig.js" id="messageBody" value="#{bean.messageBody}" language="sv" saveOnSubmit="true" />
Thanks!
Edit:
I solved it using a periodic JavaScript calling into a servlet implementing the stuff outlined in this IceFaces JIRA report
If there's a better way, please let me know :)
I solved it using a periodic JavaScript calling into a servlet implementing the stuff outlined in this IceFaces JIRA report.
It basically allows a servlet to "touch" the session and hence keep it alive.
If there's a better way, please let me know :)

Resources