[Zope] RSS and JavaScript

LARRY CHUON lchuon@telocity.com
8 Jan 2001 08:22:15 -0800


Hi all,

Thank you John for your quick reply to my previous email.  I've tried out both of your suggestions below.  It still does work.  I might have done something incorrectly as I am very new to these stuffs.  Here are the steps that I've taken:
1) I create a file called openMe_js with JavaScript function. Then, I add it to the same dir as htmlPreview.  The function looks something like:
<script language="javascript">
<!--
function openMe(URL){
window.open(URL,"","toolbar,status,resizable,menubar");
}
//-->
</script>

BTW, I've put this code directly in htmlPreview.

2) Next, I add one of the two methods that you've suggested to the head of htmlPreview:
> <script language="JavaScript">
> <dtml-var name="openMe_js">
> </script>

OR

> <SCRIPT LANGUAGE="JavaScript" SRC="<dtml-var expr="openMe_js.absolute_url()">"></SCRIPT>

3) Finally, I add <A href="javascript:openMe('<dtml-var url html_quote>')"><dtml-var linktext html_quote></A>
to one of the sections in htmlPreview. 

Sorry if the email is a bit lengthy.  I want to be sure that I'm doing it right.  Thank you all in advance to helping me.

Larry

On Sun, 07 January 2001, John Morton wrote:

> 
> On 7 Jan 2001 17:51:24 -0800 LARRY CHUON <lchuon@telocity.com> wrote:
> 
> > Hi Zopistas,
> > 
> > Happy New Year!
> > 
> > I'm working with SiteSummary and would like htmlPreview to grab the URL
> > and open it up in a new window.  It's not working correct.  I'm unsure
> > how Zope handle javascript either.
> 
> Zope handles javascript in the same way it handles html - it just sends
> it to the client and let's the browser figure out what to do with it.
> DTML, on the other hand, is interpreted beforehand, and the results are
> sent to the browser. 
> 
> >  Any help is greatly appreciated. 
> > Below is my htmlPreview.  I also tried to put the javascript function
> > (I'm new to js as well) in a file and import it to the same directory as
> > standard_html_header.  Then I add <SCRIPT LANGUAGE="JavaScript"
> > SRC="openMe.js"></SCRIPT> to stand_html_header.  That doesn't work
> > either. By the way, js doesn't seen to work well in Zope.  I could n't
> > find much info on-line.  
> 
> [cut]
> > <P><A href="javascript:openMe('<dtml-var url html_quote>')"><dtml-var linktext html_quote></A>
> 
> My understanding of what happens when this link is traversed is that the
> browser calls the javascript function 'openMe(...)', which should already
> defined in the page. It doesn't attempt to fetch anything from the server
> with that URL.
> 
> So what you need to do is ensure that htmlPreview include the function
> openMe by either including the code into the html document like this:
> 
> <script language="JavaScript">
> <dtml-var name="openMe_js">
> </script>
> 
> (note that I've replaced the dot in openMe.js with an underscore, as
> objects with dots in there ids need to be quoted to be used, and 
> 1) I've forgotten how to do it
> 2) Searching through the documentation has given me a headache
> )
> 
> ...Or do what you did before:
> 
> <SCRIPT LANGUAGE="JavaScript" SRC="<dtml-var expr="openMe_js.absolute_url()">"></SCRIPT>
> 
> Use the absolute_url() method, so that the browser is sure of getting the
> right url for the script (which may have been your problem before).
> 
> I'd use the first method as you can at least eyeball the html output of
> htmlPreview and see if the openMe function has acutally been include,
> before having to use whatever passes for javascript debugging in your
> browser.
> 
> HTH,
> John