You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Nick Lothian <nl...@essential.com.au> on 2004/02/29 23:42:37 UTC

RE: JavaScript not working correctly when both portlets are in vi ewmode...

Or else you could do as suggested by the JSR168 specification and use the
RenderResponse.encodeNamespace(String) method to generate unique (to the
page) function names for each of the Javascript functions called by each
portlet.

>From the Javadoc:

"Maps the given string value into this portlet namespace and therefore
ensures the uniqueness of the string value in the whole portal page. This
method should be applied to every variable or name used in the output
stream. For example a function name in javascript. "

Nick

> -----Original Message-----
> From: Stephan Huber [mailto:shuber@ti.com]
> Sent: Friday, 27 February 2004 3:10 AM
> To: pluto-user@jakarta.apache.org
> Subject: Re: JavaScript not working correctly when both 
> portlets are in
> viewmode...
> 
> 
> I realized the "auto-start" like this:
> 
> <body onLoad="dashBoardStart()">
> 
> dashBoardStart() is my JavaScript method to display my slide show 
> sequence...
> 
> I will try your suggestion using a plain old HTML page and 
> will tell you 
> if the problem persists...
> 
> Thanks
> 
> - Stephan
> 
> Mike Burati wrote:
> > Sounds like the Javascript itself doesn't like having two 
> copies of itself
> > on the same overall page...
> > 
> > You could try putting duplicate copies of it in two 
> portions of a plain old
> > non-portal HTML page, to rule out anything to do with 
> Pluto/portlets.
> > 
> > Can you send us the javascript or at least a fragment of 
> the piece(s) that
> > you're expecting to do the auto-start of the slide show?
> > 
> > -----Original Message-----
> > From: Stephan Huber [mailto:shuber@ti.com]
> > Sent: Friday, February 27, 2004 11:31 AM
> > To: Pluto-user
> > Subject: JavaScript not working correctly when both 
> portlets are in view
> > mode...
> > 
> > 
> > Hi,
> > 
> > I've written a SlideShow portlet which uses some JavaScript 
> in one of 
> > the JSPs to display a sequence of pictures in view mode.
> > 
> > That works very well...
> > 
> > When adding a second instance of the portlet (see below) 
> both portlets 
> > are displayed correctly in view mode - but in this case the 
> sequence of 
> > pictures isn't starting (you can only see the first picture 
> of the slide 
> > show in both portlets but not the other pictures).
> > 
> > <application id="7">
> >    <definition-id>Slide</definition-id>
> >    <portlet id="1">
> >      <definition-id>Slide.SlideShow_1</definition-id>
> >    </portlet>
> >    <portlet id="2">
> >      <definition-id>Slide.SlideShow_2</definition-id>
> >    </portlet>
> > </application>
> > 
> > It seems that JavaScript isn't starting correctly when both 
> portlets are 
> > displayed.
> > The other point is that when switching to edit mode in one 
> of the two 
> > portlets, the edit mode is displayed while the other 
> portlet is still in 
> > view mode. In this case the portlet which is now in view 
> mode displays 
> > the slide show correctly...
> > 
> > Only when both portlets are in view mode nothing happens.
> > 
> > Any ideas?
> > 
> > Best Regards
> > 
> > - Stephan
> 

Re: JavaScript not working correctly when both portlets are in vi ewmode...

Posted by Vetle Roeim <vr...@enonic.com>.
Stefan Hepper wrote:

> Stephan Huber wrote:
> 
>> Thank you Nick. But I can't find the method you mention in JSR 168 
>> Spec 1.0.
>>
> 
> RenderResponse inherits this method from PorletResponse.

No, it doesn't. I'm looking at the Portlet API (V1.0) right now,
and there is no such method.

To make sure I'm right, I also searched the specification for mention
of this method.

Instead, look at the documentation for RenderResponse.getNamspace, both
in the API documentation and in the specification. Here's an excerpt
from the javadoc:

   "The value returned by this method should be prefixed or appended to 
elements, such as JavaScript variables or function names, to ensure they 
are unique in the context of the portal page."

-- 
Vetle Roeim
Lead Developer, Enonic AS - <URL:http://enonic.com>
Mobile: +47 40 40 14 37, Office: +47 22 00 85 50, Fax: +47 22 00 85 51
PGP Public Key: http://open.enonic.com/pgp/vro-pubkey.txt

