history.jsp revision c1c58b5091c3838b6024fe7a954ea0f01e7b046f
1N/A<%--
1N/A$Id$
1N/A
1N/ACDDL HEADER START
1N/A
1N/AThe contents of this file are subject to the terms of the
1N/ACommon Development and Distribution License (the "License").
1N/AYou may not use this file except in compliance with the License.
1N/A
1N/ASee LICENSE.txt included in this distribution for the specific
1N/Alanguage governing permissions and limitations under the License.
1N/A
1N/AWhen distributing Covered Code, include this CDDL HEADER in each
1N/Afile and include the License file at LICENSE.txt.
1N/AIf applicable, add the following below this CDDL HEADER, with the
1N/Afields enclosed by brackets "[]" replaced with your own identifying
1N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
1N/A
1N/ACDDL HEADER END
1N/A
1N/ACopyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
1N/A
1N/APortions Copyright 2011 Jens Elkner.
1N/A
1N/A--%><%@page import="
1N/Ajava.text.Format,
1N/Ajava.text.SimpleDateFormat,
1N/Ajava.util.Date,
1N/Ajava.util.Set,
1N/Ajava.util.regex.Pattern,
1N/A
1N/Aorg.opensolaris.opengrok.history.History,
1N/Aorg.opensolaris.opengrok.history.HistoryEntry,
1N/Aorg.opensolaris.opengrok.history.HistoryException,
1N/Aorg.opensolaris.opengrok.configuration.RuntimeEnvironment"
1N/A%><%@
1N/A
1N/Ainclude file="mast.jsp"
1N/A
1N/A%><%/* ---------------------- history.jsp start --------------------- */
1N/A{
1N/A PageConfig cfg = PageConfig.get(request);
1N/A String path = cfg.getPath();
1N/A
1N/A if (path.length() > 0) {
1N/A String context = request.getContextPath();
1N/A RuntimeEnvironment env = cfg.getEnv();
1N/A String uriEncodedName = cfg.getUriEncodedPath();
1N/A
1N/A boolean striked = false;
1N/A String userPage = env.getUserPage();
1N/A String userPageSuffix = env.getUserPageSuffix();
1N/A if (userPageSuffix == null) {
1N/A // Set to empty string so we can append it to the URL
1N/A // unconditionally later.
1N/A userPageSuffix = "";
1N/A }
1N/A String bugPage = env.getBugPage();
1N/A String bugRegex = env.getBugPattern();
1N/A if (bugRegex == null || bugRegex.equals("")) {
1N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
1N/A }
1N/A Pattern bugPattern = Pattern.compile(bugRegex);
1N/A String reviewPage = env.getReviewPage();
1N/A String reviewRegex = env.getReviewPattern();
1N/A if(reviewRegex == null || reviewRegex.equals("")) {
1N/A reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
1N/A }
1N/A Pattern reviewPattern = Pattern.compile(reviewRegex);
1N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
1N/A File f = cfg.getResourceFile();
1N/A History hist=null;
1N/A try {
1N/A hist = HistoryGuru.getInstance().getHistory(f);
1N/A } catch (Exception e) {
1N/A // should not happen
1N/A %><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
1N/A }
1N/A if (hist != null) {
1N/A%><script type="text/javascript">/* <![CDATA[ */
1N/Adocument.domReady.push(function() {domReadyHistory();});
1N/A/* ]]> */</script>
1N/A<form action="<%= context + Prefix.DIFF_P + uriEncodedName %>">
1N/A<table class="src" id="revisions">
1N/A <caption>History log of <a href="<%= context + Prefix.XREF_P
1N/A + uriEncodedName %>"><%= path %></a></caption>
1N/A <thead>
1N/A <tr>
1N/A <th>Revision <%
1N/A if (hist.hasTags()) {
1N/A %><a href="#" onclick="javascript: toggle_revtags(); return false;">
1N/A <span class="revtags-hidden">
1N/A (&lt;&lt;&lt; Hide revision tags)</span>
1N/A <span class="revtags">
1N/A (Show revision tags &gt;&gt;&gt;)</span></a><%
1N/A }
1N/A %></th><%
1N/A if (!cfg.isDir()) {
1N/A %>
1N/A <th><input type="submit" value=" Compare "/></th><%
1N/A }
1N/A %>
1N/A <th>Date</th>
1N/A <th>Author</th>
1N/A <th>Comments <%
1N/A if (hist.hasFileList()) {
1N/A %><a href="#" onclick="javascript: toggle_filelist(); return false;">
1N/A <div class="filelist-hidden">
1N/A (&lt;&lt;&lt; Hide modified files)</div>
1N/A <div class="filelist">
1N/A (Show modified files &gt;&gt;&gt;)</div></a><%
1N/A }
1N/A %>
1N/A </th>
1N/A </tr>
1N/A </thead>
1N/A <tbody>
1N/A <%
1N/A int count=0;
1N/A for (HistoryEntry entry : hist.getHistoryEntries()) {
1N/A String rev = entry.getRevision();
1N/A if (rev == null || rev.length() == 0) {
1N/A rev = "";
1N/A }
1N/A String tags = entry.getTags();
1N/A
1N/A if (tags != null) {
1N/A int colspan;
1N/A if (cfg.isDir())
1N/A colspan = 4;
1N/A else
1N/A colspan = 5;
1N/A %>
1N/A <tr class="revtags-hidden">
1N/A <td colspan="<%= colspan %>" class="revtags">
1N/A <b>Revision tags:</b> <%= tags %>
1N/A </td>
1N/A </tr><tr style="display: none;"></tr><%
1N/A }
1N/A %>
1N/A <tr><%
1N/A if (cfg.isDir()) {
1N/A %>
1N/A <td><%= rev %></td><%
1N/A } else {
1N/A if (entry.isActive()) {
1N/A String rp = uriEncodedName;
1N/A %>
1N/A <td><a href="<%= context + Prefix.HIST_L + rp %>#<%= rev %>"
1N/A title="link to revision line">#</a>
1N/A <a href="<%= context + Prefix.XREF_P + rp + "?r=" + Util.URIEncode(rev) %>"><%=
1N/A rev %></a></td>
1N/A <td>
1N/A <input type="radio"<%
1N/A if (count == 0 ) {
1N/A %> disabled="disabled"<%
1N/A } else if (count == 1) {
1N/A %> checked="checked"<%
1N/A }
1N/A %> name="r1" value="<%= path %>@<%= rev%>"/>
1N/A <input type="radio"
1N/A name="r2"<%
1N/A if (count == 0) {
1N/A %> checked="checked"<%
1N/A }
1N/A %> value="<%= path %>@<%= rev %>"/></td><%
1N/A } else {
1N/A striked = true;
1N/A %>
1N/A <td><del><%= rev %></del></td>
1N/A <td></td><%
1N/A }
1N/A }
1N/A %>
1N/A <td><%
1N/A Date date = entry.getDate();
1N/A if (date != null) {
1N/A %><%= df.format(date) %><%
1N/A }
1N/A %></td>
1N/A <td><%
1N/A String author = entry.getAuthor();
1N/A if (author == null) {
1N/A %>(no author)<%
1N/A } else if (userPage != null && userPage.length() > 0) {
1N/A String alink = Util.getEmail(author);
1N/A %><a href="<%= userPage + Util.htmlize(alink) + userPageSuffix
1N/A %>"><%= Util.htmlize(author)%></a><%
1N/A } else {
1N/A %><%= author %><%
1N/A }
1N/A %></td>
1N/A <td><a name="<%= rev %>"></a><p><%
1N/A String cout = Util.htmlize(entry.getMessage());
1N/A if (bugPage != null && bugPage.length() > 0) {
1N/A cout = bugPattern.matcher(cout).replaceAll("<a href=\""
1N/A + bugPage + "$1\">$1</a>");
1N/A }
1N/A if (reviewPage != null && reviewPage.length() > 0) {
1N/A cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
1N/A + reviewPage + "$1\">$1</a>");
1N/A }
1N/A %><%= cout %></p><%
1N/A Set<String> files = entry.getFiles();
1N/A if (files != null) {
1N/A %><div class="filelist-hidden"><br/><%
1N/A for (String ifile : files) {
1N/A String jfile = Util.stripPathPrefix(path, ifile);
1N/A if (rev == "") {
1N/A %>
1N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>"><%= jfile %></a><br/><%
1N/A } else {
1N/A %>
1N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>?r=<%= rev %>"><%= jfile %></a><br/><%
1N/A }
1N/A }
1N/A %></div><%
1N/A }
1N/A %></td>
1N/A </tr><%
1N/A count++;
1N/A }
1N/A %>
1N/A </tbody>
1N/A</table>
1N/A</form><%
1N/A if (striked) {
1N/A%><p><b>Note:</b> No associated file changes are available for
1N/Arevisions with strike-through numbers (eg. <del>1.45</del>)</p><%
1N/A }
1N/A%>
1N/A<p class="rssbadge"><a href="<%=context + Prefix.RSS_P + uriEncodedName
1N/A%>" title="RSS XML Feed of latest changes"><span id="rssi"></span></a></p><%
1N/A }
1N/A }
1N/A}
1N/A/* ---------------------- history.jsp end --------------------- */
1N/A%><%@
1N/A
1N/Ainclude file="foot.jspf"
1N/A
1N/A%>
1N/A