Closed
Bug 250221
Opened 20 years ago
Closed 20 years ago
CA Unicenter Service Desk - JavaScript Error: document.all has no properties
Categories
(Tech Evangelism Graveyard :: English US, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: james.l.herrmann, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1 Using CA Unicenter Service Desk intranet application doesn't really work at all, but works fine in IE with ActiveX turned off. I get a popup error immediately after entering the Service Center: JavaScript Error: document.all has no properties Line Number = 621 URL=http://helpdesk1/CAisd/scripts/menu.js The JavaScript console highlights the following error at line 621 of menu.js: this.layer = document.all[this.id]; Reproducible: Always Steps to Reproduce: 1. 2. 3. Actual Results: JavaScript Error Expected Results: Expected to work the way it does in IE, which has pull down menus across the top of the page. Here is the whole menu.js source //////////////////////////////////////////////////////////////////////////// // Copyright (C) 1999 Computer Associates International, Inc // as an unpublished work. This notice does not imply unrestricted or public // access to these materials which are a trade secret of Computer Associates // International or its subsidiaries or affiliates (together referred to as // CA), and which may not be reproduced, used, sold or // transferred to any third party without CA's prior written consent. // // All Rights Reserved. // // RESTRICTED RIGHTS LEGEND // Use, duplication, or disclosure by the Government is subject to // restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in // Technical Data and Computer Software clause at DFARS 252.227-7013. //////////////////////////////////////////////////////////////////////////// // Module: menus.js // Created: 04/04/01 //////////////////////////////////////////////////////////////////////////// // Description: // This is a copy of menus.js from Customer Intelligence, modified only // to use the cfgCAISD global variable to find the image directory //////////////////////////////////////////////////////////////////////////// // @(#)$Id: menus.js,v 1.28.1.2 2001/08/09 22:32:37 tooda01 Exp $ function MenuBar() { this.menus = new Array(); } MenuBar.prototype.window = void(0); MenuBar.prototype.menus = void(0); MenuBar.prototype.current = void(0); MenuBar.prototype.exitcall = 0; MenuBar.prototype.initMenus = function() { if ( this.menus.length > this.exitcall ) siteMenuitemAdd(this.menus[this.exitcall].label); siteMenuitemAdd(); // We need to draw the menus regardless of whether the menubar has finished loading // because if we don't and *THIS* page finishes loading, trying to use document.write() // in NS4 or IE4 will be a bad thing! for (var e = 0; e < this.menus.length; e++) if (typeof this.menus[e].layer == "undefined") this.menus[e].draw(); } MenuBar.prototype.init = function(win) { if (typeof win == "undefined" || typeof win.document == "undefined") return false; this.window = win; win.document.onmousemove = menuBarWindowMouseMove; document.onmousemove = windowMouseMove; var b = new Browser(); if (b.supportsDOM >= 2) win.document.getElementById("idMenuBar").menuBar = this; else if (b.supportsLayers == true) { win.document.layers["idMenuBar"].menuBar = this; win.captureEvents(Event.MOUSEMOVE); win.onmousemove = menuBarWindowMouseMove; window.captureEvents(Event.MOUSEMOVE); window.onmousemove = windowMouseMove; } else win.document.all["idMenuBar"].menuBar = this; window.currentMenu = void(0); } MenuBar.prototype.addMenu = function(id, Label, Img, Href, callExit) { if ( callExit ) { if ( this.menus.length > this.exitcall ) { siteMenuitemAdd(this.menus[this.exitcall].label); this.exitcall++; } var rc = siteMenuMod(Label); switch( typeof rc ) { case "string": if ( rc.length == 0 ) return null; else Label = rc; break; case "number": case "boolean": if ( ! rc ) return null; break; default: break; } } var _m = new Menu(this, id, Label, Img, Href, callExit); this.menus[this.menus.length] = _m; return _m; } MenuBar.prototype.draw = function() { //alert(this.window); if (this.window == void(0)) return false; var b = new Browser(); var bar = void(0); var doc = this.window.document; var e, _m, _a, _i; if (b.supportsDOM >= 2) { bar = doc.getElementById("idMenuBar"); for (e = 0; e < this.menus.length; e++) { _m = this.menus[e]; if (e > 0) { var sp = doc.createElement("SPAN"); sp.className = "menuDivider"; sp.appendChild(doc.createTextNode(" | ")); bar.appendChild(sp); } _a = doc.createElement("A"); _a.id = _m.id; _a.className = "menu"; _a.href = _m.href; if (_m.img.length > 0) { _i = doc.createElement("IMG"); _i.border = 0; _i.src = _m.img; _a.appendChild(_i); _a.appendChild(doc.createTextNode(" ")); } // Event handlers _a.onmouseover = menuBarMouseOver; _a.onmouseout = menuBarMouseOut; _a.onclick = menuBarClick; _a.appendChild(doc.createTextNode(_m.label)); bar.appendChild(_a); if (bar.offsetTop == 0) { var top = (doc.body.offsetHeight - bar.offsetHeight) / 2; if (top < 0) top = 0; bar.style.top = top; } // Relationships _a.menu = _m; _m.link = _a; } } else if (b.supportsLayers == true) { bar = this.window.document.layers["idMenuBar"]; var out = ""; for (e = 0; e < this.menus.length; e++) { out = ""; _m = this.menus[e]; if (e > 0) out += "<SPAN CLASS=\"menuDivider\">|</SPAN>"; out += " <A CLASS=\"menu\" HREF=\"" + _m.href + "\">"; if (_m.img.length > 0) out += "<IMG SRC=\"" + _m.img + "\" BORDER=0> "; out += _m.label + "</A> "; bar.document.write(out); // Will this really work??? _a = bar.document.links[bar.document.links.length - 1]; // Event handlers _a.onmouseover = menuBarMouseOver; _a.onmouseout = menuBarMouseOut; _a.onclick = menuBarClick; _a.menu = _m; _m.link = _a; if (bar.top <= 1) { var top = this.window.innerHeight; top -= bar.clip.height; top /= 2; if (top < 0) top = 0; bar.moveTo(0, top); } //_m.draw(); } bar.document.close(); } else { bar = this.window.document.all["idMenuBar"]; var out = ""; for (e = 0; e < this.menus.length; e++) { out = ""; _m = this.menus[e]; if (e > 0) out += "<SPAN CLASS=\"menuDivider\">|</SPAN>"; out += " <A CLASS=\"menu\" ID=\"" + _m.id + "\" HREF=\"JavaScript: void(0);\">" + _m.label + "</A> "; bar.innerHTML += out; _a = bar.all[_m.id]; _m.link = _a; if (bar.offsetTop == 0) { var top = (doc.body.offsetHeight - bar.offsetHeight) / 2; if (top < 0) top = 0; bar.style.top = top; } } for (e = 0; e < bar.all.length; e++) if (bar.all[e].tagName == "A") { _a = bar.all[e]; _a.onmouseover = menuBarMouseOver; _a.menu = this.getMenu(_a.id); } } if (typeof bar == "undefined") return false; return true; } MenuBar.prototype.clear = function() { var b = new Browser(); var bar; if (b.supportsDOM >= 2) { bar = this.window.document.getElementById("idMenuBar"); for (var e = bar.childNodes.length; e > 0; e--) bar.removeChild(bar.childNodes[e - 1]); bar = this.window.document.getElementById("idMenuFlds"); for (var e = bar.childNodes.length; e > 0; e--) bar.removeChild(bar.childNodes[e - 1]); } else if (b.isIE == true && b.version.major == 4) { bar = this.window.document.all["idMenuBar"]; bar.innerHTML = ""; } } MenuBar.prototype.getMenu = function(id) { for (var e = 0; e < this.menus.length; e++) { if (this.menus[e].id == id) return this.menus[e]; } return void(0); } MenuBar.prototype.writeMenuFields = function() { var submit_func = "openDetail()"; var select_func = "next()"; var up = cfgCAISD + "/img/b_go_up.gif"; var down = cfgCAISD + "/img/b_go_down.gif"; var bar = void(0); var doc = this.window.document; var b = new Browser(); if (b.supportsDOM >= 2) { bar = doc.getElementById("idMenuFlds"); if (b.isIE == true) { var out = "<TABLE ALIGN='RIGHT' VALIGN='CENTER'>" + "<TR>" + "<TD><SELECT NAME=factory_name>"; if ( typeof propFormName == "string" && ( propFormName.indexOf("chg") != -1 || propFormName.indexOf("wf") != -1 ) ) { out += "<OPTION VALUE='cr'>Request</OPTION>" + "<OPTION SELECTED VALUE='chg'>Change Order</OPTION>"; } else { out += "<OPTION SELECTED VALUE='cr'>Request</OPTION>" + "<OPTION VALUE='chg'>Change Order</OPTION>"; } out += "</SELECT></TD>" + "<TD><INPUT TYPE='TEXT' SIZE=9 NAME=ticket_num></TD>" + "<TD>" + "<INPUT" + " TYPE='IMAGE'" + " SRC='" + up + "'" + " ONMOUSEDOWN='this.src=\"" + down + "\"; return false;'" + " ONMOUSEOUT='this.src=\"" + up + "\"; return false;'" + " ONMOUSEUP='this.src=\"" + up + "\"; return false;'" + " ONCLICK='" + submit_func + "; return true;'>" + "</TD>" + "</TR>" + "</TABLE>"; bar.innerHTML = out; } else { var table = doc.createElement("TABLE"); bar.appendChild(table); table.align = "right"; table.valign = "center"; var tr = doc.createElement("TR"); table.appendChild(tr); var td = doc.createElement("TD"); tr.appendChild(td); var sel = doc.createElement("SELECT"); sel.id = "factory_name"; td.appendChild(sel); var opt = new Array(new Option("Request"), new Option("Change Order")); opt[0].value = "cr"; opt[1].value = "chg"; if ( typeof propFormName == "string" && ( propFormName.indexOf("chg") != -1 || propFormName.indexOf("wf") != -1 ) ) opt[1].selected = true; else opt[0].selected = true; sel.options[sel.options.length] = opt[0]; sel.options[sel.options.length] = opt[1]; td = doc.createElement("TD"); tr.appendChild(td); var inp = doc.createElement("INPUT"); inp.id = "ticket_num"; td.appendChild(inp); inp.type = "TEXT"; td = doc.createElement("TD"); tr.appendChild(td); inp = doc.createElement("INPUT"); td.appendChild(inp); inp.type = "IMAGE"; inp.src = up; // Reposition the DIV so it is against the right side of the menu bar. bar.style.width = "100%"; bar.style.textAlign = "right"; //inp.onmousedown = "this.src = '" + down + "'; return false;"; inp.onmousedown = function(ev) { ev.currentTarget.src = down; return false; } inp.onmouseout = function(ev) { ev.currentTarget.src = up; return false; } inp.onmouseup = function(ev) { ev.currentTarget.src = up; return false; } inp.onclick = function(ev) { eval(submit_func); return true; } } } else { var out = "<FORM NAME='menu_flds' ONSUBMIT='" + submit_func + "; return false;'>" + "<TABLE ALIGN=RIGHT VALIGN=CENTER BORDER=0 CELLPADDING=0 CELLSPACING=0>" + "<TR>" + "<TD NOWRAP>" + "<SELECT NAME=factory_name ONCHANGE='" + select_func + "'>"; if ( typeof propFormName == "string" && ( propFormName.indexOf("chg") != -1 || propFormName.indexOf("wf") != -1 ) ) out += "<OPTION VALUE='cr'>Request</OPTION>" + "<OPTION SELECTED VALUE='chg'>Change Order</OPTION>"; else out += "<OPTION SELECTED VALUE='cr'>Request</OPTION>" + "<OPTION VALUE='chg'>Change Order</OPTION>"; out += "</SELECT>" + "</TD>" + "<TD>" + "<INPUT TYPE='TEXT' NAME=ticket_num SIZE=9> " + "</TD>" + "<TD VALIGN=baseline>" + "<A HREF='JavaScript: void(0);' ID='go_btn' ONCLICK='" + submit_func + "; return false;'>" + "<IMG SRC='" + up + "' BORDER=0 WIDTH=36 HEIGHT=23" + " ONMOUSEDOWN='this.src=\"" + down + "\"; return false;'" + " ONMOUSEOUT='this.src=\"" + up + "\"; return false;'" + " ONMOUSEUP='this.src=\"" + up + "\"; return false;'>" + "</A>" + "</TD>" + "</TABLE>" + "</FORM>"; if (b.supportsLayers == true) { bar = doc.layers["idMenuFlds"]; bar.document.write(out); bar.document.close(); } else { bar = doc.all["idMenuFlds"]; bar.innerHTML = out; } } } function Menu(parent, id, Label, Img, Href, callExit) { this.parent = parent; this.id = id; this.label = Label; if (typeof Img == "string" && Img.length > 0) this.img = Img; if (typeof Href == "string" && Href.length > 0) this.href = href; if (typeof callExit == "boolean") this.callExit = callExit; this.items = new Array(); } Menu.prototype.parent = void(0); Menu.prototype.id = ""; Menu.prototype.label = ""; Menu.prototype.img = ""; Menu.prototype.href = "JavaScript: void(0);"; Menu.prototype.callExit = true; Menu.prototype.items = void(0); Menu.prototype.link = void(0); Menu.prototype.layer = void(0); Menu.prototype.addItem = function(id, Label, Img, Script, callExit) { return this.addInternalItem(id, Label, Img, "JavaScript: ahdtop." + Script + ";", "content", callExit); } Menu.prototype.addInternalItem = function(id, Label, Img, Href, target, callExit) { if ( callExit ) { var rc = siteMenuitemMod(this.label, Label); switch( typeof rc ) { case "string": if ( rc.length == 0 ) return null; else Label = rc; break; case "number": case "boolean": if ( ! rc ) return null; break; default: break; } } var _i = new Item(this, id, Label, Img, Href, callExit); this.items[this.items.length] = _i; return _i; } Menu.prototype.draw = function() { var b = new Browser(); if (b.supportsDOM >= 2) { var _d = document.createElement("DIV"); _d.style.position = "absolute"; _d.style.display = "none"; _d.className = "menu"; for (var e = 0; e < this.items.length; e++) { var _i = this.items[e]; if (e > 0) _d.appendChild(document.createElement("BR")); var _a = document.createElement("A"); _a.className = "menu"; _a.id = _i.id; _a.href = _i.href; _a.onclick = closeCurrentMenu; if (_i.img.length > 0) { var _im = document.createElement("IMG"); _im.border = 0; _im.src = _i.img; _a.appendChild(_im); _a.appendChild(document.createTextNode(" ")); } _a.appendChild(document.createTextNode(_i.label)); _a.onmouseover = menuBarDefaultHandler; _a.onmouseout = menuBarDefaultHandler; _d.appendChild(_a); } document.body.appendChild(_d); this.layer = _d; } else { var out = ""; if (b.supportsLayers == true) out += "<LAYER Z-INDEX=\"99\" NAME=\"" + this.id + "\" VISIBILITY=\"hide\">" + "<DIV CLASS=\"menu\">"; else out += "<DIV CLASS=\"menu\" ID=\"" + this.id + "\" NOWRAP>"; for (var e = 0; e < this.items.length; e++) { var _i = this.items[e]; if (e > 0) out += "<BR>\n"; out += "<A CLASS=\"menu\" HREF=\"" + _i.href + "\" ONMOUSEOVER=\"return true;\" ONCLICK=\"return closeCurrentMenu();\">"; if (_i.img.length > 0) out += "<IMG BORDER=0 SRC=\"" + _i.img + "\"> "; out += _i.label; out += "</A>"; } if (b.supportsLayers == true) out += "</LAYER>"; out += "</DIV>"; document.writeln(out); if (b.supportsLayers == true) { this.layer = document.layers[this.id]; this.layer.visibility = "hide"; } else { this.layer = document.all[this.id]; this.layer.style.display = "none"; var maxWidth = 0; for (var e = 0; e < this.layer.all.length; e++) { var elem = this.layer.all[e]; if (elem.tagName == "A" && maxWidth < elem.offsetWidth + 10) maxWidth = elem.offsetWidth + 10; } this.layer.style.width = maxWidth; } } } Menu.prototype.show = function(left, top) { var b = new Browser(); var _curr = this.parent.current; this.parent.current = this; window.currentMenu = this; if (_curr != void(0) && _curr != this) _curr.hide(); if (b.supportsDOM >= 2 || b.isIE == true) { this.layer.style.display = ""; if (b.isIE == true) { this.layer.style.left = left + document.body.scrollLeft; this.layer.style.top = top + document.body.scrollTop; } else { this.layer.style.left = left; this.layer.style.top = top; } } else { this.layer.moveTo(left, top); this.layer.visibility = "show"; } } Menu.prototype.hide = function() { var b = new Browser(); if (b.supportsDOM >= 2 || b.isIE == true) { this.layer.style.display = "none"; } else this.layer.visibility = "hide"; if (this.parent.current == this) this.parent.current = void(0); if (window.currentMenu == this) window.currentMenu = void(0); // If the search filter was hidden when the menu was shown, show it again. if ( typeof window.currentMenu == "undefined" && typeof searchFilterClearTimeout == "function" ) searchFilterClearTimeout(); } function Item(parent, id, Label, Img, Href, callExit) { this.parent = parent; this.id = id; this.label = Label; if (typeof Img == "string" && Img.length > 0) this.img = Img; if (typeof Href == "string" && Href.length > 0) this.href = Href; if (typeof callExit == "boolean") this.callExit = callExit; } Item.prototype.parent = void(0); Item.prototype.id = ""; Item.prototype.label = ""; Item.prototype.img = ""; Item.prototype.href = ""; Item.prototype.callExit = true; // Global functions (I can't put these into the objects-- but we'll manage!) function menuBarMouseOut(ev) { window.status = window.defaultStatus; return true; } function menuBarClick(ev) { return false; } function menuBarWindowMouseMove(ev) { var win = window.parent.frames["menubar"]; var b = new Browser(); var x, y; var width, height; var _mB; if (b.isIE == true) ev = win.event; if (b.supportsDOM >= 2) { x = ev.clientX; y = ev.clientY; width = win.document.getElementById("idMenuBar").offsetWidth; height = win.document.getElementById("idMenuBar").offsetHeight; _mB = win.document.getElementById("idMenuBar").menuBar; } else if (b.supportsLayers == true) { x = ev.x; y = ev.y; width = win.document.layers["idMenuBar"].clip.width; height = win.document.layers["idMenuBar"].clip.height; _mB = win.document.layers["idMenuBar"].menuBar; } else { x = ev.clientX; y = ev.clientY; width = win.document.all["idMenuBar"].offsetWidth; height = win.document.all["idMenuBar"].offsetHeight; _mB = win.document.all["idMenuBar"].menuBar; } //window.status = "X: " + String(x) + ", Y: " + String(y) + ", Width: " + String(width) + ", Height: " + String(height); if (x <= 0 || x >= width || y <= 0) { if (typeof _mB == "object" && _mB != void(0) && _mB.current != void(0)) _mB.current.hide(); } return true; } function menuBarMouseOver(ev) { var b = new Browser(); var _m = void(0); var left, top; top = 0; if (b.isIE == true) { ev = window.parent.frames["menubar"].event; _m = ev.srcElement.menu; left = ev.srcElement.offsetLeft; } else if (b.isNS == true && b.version.major == 4) { _m = ev.target.menu; left = ev.target.x + window.pageXOffset; top = window.pageYOffset; } else if (b.isNS == true && b.version.major >= 6) { _m = ev.currentTarget.menu; left = ev.currentTarget.offsetLeft; } window.status = _m.label; // We don't want to show the menubar quite yet... var filter_timeout_called = false; if ( typeof searchFilterSetTimeout == "function" ) { searchFilterSetTimeout(); filter_timeout_called = true; } else { if ( ! filter_timeout_called ) { if ( typeof searchFilterClearTimeout == "function" ) searchFilterClearTimeout(); filter_timeout_called = true; } } _m.show(left, top); return true; } function windowMouseMove(ev) { var b = new Browser(); var x, y; var left, top; var width, height; var _curr = window.currentMenu; if (_curr != void(0)) { if (b.isIE == true) ev = window.event; if (b.supportsDOM >= 2 || b.isIE == true) { x = ev.clientX; y = ev.clientY; left = _curr.layer.offsetLeft; top = _curr.layer.offsetTop; if (b.isIE == true) { x += document.body.scrollLeft; y += document.body.scrollTop; } width = _curr.layer.offsetWidth; height = _curr.layer.offsetHeight; } else if (b.supportsLayers == true) { x = ev.pageX; y = ev.pageY; left = _curr.layer.left; top = _curr.layer.top; width = _curr.layer.clip.width; height = _curr.layer.clip.height; } if (_curr != void(0) && (x <= left || x >= (left + width) || y >= (top + height))) _curr.hide(); } if ( _browser.supportsLayers == true ) document.routeEvent(ev); } function closeCurrentMenu() { if ((typeof window.currentMenu == "object") && (typeof window.currentMenu.hide == "function")) window.currentMenu.hide(); } function menuBarDefaultHandler(ev) { return true; } function openDetail() { var b = new Browser(); var opt, tk; if (b.supportsDOM >= 2) { var doc = window.parent.frames["menubar"].document; opt = doc.getElementById("factory_name"); tk = doc.getElementById("ticket_num"); } else if (b.supportsLayers == true) { var doc = window.parent.frames["menubar"].document.layers["idMenuFlds"].document; opt = doc.forms[0].factory_name; tk = doc.forms[0].ticket_num; } else { var doc = window.parent.frames["menubar"].document; opt = doc.all["factory_name"]; tk = doc.all["ticket_num"]; } var factory = opt.options[opt.selectedIndex].value; var num = tk.value; tk.value = ""; window.status = "Factory: " + String(factory) + ", Num: " + String(num); do_openDetail(factory, num); } function next() { var b = new Browser(); if (b.supportsDOM >= 2) window.parent.frames["menubar"].document.getElement("ticket_num").focus(); else if (b.supportsLayers == true) window.parent.frames["menubar"].document.layers["idMenuFlds"].document.forms[0].ticket_num.focus(); else window.parent.frames["menubar"].document.all["idMenuFlds"].document.forms[0].ticket_num.focus(); } // addMenuItem() // Called from sitemods.js to add something to the menubar function addMenuItem(name) { if ( typeof __menuBar != "object" ) __menuBar = new MenuBar(); var n = __menuBar.menus.length; __menuBar.addMenu("idUserMenu"+n, name, "", "", false); } // addSubMenuItem() // Called from sitemods.js to add something to the menubar function addSubMenuItem(name, script) { var n = __menuBar.menus.length-1; var m = __menuBar.menus[n]; var n1 = m.items.length; m.addItem("idUserSubmenu" + n + "_" + n1, name, "", script, false); }
Comment 1•20 years ago
|
||
document.all is non-standard, IE-proprietary code. It is not supported by Mozilla. The site needs to rewrite its code to be browser-neutral. ->TE
Assignee: general → english-us
Component: JavaScript Engine → English US
Product: Browser → Tech Evangelism
QA Contact: pschwartau → english-us
Version: Trunk → unspecified
Comment 2•20 years ago
|
||
But see bug 248549. Which could be a dependency of this bug, if not what this bug gets dup'd against. /be
Comment 3•20 years ago
|
||
Waitaminute. What sets b.supportsDOM? For Mozilla, it should be >= 2, at least for this menu stuff to work (at a glance). This looks like easy evangelism. /be
Status: UNCONFIRMED → NEW
Ever confirmed: true
Reporter | ||
Comment 4•20 years ago
|
||
I checked with Computer Associates, and they said that the current version of Unicenter Support Desk (v6.0) supports Mozilla, and version we are on (5.5) does not. So they are coming around to standards, and I just need to get my company to upgrade the software. That's not to say that there isn't any valuable information in this request for Firefox, and if I can help further, please let me know. For now, I'm going to go with the first solution, being that the product needs to be made browser neutral, which it now is. I'll work on it from this side. Thanks all, Jim
Comment 5•20 years ago
|
||
Thanks Jim! Since version 6 works, I will mark this as a WFM.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
Updated•9 years ago
|
Product: Tech Evangelism → Tech Evangelism Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•