xref: /OpenGrok/opengrok-web/src/main/webapp/mast.jsp (revision aa18fa2876e3629259023f79466c3f639b53b9d0)
1<%--
2$Id$
3
4CDDL HEADER START
5
6The contents of this file are subject to the terms of the
7Common Development and Distribution License (the "License").
8You may not use this file except in compliance with the License.
9
10See LICENSE.txt included in this distribution for the specific
11language governing permissions and limitations under the License.
12
13When distributing Covered Code, include this CDDL HEADER in each
14file and include the License file at LICENSE.txt.
15If applicable, add the following below this CDDL HEADER, with the
16fields enclosed by brackets "[]" replaced with your own identifying
17information: Portions Copyright [yyyy] [name of copyright owner]
18
19CDDL HEADER END
20
21Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
22Portions Copyright 2011 Jens Elkner.
23Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
24
25--%><%--
26
27After include you are here: /body/div#page/div#content/
28
29--%>
30<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
31<%@page import="org.opengrok.indexer.web.messages.MessagesContainer"%>
32<%@ page session="false" errorPage="error.jsp" import="
33org.opengrok.web.PageConfig,
34org.opengrok.indexer.web.Prefix,
35org.opengrok.indexer.web.Util"%>
36<%@ page import="org.opengrok.indexer.web.messages.MessagesUtils" %>
37<%@ page import="jakarta.servlet.http.HttpServletResponse" %>
38<%
39/* ---------------------- mast.jsp start --------------------- */
40{
41    PageConfig cfg = PageConfig.get(request);
42    if (cfg.isUnreadable()) {
43        response.sendError(HttpServletResponse.SC_FORBIDDEN);
44        return;
45    }
46
47    String redir = cfg.canProcess();
48    if (redir == null || redir.length() > 0) {
49        if (redir == null) {
50            response.sendError(HttpServletResponse.SC_NOT_FOUND);
51        } else {
52            response.sendRedirect(redir);
53        }
54        return;
55    }
56
57    if (cfg.isNotModified(request, response)) {
58        // the resource was not modified
59        // the code 304 NOT MODIFIED has been inserted to the response
60        return;
61    }
62
63    // Use UTF-8 if no encoding is specified in the request
64    if (request.getCharacterEncoding() == null) {
65        request.setCharacterEncoding("UTF-8");
66    }
67
68    // set the default page title
69    String path = cfg.getPath();
70    cfg.setTitle(cfg.getPathTitle());
71}
72%>
73<%@
74
75include file="httpheader.jspf"
76
77        %><body>
78<script type="text/javascript">/* <![CDATA[ */
79    document.rev = function() { return getParameter("r"); };
80    document.annotate = <%= PageConfig.get(request).annotate() %>;
81    document.domReady.push(function() { domReadyMast(); });
82    document.pageReady.push(function() { pageReadyMast(); });
83/* ]]> */</script>
84<div id="page">
85    <header id="whole_header">
86        <%@include file="pageheader.jspf" %>
87<div id="Masthead">
88    <%
89{
90    PageConfig cfg = PageConfig.get(request);
91    String path = cfg.getPath();
92    String context = request.getContextPath();
93    String rev = cfg.getRequestedRevision();
94
95    String messages = "";
96    if (cfg.getProject() != null) {
97        messages = MessagesUtils.messagesToJson(cfg.getProject(),
98                    MessagesContainer.MESSAGES_MAIN_PAGE_TAG);
99    }
100    %>
101    <a href="<%= context + Prefix.XREF_P %>/">xref</a>:
102    <%= Util.breadcrumbPath(context + Prefix.XREF_P, path,'/',"",true,cfg.isDir()) %>
103    <% if (rev.length() != 0) { %>
104        (revision <%= Util.htmlize(rev) %>)
105    <% } %>
106    <span id="dtag">
107    <%
108    String dtag = cfg.getDefineTagsIndex();
109    if (dtag.length() > 0) {
110        %> (<%= dtag %>)<%
111    }
112    %></span>
113    <% if (!messages.isEmpty()) { %>
114    <span class="note-<%= MessagesUtils.getMessageLevel(cfg.getProject().getName(), MessagesContainer.MESSAGES_MAIN_PAGE_TAG) %> important-note important-note-rounded"
115          data-messages='<%= messages %>'>!</span>
116    <% }
117}
118%>
119</div>
120<%@
121
122include file="minisearch.jspf"
123
124%>
125<%
126/* ---------------------- mast.jsp end --------------------- */
127%>
128