My Project - RET HER  versionsnr
menu.js
Go to the documentation of this file.
1 /*
2  @licstart The following is the entire license notice for the
3  JavaScript code in this file.
4 
5  Copyright (C) 1997-2017 by Dimitri van Heesch
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License along
18  with this program; if not, write to the Free Software Foundation, Inc.,
19  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 
21  @licend The above is the entire license notice
22  for the JavaScript code in this file
23  */
24 function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
25  function makeTree(data,relPath) {
26  var result='';
27  if ('children' in data) {
28  result+='<ul>';
29  for (var i in data.children) {
30  result+='<li><a href="'+relPath+data.children[i].url+'">'+
31  data.children[i].text+'</a>'+
32  makeTree(data.children[i],relPath)+'</li>';
33  }
34  result+='</ul>';
35  }
36  return result;
37  }
38 
39  $('#main-nav').append(makeTree(menudata,relPath));
40  $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
41  if (searchEnabled) {
42  if (serverSide) {
43  $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+relPath+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.png" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
44  } else {
45  $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>');
46  }
47  }
48  $('#main-menu').smartmenus();
49 }
50 /* @license-end */