menu.jspf revision 8d5daad4d9da04018b562f0dd12044f5f53c1a66
4406N/A<%--
4406N/A$Id$
4406N/A
4406N/ACDDL HEADER START
4406N/A
4406N/AThe contents of this file are subject to the terms of the
4406N/ACommon Development and Distribution License (the "License").
4406N/AYou may not use this file except in compliance with the License.
4406N/A
4406N/ASee LICENSE.txt included in this distribution for the specific
4406N/Alanguage governing permissions and limitations under the License.
4406N/A
4406N/AWhen distributing Covered Code, include this CDDL HEADER in each
4406N/Afile and include the License file at LICENSE.txt.
4406N/AIf applicable, add the following below this CDDL HEADER, with the
4406N/Afields enclosed by brackets "[]" replaced with your own identifying
4406N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
4406N/A
4406N/ACDDL HEADER END
4406N/A
4406N/ACopyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
4406N/A
5680N/APortions Copyright 2011 Jens Elkner.
4406N/A
5680N/A--%><%@page import="java.util.TreeSet"%>
4406N/A<%@page import="java.util.Set"%>
4406N/A<%@page import="java.util.LinkedList"%>
4406N/A<%@page import="org.opensolaris.opengrok.configuration.Group"%>
4406N/A<%@page import="org.opensolaris.opengrok.web.ProjectHelper"%>
4406N/A<%@page import="org.opensolaris.opengrok.web.SearchHelper"%>
4406N/A<%@page import="java.util.Map"%>
4406N/A<%@page import="
4406N/Ajava.util.SortedSet,
4406N/Ajava.util.TreeMap,
4406N/Ajava.util.Map.Entry,
4406N/Ajava.util.List,
4406N/Ajava.util.HashMap,
4406N/Ajava.util.ArrayList,
5680N/A
5680N/Aorg.opensolaris.opengrok.configuration.Project,
4406N/Aorg.opensolaris.opengrok.search.QueryBuilder,
4406N/Aorg.opensolaris.opengrok.web.PageConfig,
4406N/Aorg.opensolaris.opengrok.web.Prefix,
4406N/Aorg.opensolaris.opengrok.web.Util"
4406N/A%><%
/* ---------------------- menu.jspf start --------------------- */
{
// PageConfig cfg = PageConfig.get(request);
ProjectHelper ph = ProjectHelper.getInstance(cfg);
Set<Project> projects = ph.getAllProjects();
if (projects == null) {
projects = new TreeSet<>();
}
int projectsSize = ph.getAllUngrouped().size();
if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0)
projectsSize++;
for (Group group : ph.getGroups()) {
projectsSize++;
projectsSize += ph.getAllGrouped(group).size();
}
TreeMap<String, String> pMap = new TreeMap<>();
QueryBuilder queryParams = cfg.getQueryBuilder();
if (projects.size() != 0) {
for (Project p : projects) {
String name = p.getDescription();
String esc = Util.formQuoteEscape(p.getDescription());
pMap.put(name, esc);
}
StringBuilder jsProjects = new StringBuilder(64);
jsProjects.append('\'');
for (String name : cfg.getRequestedProjects()) {
jsProjects.append(name).append("','");
}
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" type="text" 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" type="text" 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" type="text" 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" type="text" 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" type="text" 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.getFileTypeDescriptions()) {
%>
<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(event);"
onkeyup="javascript: checkEnter(event);" class="q" id="project"
name="project" multiple="multiple" size="<%=
Math.min(15, projectsSize) %>"><%
SortedSet<String> pRequested = cfg.getRequestedProjects();
for ( Group group : ph.getGroups() ) {
Set<Project> groupProjects = ph.getAllGrouped(group);
if ( groupProjects.size() > 0) {
%><optgroup label="<%= group.getName() %>"><%
for (Project p : groupProjects) {
// 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="<%= p.getDescription() %>"<%
if (pRequested.contains(p.getDescription())) {
%> selected="selected"<%
}
%>><%= Util.formQuoteEscape(p.getDescription()) %></option><%
}
%></optgroup><%
}
}
if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0) {
%><optgroup label="Other"><%
}
for ( Project p : ph.getAllUngrouped()) {
%><option value="<%= p.getDescription() %>"<%
if (pRequested.contains(p.getDescription())) {
%> selected="selected"<%
}
%>><%= Util.formQuoteEscape(p.getDescription()) %></option><%
}
if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0) {
%></optgroup><%
}
%></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 --------------------- */
%>