menu.jspf revision 99b4056e2c5b0a51f7f480ebcefb1f917613ce2a
2452N/A<%--
2452N/A$Id$
2452N/A
2452N/ACDDL HEADER START
2452N/A
2452N/AThe contents of this file are subject to the terms of the
2452N/ACommon Development and Distribution License (the "License").
2452N/AYou may not use this file except in compliance with the License.
2452N/A
2452N/ASee LICENSE.txt included in this distribution for the specific
2452N/Alanguage governing permissions and limitations under the License.
2452N/A
2452N/AWhen distributing Covered Code, include this CDDL HEADER in each
2452N/Afile and include the License file at LICENSE.txt.
2452N/AIf applicable, add the following below this CDDL HEADER, with the
2452N/Afields enclosed by brackets "[]" replaced with your own identifying
2452N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
2452N/A
2452N/ACDDL HEADER END
2452N/A
5680N/ACopyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
5680N/A
5575N/APortions Copyright 2011 Jens Elkner.
2452N/A
2452N/A--%><%@page import="org.opensolaris.opengrok.web.SearchHelper"%>
2452N/A<%@page import="java.util.Map"%>
2452N/A<%@page import="
2452N/Ajava.util.SortedSet,
2452N/Ajava.util.TreeMap,
2452N/Ajava.util.Map.Entry,
2452N/Ajava.util.List,
2452N/Ajava.util.HashMap,
2452N/Ajava.util.ArrayList,
2452N/A
2452N/Aorg.opensolaris.opengrok.configuration.Project,
2452N/Aorg.opensolaris.opengrok.search.QueryBuilder,
2452N/Aorg.opensolaris.opengrok.web.PageConfig,
2452N/Aorg.opensolaris.opengrok.web.Prefix,
2899N/Aorg.opensolaris.opengrok.web.Util"
2899N/A%><%
3817N/A/* ---------------------- menu.jspf start --------------------- */
3817N/A{
3817N/A // PageConfig cfg = PageConfig.get(request);
2452N/A
2452N/A List<Project> projects = cfg.getEnv().getProjects();
2452N/A if (projects == null) {
5795N/A projects = new ArrayList<Project>(0);
5795N/A }
5795N/A TreeMap<String, String> pMap = new TreeMap<String, String>();
2452N/A QueryBuilder queryParams = cfg.getQueryBuilder();
5795N/A if (projects.size() != 0) {
5795N/A for (Project p : projects) {
5795N/A String name = p.getDescription();
2452N/A String esc = Util.formQuoteEscape(p.getDescription());
2452N/A pMap.put(name, esc);
4337N/A }
4337N/A StringBuilder jsProjects = new StringBuilder(64);
6972N/A jsProjects.append('\'');
6972N/A for (String name : cfg.getRequestedProjects()) {
3817N/A jsProjects.append(name).append("','");
3817N/A }
if (jsProjects.length() > 1) {
jsProjects.setLength(jsProjects.length()-2);
} else {
jsProjects.setLength(0);
}
%>
<script type="text/javascript">/* <![CDATA[ */
document.projects = [ <%= Util.encode(jsProjects.toString())
%> ];document.xrefPath = '<%= request.getContextPath() + Prefix.XREF_P
%>';document.domReady.push(function() { domReadyMenu(); });
/* ]]> */
</script><%
}
%>
<form action="search" id="sbox">
<div id="qtbl">
<table>
<tr>
<td><label for="s1" title="The text token(s) or other fields to be found (lucene query, this is not full text!)">Full&nbsp;Search</label></td>
<td><input tabindex="1" class="q" name="q" id="q" value="<%=
Util.formQuoteEscape(queryParams.getFreetext()) %>"/></td>
</tr>
<tr>
<td><label for="s2" title="Definition of function/variable/class">Definition</label></td>
<td><input class="q" tabindex="2" name="defs" id="defs" value="<%=
Util.formQuoteEscape(queryParams.getDefs()) %>"/></td>
</tr>
<tr>
<td><label for="s3" title="Usage of function/variable/class">Symbol</label></td>
<td><input class="q" tabindex="3" name="refs" id="refs" value="<%=
Util.formQuoteEscape(queryParams.getRefs()) %>"/></td>
</tr>
<tr>
<td><label for="s4" title="path or parts of it, no need to use dividers">File&nbsp;Path</label></td>
<td><input class="q" tabindex="4" name="path" id="path" value="<%=
Util.formQuoteEscape(queryParams.getPath()) %>"/></td>
</tr>
<tr>
<td><label for="s5" title="Search in log messages">History</label></td>
<td><input class="q" tabindex="5" name="hist" id="hist" value="<%=
Util.formQuoteEscape(queryParams.getHist()) %>"/></td>
</tr>
<tr>
<td><label for="s5">Type</label></td>
<td><select class="q" tabindex="6" name="type" id="type"><%
String selection = queryParams.getType();
%>
<option value="">Any</option><%
for (Map.Entry<String, String> d : SearchHelper.getFileTypeDescirptions()) {
%>
<option value="<%= Util.formQuoteEscape(d.getKey()) %>"<%
if (d.getKey().equals(selection)) {
%> selected="selected"<%
}
%>><%= Util.htmlize(d.getValue()) %></option><%
}
%>
</select>
</td>
</tr>
<%-- TODO Bug 11749
<%
if (projects.size() != 0) {
String imgDir = cfg.getCssDir() + "/img/";
%>
<tr>
<td>Project(s)</td>
<td>
<table class="combo_table" id="combotable">
<tbody>
<tr>
<td class="combo_td1"><div class="combo_div4"
style="background: transparent url(<%=
imgDir %>transparent_pixel.gif)
repeat scroll 0% 0%;"><input
class="combo_input1 combo_input" id="project"
name="project" size="25"
value="<%= cfg.getRequestedProjectsAsString()
%>"/></div>
</td>
<td valign="top" align="left" class="combo_td2"
id="combotable_button"><a
onclick='javascript: $("#project").click();
$("#project").click();'/><img style="display: none;"
alt="" src="<%= imgDir %>button2.png"/>
</td>
</tr>
</tbody>
</table></td>
</tr><%
}
%>
--%>
</table>
</div><%
if (projects.size() != 0) {
%>
<div id="ptbl">
<p><label for="project">In Project(s)</label> <button tabindex="6" type="button"
onclick="javascript: selectAllProjects(); return false;"
>select all</button>&nbsp;<button tabindex="7" type="button"
onclick="javascript: invertAllProjects(); return false;"
>invert selection</button> </p>
<select tabindex="8" ondblclick="javascript: goFirstProject();"
onkeyup="javascript: checkEnter(event);" class="q" id="project"
name="project" multiple="multiple" size="<%=
Math.min(6, projects.size()) %>"><%
SortedSet<String> pRequested = cfg.getRequestedProjects();
for (Entry<String,String> e : pMap.entrySet()) {
// TODO below "selected" has no effect if one refreshes the page
// with F5 also below ondblclick doesn't work in IE ...
// ondblclick="javascript:goFirstProject();"
%>
<option value="<%= e.getValue() %>"<%
if (pRequested.contains(e.getKey())) {
%> selected="selected"<%
}
%>><%= e.getValue() %></option><%
}
%>
</select>
</div><%
}
%>
<p><input tabindex="9" class="submit" type="submit" value="Search"/>
<input tabindex="10" class="submit" onclick="javascript: clearSearchFrom();"
type="button" value=" Clear "/>
<button class="help" tabindex="11" onclick="window.open('help.jsp');">Help
</button>
</p>
</form>
<%
}
/* ---------------------- menu.jspf end --------------------- */
%>