Re: JavaScript not working correctly when both portlets are in vi ewmode...

Posted by Stefan Hepper <st...@hursley.ibm.com>.
Stephan Huber wrote:
> Thank you Nick. But I can't find the method you mention in JSR 168 Spec 
> 1.0.
> 
> - Stephan
> 

RenderResponse inherits this method from PorletResponse.


Stefan


Re: JavaScript not working correctly when both portlets are in vi ewmode...

Posted by Stephan Huber <sh...@ti.com>.
Thank you Nick. But I can't find the method you mention in JSR 168 Spec 1.0.

- Stephan

Nick Lothian wrote:
> Or else you could do as suggested by the JSR168 specification and use the
> RenderResponse.encodeNamespace(String) method to generate unique (to the
> page) function names for each of the Javascript functions called by each
> portlet.
> 
>>>From the Javadoc:
> 
> "Maps the given string value into this portlet namespace and therefore
> ensures the uniqueness of the string value in the whole portal page. This
> method should be applied to every variable or name used in the output
> stream. For example a function name in javascript. "
> 
> Nick
> 
> 
>>-----Original Message-----
>>From: Stephan Huber [mailto:shuber@ti.com]
>>Sent: Friday, 27 February 2004 3:10 AM
>>To: pluto-user@jakarta.apache.org
>>Subject: Re: JavaScript not working correctly when both 
>>portlets are in
>>viewmode...
>>
>>
>>I realized the "auto-start" like this:
>>
>><body onLoad="dashBoardStart()">
>>
>>dashBoardStart() is my JavaScript method to display my slide show 
>>sequence...
>>
>>I will try your suggestion using a plain old HTML page and 
>>will tell you 
>>if the problem persists...
>>
>>Thanks
>>
>>- Stephan
>>
>>Mike Burati wrote:
>>
>>>Sounds like the Javascript itself doesn't like having two 
>>
>>copies of itself
>>
>>>on the same overall page...
>>>
>>>You could try putting duplicate copies of it in two 
>>
>>portions of a plain old
>>
>>>non-portal HTML page, to rule out anything to do with 
>>
>>Pluto/portlets.
>>
>>>Can you send us the javascript or at least a fragment of 
>>
>>the piece(s) that
>>
>>>you're expecting to do the auto-start of the slide show?
>>>
>>>-----Original Message-----
>>>From: Stephan Huber [mailto:shuber@ti.com]
>>>Sent: Friday, February 27, 2004 11:31 AM
>>>To: Pluto-user
>>>Subject: JavaScript not working correctly when both 
>>
>>portlets are in view
>>
>>>mode...
>>>
>>>
>>>Hi,
>>>
>>>I've written a SlideShow portlet which uses some JavaScript 
>>
>>in one of 
>>
>>>the JSPs to display a sequence of pictures in view mode.
>>>
>>>That works very well...
>>>
>>>When adding a second instance of the portlet (see below) 
>>
>>both portlets 
>>
>>>are displayed correctly in view mode - but in this case the 
>>
>>sequence of 
>>
>>>pictures isn't starting (you can only see the first picture 
>>
>>of the slide 
>>
>>>show in both portlets but not the other pictures).
>>>
>>><application id="7">
>>>   <definition-id>Slide</definition-id>
>>>   <portlet id="1">
>>>     <definition-id>Slide.SlideShow_1</definition-id>
>>>   </portlet>
>>>   <portlet id="2">
>>>     <definition-id>Slide.SlideShow_2</definition-id>
>>>   </portlet>
>>></application>
>>>
>>>It seems that JavaScript isn't starting correctly when both 
>>
>>portlets are 
>>
>>>displayed.
>>>The other point is that when switching to edit mode in one 
>>
>>of the two 
>>
>>>portlets, the edit mode is displayed while the other 
>>
>>portlet is still in 
>>
>>>view mode. In this case the portlet which is now in view 
>>
>>mode displays 
>>
>>>the slide show correctly...
>>>
>>>Only when both portlets are in view mode nothing happens.
>>>
>>>Any ideas?
>>>
>>>Best Regards
>>>
>>>- Stephan
>>