Thanks! This works. The parameter is still backward I think...
<parameter name="dont_remove_onsomething" value="no" hidden="false"/>
...will in fact return the "onclick" attribute. I think it should be
"yes" to say "Yes", don't remove the "onsomething" attributes?
Thanks again.
Paul Spencer <[EMAIL PROTECTED]>
01/10/02 12:03 PM
Please respond to Jetspeed Users List
To: Jetspeed Users List <[EMAIL PROTECTED]>
cc:
Subject: Re: Losing attributes with WebPagePortlet
Ozgur,
Thank you for the patch, I will apply it.
Paul Spencer
Ozgur Balsoy wrote:
> This is a bug in org.apache.jetspeed.util.HTMLRewriter.Callback, method
> appendTagToResult(...).
>
> When you set the dont_remove_onsomething to yes, it skips the attributes
> starting with "on...". However, the "if" statement misses an else and
when
> the flag is set to no, no attribute is added.
>
> Also, there is another bug hidden there. If an attribute's name is just
one
> character, it returns a StringIndexOutOfBoundsException.
>
> Here is my fix. In HTMLRewriter v0.2, replace the lines between 329-340
with
> this:
>
> convertURLS(tag,attrs);
> Enumeration e = attrs.getAttributeNames();
> addToResult("<").addToResult(tag);
> while (e.hasMoreElements()) {
> Object attr = e.nextElement();
> String attrName = attr.toString();
> String value = attrs.getAttribute(attr).toString();
> if(removeOnSomething) {
> if(!attrName.toLowerCase().startsWith("on"))
> // filter the onClick, onThis, onThat-Attributes
> addToResult("
").addToResult(attr).addToResult("=\"").
> addToResult(value).addToResult("\"");
> }
> else
> addToResult(" ").addToResult(attr).addToResult("=\"").
> addToResult(value).addToResult("\"");
> }
>
> Hope this helps.
> Ozgur Balsoy
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 09, 2002 5:46 PM
> To: Jetspeed Users List
> Subject: Re: Losing attributes with WebPagePortlet
>
>
> Believe it or not... I tried adding the line below and it caused the
> portlet to drop more attributes such as the href. Am I the only one
> having this problem? I'm using an anchor tag with an href. There is
also
> an onclick attribute that uses javascript to open a pop up window. When
I
> close the popup window I reset the href back to the original page. Works
> great in Cocoon outside of Jetspeed.
>
> <parameter name="dont_remove_onsomething" value="yes" hidden="false"/>
>
> Any ideas are appreciated.
>
>
>
>
>
>
> Paul Spencer <[EMAIL PROTECTED]>
> 01/09/02 05:03 PM
> Please respond to Jetspeed Users List
>
>
> To: Jetspeed Users List <[EMAIL PROTECTED]>
> cc:
> Subject: Re: Losing attributes with WebPagePortlet
>
>
>
> Jim,
> Try adding
> <parameter name="dont_remove_onsomething" value="yes" hidden="false"/>
>
> Paul Spencer
>
> [EMAIL PROTECTED] wrote:
>
>
>>I'm using the 12/6 nightly build... Haven't installed the release build
>>yet.
>>
>>I have a portlet that uses WebPagePortlet as the Parent. All my
>>javascript and even my onclick attributes are removed. I tried using
>>
> the
>
>>following entry:
>><parameter name="dont_remove_script" value="yes" hidden="false"/> ...and
>>
>
>>the problem persists. Am I missing something? Does WebPagePortlet
>>automatically remove these things?
>>
>>Thanks.
>>Jim
>>
>>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>