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