Forum OpenACS Q&A: Script Error in admin pages

Collapse
Posted by Ravi Gadad on
When I go into the admin section of my OpenACS installation, I
get a script error from Microsoft Internet Explorer 5.0 on my Mac.
I always instruct the browser to continue to run scripts, ignoring
the error, and everything seems to work fine.  I would, however,
like to resolve the script error, or at least find out what it means.
Here's what it looks like:

Microsoft JScript runtime error:
Line 42
Char 5
Error: 'UserManagement' is undefined

In the generated source for the page, line 42 reads:

UserManagement.cascade.addMember("User
Management","/admin/#user_management",false);

Is anyone else getting script errors like these?  I have never
gotten the PDMs to work anyway.. should I just disable them
completely?

Collapse
Posted by Don Baccus on
Either disable them or fix 'em and submit your patch :)

ACS Classic has had issues with these as well, I can't remember if they  got fixed in 3.2 or if users had to wait until 3.3.

Collapse
Posted by Ryan Lee on
I just submitted a patch for it.  It's only a two-character change, though (and it's not a JavaScript issue, it's a Pg query issue).  The patch, verbally:

In the file /tcl/pull-down-menu-defs.tcl, the proc ad_pdm, line 118 and 122, change 0 to 1.  Restart the AOLserver and all should be well.

This makes the admin pdm's work; I don't know about anything else because I turned it off ;p

Collapse
Posted by Kevin Cheng on
You can partially fix this by modifying some code in the file /tcl/pull-down-menu-defs.tcl.  Inside proc_doc ad_pdm, search for the phrase "cascade.addMember".  It should put you in the 'if' statement that writes the javascript for each menu entry.  Replace the entire if statement (there should be 3 branches) with the code below:

# modified on 8/17/00 - Kevin Cheng

#  append statements were replaced to output the correct javascript.

    if {[empty_string_p $parent_label]} {

        append script "
    $c_parent_label.cascade.addMember("$label","$url",false);"

    } elseif {$number_of_children > 0} {

        append script "
  var $js_label = new NavBarItem("${label} ...","$url",true);"

    } else {

        append script "
  var $parent_label = new NavBarItem("$label","$url",false);"

    }

# Note that I did NOT test this on menus more than 2 levels deep, but it works with the default admin pull-down-menus. (they're pretty cool!).