// Path of the Master database: var DBNameHTML = "/clients/luanda-jinja/cms.nsf"; // Path of the current database: var DBNameHTML_C = ""; var sPathName = document.location.pathname; var iNSFPos = sPathName.toUpperCase().indexOf( ".NSF" ); if( iNSFPos == -1 ){ var iSlashPos = sPathName.indexOf( "/", 1 ); DBNameHTML_C = sPathName.substring( 0, iSlashPos ); } else { DBNameHTML_C = sPathName.substring( 0, iNSFPos + 4 ); } // Menu Entries Array, filled by calling mE( .... ) var aME = new Array(); // Parameters: Concept, Title, Parent, Button_URL_1, Button_Target_1, Button_URL_2, Button_Target_2, Button_URL_3, Button_Target_3, Button_URL_4, Button_Target_4, ImageStoreDoc, ImageName, FontFace function menuEntry( sConcept, sBTitle, sParent, sBURL1, sBTarget1, sBURL2, sBTarget2, sBURL3, sBTarget3, sBURL4, sBTarget4, sImageStoreDoc, sImageName, sFontFace ) { // Object constructor this.sConcept = sConcept; this.sBTitle = sBTitle; this.sParent = sParent; this.sBURL1 = sBURL1; this.sBTarget1 = sBTarget1; this.sBURL2 = sBURL2; this.sBTarget2 = getTargetName( sBTarget2 ); this.sBURL3 = sBURL3; this.sBTarget3 = getTargetName( sBTarget3 ); this.sBURL4 = sBURL4; this.sBTarget4 = getTargetName( sBTarget4 ); this.sImageStoreDoc = sImageStoreDoc; this.sImageName = sImageName; this.sFontFace = sFontFace; // Private function function getTargetName( sTarget ) { // Map Button target names to Passage CMS frameset names var sReturnValue = sTarget; switch( sTarget ) { case "Content Page" : sReturnValue = "rechts"; break; case "Cluster Navigator" : sReturnValue = "links"; break; case "Top Navigator" : sReturnValue = "boven"; break; case "Extra Frame" : sReturnValue = "londer"; break; } return sReturnValue; } // end getTargetName( ) } // end menuEntry( ) function mE( sConcept, sBTitle, sParent, sBURL1, sBTarget1, sBURL2, sBTarget2, sBURL3, sBTarget3, sBURL4, sBTarget4, sImageStoreDoc, sImageName, sFontFace ) { // Menu Entry: create an object instance in the array oMenuEntry = new menuEntry( sConcept, sBTitle, sParent, sBURL1, sBTarget1, sBURL2, sBTarget2, sBURL3, sBTarget3, sBURL4, sBTarget4, sImageStoreDoc, sImageName, sFontFace ); if (aME.push ) { pushed = aME.push( oMenuEntry ); } else { aME = aME.concat(oMenuEntry ) } } // end mE( ) function getTigraMenuArray( sFilter ) { // Initialize the array with TigraMenu menu elements, filled by calling writeMenu( ) var TREE_ITEMS = new Array( 0 ); /** Loop the created array of Button items **/ var iCurrentLevel = 0; var iPreviousLevel = 0; var iHighestLevel = 0; var aLevelCounter = new Array( ); if( aME.length > 0 ) { for( var i=0; i < aME.length; i++ ) { // Add the current Button item to the menu, dependant on the filter if( sFilter == "" ) { // No Filter specified addDHTMLMenuItem( i ); } else { // Filter specified oCurrentButton = aME[i]; sFilterObjectName = sFilter.replace( / /gi, "_" ); // Include the topmost button (i.e. without parent) iDividerPos = oCurrentButton.sParent.indexOf( "¶" ); // alert( oCurrentButton.sParent.substring( 0, iDividerPos ) ); if ( ( oCurrentButton.sBTitle == sFilter && oCurrentButton.sParent == "" ) || ( oCurrentButton.sParent == sFilterObjectName ) || ( iDividerPos > -1 && oCurrentButton.sParent.substring( 0, iDividerPos ) == sFilterObjectName ) ) { addDHTMLMenuItem( i ); } } } // Initialisatie van het menu vindt plaats op de plek waar het menu getoond moet worden, in de Layout Definition } // Clear global variable aME for re-use // aME = null; // Return the created TREE_ITEMS TigraMenu array return TREE_ITEMS; // Private functions function getOnClickCode( sURL, sTarget ) { if( sURL == "#" ) return ""; // Create the code if( sURL.substr( 0, 10 ).toUpperCase( ) == "JAVASCRIPT" ) { // The URL is a JS function call, strip the word JAVASCRIPT: return sURL.substr( 11, sURL.length ) + ';'; } if( ( sURL.substr( 0, 1 ) == "/" ) || ( sURL.substr( 0, 3 ).toUpperCase( ) == "HTTP" ) || ( sURL.substr( 0, 2 ).toUpperCase( ) == "FTP" ) || ( sURL.substr( 0, 5 ).toUpperCase( ) == "MAILTO" ) ) { // The URL is a real link, create the link code // If no target is specified or the specified target frame doesn't exist, // the link is opened in the document itself. if ( sTarget == "" || ! parent.frames[ sTarget ] ) { return "document.location.href='" + sURL + "';"; } else { return "parent.frames['" + sTarget + "'].location.href='" + sURL + "';"; // return 'parent.frames["' + sTarget + '"].location.href="' + sURL + '";'; } } else { // For all other cases: return the plain URL (for example, direct JS function calls) return sURL; } } // end getOnClickCode( ) // Private function function addDHTMLMenuItem( i ) { /** This function is specific to the type of menu used: Tigra Tree Menu Pro **/ var aArrayIndex = new Array( ); // The button's actions will be executed as JavaScript in the onSelectItemHandler, // meaning that the A HREF link is not used var sAction1 = getOnClickCode( aME[i].sBURL1, aME[i].sBTarget1 ); var sAction2 = getOnClickCode( aME[i].sBURL2, aME[i].sBTarget2 ); var sAction3 = getOnClickCode( aME[i].sBURL3, aME[i].sBTarget3 ); var sAction4 = getOnClickCode( aME[i].sBURL4, aME[i].sBTarget4 ); sOnClickCode = "JavaScript:" + sAction1 + sAction2 + sAction3 + sAction4; // var item_link = '" onClick="' + sOnClickCode; // var item_link = '" onClick="JavaScript:alert( this )'; var item_link = sOnClickCode; // var item_link = "JavaScript:document.location.href='http://www.xs4all.nl'"; // Determine the current level // Each name in sParent stands for another level of submenu var sParent = aME[i].sParent; var iCurrentLevel = ( sParent == "" ) ? 0 : iCurrentLevel = sParent.split( '¶' ).length; // Remember the number of elements in the current level aLevelCounter[ iCurrentLevel ] = ( aLevelCounter[ iCurrentLevel ] == null ) ? aLevelCounter[ iCurrentLevel ] = 0 : aLevelCounter[ iCurrentLevel ] = aLevelCounter[ iCurrentLevel ] + 1; // Keep track of the highest menu level if( iHighestLevel < iCurrentLevel ) iHighestLevel = iCurrentLevel; // If the current level is less than the previous level, // the array that keeps track of the number of elements in // each level higher than the current must be reset to 0 if( iCurrentLevel < iPreviousLevel ) { for( var il = iCurrentLevel + 1; il <= iHighestLevel; il++ ) { aLevelCounter[ il ] = null; } } // Fill the array that defines the coordinates of the current Button item in the Menu array // The offset is needed because the child elements are the fourth parameter of the Menu array, // except if it's the first item in the menu for( var ilc = 0; ilc <= iCurrentLevel; ilc++ ) { iIndexOffset = ( ilc == 0 ) ? 0 : 3; aArrayIndex[ ilc ] = aLevelCounter[ ilc ] + iIndexOffset; } // The item_caption gets set in the ClassItemScope // var item_caption = aME[i].sBTitle; var item_scope = new ClassItemScope( i, iCurrentLevel, aArrayIndex ); // Fill the multi-dimensional Menu array with the new menu item using the // array that contains the coordinates - with a maximum of 5 sublevels switch( aArrayIndex.length ) { case 1 : TREE_ITEMS[ aArrayIndex[ 0 ] ] = [ item_caption, item_link, item_scope ]; break; case 2 : TREE_ITEMS [ aArrayIndex[ 0 ] ] [ aArrayIndex[ 1 ] ] = [ item_caption, item_link, item_scope ]; break; case 3 : TREE_ITEMS [ aArrayIndex[ 0 ] ] [ aArrayIndex[ 1 ] ] [ aArrayIndex[ 2 ] ] = [ item_caption, item_link, item_scope ]; break; case 4 : TREE_ITEMS [ aArrayIndex[ 0 ] ] [ aArrayIndex[ 1 ] ] [ aArrayIndex[ 2 ] ] [ aArrayIndex[ 3 ] ] = [ item_caption, item_link, item_scope ]; break; case 5 : TREE_ITEMS [ aArrayIndex[ 0 ] ] [ aArrayIndex[ 1 ] ] [ aArrayIndex[ 2 ] ] [ aArrayIndex[ 3 ] ] [ aArrayIndex[ 4 ] ] = [ item_caption, item_link, item_scope ]; break; default : } // Remember the last level iPreviousLevel = iCurrentLevel // Customizable private class of addDHTMLMenuItem function ClassItemScope( i, iCurrentLevel, aArrayIndex ) { // Define the item's individual properties. Most of the properties will be defined in the TigraMenuGold_Template JS this.sb = aME[i].sBTitle; // Default item_caption item_caption = aME[i].sBTitle; // Debug: // alert( "item_caption=" + item_caption + "\ni=" + i + "\niCurrentLevel=" + iCurrentLevel + "\naArrayIndex=" + aArrayIndex ); // Set level-specific properties switch( iCurrentLevel ) { case 0 : // item_caption = aME[i].sBTitle.toUpperCase( ); break; case 1 : // item_caption = aME[i].sBTitle; break; case 2 : // item_caption = "> " + aME[i].sBTitle; break; case 3 : // item_caption = "- " + aME[i].sBTitle; break; default: } } } // end ClassItemScope( ) } // end getTigraMenuArray( ) function loadTigraMenuGoldScripts( ) { // Loads the scripts necessary for Tigra Menu Gold; DO NOT CHANGE THE ORDER! // Main Tigra Menu Gold script (attached in the JS document) document.write( '' ); // Items, created from a lookup to the Buttons JS view, processed by function getTigraMenuArray() document.write( '' ); // The template defines what classes will be used and several other properties document.write( '' ); } function showTigraMenuGold( sMenu_Items, sMenu_Scope, bIsMasterFrameset ) { // Shows the Tigra Menu Gold at the position in the HTML where this function was called oMenu_Items = eval( sMenu_Items ); oMenu_Scope = eval( sMenu_Scope ); if( oMenu_Items && oMenu_Scope ) { if( bIsMasterFrameset ) { // Define the layout of the frameset, line-by-line, column-by-column var MENU_FRAMES0 = [ ['links', 'boven'], ['links', 'rechts'], ['links', 'londer'] ] var oMENU_FRAMES0 = new menu ( oMenu_Items, oMenu_Scope , { 'frames' : MENU_FRAMES0 }); } else { var oMENU_FRAMES0 = new menu ( oMenu_Items, oMenu_Scope ); } } else { alert( "The Tigra Menu could not be loaded" ); } // if( oMenu_Items && oMenu_Scope ) }