xref: /OpenGrok/opengrok-web/src/main/webapp/mast.jsp (revision 0d40e9d0d07acb46ebe450cbc6042a9705a36e41)
1*0d40e9d0SAdam Hornáček<%--
2*0d40e9d0SAdam Hornáček$Id$
3*0d40e9d0SAdam Hornáček
4*0d40e9d0SAdam HornáčekCDDL HEADER START
5*0d40e9d0SAdam Hornáček
6*0d40e9d0SAdam HornáčekThe contents of this file are subject to the terms of the
7*0d40e9d0SAdam HornáčekCommon Development and Distribution License (the "License").
8*0d40e9d0SAdam HornáčekYou may not use this file except in compliance with the License.
9*0d40e9d0SAdam Hornáček
10*0d40e9d0SAdam HornáčekSee LICENSE.txt included in this distribution for the specific
11*0d40e9d0SAdam Hornáčeklanguage governing permissions and limitations under the License.
12*0d40e9d0SAdam Hornáček
13*0d40e9d0SAdam HornáčekWhen distributing Covered Code, include this CDDL HEADER in each
14*0d40e9d0SAdam Hornáčekfile and include the License file at LICENSE.txt.
15*0d40e9d0SAdam HornáčekIf applicable, add the following below this CDDL HEADER, with the
16*0d40e9d0SAdam Hornáčekfields enclosed by brackets "[]" replaced with your own identifying
17*0d40e9d0SAdam Hornáčekinformation: Portions Copyright [yyyy] [name of copyright owner]
18*0d40e9d0SAdam Hornáček
19*0d40e9d0SAdam HornáčekCDDL HEADER END
20*0d40e9d0SAdam Hornáček
21*0d40e9d0SAdam HornáčekCopyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
22*0d40e9d0SAdam HornáčekPortions Copyright 2011 Jens Elkner.
23*0d40e9d0SAdam Hornáček
24*0d40e9d0SAdam Hornáček--%><%--
25*0d40e9d0SAdam Hornáček
26*0d40e9d0SAdam HornáčekAfter include you are here: /body/div#page/div#content/
27*0d40e9d0SAdam Hornáček
28*0d40e9d0SAdam Hornáček--%>
29*0d40e9d0SAdam Hornáček<%@page import="org.json.simple.JSONArray"%>
30*0d40e9d0SAdam Hornáček<%@page import="org.opensolaris.opengrok.configuration.messages.Message"%>
31*0d40e9d0SAdam Hornáček<%@page import="java.util.SortedSet"%>
32*0d40e9d0SAdam Hornáček<%@page import="org.opensolaris.opengrok.configuration.RuntimeEnvironment"%>
33*0d40e9d0SAdam Hornáček<%@ page session="false" errorPage="error.jsp" import="
34*0d40e9d0SAdam Hornáčekjava.io.File,
35*0d40e9d0SAdam Hornáčekjava.io.IOException,
36*0d40e9d0SAdam Hornáček
37*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.configuration.Project,
38*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.history.HistoryGuru,
39*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.web.EftarFileReader,
40*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.web.PageConfig,
41*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.web.Prefix,
42*0d40e9d0SAdam Hornáčekorg.opensolaris.opengrok.web.Util"%><%
43*0d40e9d0SAdam Hornáček/* ---------------------- mast.jsp start --------------------- */
44*0d40e9d0SAdam Hornáček{
45*0d40e9d0SAdam Hornáček    PageConfig cfg = PageConfig.get(request);
46*0d40e9d0SAdam Hornáček    String redir = cfg.canProcess();
47*0d40e9d0SAdam Hornáček    if (redir == null || redir.length() > 0) {
48*0d40e9d0SAdam Hornáček        if (redir == null) {
49*0d40e9d0SAdam Hornáček            response.sendError(HttpServletResponse.SC_NOT_FOUND);
50*0d40e9d0SAdam Hornáček        } else {
51*0d40e9d0SAdam Hornáček            response.sendRedirect(redir);
52*0d40e9d0SAdam Hornáček        }
53*0d40e9d0SAdam Hornáček        return;
54*0d40e9d0SAdam Hornáček    }
55*0d40e9d0SAdam Hornáček
56*0d40e9d0SAdam Hornáček    // jel: hmmm - questionable for dynamic content
57*0d40e9d0SAdam Hornáček    long flast = cfg.getLastModified();
58*0d40e9d0SAdam Hornáček    if (request.getDateHeader("If-Modified-Since") >= flast) {
59*0d40e9d0SAdam Hornáček        response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
60*0d40e9d0SAdam Hornáček        return;
61*0d40e9d0SAdam Hornáček    }
62*0d40e9d0SAdam Hornáček    response.setDateHeader("Last-Modified", flast);
63*0d40e9d0SAdam Hornáček
64*0d40e9d0SAdam Hornáček    // Use UTF-8 if no encoding is specified in the request
65*0d40e9d0SAdam Hornáček    if (request.getCharacterEncoding() == null) {
66*0d40e9d0SAdam Hornáček        request.setCharacterEncoding("UTF-8");
67*0d40e9d0SAdam Hornáček    }
68*0d40e9d0SAdam Hornáček
69*0d40e9d0SAdam Hornáček    // set the default page title
70*0d40e9d0SAdam Hornáček    String path = cfg.getPath();
71*0d40e9d0SAdam Hornáček    cfg.setTitle(cfg.getPathTitle());
72*0d40e9d0SAdam Hornáček
73*0d40e9d0SAdam Hornáček    String context = request.getContextPath();
74*0d40e9d0SAdam Hornáček    cfg.getEnv().setUrlPrefix(context + Prefix.SEARCH_R + "?");
75*0d40e9d0SAdam Hornáček}
76*0d40e9d0SAdam Hornáček%>
77*0d40e9d0SAdam Hornáček<%@
78*0d40e9d0SAdam Hornáček
79*0d40e9d0SAdam Hornáčekinclude file="httpheader.jspf"
80*0d40e9d0SAdam Hornáček
81*0d40e9d0SAdam Hornáček        %><body>
82*0d40e9d0SAdam Hornáček<script type="text/javascript">/* <![CDATA[ */
83*0d40e9d0SAdam Hornáček    document.rev = function() { return getParameter("r"); };
84*0d40e9d0SAdam Hornáček    document.annotate = <%= PageConfig.get(request).annotate() %>;
85*0d40e9d0SAdam Hornáček    document.domReady.push(function() { domReadyMast(); });
86*0d40e9d0SAdam Hornáček    document.pageReady.push(function() { pageReadyMast(); });
87*0d40e9d0SAdam Hornáček/* ]]> */</script>
88*0d40e9d0SAdam Hornáček<div id="page">
89*0d40e9d0SAdam Hornáček    <div id="whole_header">
90*0d40e9d0SAdam Hornáček<div id="header"><%@
91*0d40e9d0SAdam Hornáček
92*0d40e9d0SAdam Hornáčekinclude file="pageheader.jspf"
93*0d40e9d0SAdam Hornáček
94*0d40e9d0SAdam Hornáček%>
95*0d40e9d0SAdam Hornáček</div>
96*0d40e9d0SAdam Hornáček<div id="Masthead">
97*0d40e9d0SAdam Hornáček    <%
98*0d40e9d0SAdam Hornáček{
99*0d40e9d0SAdam Hornáček    PageConfig cfg = PageConfig.get(request);
100*0d40e9d0SAdam Hornáček    String path = cfg.getPath();
101*0d40e9d0SAdam Hornáček    String context = request.getContextPath();
102*0d40e9d0SAdam Hornáček    String rev = cfg.getRequestedRevision();
103*0d40e9d0SAdam Hornáček
104*0d40e9d0SAdam Hornáček    JSONArray messages = new JSONArray();
105*0d40e9d0SAdam Hornáček    if (cfg.getProject() != null) {
106*0d40e9d0SAdam Hornáček        messages = Util.messagesToJson(cfg.getProject(),
107*0d40e9d0SAdam Hornáček                    RuntimeEnvironment.MESSAGES_MAIN_PAGE_TAG);
108*0d40e9d0SAdam Hornáček    }
109*0d40e9d0SAdam Hornáček    %>
110*0d40e9d0SAdam Hornáček    <% if (!messages.isEmpty()) { %>
111*0d40e9d0SAdam Hornáček    <span class="important-note">
112*0d40e9d0SAdam Hornáček    <% } %>
113*0d40e9d0SAdam Hornáček        <a href="<%= context + Prefix.XREF_P %>/">xref</a>: <%= Util
114*0d40e9d0SAdam Hornáček        .breadcrumbPath(context + Prefix.XREF_P, path,'/',"",true,cfg.isDir()) %>
115*0d40e9d0SAdam Hornáček        <% if (rev.length() != 0) { %>
116*0d40e9d0SAdam Hornáček        (revision <%= Util.htmlize(rev) %>)
117*0d40e9d0SAdam Hornáček        <% } %>
118*0d40e9d0SAdam Hornáček    <span id="dtag">
119*0d40e9d0SAdam Hornáček    <%
120*0d40e9d0SAdam Hornáček    String dtag = cfg.getDefineTagsIndex();
121*0d40e9d0SAdam Hornáček    if (dtag.length() > 0) {
122*0d40e9d0SAdam Hornáček        %> (<%= dtag %>)<%
123*0d40e9d0SAdam Hornáček    }
124*0d40e9d0SAdam Hornáček    %></span>
125*0d40e9d0SAdam Hornáček    <% if (!messages.isEmpty()) { %>
126*0d40e9d0SAdam Hornáček    </span>
127*0d40e9d0SAdam Hornáček    <span class="important-note important-note-rounded"
128*0d40e9d0SAdam Hornáček          data-messages='<%= messages %>'>!</span>
129*0d40e9d0SAdam Hornáček    <% }
130*0d40e9d0SAdam Hornáček}
131*0d40e9d0SAdam Hornáček%>
132*0d40e9d0SAdam Hornáček</div>
133*0d40e9d0SAdam Hornáček<%@
134*0d40e9d0SAdam Hornáček
135*0d40e9d0SAdam Hornáčekinclude file="minisearch.jspf"
136*0d40e9d0SAdam Hornáček
137*0d40e9d0SAdam Hornáček%>
138*0d40e9d0SAdam Hornáček<%
139*0d40e9d0SAdam Hornáček/* ---------------------- mast.jsp end --------------------- */
140*0d40e9d0SAdam Hornáček%>
141