xref: /OpenGrok/opengrok-web/src/main/webapp/minisearch.jspf (revision d6df19e1b22784c78f567cf74c42f18e3901b900)
1<%--
2CDDL HEADER START
3
4The contents of this file are subject to the terms of the
5Common Development and Distribution License (the "License").
6You may not use this file except in compliance with the License.
7
8See LICENSE.txt included in this distribution for the specific
9language governing permissions and limitations under the License.
10
11When distributing Covered Code, include this CDDL HEADER in each
12file and include the License file at LICENSE.txt.
13If applicable, add the following below this CDDL HEADER, with the
14fields enclosed by brackets "[]" replaced with your own identifying
15information: Portions Copyright [yyyy] [name of copyright owner]
16
17CDDL HEADER END
18
19Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
20Portions Copyright (c) 2020, Chris Fraire <cfraire@me.com>.
21--%>
22<%@ page session="false" errorPage="error.jsp" import="
23org.opengrok.indexer.configuration.Project,
24org.opengrok.web.PageConfig,
25org.opengrok.indexer.web.Prefix,
26org.opengrok.indexer.web.QueryParameters,
27org.opengrok.indexer.web.Util"%><%
28    /* ---------------------- minisearch.jspf start --------------------- */
29{
30        PageConfig cfg = PageConfig.get(request);
31        String context = request.getContextPath();
32%>
33
34<form action="<%= context + Prefix.SEARCH_P %>">
35<div id="bar">
36    <ul>
37        <li><a href="<%= context %>/"><span id="home"></span>Home</a></li><%
38    if (cfg.getEnv().isHistoryEnabled()) {
39        if (!cfg.hasHistory()) {
40            %><li><span id="history"></span><span class="c">History</span></li><%
41        } else {
42            %><li><a href="<%= context + Prefix.HIST_L + cfg.getUriEncodedPath()
43                %>"><span id="history"></span>History</a></li><%
44        }
45    }
46    if (!cfg.hasAnnotations() /* || cfg.getPrefix() == Prefix.HIST_S */ ) {
47        %><li><span class="c"><span class="annotate"></span>Annotate</span></li><%
48    } else if (cfg.annotate()) {
49        %><li><span id="toggle-annotate-by-javascript" style="display: none"><a
50            href="#" onclick="toggle_annotations(); return false;"
51            title="Show or hide line annotation (revisions, authors)."
52            ><span class="annotate"></span>Annotate</a></span><span
53            id="toggle-annotate"><a href="#"><span class="annotate"></span>
54            Annotate</a></span></li><%
55    } else if (cfg.getPrefix() == Prefix.HIST_L) {
56        %><li>
57            <a href="#"
58               onclick="window.location = '<%= context + Prefix.XREF_P + cfg.getUriEncodedPath() %>'
59               // taken from get_annotations() from utils.js
60               + '?<%= QueryParameters.ANNOTATION_PARAM_EQ_TRUE %>'
61               + (document.rev && document.rev() ?
62                       '&amp;<%= QueryParameters.REVISION_PARAM_EQ %>'
63               + encodeURIComponent(document.rev()) : '')
64               + (window.location.hash ?
65                       '&amp;<%= QueryParameters.WINDOW_HASH_PARAM_EQ %>'
66               + window.location.hash.substring(1, window.location.hash.length) : '');
67                           return false;">
68                <span class="annotate"></span>
69                Annotate
70            </a>
71        </li><%
72    } else {
73        %><li><a href="#" onclick="get_annotations(); return false;"
74            ><span class="annotate"></span>Annotate</a></li><%
75    }
76    if (!cfg.isDir()) {
77        if (cfg.getPrefix() == Prefix.XREF_P) {
78        %><li><a href="#" onclick="lntoggle();return false;"
79            title="Show or hide line numbers (might be slower if file has more than 10 000 lines).">
80              <span id="line"></span>Line#</a></li>
81          <li><a href="#" class="scopes-toggle"
82            title="Show or hide scopes window.">
83              <span id="scopes"></span>Scopes#</a></li>
84        <li><a href="#" id="navigate"
85            title="Show or hide symbol list.">
86              <span id="defbox"></span>Navigate#</a></li><%
87        }
88        %>
89	<li><a href="<%= context + Prefix.RAW_P + cfg.getUriEncodedPath() +
90            (cfg.getRequestedRevision().length() == 0 ? "" : "?" +
91            QueryParameters.REVISION_PARAM_EQ + Util.uriEncode(cfg.getRequestedRevision()))
92            %>"><span id="raw"></span>Raw</a></li>
93	<li><a href="<%= context + Prefix.DOWNLOAD_P + cfg.getUriEncodedPath() +
94            (cfg.getRequestedRevision().length() == 0 ? "" : "?" +
95            QueryParameters.REVISION_PARAM_EQ + Util.uriEncode(cfg.getRequestedRevision()))
96            %>"><span id="download"></span>Download</a></li>
97	<%
98    }
99        %><li><input type="text" id="search" name="<%= QueryParameters.FULL_SEARCH_PARAM %>"
100                  class="q" aria-label="Search"/></li>
101            <li><input type="submit" value="Search" class="submit" /></li><%
102    Project proj = cfg.getProject();
103    String[] vals = cfg.getSearchOnlyIn();
104        %><li><label><input id="minisearch-path" type="checkbox"
105                  name="<%= QueryParameters.PATH_SEARCH_PARAM %>" value='"<%= vals[0]
106            %>"' <%= vals[2] %>/> current directory</label></li>
107    </ul><%
108    if (proj != null) {
109    %>
110    <input id="minisearch-project" type="hidden" name="<%= QueryParameters.PROJECT_SEARCH_PARAM %>"
111           value="<%=proj.getName()%>" /><%
112    }
113%>
114    <input type="hidden" id="contextpath" value="<%=request.getContextPath()%>" />
115</div>
116        </form>
117        <script type="text/javascript">/* <![CDATA[ */
118            document.domReady.push(function() { domReadyMenu(true); });
119            /* ]]> */
120        </script>
121    </header>
122<div id="content">
123<%
124}
125/* ---------------------- minisearch.jspf end --------------------- */
126%>