Forum OpenACS Development: Re: AjaxHelper seems to not working on Internet Explorer

Collapse
Posted by Amruta Lakade on
Hi Hamilton,

I think you have confused with above code.So I am posting you the test script for Ajax ContextMenu.

The test file is properly working on Mozilla but not on IE 6.
When I try to run this on IE,it gives me error as :'Done with error on page'

The code is:
TCL part

set menulist1 { { { "text" "Yipeeeee" } { "onclick:" "javascript:alert('')" } } \
                { { "text" "Yahoo"} { "url" "http://www.yahoo.com"} } \
                { { "text" "Ask.com"} { "url" "javascript:alert('You clicked Ask.com')"} } }

ah::yui::contextmenu \
    -varname "oContextMenu" \
    -id "mycontextmenu" \
    -menulist $menulist1 \
    -triggerel "document"

ADP part:

<master>
<property name="title"> TEST : Yahoo Context Menu</property>
<p>Right click anywhere on this page
<div id="div_for_ajax">
</div>

Please reply me. I am stucked on the issue.
-Amruta

Collapse
Posted by Hamilton Chua on
Hi Amruta,

In your copy of AjaxHelper, can your replace the proc ah::yui::contextmenu in the file tcl/ajax-yahoo-procs.tcl with this

****************************
ad_proc -public ah::yui::contextmenu {
-varname:required
-id:required
-menulist:required
{-css ""}
{-options ""}
{-triggerel "document"}
{-renderin "document.body"}
} {
Generates the javascript to create a YUI context menu from a tcl list.
http://developer.yahoo.com/yui/menu/

@author Hamilton Chua (mailto:ham@solutiongrove.com)
@creation-date 2006-12-25

@param varname The javascript variable to represent the menu object.
@param menulist A list of lists with the parameters this script needs to generate your menu.
@param id The html id the menu element.
@param css Specify the full path to a css style sheet file to use an alternative to the menu.css that is used.
@param options Additional options that you want to pass to the javascript object constructor.
@param triggerel What element on the page which when right clicked will show the contextmenu
@param renderin The element on the html page where the menu will be rendered. Default is the body of the page.

} {

ah::yui::requires -sources "menu,container,overlay"

if { [exists_and_not_null css] } { template::head::add_css -href $css }

set jsonlist [ah::yui::menu_list_to_json -lists_of_pairs $menulist]

set initoptions "trigger: ${triggerel}, lazyload:true"
if { [exists_and_not_null options] } {
set options "${initoptions},${options}"
} else {
set options "${initoptions}"
}

append options ", itemdata: \[${jsonlist}\]"

set script "var $varname = new YAHOO.widget.ContextMenu(\"${id}\", { ${options} } ); "

global ajax_helper_init_scripts

append ajax_helper_init_scripts ${script}

}

****************************

I have to apologize, AjaxHelper isn't up to date anymore, Yahoo has already released 2.5.1 and it's still stuck with 2.3.0.

I'm going to try and find time to get it up to speed.

Please let me know if that fixes the problem for you.

Thanks,

Hamilton