/*=========================================================================== Copyright (c) 2007 Matias Capeletto Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ===========================================================================*/ /*********************** NestedLinks API ********************************** In your html body use it like: ----------------------------------------------------------------------------
--------------------------------------------------------------------------- Read the html docs for more information. **************************************************************************/ /* Requires: common.js */ /* Requires: load_file.js */ (function() { // Options for drop down list function construct_select_option(oXmlElement,sClass, sBaseUrl,sDefaultUrl,sSelected) { var sTag = oXmlElement.getAttribute('tag' ); var sUrl = oXmlElement.getAttribute('href'); return '\n'; } // Populate a select block from an xml and insert the result in sId div function select_box(sId,sXmlUrl,sUserBaseUrl,sSelected) { boostscript.load_file.load_xml(sXmlUrl, function(oEntireXml) { var oXml = oEntireXml.getElementsByTagName('nestedLinks')[0]; // manage parameters var sBaseUrl = sUserBaseUrl ? boostscript.common.format_base_url( sUserBaseUrl ) : './'; var oBaseUrlNode = oXml.getElementsByTagName('base')[0]; if( oBaseUrlNode ) { sBaseUrl += boost_format_base_url( oBaseUrlNode.getAttribute('href') ); } var sDefaultUrl = sBaseUrl + 'index'; var oTitle = oXml.getElementsByTagName('title')[0]; if( sSelected == null && oTitle != null ) { sSelected = oTitle.getAttribute('tag'); var sUrl = oTitle.getAttribute('href'); if( sUrl ) { sDefaultUrl = sUrl; } } // Construct the select box var sSelectHtml = '\n'; } ); } // Action function used when the user selects an option from the drop down list function go_to_url(sId) { var oe = document.getElementById(sId); parent.self.location = oe.options[oe.selectedIndex].value; } // Public Interface boostscript.nested_links.internal_go_to_url = go_to_url; boostscript.nested_links.select_box = select_box; boostscript.nested_links.loaded = true; })();