/* $Id: martview.js,v 1.35 2008-04-18 16:18:29 syed Exp $ =head1 MartView client side JavaScript functions The following functions are used on the client side of a MartView request. Most are called in response to user actions (form element event handlers), but a few are called on page load as well. =head1 AUTHOR - Arek Kasprzyk, Syed Haider, Richard Holland, Damian Smedley, Gudmundur Arni Thorisson =cut =head2 updateMenuPushactions() Main function for doing pushaction-updating of secondary menus when primary menu changes. All information is stored in the big hash-struct at the bottom of the filter panel. The function traverses the possibly recursive pushaction-config (flattened in the hash), updates the secondary menu and calls itself to also process downstream menus if needed. =cut */ function updateMenuPushactions(menu, pushActionsOfMenu, prevValueOfMenu) { // Get pushaction-info corresponding to the selected value of this menu, if any if(menu.selectedIndex < 0) { //alert("ATTN, no value selected for menu " + menu.name + ", selectedIndex = " + menu.selectedIndex + ", can't do pushaction-thing now"); return false; } var menu_value = menu.options[menu.selectedIndex].value; var pushActionInfo; //alert (menu.name + ' - '+menu_value); if(pushActionsOfMenu && pushActionsOfMenu[menu.name]) { // alert ('Its there'); pushActionInfo = pushActionsOfMenu[menu.name][menu_value]; } if(!pushActionInfo) { //alert('FASLE'); return false; // return w/o doing anything if there's no pa-info available for this menu } //alert("I'm here"); // Find all secondary menus to update given the value of the primary menu for(var menu2_name in pushActionInfo) { var menu2 = document.mainform.elements[menu2_name]; //alert("Have secondary menu to update: " + menu2_name); menu2.length = 0; if(!menu2) { continue; } if(prevValueOfMenu) { //alert(prevValueOfMenu[menu2_name]); } //alert('DBLENGTH '+pushActionInfo[menu2_name].length+ ' DB: '+pushActionInfo[menu2_name][0][0]); var pushActionLoopLength = pushActionInfo[menu2_name].length; for(var i=0;i < pushActionLoopLength; i++) { //option_name = option_names[i]; //alert(i + " "+ pushActionInfo[menu2_name][i][1]); optionName = pushActionInfo[menu2_name][i][0]; optionDisplayName = pushActionInfo[menu2_name][i][1]; var option = new Option(optionDisplayName, optionName); menu2.options[i] = option; if(prevValueOfMenu && prevValueOfMenu[menu2_name] == optionDisplayName) { // alert ('SELECTED') menu2.options[i].selected = true; } } // Call this function again, to recursively process pushaction-config // of arbitrary depth, but only if there's actually pushaction-info // available (to avoid an infinite loop here, you see..) if(pushActionsOfMenu[menu2_name]) { //alert("Have tertiary menu to update, calling function again for menu " + menu2_name); //alert ('yes '+ menu2_name); updateMenuPushactions(menu2, pushActionsOfMenu, prevValueOfMenu); } } } function changeRadioStatus (siblingNodes, thisName, attListName) { for(var i=0; i