xref: /OpenGrok/opengrok-web/src/main/webapp/mast.jsp (revision 56f072caf7d2bfa8d9934d1e7cbac3987de2dc17)
10d40e9d0SAdam Hornáček<%--
20d40e9d0SAdam Hornáček$Id$
30d40e9d0SAdam Hornáček
40d40e9d0SAdam HornáčekCDDL HEADER START
50d40e9d0SAdam Hornáček
60d40e9d0SAdam HornáčekThe contents of this file are subject to the terms of the
70d40e9d0SAdam HornáčekCommon Development and Distribution License (the "License").
80d40e9d0SAdam HornáčekYou may not use this file except in compliance with the License.
90d40e9d0SAdam Hornáček
100d40e9d0SAdam HornáčekSee LICENSE.txt included in this distribution for the specific
110d40e9d0SAdam Hornáčeklanguage governing permissions and limitations under the License.
120d40e9d0SAdam Hornáček
130d40e9d0SAdam HornáčekWhen distributing Covered Code, include this CDDL HEADER in each
140d40e9d0SAdam Hornáčekfile and include the License file at LICENSE.txt.
150d40e9d0SAdam HornáčekIf applicable, add the following below this CDDL HEADER, with the
160d40e9d0SAdam Hornáčekfields enclosed by brackets "[]" replaced with your own identifying
170d40e9d0SAdam Hornáčekinformation: Portions Copyright [yyyy] [name of copyright owner]
180d40e9d0SAdam Hornáček
190d40e9d0SAdam HornáčekCDDL HEADER END
200d40e9d0SAdam Hornáček
21*56f072caSAdam HornáčekCopyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
220d40e9d0SAdam HornáčekPortions Copyright 2011 Jens Elkner.
23a804b2d7SAdam HornáčekPortions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
240d40e9d0SAdam Hornáček
250d40e9d0SAdam Hornáček--%><%--
260d40e9d0SAdam Hornáček
270d40e9d0SAdam HornáčekAfter include you are here: /body/div#page/div#content/
280d40e9d0SAdam Hornáček
290d40e9d0SAdam Hornáček--%>
30a804b2d7SAdam Hornáček<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
310d40e9d0SAdam Hornáček<%@page import="org.json.simple.JSONArray"%>
32*56f072caSAdam Hornáček<%@page import="org.opengrok.configuration.messages.Message"%>
330d40e9d0SAdam Hornáček<%@page import="java.util.SortedSet"%>
34*56f072caSAdam Hornáček<%@page import="org.opengrok.configuration.RuntimeEnvironment"%>
350d40e9d0SAdam Hornáček<%@ page session="false" errorPage="error.jsp" import="
360d40e9d0SAdam Hornáčekjava.io.File,
370d40e9d0SAdam Hornáčekjava.io.IOException,
380d40e9d0SAdam Hornáček
39*56f072caSAdam Hornáčekorg.opengrok.configuration.Project,
40*56f072caSAdam Hornáčekorg.opengrok.history.HistoryGuru,
41*56f072caSAdam Hornáčekorg.opengrok.web.EftarFileReader,
42*56f072caSAdam Hornáčekorg.opengrok.web.PageConfig,
43*56f072caSAdam Hornáčekorg.opengrok.web.Prefix,
44*56f072caSAdam Hornáčekorg.opengrok.web.Util"%><%
450d40e9d0SAdam Hornáček/* ---------------------- mast.jsp start --------------------- */
460d40e9d0SAdam Hornáček{
470d40e9d0SAdam Hornáček    PageConfig cfg = PageConfig.get(request);
480d40e9d0SAdam Hornáček    String redir = cfg.canProcess();
490d40e9d0SAdam Hornáček    if (redir == null || redir.length() > 0) {
500d40e9d0SAdam Hornáček        if (redir == null) {
510d40e9d0SAdam Hornáček            response.sendError(HttpServletResponse.SC_NOT_FOUND);
520d40e9d0SAdam Hornáček        } else {
530d40e9d0SAdam Hornáček            response.sendRedirect(redir);
540d40e9d0SAdam Hornáček        }
550d40e9d0SAdam Hornáček        return;
560d40e9d0SAdam Hornáček    }
570d40e9d0SAdam Hornáček
580d40e9d0SAdam Hornáček    // jel: hmmm - questionable for dynamic content
590d40e9d0SAdam Hornáček    long flast = cfg.getLastModified();
600d40e9d0SAdam Hornáček    if (request.getDateHeader("If-Modified-Since") >= flast) {
610d40e9d0SAdam Hornáček        response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
620d40e9d0SAdam Hornáček        return;
630d40e9d0SAdam Hornáček    }
640d40e9d0SAdam Hornáček    response.setDateHeader("Last-Modified", flast);
650d40e9d0SAdam Hornáček
660d40e9d0SAdam Hornáček    // Use UTF-8 if no encoding is specified in the request
670d40e9d0SAdam Hornáček    if (request.getCharacterEncoding() == null) {
680d40e9d0SAdam Hornáček        request.setCharacterEncoding("UTF-8");
690d40e9d0SAdam Hornáček    }
700d40e9d0SAdam Hornáček
710d40e9d0SAdam Hornáček    // set the default page title
720d40e9d0SAdam Hornáček    String path = cfg.getPath();
730d40e9d0SAdam Hornáček    cfg.setTitle(cfg.getPathTitle());
740d40e9d0SAdam Hornáček
750d40e9d0SAdam Hornáček    String context = request.getContextPath();
760d40e9d0SAdam Hornáček    cfg.getEnv().setUrlPrefix(context + Prefix.SEARCH_R + "?");
770d40e9d0SAdam Hornáček}
780d40e9d0SAdam Hornáček%>
790d40e9d0SAdam Hornáček<%@
800d40e9d0SAdam Hornáček
810d40e9d0SAdam Hornáčekinclude file="httpheader.jspf"
820d40e9d0SAdam Hornáček
830d40e9d0SAdam Hornáček        %><body>
840d40e9d0SAdam Hornáček<script type="text/javascript">/* <![CDATA[ */
850d40e9d0SAdam Hornáček    document.rev = function() { return getParameter("r"); };
860d40e9d0SAdam Hornáček    document.annotate = <%= PageConfig.get(request).annotate() %>;
870d40e9d0SAdam Hornáček    document.domReady.push(function() { domReadyMast(); });
880d40e9d0SAdam Hornáček    document.pageReady.push(function() { pageReadyMast(); });
890d40e9d0SAdam Hornáček/* ]]> */</script>
900d40e9d0SAdam Hornáček<div id="page">
910d40e9d0SAdam Hornáček    <div id="whole_header">
920d40e9d0SAdam Hornáček<div id="header"><%@
930d40e9d0SAdam Hornáček
940d40e9d0SAdam Hornáčekinclude file="pageheader.jspf"
950d40e9d0SAdam Hornáček
960d40e9d0SAdam Hornáček%>
970d40e9d0SAdam Hornáček</div>
980d40e9d0SAdam Hornáček<div id="Masthead">
990d40e9d0SAdam Hornáček    <%
1000d40e9d0SAdam Hornáček{
1010d40e9d0SAdam Hornáček    PageConfig cfg = PageConfig.get(request);
1020d40e9d0SAdam Hornáček    String path = cfg.getPath();
1030d40e9d0SAdam Hornáček    String context = request.getContextPath();
1040d40e9d0SAdam Hornáček    String rev = cfg.getRequestedRevision();
1050d40e9d0SAdam Hornáček
1060d40e9d0SAdam Hornáček    JSONArray messages = new JSONArray();
1070d40e9d0SAdam Hornáček    if (cfg.getProject() != null) {
1080d40e9d0SAdam Hornáček        messages = Util.messagesToJson(cfg.getProject(),
1090d40e9d0SAdam Hornáček                    RuntimeEnvironment.MESSAGES_MAIN_PAGE_TAG);
1100d40e9d0SAdam Hornáček    }
1110d40e9d0SAdam Hornáček    %>
1120d40e9d0SAdam Hornáček    <% if (!messages.isEmpty()) { %>
1130d40e9d0SAdam Hornáček    <span class="important-note">
1140d40e9d0SAdam Hornáček    <% } %>
1150d40e9d0SAdam Hornáček        <a href="<%= context + Prefix.XREF_P %>/">xref</a>: <%= Util
1160d40e9d0SAdam Hornáček        .breadcrumbPath(context + Prefix.XREF_P, path,'/',"",true,cfg.isDir()) %>
1170d40e9d0SAdam Hornáček        <% if (rev.length() != 0) { %>
1180d40e9d0SAdam Hornáček        (revision <%= Util.htmlize(rev) %>)
1190d40e9d0SAdam Hornáček        <% } %>
1200d40e9d0SAdam Hornáček    <span id="dtag">
1210d40e9d0SAdam Hornáček    <%
1220d40e9d0SAdam Hornáček    String dtag = cfg.getDefineTagsIndex();
1230d40e9d0SAdam Hornáček    if (dtag.length() > 0) {
1240d40e9d0SAdam Hornáček        %> (<%= dtag %>)<%
1250d40e9d0SAdam Hornáček    }
1260d40e9d0SAdam Hornáček    %></span>
1270d40e9d0SAdam Hornáček    <% if (!messages.isEmpty()) { %>
1280d40e9d0SAdam Hornáček    </span>
1290d40e9d0SAdam Hornáček    <span class="important-note important-note-rounded"
1300d40e9d0SAdam Hornáček          data-messages='<%= messages %>'>!</span>
1310d40e9d0SAdam Hornáček    <% }
1320d40e9d0SAdam Hornáček}
1330d40e9d0SAdam Hornáček%>
1340d40e9d0SAdam Hornáček</div>
1350d40e9d0SAdam Hornáček<%@
1360d40e9d0SAdam Hornáček
1370d40e9d0SAdam Hornáčekinclude file="minisearch.jspf"
1380d40e9d0SAdam Hornáček
1390d40e9d0SAdam Hornáček%>
1400d40e9d0SAdam Hornáček<%
1410d40e9d0SAdam Hornáček/* ---------------------- mast.jsp end --------------------- */
1420d40e9d0SAdam Hornáček%>
143