menu.jspf revision 59b6a8c0cc6ef741a7180504b3c371e67c2aa338
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen<%--
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner$Id$
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeCDDL HEADER START
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeThe contents of this file are subject to the terms of the
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders HatlenCommon Development and Distribution License (the "License").
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeYou may not use this file except in compliance with the License.
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeSee LICENSE.txt included in this distribution for the specific
9ec7787531611654e8f50932473aa48963eaba55Trond Norbyelanguage governing permissions and limitations under the License.
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeWhen distributing Covered Code, include this CDDL HEADER in each
9ec7787531611654e8f50932473aa48963eaba55Trond Norbyefile and include the License file at LICENSE.txt.
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeIf applicable, add the following below this CDDL HEADER, with the
9ec7787531611654e8f50932473aa48963eaba55Trond Norbyefields enclosed by brackets "[]" replaced with your own identifying
9ec7787531611654e8f50932473aa48963eaba55Trond Norbyeinformation: Portions Copyright [yyyy] [name of copyright owner]
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeCDDL HEADER END
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeCopyright 2007 Sun Microsystems, Inc. All rights reserved.
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeUse is subject to license terms.
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye
14a41f02433890d19b2f871156271e3388cd0845Jens ElknerPortions Copyright 2011 Jens Elkner.
02508b90a0eace220eabd5ec85ff37e9009c6b16Lubos Kosco
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner--%><%@page import="
be72dc8ed6dfce2445cea09638f601a08b9175e2Trond Norbyejava.util.SortedSet,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerjava.util.TreeMap,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerjava.util.Map.Entry,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerjava.util.List,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerjava.util.HashMap,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerjava.util.ArrayList,
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.configuration.Project,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.search.QueryBuilder,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.web.PageConfig,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.web.Prefix,
14a41f02433890d19b2f871156271e3388cd0845Jens Elknerorg.opensolaris.opengrok.web.Util"
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner%><%
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- menu.jspf start --------------------- */
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner{
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen // PageConfig cfg = PageConfig.get(request);
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen List<Project> projects = cfg.getEnv().getProjects();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (projects == null) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen projects = new ArrayList<Project>(0);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen TreeMap<String, String> pMap = new TreeMap<String, String>();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen QueryBuilder queryParams = cfg.getQueryBuilder();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (projects.size() != 0) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen for (Project p : projects) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String name = p.getDescription();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String esc = Util.formQuoteEscape(p.getDescription());
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen pMap.put(name, esc);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen StringBuilder jsProjects = new StringBuilder(64);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.append('\'');
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen for (String name : cfg.getRequestedProjects()) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.append(name).append("','");
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (jsProjects.length() > 1) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.setLength(jsProjects.length()-2);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen } else {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.setLength(0);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
981e542f40f5acaf95b69c5854e5ffb080204242Lubos Kosco%>
ff32508916722fc0e579f39b5bf22936116b8829Lubos Kosco<script type="text/javascript">/* <![CDATA[ */
73100f4d1c412f00eb2568969d935cf3182b0d77Lubos Kosco document.projects = [ <%= Util.encode(jsProjects.toString())
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %> ];document.xrefPath = '<%= request.getContextPath() + Prefix.XREF_P
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>';document.domReady.push(function() { domReadyMenu(); });
ff32508916722fc0e579f39b5bf22936116b8829Lubos Kosco/* ]]> */
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner</script><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner%>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<form action="search" id="sbox">
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<div id="qtbl">
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<table>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><label for="s1">Full&nbsp;Search</label></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><input tabindex="1" class="q" name="q" id="s1" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getFreetext()) %>"/></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><label for="s2">Definition</label></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><input class="q" tabindex="2" name="defs" id="s2" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getDefs()) %>"/></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><label for="s3">Symbol</label></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><input class="q" tabindex="3" name="refs" id="s3" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getRefs()) %>"/></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><label for="s4">File&nbsp;Path</label></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><input class="q" tabindex="4" name="path" id="s4" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getPath()) %>"/></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><label for="s5">History</label></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td><input class="q" tabindex="5" name="hist" id="s5" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getHist()) %>"/></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
ff32508916722fc0e579f39b5bf22936116b8829Lubos Kosco<%-- TODO Bug 11749
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (projects.size() != 0) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String imgDir = cfg.getCssDir() + "/img/";
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td>Project(s)</td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <table class="combo_table" id="combotable">
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tbody>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td class="combo_td1"><div class="combo_div4"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen style="background: transparent url(<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen imgDir %>transparent_pixel.gif)
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen repeat scroll 0% 0%;"><input
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen class="combo_input1 combo_input" id="project"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen name="project" size="25"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen value="<%= cfg.getRequestedProjectsAsString()
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>"/></div>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td valign="top" align="left" class="combo_td2"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen id="combotable_button"><a
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onclick='javascript: $("#project").click();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen $("#project").click();'/><img style="display: none;"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen alt="" src="<%= imgDir %>button2.png"/>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tbody>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </table></td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </tr><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner%>
ff32508916722fc0e579f39b5bf22936116b8829Lubos Kosco--%>
9ec7787531611654e8f50932473aa48963eaba55Trond Norbye</table>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner</div><%
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (projects.size() != 0) {
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner%>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<div id="ptbl">
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <p><label for="project">In Project(s)</label> <button tabindex="6" type="button"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onclick="javascript: selectAllProjects(); return false;"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen >select all</button>&nbsp;<button tabindex="7" type="button"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onclick="javascript: invertAllProjects(); return false;"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen >invert selection</button> </p>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <select tabindex="8" ondblclick="javascript: goFirstProject();"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onkeyup="javascript: checkEnter(event);" class="q" id="project"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen name="project" multiple="multiple" size="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Math.min(6, projects.size()) %>"><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen SortedSet<String> pRequested = cfg.getRequestedProjects();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen for (Entry<String,String> e : pMap.entrySet()) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen // TODO below "selected" has no effect if one refreshes the page
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen // with F5 also below ondblclick doesn't work in IE ...
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen // ondblclick="javascript:goFirstProject();"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <option value="<%= e.getValue() %>"<%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (pRequested.contains(e.getKey())) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %> selected="selected"<%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>><%= e.getValue() %></option><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen </select>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner</div><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen }
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen %>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen<p><input
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen tabindex="9" class="submit" type="submit" value="Search"/> <input
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen tabindex="10" class="submit" onclick="javascript: sbox.q.value='';
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen sbox.defs.value = ''; sbox.refs.value = ''; sbox.path.value = '';
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen sbox.hist.value = ''; sbox.project.value ='';" type="button"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen value=" Clear "/> <button class="help"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen tabindex="11" onclick="window.open('help.jsp')">Help</button>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner</p>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner</form>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<%
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner}
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- menu.jspf end --------------------- */
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner%>