// Copyright 2003 Perforce Software. All rights reserved. // // This file is part of Perforce - the FAST SCM System. // // p4wJsHier: // Appends the requested javascript data to itself (which is basically // a StrBuf). This class is used for generating hierarchical drop-down // menus. #include <p4wp4.h> #include "p4wStrBuf.h" #include "p4wJsHier.h" p4wJsHier & p4wJsHier::beginJs( const char *version ) { // // Generate the script directive used to start // a javascript section of code Append( "<script language=\"JavaScript" ); if( version ) Append( version ); Append( "\">" ); Append( crlf ); return *this; } p4wJsHier & p4wJsHier::endJs() { // // Generate the end script directive Append( "</script>" ); Append( crlf ); return *this; } p4wJsHier & p4wJsHier::writeMenus( const char *name ) { // // Generate the command used to write out the named menu // using the hierarchical menu API. Append( "window." ); Append( name ); Append( ".writeMenus();" ); Append( crlf ); return *this; } p4wJsHier & p4wJsHier::addMenuItem( const char *name, const char *tag, const char *action ) { // // Generate the command to add an item to the named menu // using the hierarchical menu API Append( "window." ); Append( name ); Append( ".addMenuItem(\"" ); Append( tag ); Append( "\",\"location='" ); Append( action ); Append( "'\");" ); Append( crlf ); return *this; } p4wJsHier & p4wJsHier::menuAPI() { // // Generate the javascript menu API that is used to generate // hierarchical javascript menus. Yup, it's big! menuAPI1(); menuAPI2(); menuAPI3(); menuAPI4(); menuAPI5(); return *this; } p4wJsHier & p4wJsHier::newMenu( const char *label, int menuHeight, int menuWidth, const char *font, int fontSize, const char * fontColor, const char *fontHiColor, const char *itemBgColor, const char *hiBgColor, const char *halgn, const char *valgn, int pad, int space, int to, int sx, int sy, int srel, int opaque, int vert, int indent ) { // // Generates menuAPI's Menu() method to create a new menu Append( "window." ); Append( label ); Append( " = new Menu(\"root\"," ); Append( StrNum( menuHeight ).Text() ); Append( "," ); Append( StrNum( menuWidth ).Text() ); Append( "," ); Append( "\"" ); Append( font ); Append( "\"," ); Append( StrNum( fontSize ).Text() ); Append( "," ); Append( "\"" ); Append( fontColor ); Append( "\"," ); Append( "\"" ); Append( fontHiColor ); Append( "\"," ); Append( "\"" ); Append( itemBgColor ); Append( "\"," ); Append( "\"" ); Append( hiBgColor ); Append( "\"," ); Append( "\"" ); Append( halgn ); Append( "\"," ); Append( "\"" ); Append( valgn ); Append( "\"," ); Append( StrNum( pad ).Text() ); Append( "," ); Append( StrNum( space ).Text() ); Append( "," ); Append( StrNum( to ).Text() ); Append( "," ); Append( StrNum( sx ).Text() ); Append( "," ); Append( StrNum( sy ).Text() ); Append( "," ); if( srel ) Append( "true" ); else Append( "false" ); Append( "," ); if( opaque ) Append( "true" ); else Append( "false" ); Append( "," ); if( vert ) Append( "true" ); else Append( "false" ); Append( "," ); Append( StrNum( indent ).Text() ); Append( "," ); Append( "true,true);" ); Append( crlf ); return *this; } p4wJsHier & p4wJsHier::menuAtts( const char *label, const char *fontWeight, int hideMouseOut, int menuBorder, const char *liteBgColor, const char *borderBgColor, const char *bgColor ) { // // Sets some attributes of the label's menu Append( "window." ); Append( label ); Append( ".fontWeight=\"" ); Append( fontWeight ); Append( "\"" ); Append( ";" ); Append( crlf ); Append( "window." ); Append( label ); Append( ".hideOnMouseOut=" ); if( hideMouseOut ) Append( "true" ); else Append( "false" ); Append( ";" ); Append( crlf ); Append( "window." ); Append( label ); Append( ".menuBorder=" ); Append( StrNum( menuBorder ).Text() ); Append( ";" ); Append( crlf ); Append( "window." ); Append( label ); Append( ".menuLiteBgColor='" ); Append( liteBgColor ); Append( "';" ); Append( crlf ); Append( "window." ); Append( label ); Append( ".menuBorderBgColor='" ); Append( borderBgColor ); Append( "';" ); Append( crlf ); Append( "window." ); Append( label ); Append( ".bgColor='" ); Append( bgColor ); Append( "';" ); Append( crlf ); return *this; } void p4wJsHier::menuAPI1() { // Methods from the menuApi used for generating hierarchical // dropdown menus Append( "/**" ); Append( crlf ); Append( " * mm_menu 20MAR2002 Version 6.0" ); Append( crlf ); Append( " * Andy Finnell, March 2002" ); Append( crlf ); Append( " * Copyright (c) 2000-2002 Macromedia, Inc." ); Append( crlf ); Append( " *" ); Append( crlf ); Append( " * based on menu.js" ); Append( crlf ); Append( " * by gary smith, July 1997" ); Append( crlf ); Append( " * Copyright (c) 1997-1999 Netscape Communications Corp." ); Append( crlf ); Append( " *" ); Append( crlf ); Append( " * Netscape grants you a royalty free license to use or modify this" ); Append( crlf ); Append( " * software provided that this copyright notice appears on all copies." ); Append( crlf ); Append( " * This software is provided \"AS IS,\" without a warranty of any kind." ); Append( crlf ); Append( " */" ); Append( crlf ); Append( "function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah)" ); Append( crlf ); Append( "{" ); Append( crlf ); Append( "this.version = \"020320 [Menu; mm_menu.js]\";" ); Append( crlf ); Append( "this.type = \"Menu\";" ); Append( crlf ); Append( "this.menuWidth = mw;" ); Append( crlf ); Append( "this.menuItemHeight = mh;" ); Append( crlf ); Append( "this.fontSize = fs;" ); Append( crlf ); Append( "this.fontWeight = \"plain\";" ); Append( crlf ); Append( "this.fontFamily = fnt;" ); Append( crlf ); Append( "this.fontColor = fclr;" ); Append( crlf ); Append( "this.fontColorHilite = fhclr;" ); Append( crlf ); Append( "this.bgColor = \"#555555\";" ); Append( crlf ); Append( "this.menuBorder = 1;" ); Append( crlf ); Append( "this.menuBgOpaque=opq;" ); Append( crlf ); Append( "this.menuItemBorder = 1;" ); Append( crlf ); Append( "this.menuItemIndent = idt;" ); Append( crlf ); Append( "this.menuItemBgColor = bg;" ); Append( crlf ); Append( "this.menuItemVAlign = valgn;" ); Append( crlf ); Append( "this.menuItemHAlign = halgn;" ); Append( crlf ); Append( "this.menuItemPadding = pad;" ); Append( crlf ); Append( "this.menuItemSpacing = space;" ); Append( crlf ); Append( "this.menuLiteBgColor = \"#ffffff\";" ); Append( crlf ); Append( "this.menuBorderBgColor = \"#777777\";" ); Append( crlf ); Append( "this.menuHiliteBgColor = bgh;" ); Append( crlf ); Append( "this.menuContainerBgColor = \"#cccccc\";" ); Append( crlf ); Append( "this.childMenuIcon = \"arrows.gif\";" ); Append( crlf ); Append( "this.submenuXOffset = sx;" ); Append( crlf ); Append( "this.submenuYOffset = sy;" ); Append( crlf ); Append( "this.submenuRelativeToItem = srel;" ); Append( crlf ); Append( "this.vertical = vert;" ); Append( crlf ); Append( "this.items = new Array();" ); Append( crlf ); Append( "this.actions = new Array();" ); Append( crlf ); Append( "this.childMenus = new Array();" ); Append( crlf ); Append( "this.hideOnMouseOut = true;" ); Append( crlf ); Append( "this.hideTimeout = to;" ); Append( crlf ); Append( "this.addMenuItem = addMenuItem;" ); Append( crlf ); Append( "this.writeMenus = writeMenus;" ); Append( crlf ); Append( "this.MM_showMenu = MM_showMenu;" ); Append( crlf ); Append( "this.onMenuItemOver = onMenuItemOver;" ); Append( crlf ); Append( "this.onMenuItemAction = onMenuItemAction;" ); Append( crlf ); Append( "this.hideMenu = hideMenu;" ); Append( crlf ); Append( "this.hideChildMenu = hideChildMenu;" ); Append( crlf ); Append( "if (!window.menus) window.menus = new Array();" ); Append( crlf ); Append( "this.label = \" \" + label;" ); Append( crlf ); Append( "window.menus[this.label] = this;" ); Append( crlf ); Append( "window.menus[window.menus.length] = this;" ); Append( crlf ); Append( "if (!window.activeMenus) window.activeMenus = new Array();" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function addMenuItem(label, action) {" ); Append( crlf ); Append( "this.items[this.items.length] = label;" ); Append( crlf ); Append( "this.actions[this.actions.length] = action;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function FIND(item) {" ); Append( crlf ); Append( "if( window.mmIsOpera ) return(document.getElementById(item));" ); Append( crlf ); Append( "if (document.all) return(document.all[item]);" ); Append( crlf ); Append( "if (document.getElementById) return(document.getElementById(item));" ); Append( crlf ); Append( "return(false);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); } void p4wJsHier::menuAPI2() { // Methods from the menuApi used for generating hierarchical // dropdown menus Append( "function writeMenus(container) {" ); Append( crlf ); Append( "if (window.triedToWriteMenus) return;" ); Append( crlf ); Append( "var agt = navigator.userAgent.toLowerCase();" ); Append( crlf ); Append( "window.mmIsOpera = agt.indexOf(\"opera\") != -1;" ); Append( crlf ); Append( "if (!container && document.layers) {" ); Append( crlf ); Append( "window.delayWriteMenus = this.writeMenus;" ); Append( crlf ); Append( "var timer = setTimeout('delayWriteMenus()', 500);" ); Append( crlf ); Append( "container = new Layer(100);" ); Append( crlf ); Append( "clearTimeout(timer);" ); Append( crlf ); Append( "} else if (document.all || document.hasChildNodes || window.mmIsOpera) {" ); Append( crlf ); Append( "document.writeln('<span id=\"menuContainer\"></span>');" ); Append( crlf ); Append( "container = FIND(\"menuContainer\");" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "window.mmHideMenuTimer = null;" ); Append( crlf ); Append( "if (!container) return;" ); Append( crlf ); Append( "window.triedToWriteMenus = true;" ); Append( crlf ); Append( "container.isContainer = true;" ); Append( crlf ); Append( "container.menus = new Array();" ); Append( crlf ); Append( "for (var i=0; i<window.menus.length; i++)" ); Append( crlf ); Append( "container.menus[i] = window.menus[i];" ); Append( crlf ); Append( "window.menus.length = 0;" ); Append( crlf ); Append( "var countMenus = 0;" ); Append( crlf ); Append( "var countItems = 0;" ); Append( crlf ); Append( "var top = 0;" ); Append( crlf ); Append( "var content = '';" ); Append( crlf ); Append( "var lrs = false;" ); Append( crlf ); Append( "var theStat = \"\";" ); Append( crlf ); Append( "var tsc = 0;" ); Append( crlf ); Append( "if (document.layers) lrs = true;" ); Append( crlf ); Append( "for (var i=0; i<container.menus.length; i++, countMenus++) {" ); Append( crlf ); Append( "var menu = container.menus[i];" ); Append( crlf ); Append( "if (menu.bgImageUp || !menu.menuBgOpaque) {" ); Append( crlf ); Append( "menu.menuBorder = 0;" ); Append( crlf ); Append( "menu.menuItemBorder = 0;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (lrs) {" ); Append( crlf ); Append( "var menuLayer = new Layer(100, container);" ); Append( crlf ); Append( "var lite = new Layer(100, menuLayer);" ); Append( crlf ); Append( "lite.top = menu.menuBorder;" ); Append( crlf ); Append( "lite.left = menu.menuBorder;" ); Append( crlf ); Append( "var body = new Layer(100, lite);" ); Append( crlf ); Append( "body.top = menu.menuBorder;" ); Append( crlf ); Append( "body.left = menu.menuBorder;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "content += ''+" ); Append( crlf ); Append( "'<div id=\"menuLayer'+ countMenus +'\"" ); Append( " style=\"position:absolute;z-index:1;left:10px;top:'" ); Append( "+ (i * 100) +'px;visibility:hidden;color:'" ); Append( " + menu.menuBorderBgColor + ';\">\\n'+" ); Append( crlf ); Append( "' <div id=\"menuLite'+ countMenus +'\"" ); Append( " style=\"position:absolute;z-index:1;left:'" ); Append( "+ menu.menuBorder +'px;top:'+ menu.menuBorder +" ); Append( "'px;visibility:hide;\" onmouseout=\"mouseoutMenu();\">\\n'" ); Append( "+" ); Append( crlf ); Append( "' <div id=\"menuFg'+ countMenus +'\"" ); Append( " style=\"position:absolute;left:'+ menu.menuBorder +" ); Append( "'px;top:'+ menu.menuBorder +'px;visibility:hide;\">\\n'" ); Append( "+" ); Append( crlf ); Append( "'';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "var x=i;" ); Append( crlf ); Append( "for (var i=0; i<menu.items.length; i++) {" ); Append( crlf ); Append( "var item = menu.items[i];" ); Append( crlf ); Append( "var childMenu = false;" ); Append( crlf ); Append( "var defaultHeight = menu.fontSize+2*menu.menuItemPadding;" ); Append( crlf ); Append( "if (item.label) {" ); Append( crlf ); Append( "item = item.label;" ); Append( crlf ); Append( "childMenu = true;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "menu.menuItemHeight = menu.menuItemHeight || defaultHeight;" ); Append( crlf ); Append( "var itemProps = '';" ); Append( crlf ); Append( "if( menu.fontFamily != '' ) itemProps += 'font-family:' + menu.fontFamily +';';" ); Append( crlf ); Append( "itemProps += 'font-weight:' + menu.fontWeight + ';fontSize:' + menu.fontSize + 'px;';" ); Append( crlf ); Append( "if (menu.fontStyle) itemProps += 'font-style:' + menu.fontStyle + ';';" ); Append( crlf ); Append( "if (document.all || window.mmIsOpera)" ); Append( crlf ); Append( "itemProps += 'font-size:' + menu.fontSize + 'px;\" onmouseover=\"onMenuItemOver(null,this);\" onclick=\"onMenuItemAction(null,this);';" ); Append( crlf ); Append( "else if (!document.layers) {" ); Append( crlf ); Append( "itemProps += 'font-size:' + menu.fontSize + 'px;';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "var l;" ); Append( crlf ); Append( "if (lrs) {" ); Append( crlf ); Append( "var lw = menu.menuWidth;" ); Append( crlf ); Append( "if( menu.menuItemHAlign == 'right' ) lw -= menu.menuItemPadding;" ); Append( crlf ); Append( "l = new Layer(lw,body);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "var itemLeft = 0;" ); Append( crlf ); Append( "var itemTop = i*menu.menuItemHeight;" ); Append( crlf ); Append( "if( !menu.vertical ) {" ); Append( crlf ); Append( "itemLeft = i*menu.menuWidth;" ); Append( crlf ); Append( "itemTop = 0;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "var dTag = '<div id=\"menuItem'+ countItems +'\" style=\"position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'\">';" ); Append( crlf ); Append( "var dClose = '</div>'" ); Append( crlf ); Append( "if (menu.bgImageUp) dTag = '<div id=\"menuItem'+ countItems +'\" style=\"background:url('+menu.bgImageUp+');position:absolute;left:' + itemLeft + 'px;top:'+ itemTop +'px;'+ itemProps +'\">';" ); Append( crlf ); Append( crlf ); Append( "var left = 0, top = 0, right = 0, bottom = 0;" ); Append( crlf ); Append( "left = 1 + menu.menuItemPadding + menu.menuItemIndent;" ); Append( crlf ); Append( "right = left + menu.menuWidth - 2*menu.menuItemPadding - menu.menuItemIndent;" ); Append( crlf ); Append( "if( menu.menuItemVAlign == 'top' ) top = menu.menuItemPadding;" ); Append( crlf ); Append( "if( menu.menuItemVAlign == 'bottom' ) top = menu.menuItemHeight-menu.fontSize-1-menu.menuItemPadding;" ); Append( crlf ); Append( "if( menu.menuItemVAlign == 'middle' ) top = ((menu.menuItemHeight/2)-(menu.fontSize/2)-1);" ); Append( crlf ); Append( "bottom = menu.menuItemHeight - 2*menu.menuItemPadding;" ); Append( crlf ); Append( "var textProps = 'position:absolute;left:' + left + 'px;top:' + top + 'px;';" ); Append( crlf ); Append( "if (lrs) {" ); Append( crlf ); Append( "textProps +=itemProps + 'right:' + right + ';bottom:' + bottom + ';';" ); Append( crlf ); Append( "dTag = \"\";" ); Append( crlf ); Append( "dClose = \"\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "if(document.all && !window.mmIsOpera) {" ); Append( crlf ); Append( "item = '<div align=\"' + menu.menuItemHAlign + '\">' + item + '</div>';" ); Append( crlf ); Append( "} else if (lrs) {" ); Append( crlf ); Append( "item = '<div style=\"text-align:' + menu.menuItemHAlign + ';\">' + item + '</div>';" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "var hitem = null;" ); Append( crlf ); Append( "if( menu.menuItemHAlign != 'left' ) {" ); Append( crlf ); Append( "if(window.mmIsOpera) {" ); Append( crlf ); Append( "var operaWidth = menu.menuItemHAlign == 'center' ? -(menu.menuWidth-2*menu.menuItemPadding) : (menu.menuWidth-6*menu.menuItemPadding);" ); Append( crlf ); Append( "hitem = '<div id=\"menuItemHilite' + countItems + 'Shim\" style=\"position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:'" ); Append( crlf ); Append( "+ menu.menuItemHAlign + ';visibility:visible;\">' + item + '</div>';" ); Append( crlf ); Append( "item = '<div id=\"menuItemText' + countItems + 'Shim\" style=\"position:absolute;top:1px;left:' + menu.menuItemPadding + 'px;width:' + operaWidth + 'px;text-align:'" ); Append( crlf ); Append( "+ menu.menuItemHAlign + ';visibility:visible;\">' + item + '</div>';" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "hitem = '<div id=\"menuItemHilite' + countItems + 'Shim\" style=\"position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:'" ); Append( crlf ); Append( "+ menu.menuItemHAlign + ';visibility:visible;\">' + item + '</div>';" ); Append( crlf ); Append( "item = '<div id=\"menuItemText' + countItems + 'Shim\" style=\"position:absolute;top:1px;left:1px;right:-' + (left+menu.menuWidth-3*menu.menuItemPadding) + 'px;text-align:'" ); Append( crlf ); Append( "+ menu.menuItemHAlign + ';visibility:visible;\">' + item + '</div>';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else hitem = null;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if(document.all && !window.mmIsOpera) item = '<div id=\"menuItemShim' + countItems + '\" style=\"position:absolute;left:0px;top:0px;\">' + item + '</div>';" ); Append( crlf ); Append( "var dText= '<div id=\"menuItemText'+ countItems +'\" style=\"' + textProps + 'color:'+ menu.fontColor +';\">'+ item +' </div>\\n'" ); Append( crlf ); Append( "+ '<div id=\"menuItemHilite'+ countItems +'\" style=\"' + textProps + 'color:'+ menu.fontColorHilite +';visibility:hidden;\">'" ); Append( crlf ); Append( "+ (hitem||item) +' </div>';" ); Append( crlf ); Append( "if (childMenu) content += ( dTag + dText + '<div id=\"childMenu'+ countItems +'\" style=\"position:absolute;left:0px;top:3px;\"><img src=\"'+ menu.childMenuIcon +'\"></div>\\n' + dClose);" ); Append( crlf ); Append( "else content += ( dTag + dText + dClose);" ); Append( crlf ); Append( "if (lrs) {" ); Append( crlf ); Append( "l.document.open(\"text/html\");" ); Append( crlf ); Append( "l.document.writeln(content);" ); Append( crlf ); Append( "l.document.close();" ); Append( crlf ); Append( "content = '';" ); Append( crlf ); Append( "theStat += \"-\";" ); Append( crlf ); Append( "tsc++;" ); Append( crlf ); Append( "if (tsc > 50) {" ); Append( crlf ); Append( "tsc = 0;" ); Append( crlf ); Append( "theStat = \"\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "status = theStat;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "countItems++; " ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (lrs) {" ); Append( crlf ); Append( "var focusItem = new Layer(100, body);" ); Append( crlf ); Append( "focusItem.visiblity=\"hidden\";" ); Append( crlf ); Append( "focusItem.document.open(\"text/html\");" ); Append( crlf ); Append( "focusItem.document.writeln(\" \");" ); Append( crlf ); Append( "focusItem.document.close();" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( " content += ' <div id=\"focusItem'+ countMenus +'\" style=\"position:absolute;left:0px;top:0px;visibility:hide;\" onclick=\"onMenuItemAction(null,this);\"> </div>\\n';" ); Append( crlf ); Append( " content += ' </div>\\n </div>\\n</div>\\n';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "i=x;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (document.layers) {" ); Append( crlf ); Append( "container.clip.width = window.innerWidth;" ); Append( crlf ); Append( "container.clip.height = window.innerHeight;" ); Append( crlf ); Append( "container.onmouseout = mouseoutMenu;" ); Append( crlf ); Append( "container.menuContainerBgColor = this.menuContainerBgColor;" ); Append( crlf ); Append( "for (var i=0; i<container.document.layers.length; i++) {" ); Append( crlf ); Append( "proto = container.menus[i];" ); Append( crlf ); Append( "var menu = container.document.layers[i];" ); Append( crlf ); Append( "container.menus[i].menuLayer = menu;" ); Append( crlf ); Append( "container.menus[i].menuLayer.Menu = container.menus[i];" ); Append( crlf ); Append( "container.menus[i].menuLayer.Menu.container = container;" ); Append( crlf ); Append( "var body = menu.document.layers[0].document.layers[0];" ); Append( crlf ); Append( "body.clip.width = proto.menuWidth || body.clip.width;" ); Append( crlf ); Append( "body.clip.height = proto.menuHeight || body.clip.height;" ); Append( crlf ); Append( "for (var n=0; n<body.document.layers.length-1; n++) {" ); Append( crlf ); Append( "var l = body.document.layers[n];" ); Append( crlf ); Append( "l.Menu = container.menus[i];" ); Append( crlf ); Append( "l.menuHiliteBgColor = proto.menuHiliteBgColor;" ); Append( crlf ); Append( "l.document.bgColor = proto.menuItemBgColor;" ); Append( crlf ); Append( "l.saveColor = proto.menuItemBgColor;" ); Append( crlf ); Append( "l.onmouseover = proto.onMenuItemOver;" ); Append( crlf ); Append( "l.onclick = proto.onMenuItemAction;" ); Append( crlf ); Append( "l.mmaction = container.menus[i].actions[n];" ); Append( crlf ); Append( "l.focusItem = body.document.layers[body.document.layers.length-1];" ); Append( crlf ); Append( "l.clip.width = proto.menuWidth || body.clip.width;" ); Append( crlf ); Append( "l.clip.height = proto.menuItemHeight || l.clip.height;" ); Append( crlf ); Append( "if (n>0) {" ); Append( crlf ); Append( "if( l.Menu.vertical ) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder + proto.menuItemSpacing;" ); Append( crlf ); Append( "else l.left = body.document.layers[n-1].left + body.document.layers[n-1].clip.width + proto.menuItemBorder + proto.menuItemSpacing;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.hilite = l.document.layers[1];" ); Append( crlf ); Append( "if (proto.bgImageUp) l.background.src = proto.bgImageUp;" ); Append( crlf ); Append( "l.document.layers[1].isHilite = true;" ); Append( crlf ); Append( "if (l.document.layers.length > 2) {" ); Append( crlf ); Append( "l.childMenu = container.menus[i].items[n].menuLayer;" ); Append( crlf ); Append( "l.document.layers[2].left = l.clip.width -13;" ); Append( crlf ); Append( "l.document.layers[2].top = (l.clip.height / 2) -4;" ); Append( crlf ); Append( "l.document.layers[2].clip.left += 3;" ); Append( crlf ); Append( "l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if( proto.menuBgOpaque ) body.document.bgColor = proto.bgColor;" ); Append( crlf ); Append( "if( proto.vertical ) {" ); Append( crlf ); Append( "body.clip.width = l.clip.width +proto.menuBorder;" ); Append( crlf ); Append( "body.clip.height = l.top + l.clip.height +proto.menuBorder;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "body.clip.height = l.clip.height +proto.menuBorder;" ); Append( crlf ); Append( "body.clip.width = l.left + l.clip.width +proto.menuBorder;" ); Append( crlf ); Append( "if( body.clip.width > window.innerWidth ) body.clip.width = window.innerWidth;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "var focusItem = body.document.layers[n];" ); Append( crlf ); Append( "focusItem.clip.width = body.clip.width;" ); Append( crlf ); Append( "focusItem.Menu = l.Menu;" ); Append( crlf ); Append( "focusItem.top = -30;" ); Append( crlf ); Append( " focusItem.captureEvents(Event.MOUSEDOWN);" ); Append( crlf ); Append( " focusItem.onmousedown = onMenuItemDown;" ); Append( crlf ); Append( "if( proto.menuBgOpaque ) menu.document.bgColor = proto.menuBorderBgColor;" ); Append( crlf ); Append( "var lite = menu.document.layers[0];" ); Append( crlf ); Append( "if( proto.menuBgOpaque ) lite.document.bgColor = proto.menuLiteBgColor;" ); Append( crlf ); Append( "lite.clip.width = body.clip.width +1;" ); Append( crlf ); Append( "lite.clip.height = body.clip.height +1;" ); Append( crlf ); Append( "menu.clip.width = body.clip.width + (proto.menuBorder * 3) ;" ); Append( crlf ); Append( "menu.clip.height = body.clip.height + (proto.menuBorder * 3);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "if ((!document.all) && (container.hasChildNodes) && !window.mmIsOpera) {" ); Append( crlf ); Append( "container.innerHTML=content;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "container.document.open(\"text/html\");" ); Append( crlf ); Append( "container.document.writeln(content);" ); Append( crlf ); Append( "container.document.close();" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (!FIND(\"menuLayer0\")) return;" ); Append( crlf ); Append( "var menuCount = 0;" ); Append( crlf ); Append( "for (var x=0; x<container.menus.length; x++) {" ); Append( crlf ); Append( "var menuLayer = FIND(\"menuLayer\" + x);" ); Append( crlf ); Append( "container.menus[x].menuLayer = \"menuLayer\" + x;" ); Append( crlf ); Append( "menuLayer.Menu = container.menus[x];" ); Append( crlf ); Append( "menuLayer.Menu.container = \"menuLayer\" + x;" ); Append( crlf ); Append( "menuLayer.style.zindex = 1;" ); Append( crlf ); Append( " var s = menuLayer.style;" ); Append( crlf ); Append( "s.pixeltop = -300;" ); Append( crlf ); Append( "s.pixelleft = -300;" ); Append( crlf ); Append( "s.top = '-300px';" ); Append( crlf ); Append( "s.left = '-300px';" ); Append( crlf ); Append( crlf ); Append( "var menu = container.menus[x];" ); Append( crlf ); Append( "menu.menuItemWidth = menu.menuWidth || menu.menuIEWidth || 140;" ); Append( crlf ); Append( "if( menu.menuBgOpaque ) menuLayer.style.backgroundColor = menu.menuBorderBgColor;" ); Append( crlf ); Append( "var top = 0;" ); Append( crlf ); Append( "var left = 0;" ); Append( crlf ); Append( "menu.menuItemLayers = new Array();" ); Append( crlf ); Append( "for (var i=0; i<container.menus[x].items.length; i++) {" ); Append( crlf ); Append( "var l = FIND(\"menuItem\" + menuCount);" ); Append( crlf ); Append( "l.Menu = container.menus[x];" ); Append( crlf ); Append( "l.Menu.menuItemLayers[l.Menu.menuItemLayers.length] = l;" ); Append( crlf ); Append( "if (l.addEventListener || window.mmIsOpera) {" ); Append( crlf ); Append( "l.style.width = menu.menuItemWidth + 'px';" ); Append( crlf ); Append( "l.style.height = menu.menuItemHeight + 'px';" ); Append( crlf ); Append( "l.style.pixelWidth = menu.menuItemWidth;" ); Append( crlf ); Append( "l.style.pixelHeight = menu.menuItemHeight;" ); Append( crlf ); Append( "l.style.top = top + 'px';" ); Append( crlf ); Append( "l.style.left = left + 'px';" ); Append( crlf ); Append( "if(l.addEventListener) {" ); Append( crlf ); Append( "l.addEventListener(\"mouseover\", onMenuItemOver, false);" ); Append( crlf ); Append( "l.addEventListener(\"click\", onMenuItemAction, false);" ); Append( crlf ); Append( "l.addEventListener(\"mouseout\", mouseoutMenu, false);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if( menu.menuItemHAlign != 'left' ) {" ); Append( crlf ); Append( "l.hiliteShim = FIND(\"menuItemHilite\" + menuCount + \"Shim\");" ); Append( crlf ); Append( "l.hiliteShim.style.visibility = \"inherit\";" ); Append( crlf ); Append( "l.textShim = FIND(\"menuItemText\" + menuCount + \"Shim\");" ); Append( crlf ); Append( "l.hiliteShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;" ); Append( crlf ); Append( "l.hiliteShim.style.width = l.hiliteShim.style.pixelWidth;" ); Append( crlf ); Append( "l.textShim.style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;" ); Append( crlf ); Append( "l.textShim.style.width = l.textShim.style.pixelWidth;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "l.style.pixelWidth = menu.menuItemWidth;" ); Append( crlf ); Append( "l.style.pixelHeight = menu.menuItemHeight;" ); Append( crlf ); Append( "l.style.pixelTop = top;" ); Append( crlf ); Append( "l.style.pixelLeft = left;" ); Append( crlf ); Append( "if( menu.menuItemHAlign != 'left' ) {" ); Append( crlf ); Append( "var shim = FIND(\"menuItemShim\" + menuCount);" ); Append( crlf ); Append( "shim[0].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;" ); Append( crlf ); Append( "shim[1].style.pixelWidth = menu.menuItemWidth - 2*menu.menuItemPadding - menu.menuItemIndent;" ); Append( crlf ); Append( "shim[0].style.width = shim[0].style.pixelWidth + 'px';" ); Append( crlf ); Append( "shim[1].style.width = shim[1].style.pixelWidth + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if( menu.vertical ) top = top + menu.menuItemHeight+menu.menuItemBorder+menu.menuItemSpacing;" ); Append( crlf ); Append( "else left = left + menu.menuItemWidth+menu.menuItemBorder+menu.menuItemSpacing;" ); Append( crlf ); Append( "l.style.fontSize = menu.fontSize + 'px';" ); Append( crlf ); Append( "l.style.backgroundColor = menu.menuItemBgColor;" ); Append( crlf ); Append( "l.style.visibility = \"inherit\";" ); Append( crlf ); Append( "l.saveColor = menu.menuItemBgColor;" ); Append( crlf ); Append( "l.menuHiliteBgColor = menu.menuHiliteBgColor;" ); Append( crlf ); Append( "l.mmaction = container.menus[x].actions[i];" ); Append( crlf ); Append( "l.hilite = FIND(\"menuItemHilite\" + menuCount);" ); Append( crlf ); Append( "l.focusItem = FIND(\"focusItem\" + x);" ); Append( crlf ); Append( "l.focusItem.style.pixelTop = -30;" ); Append( crlf ); Append( "l.focusItem.style.top = '-30px';" ); Append( crlf ); Append( "var childItem = FIND(\"childMenu\" + menuCount);" ); Append( crlf ); Append( "if (childItem) {" ); Append( crlf ); Append( "l.childMenu = container.menus[x].items[i].menuLayer;" ); Append( crlf ); Append( "childItem.style.pixelLeft = menu.menuItemWidth -11;" ); Append( crlf ); Append( "childItem.style.left = childItem.style.pixelLeft + 'px';" ); Append( crlf ); Append( "childItem.style.pixelTop = (menu.menuItemHeight /2) -4;" ); Append( crlf ); Append( "childItem.style.top = childItem.style.pixelTop + 'px';" ); Append( crlf ); Append( "l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.style.cursor = \"hand\";" ); Append( crlf ); Append( "menuCount++;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if( menu.vertical ) {" ); Append( crlf ); Append( "menu.menuHeight = top-1-menu.menuItemSpacing;" ); Append( crlf ); Append( "menu.menuWidth = menu.menuItemWidth;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "menu.menuHeight = menu.menuItemHeight;" ); Append( crlf ); Append( "menu.menuWidth = left-1-menu.menuItemSpacing;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "var lite = FIND(\"menuLite\" + x);" ); Append( crlf ); Append( "var s = lite.style;" ); Append( crlf ); Append( "s.pixelHeight = menu.menuHeight +(menu.menuBorder * 2);" ); Append( crlf ); Append( "s.height = s.pixelHeight + 'px';" ); Append( crlf ); Append( "s.pixelWidth = menu.menuWidth + (menu.menuBorder * 2);" ); Append( crlf ); Append( "s.width = s.pixelWidth + 'px';" ); Append( crlf ); Append( "if( menu.menuBgOpaque ) s.backgroundColor = menu.menuLiteBgColor;" ); Append( crlf ); Append( crlf ); Append( "var body = FIND(\"menuFg\" + x);" ); Append( crlf ); Append( "s = body.style;" ); Append( crlf ); Append( "s.pixelHeight = menu.menuHeight + menu.menuBorder;" ); Append( crlf ); Append( "s.height = s.pixelHeight + 'px';" ); Append( crlf ); Append( "s.pixelWidth = menu.menuWidth + menu.menuBorder;" ); Append( crlf ); Append( "s.width = s.pixelWidth + 'px';" ); Append( crlf ); Append( "if( menu.menuBgOpaque ) s.backgroundColor = menu.bgColor;" ); Append( crlf ); Append( crlf ); Append( "s = menuLayer.style;" ); Append( crlf ); Append( "s.pixelWidth = menu.menuWidth + (menu.menuBorder * 4);" ); Append( crlf ); Append( "s.width = s.pixelWidth + 'px';" ); Append( crlf ); Append( "s.pixelHeight = menu.menuHeight+(menu.menuBorder*4);" ); Append( crlf ); Append( "s.height = s.pixelHeight + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (document.captureEvents) document.captureEvents(Event.MOUSEUP);" ); Append( crlf ); Append( "if (document.addEventListener) document.addEventListener(\"mouseup\", onMenuItemOver, false);" ); Append( crlf ); Append( "if (document.layers && window.innerWidth) {" ); Append( crlf ); Append( "window.onresize = NS4resize;" ); Append( crlf ); Append( "window.NS4sIW = window.innerWidth;" ); Append( crlf ); Append( "window.NS4sIH = window.innerHeight;" ); Append( crlf ); Append( "setTimeout(\"NS4resize()\",500);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "document.onmouseup = mouseupMenu;" ); Append( crlf ); Append( "window.mmWroteMenu = true;" ); Append( crlf ); Append( "status = \"\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); } void p4wJsHier::menuAPI3() { // Methods from the menuApi used for generating hierarchical // dropdown menus Append( "function NS4resize() {" ); Append( crlf ); Append( "if (NS4sIW != window.innerWidth || NS4sIH != window.innerHeight) window.location.reload();" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function onMenuItemOver(e, l) {" ); Append( crlf ); Append( "MM_clearTimeout();" ); Append( crlf ); Append( "l = l || this;" ); Append( crlf ); Append( "a = window.ActiveMenuItem;" ); Append( crlf ); Append( "if (document.layers) {" ); Append( crlf ); Append( "if (a) {" ); Append( crlf ); Append( "a.document.bgColor = a.saveColor;" ); Append( crlf ); Append( "if (a.hilite) a.hilite.visibility = \"hidden\";" ); Append( crlf ); Append( "if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp;" ); Append( crlf ); Append( "a.focusItem.top = -100;" ); Append( crlf ); Append( "a.clicked = false;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (l.hilite) {" ); Append( crlf ); Append( "l.document.bgColor = l.menuHiliteBgColor;" ); Append( crlf ); Append( "l.zIndex = 1;" ); Append( crlf ); Append( "l.hilite.visibility = \"inherit\";" ); Append( crlf ); Append( "l.hilite.zIndex = 2;" ); Append( crlf ); Append( "l.document.layers[1].zIndex = 1;" ); Append( crlf ); Append( "l.focusItem.zIndex = this.zIndex +2;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (l.Menu.bgImageOver) l.background.src = l.Menu.bgImageOver;" ); Append( crlf ); Append( "l.focusItem.top = this.top;" ); Append( crlf ); Append( "l.focusItem.left = this.left;" ); Append( crlf ); Append( "l.focusItem.clip.width = l.clip.width;" ); Append( crlf ); Append( "l.focusItem.clip.height = l.clip.height;" ); Append( crlf ); Append( "l.Menu.hideChildMenu(l);" ); Append( crlf ); Append( "} else if (l.style && l.Menu) {" ); Append( crlf ); Append( "if (a) {" ); Append( crlf ); Append( "a.style.backgroundColor = a.saveColor;" ); Append( crlf ); Append( "if (a.hilite) a.hilite.style.visibility = \"hidden\";" ); Append( crlf ); Append( "if (a.hiliteShim) a.hiliteShim.style.visibility = \"inherit\";" ); Append( crlf ); Append( "if (a.Menu.bgImageUp) a.style.background = \"url(\" + a.Menu.bgImageUp +\")\";;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.style.backgroundColor = l.menuHiliteBgColor;" ); Append( crlf ); Append( "l.zIndex = 1;" ); Append( crlf ); Append( "if (l.Menu.bgImageOver) l.style.background = \"url(\" + l.Menu.bgImageOver +\")\";" ); Append( crlf ); Append( "if (l.hilite) {" ); Append( crlf ); Append( "l.hilite.style.visibility = \"inherit\";" ); Append( crlf ); Append( "if( l.hiliteShim ) l.hiliteShim.style.visibility = \"visible\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.focusItem.style.pixelTop = l.style.pixelTop;" ); Append( crlf ); Append( "l.focusItem.style.top = l.focusItem.style.pixelTop + 'px';" ); Append( crlf ); Append( "l.focusItem.style.pixelLeft = l.style.pixelLeft;" ); Append( crlf ); Append( "l.focusItem.style.left = l.focusItem.style.pixelLeft + 'px';" ); Append( crlf ); Append( "l.focusItem.style.zIndex = l.zIndex +1;" ); Append( crlf ); Append( "l.Menu.hideChildMenu(l);" ); Append( crlf ); Append( "} else return;" ); Append( crlf ); Append( "window.ActiveMenuItem = l;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function onMenuItemAction(e, l) {" ); Append( crlf ); Append( "l = window.ActiveMenuItem;" ); Append( crlf ); Append( "if (!l) return;" ); Append( crlf ); Append( "hideActiveMenus();" ); Append( crlf ); Append( "if (l.mmaction) eval(\"\" + l.mmaction);" ); Append( crlf ); Append( "window.ActiveMenuItem = 0;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function MM_clearTimeout() {" ); Append( crlf ); Append( "if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);" ); Append( crlf ); Append( "mmHideMenuTimer = null;" ); Append( crlf ); Append( "mmDHFlag = false;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function MM_startTimeout() {" ); Append( crlf ); Append( "if( window.ActiveMenu ) {" ); Append( crlf ); Append( "mmStart = new Date();" ); Append( crlf ); Append( "mmDHFlag = true;" ); Append( crlf ); Append( "mmHideMenuTimer = setTimeout(\"mmDoHide()\", window.ActiveMenu.Menu.hideTimeout);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function mmDoHide() {" ); Append( crlf ); Append( "if (!mmDHFlag || !window.ActiveMenu) return;" ); Append( crlf ); Append( "var elapsed = new Date() - mmStart;" ); Append( crlf ); Append( "var timeout = window.ActiveMenu.Menu.hideTimeout;" ); Append( crlf ); Append( "if (elapsed < timeout) {" ); Append( crlf ); Append( "mmHideMenuTimer = setTimeout(\"mmDoHide()\", timeout+100-elapsed);" ); Append( crlf ); Append( "return;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "mmDHFlag = false;" ); Append( crlf ); Append( "hideActiveMenus();" ); Append( crlf ); Append( "window.ActiveMenuItem = 0;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); } void p4wJsHier::menuAPI4() { // Methods from the menuApi used for generating hierarchical // dropdown menus Append( "function MM_showMenu(menu, x, y, child, imgname) {" ); Append( crlf ); Append( "if (!window.mmWroteMenu) return;" ); Append( crlf ); Append( "MM_clearTimeout();" ); Append( crlf ); Append( "if (menu) {" ); Append( crlf ); Append( "var obj = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];" ); Append( crlf ); Append( "x = moveXbySlicePos (x, obj);" ); Append( crlf ); Append( "y = moveYbySlicePos (y, obj);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (document.layers) {" ); Append( crlf ); Append( "if (menu) {" ); Append( crlf ); Append( "var l = menu.menuLayer || menu;" ); Append( crlf ); Append( "l.top = l.left = 1;" ); Append( crlf ); Append( "hideActiveMenus();" ); Append( crlf ); Append( "if (this.visibility) l = this;" ); Append( crlf ); Append( "window.ActiveMenu = l;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "var l = child;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (!l) return;" ); Append( crlf ); Append( "for (var i=0; i<l.layers.length; i++) { " ); Append( crlf ); Append( "if (!l.layers[i].isHilite) l.layers[i].visibility = \"inherit\";" ); Append( crlf ); Append( "if (l.layers[i].document.layers.length > 0) MM_showMenu(null, \"relative\", \"relative\", l.layers[i]);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (l.parentLayer) {" ); Append( crlf ); Append( "if (x != \"relative\") l.parentLayer.left = x || window.pageX || 0;" ); Append( crlf ); Append( "if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);" ); Append( crlf ); Append( "if (y != \"relative\") l.parentLayer.top = y || window.pageY || 0;" ); Append( crlf ); Append( "if (l.parentLayer.isContainer) {" ); Append( crlf ); Append( "l.Menu.xOffset = window.pageXOffset;" ); Append( crlf ); Append( "l.Menu.yOffset = window.pageYOffset;" ); Append( crlf ); Append( "l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;" ); Append( crlf ); Append( "l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;" ); Append( crlf ); Append( "if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.visibility = \"inherit\";" ); Append( crlf ); Append( "if (l.Menu) l.Menu.container.visibility = \"inherit\";" ); Append( crlf ); Append( "} else if (FIND(\"menuItem0\")) {" ); Append( crlf ); Append( "var l = menu.menuLayer || menu;" ); Append( crlf ); Append( "hideActiveMenus();" ); Append( crlf ); Append( "if (typeof(l) == \"string\") l = FIND(l);" ); Append( crlf ); Append( "window.ActiveMenu = l;" ); Append( crlf ); Append( "var s = l.style;" ); Append( crlf ); Append( "s.visibility = \"inherit\";" ); Append( crlf ); Append( "if (x != \"relative\") {" ); Append( crlf ); Append( "s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;" ); Append( crlf ); Append( "s.left = s.pixelLeft + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (y != \"relative\") {" ); Append( crlf ); Append( "s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;" ); Append( crlf ); Append( "s.top = s.pixelTop + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "l.Menu.xOffset = document.body.scrollLeft;" ); Append( crlf ); Append( "l.Menu.yOffset = document.body.scrollTop;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (menu) window.activeMenus[window.activeMenus.length] = l;" ); Append( crlf ); Append( "MM_clearTimeout();" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function onMenuItemDown(e, l) {" ); Append( crlf ); Append( "var a = window.ActiveMenuItem;" ); Append( crlf ); Append( "if (document.layers && a) {" ); Append( crlf ); Append( "a.eX = e.pageX;" ); Append( crlf ); Append( "a.eY = e.pageY;" ); Append( crlf ); Append( "a.clicked = true;" ); Append( crlf ); Append( " }" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function mouseupMenu(e) {" ); Append( crlf ); Append( "hideMenu(true, e);" ); Append( crlf ); Append( "hideActiveMenus();" ); Append( crlf ); Append( "return true;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function getExplorerVersion() {" ); Append( crlf ); Append( "var ieVers = parseFloat(navigator.appVersion);" ); Append( crlf ); Append( "if( navigator.appName != 'Microsoft Internet Explorer' ) return ieVers;" ); Append( crlf ); Append( "var tempVers = navigator.appVersion;" ); Append( crlf ); Append( "var i = tempVers.indexOf( 'MSIE ' );" ); Append( crlf ); Append( "if( i >= 0 ) {" ); Append( crlf ); Append( "tempVers = tempVers.substring( i+5 );" ); Append( crlf ); Append( "ieVers = parseFloat( tempVers );" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "return ieVers;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function mouseoutMenu() {" ); Append( crlf ); Append( "if ((navigator.appName == \"Microsoft Internet Explorer\") && (getExplorerVersion() < 4.5))" ); Append( crlf ); Append( "return true;" ); Append( crlf ); Append( "hideMenu(false, false);" ); Append( crlf ); Append( "return true;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); } void p4wJsHier::menuAPI5() { // Methods from the menuApi used for generating hierarchical // dropdown menus Append( "function hideMenu(mouseup, e) {" ); Append( crlf ); Append( "var a = window.ActiveMenuItem;" ); Append( crlf ); Append( "if (a && document.layers) {" ); Append( crlf ); Append( "a.document.bgColor = a.saveColor;" ); Append( crlf ); Append( "a.focusItem.top = -30;" ); Append( crlf ); Append( "if (a.hilite) a.hilite.visibility = \"hidden\";" ); Append( crlf ); Append( "if (mouseup && a.mmaction && a.clicked && window.ActiveMenu) {" ); Append( crlf ); Append( " if (a.eX <= e.pageX+15 && a.eX >= e.pageX-15 && a.eY <= e.pageY+10 && a.eY >= e.pageY-10) {" ); Append( crlf ); Append( "setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 500);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "a.clicked = false;" ); Append( crlf ); Append( "if (a.Menu.bgImageOver) a.background.src = a.Menu.bgImageUp;" ); Append( crlf ); Append( "} else if (window.ActiveMenu && FIND(\"menuItem0\")) {" ); Append( crlf ); Append( "if (a) {" ); Append( crlf ); Append( "a.style.backgroundColor = a.saveColor;" ); Append( crlf ); Append( "if (a.hilite) a.hilite.style.visibility = \"hidden\";" ); Append( crlf ); Append( "if (a.hiliteShim) a.hiliteShim.style.visibility = \"inherit\";" ); Append( crlf ); Append( "if (a.Menu.bgImageUp) a.style.background = \"url(\" + a.Menu.bgImageUp +\")\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (!mouseup && window.ActiveMenu) {" ); Append( crlf ); Append( "if (window.ActiveMenu.Menu) {" ); Append( crlf ); Append( "if (window.ActiveMenu.Menu.hideOnMouseOut) MM_startTimeout();" ); Append( crlf ); Append( "return(true);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "return(true);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function hideChildMenu(hcmLayer) {" ); Append( crlf ); Append( "MM_clearTimeout();" ); Append( crlf ); Append( "var l = hcmLayer;" ); Append( crlf ); Append( "for (var i=0; i < l.Menu.childMenus.length; i++) {" ); Append( crlf ); Append( "var theLayer = l.Menu.childMenus[i];" ); Append( crlf ); Append( "if (document.layers) theLayer.visibility = \"hidden\";" ); Append( crlf ); Append( "else {" ); Append( crlf ); Append( "theLayer = FIND(theLayer);" ); Append( crlf ); Append( "theLayer.style.visibility = \"hidden\";" ); Append( crlf ); Append( "if( theLayer.Menu.menuItemHAlign != 'left' ) {" ); Append( crlf ); Append( "for(var j = 0; j < theLayer.Menu.menuItemLayers.length; j++) {" ); Append( crlf ); Append( "var itemLayer = theLayer.Menu.menuItemLayers[j];" ); Append( crlf ); Append( "if(itemLayer.textShim) itemLayer.textShim.style.visibility = \"inherit\";" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "theLayer.Menu.hideChildMenu(theLayer);" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (l.childMenu) {" ); Append( crlf ); Append( "var childMenu = l.childMenu;" ); Append( crlf ); Append( "if (document.layers) {" ); Append( crlf ); Append( "l.Menu.MM_showMenu(null,null,null,childMenu.layers[0]);" ); Append( crlf ); Append( "childMenu.zIndex = l.parentLayer.zIndex +1;" ); Append( crlf ); Append( "childMenu.top = l.Menu.menuLayer.top + l.Menu.submenuYOffset;" ); Append( crlf ); Append( "if( l.Menu.vertical ) {" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) childMenu.top += l.top + l.parentLayer.top;" ); Append( crlf ); Append( "childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "childMenu.top += l.top + l.parentLayer.top;" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) childMenu.left = l.Menu.menuLayer.left + l.left + l.clip.width + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "else childMenu.left = l.parentLayer.left + l.parentLayer.clip.width - (2*l.Menu.menuBorder) + l.Menu.menuLayer.left + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if( childMenu.left < l.Menu.container.clip.left ) l.Menu.container.clip.left = childMenu.left;" ); Append( crlf ); Append( "var w = childMenu.clip.width+childMenu.left-l.Menu.container.clip.left;" ); Append( crlf ); Append( "if (w > l.Menu.container.clip.width) l.Menu.container.clip.width = w;" ); Append( crlf ); Append( "var h = childMenu.clip.height+childMenu.top-l.Menu.container.clip.top;" ); Append( crlf ); Append( "if (h > l.Menu.container.clip.height) l.Menu.container.clip.height = h;" ); Append( crlf ); Append( "l.document.layers[1].zIndex = 0;" ); Append( crlf ); Append( "childMenu.visibility = \"inherit\";" ); Append( crlf ); Append( "} else if (FIND(\"menuItem0\")) {" ); Append( crlf ); Append( "childMenu = FIND(l.childMenu);" ); Append( crlf ); Append( "var menuLayer = FIND(l.Menu.menuLayer);" ); Append( crlf ); Append( "var s = childMenu.style;" ); Append( crlf ); Append( "s.zIndex = menuLayer.style.zIndex+1;" ); Append( crlf ); Append( "if (document.all || window.mmIsOpera) {" ); Append( crlf ); Append( "s.pixelTop = menuLayer.style.pixelTop + l.Menu.submenuYOffset;" ); Append( crlf ); Append( "if( l.Menu.vertical ) {" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) s.pixelTop += l.style.pixelTop;" ); Append( crlf ); Append( "s.pixelLeft = l.style.pixelWidth + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "s.left = s.pixelLeft + 'px';" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "s.pixelTop += l.style.pixelTop;" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) s.pixelLeft = menuLayer.style.pixelLeft + l.style.pixelLeft + l.style.pixelWidth + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "else s.pixelLeft = (menuLayer.style.pixelWidth-4*l.Menu.menuBorder) + menuLayer.style.pixelLeft + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "s.left = s.pixelLeft + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "var top = parseInt(menuLayer.style.top) + l.Menu.submenuYOffset;" ); Append( crlf ); Append( "var left = 0;" ); Append( crlf ); Append( "if( l.Menu.vertical ) {" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) top += parseInt(l.style.top);" ); Append( crlf ); Append( "left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "} else {" ); Append( crlf ); Append( "top += parseInt(l.style.top);" ); Append( crlf ); Append( "if( l.Menu.submenuRelativeToItem ) left = parseInt(menuLayer.style.left) + parseInt(l.style.left) + parseInt(l.style.width) + (2*l.Menu.menuBorder) + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "else left = (parseInt(menuLayer.style.width)-4*l.Menu.menuBorder) + parseInt(menuLayer.style.left) + l.Menu.submenuXOffset;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "s.top = top + 'px';" ); Append( crlf ); Append( "s.left = left + 'px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "childMenu.style.visibility = \"inherit\";" ); Append( crlf ); Append( "} else return;" ); Append( crlf ); Append( "window.activeMenus[window.activeMenus.length] = childMenu;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function hideActiveMenus() {" ); Append( crlf ); Append( "if (!window.activeMenus) return;" ); Append( crlf ); Append( "for (var i=0; i < window.activeMenus.length; i++) {" ); Append( crlf ); Append( "if (!activeMenus[i]) continue;" ); Append( crlf ); Append( "if (activeMenus[i].visibility && activeMenus[i].Menu && !window.mmIsOpera) {" ); Append( crlf ); Append( "activeMenus[i].visibility = \"hidden\";" ); Append( crlf ); Append( "activeMenus[i].Menu.container.visibility = \"hidden\";" ); Append( crlf ); Append( "activeMenus[i].Menu.container.clip.left = 0;" ); Append( crlf ); Append( "} else if (activeMenus[i].style) {" ); Append( crlf ); Append( "var s = activeMenus[i].style;" ); Append( crlf ); Append( "s.visibility = \"hidden\";" ); Append( crlf ); Append( "s.left = '-200px';" ); Append( crlf ); Append( "s.top = '-200px';" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "if (window.ActiveMenuItem) hideMenu(false, false);" ); Append( crlf ); Append( "window.activeMenus.length = 0;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function moveXbySlicePos (x, img) {" ); Append( crlf ); Append( "if (!document.layers) {" ); Append( crlf ); Append( "var onWindows = navigator.platform ? navigator.platform == \"Win32\" : false;" ); Append( crlf ); Append( "var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;" ); Append( crlf ); Append( "var par = img;" ); Append( crlf ); Append( "var lastOffset = 0;" ); Append( crlf ); Append( "while(par){" ); Append( crlf ); Append( "if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);" ); Append( crlf ); Append( "if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);" ); Append( crlf ); Append( "if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;" ); Append( crlf ); Append( "par = macIE45 ? par.parentElement : par.offsetParent;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else if (img.x) x += img.x;" ); Append( crlf ); Append( "return x;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( crlf ); Append( "function moveYbySlicePos (y, img) {" ); Append( crlf ); Append( "if(!document.layers) {" ); Append( crlf ); Append( "var onWindows = navigator.platform ? navigator.platform == \"Win32\" : false;" ); Append( crlf ); Append( "var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;" ); Append( crlf ); Append( "var par = img;" ); Append( crlf ); Append( "var lastOffset = 0;" ); Append( crlf ); Append( "while(par){" ); Append( crlf ); Append( "if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);" ); Append( crlf ); Append( "if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);" ); Append( crlf ); Append( "if( par.offsetTop != 0 ) lastOffset = par.offsetTop;" ); Append( crlf ); Append( "par = macIE45 ? par.parentElement : par.offsetParent;" ); Append( crlf ); Append( "}" ); Append( crlf ); Append( "} else if (img.y >= 0) y += img.y;" ); Append( crlf ); Append( "return y;" ); Append( crlf ); Append( "}" ); Append( crlf ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12234 | Matt Attaway |
Rejigger P4Web project in preparation for official sunsetting The bin directory contains the last official builds of P4Web from the Perforce download site. P4Web is soon to be completely sunsetted; these builds are here for folks who don't want to build their own. To better handle the archived builds the source code has been moved into a separate src directory. |
||
//guest/perforce_software/p4web/util/p4wJsHier.cpp | |||||
#1 | 8914 | Matt Attaway | Initial add of the P4Web source code |