menu.jspf revision 838924562130977ca1a3d3839d146fcda39ea1af
9ec7787531611654e8f50932473aa48963eaba55Trond NorbyeCDDL HEADER START
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 NorbyeSee LICENSE.txt included in this distribution for the specific
9ec7787531611654e8f50932473aa48963eaba55Trond Norbyelanguage governing permissions and limitations under the License.
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 NorbyeCDDL HEADER END
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof TulingerCopyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
14a41f02433890d19b2f871156271e3388cd0845Jens ElknerPortions Copyright 2011 Jens Elkner.
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger--%><%@page import="org.opensolaris.opengrok.configuration.RuntimeEnvironment"%>
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger<%@page import="org.opensolaris.opengrok.configuration.messages.Message"%>
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger<%@page import="java.util.TreeSet"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="java.util.Set"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="java.util.LinkedList"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="org.opensolaris.opengrok.configuration.Group"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="org.opensolaris.opengrok.web.ProjectHelper"%>
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger<%@page import="org.opensolaris.opengrok.web.SearchHelper"%>
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz<%@page import="java.util.Map"%>
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz<%@page import="
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- menu.jspf start --------------------- */
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen // PageConfig cfg = PageConfig.get(request);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger ProjectHelper ph = ProjectHelper.getInstance(cfg);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Set<Project> projects = ph.getAllProjects();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen if (projects == null) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger projects = new TreeSet<>();
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger int projectsSize = ph.getAllUngrouped().size();
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0)
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger projectsSize++;
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger for (Group group : ph.getGroups()) {
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger projectsSize++;
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger projectsSize += ph.getAllGrouped(group).size();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger TreeMap<String, String> pMap = new TreeMap<>();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen QueryBuilder queryParams = cfg.getQueryBuilder();
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen for (Project p : projects) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String esc = Util.formQuoteEscape(p.getDescription());
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen StringBuilder jsProjects = new StringBuilder(64);
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen for (String name : cfg.getRequestedProjects()) {
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.append(name).append("','");
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen jsProjects.setLength(jsProjects.length()-2);
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(); });
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<form action="search" id="sbox">
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<div id="qtbl">
99b4056e2c5b0a51f7f480ebcefb1f917613ce2aLubos Kosco <td><label for="s1" title="The text token(s) or other fields to be found (lucene query, this is not full text!)">Full Search</label></td>
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof Tulinger <td><input tabindex="1" class="q" name="q" id="q" type="text" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getFreetext()) %>"/></td>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco <td><label for="s2" title="Definition of function/variable/class">Definition</label></td>
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof Tulinger <td><input class="q" tabindex="2" name="defs" id="defs" type="text" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getDefs()) %>"/></td>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco <td><label for="s3" title="Usage of function/variable/class">Symbol</label></td>
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof Tulinger <td><input class="q" tabindex="3" name="refs" id="refs" type="text" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getRefs()) %>"/></td>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco <td><label for="s4" title="path or parts of it, no need to use dividers">File Path</label></td>
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof Tulinger <td><input class="q" tabindex="4" name="path" id="path" type="text" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getPath()) %>"/></td>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco <td><label for="s5" title="Search in log messages">History</label></td>
8d5daad4d9da04018b562f0dd12044f5f53c1a66Kryštof Tulinger <td><input class="q" tabindex="5" name="hist" id="hist" type="text" value="<%=
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen Util.formQuoteEscape(queryParams.getHist()) %>"/></td>
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz <td><label for="s5">Type</label></td>
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz <td><select class="q" tabindex="6" name="type" id="type"><%
73189ea86c6fb0af01e16eaa5b0da3f2bb775c41Harry Pan String selection = queryParams.getType();
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz <option value="">Any</option><%
73189ea86c6fb0af01e16eaa5b0da3f2bb775c41Harry Pan for (Map.Entry<String, String> d : SearchHelper.getFileTypeDescriptions()) {
ceddad3a2fabdcc5b60631501187f9e8b4b43a3bKnut Anders Hatlen <option value="<%= Util.formQuoteEscape(d.getKey()) %>"<%
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz if (d.getKey().equals(selection)) {
0660813d1476ce33b006694581155bf28067687bSven-Kristofer Pilz %> selected="selected"<%
ceddad3a2fabdcc5b60631501187f9e8b4b43a3bKnut Anders Hatlen %>><%= Util.htmlize(d.getValue()) %></option><%
ff32508916722fc0e579f39b5bf22936116b8829Lubos Kosco<%-- TODO Bug 11749
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen String imgDir = cfg.getCssDir() + "/img/";
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td>Project(s)</td>
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <table class="combo_table" id="combotable">
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen <td class="combo_td1"><div class="combo_div4"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen style="background: transparent url(<%=
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 <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"/>
838924562130977ca1a3d3839d146fcda39ea1afKryštof TulingerSortedSet<Message> messages;
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner<div id="ptbl">
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <p><label for="project">In Project(s)</label>
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <button tabindex="6" type="button"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onclick="javascript: selectAllProjects(); return false;"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen >select all</button> <button tabindex="7" type="button"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen onclick="javascript: invertAllProjects(); return false;"
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger >invert selection</button> <button tabindex="8" type="button"
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger onclick="javascript: deselectAllProjects(); return false;"
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger >clear</button></p>
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <select tabindex="8" class="q" id="project"
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen name="project" multiple="multiple" size="<%=
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger Math.min(15, projectsSize) %>"><%
59b6a8c0cc6ef741a7180504b3c371e67c2aa338Knut Anders Hatlen SortedSet<String> pRequested = cfg.getRequestedProjects();
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for ( Group group : ph.getGroups() ) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger Set<Project> groupProjects = ph.getAllGrouped(group);
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><optgroup label="<%= group.getName() %>"><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for (Project p : groupProjects) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger // TODO below "selected" has no effect if one refreshes the page
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><option value="<%= p.getDescription() %>"<%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (pRequested.contains(p.getDescription())) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %> selected="selected"<%
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger messages = cfg.getEnv().getMessages(p.getDescription());
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger %> data-messages='<%= Util.messagesToJson(messages).toJSONString()%>' <%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %>><%= Util.formQuoteEscape(p.getDescription()) %></option><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %></optgroup><%
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><optgroup label="Other"><%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger for ( Project p : ph.getAllUngrouped()) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %><option value="<%= p.getDescription() %>"<%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger if (pRequested.contains(p.getDescription())) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %> selected="selected"<%
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger messages = cfg.getEnv().getMessages(p.getDescription());
838924562130977ca1a3d3839d146fcda39ea1afKryštof Tulinger %> data-messages='<%= Util.messagesToJson(messages).toJSONString() %>' <%
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %>><%= Util.formQuoteEscape(p.getDescription()) %></option><%
cd9fbd3b531043a6a754f7013f542087727b9321Kryštof Tulinger if(ph.getGroups().size() > 0 && ph.getAllUngrouped().size() > 0) {
d470e59c0405a31b7e5f194bd9b705e91b12bf0aKryštof Tulinger %></optgroup><%
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger<div id="ltbl">
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <!-- filled with javascript -->
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <div class="clearfix"></div>
73189ea86c6fb0af01e16eaa5b0da3f2bb775c41Harry Pan <p><input tabindex="9" class="submit" type="submit" value="Search"/>
73189ea86c6fb0af01e16eaa5b0da3f2bb775c41Harry Pan <input tabindex="10" class="submit" onclick="javascript: clearSearchFrom();"
73189ea86c6fb0af01e16eaa5b0da3f2bb775c41Harry Pan type="button" value=" Clear "/>
9a4361e23046cda58b9a5b8f4e11910dc433badaLubos Kosco <button class="help" tabindex="11" onclick="window.open('help.jsp');">Help
3df9409a61b23dd736d9ce7bea6e4256bc449ff2Kryštof Tulinger <div class="clearfix"></div>
14a41f02433890d19b2f871156271e3388cd0845Jens Elkner/* ---------------------- menu.jspf end --------------------- */