history.jsp revision 1423
278N/A<%--
278N/A$Id$
278N/A
278N/ACDDL HEADER START
278N/A
278N/AThe contents of this file are subject to the terms of the
278N/ACommon Development and Distribution License (the "License").
278N/AYou may not use this file except in compliance with the License.
278N/A
278N/ASee LICENSE.txt included in this distribution for the specific
278N/Alanguage governing permissions and limitations under the License.
278N/A
278N/AWhen distributing Covered Code, include this CDDL HEADER in each
278N/Afile and include the License file at LICENSE.txt.
278N/AIf applicable, add the following below this CDDL HEADER, with the
278N/Afields enclosed by brackets "[]" replaced with your own identifying
278N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
278N/A
278N/ACDDL HEADER END
278N/A
1845N/ACopyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
278N/A
278N/APortions Copyright 2011, 2012 Jens Elkner.
278N/A
278N/A--%><%@page import="
278N/Ajava.text.Format,
278N/Ajava.text.SimpleDateFormat,
618N/Ajava.util.Date,
1258N/Ajava.util.Set,
278N/Ajava.util.regex.Pattern,
278N/A
278N/Aorg.opensolaris.opengrok.history.History,
278N/Aorg.opensolaris.opengrok.history.HistoryEntry,
278N/Aorg.opensolaris.opengrok.history.HistoryGuru,
278N/Aorg.opensolaris.opengrok.configuration.RuntimeEnvironment"
278N/A%><%@
278N/A
278N/Ainclude file="mast.jsp"
278N/A
278N/A%><%/* ---------------------- history.jsp start --------------------- */
278N/A{
1845N/A PageConfig cfg = PageConfig.get(request);
1845N/A String path = cfg.getPath();
1845N/A
278N/A if (path.length() > 0) {
278N/A String context = request.getContextPath();
278N/A RuntimeEnvironment env = cfg.getEnv();
278N/A String uriEncodedName = cfg.getUriEncodedPath();
278N/A
278N/A boolean striked = false;
278N/A String userPage = env.getUserPage();
278N/A String userPageSuffix = env.getUserPageSuffix();
278N/A if (userPageSuffix == null) {
278N/A // Set to empty string so we can append it to the URL
278N/A // unconditionally later.
278N/A userPageSuffix = "";
278N/A }
278N/A String bugPage = env.getBugPage();
278N/A String bugRegex = env.getBugPattern();
278N/A if (bugRegex == null || bugRegex.equals("")) {
278N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
278N/A }
Pattern bugPattern = Pattern.compile(bugRegex);
String reviewPage = env.getReviewPage();
String reviewRegex = env.getReviewPattern();
if(reviewRegex == null || reviewRegex.equals("")) {
reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
}
Pattern reviewPattern = Pattern.compile(reviewRegex);
Format df = new SimpleDateFormat("dd-MMM-yyyy");
History hist=null;
try {
hist = HistoryGuru.getInstance().getHistory(cfg.getResourceFile());
} catch (Exception e) {
// should not happen
%><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
}
if (hist != null) {
%><script type="text/javascript">/* <![CDATA[ */
O.hasFileList=<%= hist.hasFileList() %>;
O.domReady.push(O.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</th><%
if (!cfg.isDir()) {
%>
<th><button type="submit">Compare</button></th><%
}
%>
<th>Date</th>
<th>Author</th>
<th>Comments <a href="#"><span id="expand"></span> Expand </a></th>
</tr>
</thead>
<tbody>
<%
int count=0;
String subdir = path;
if (!subdir.endsWith("/")) {
int idx = subdir.lastIndexOf('/');
assert(idx != 0);
subdir = subdir.substring(0, idx+1);
}
for (HistoryEntry entry : hist.getHistoryEntries()) {
String rev = entry.getRevision();
String encodedRev;
if (rev == null || rev.length() == 0) {
rev = "";
encodedRev = "";
} else {
encodedRev = "?r=" + Util.URIEncode(rev);
}
%>
<tr><%
if (cfg.isDir()) {
%>
<td><%= rev %></td><%
} else if (entry.isActive()) {
String rp = uriEncodedName;
%>
<td><a name="<%= rev %>" href="<%=
context + Prefix.XREF_P + rp + encodedRev %>"><%= rev %></a></td>
<td>
<input type="radio"<%
if (count == 0 ) {
%> disabled="disabled"<%
} else if (count == 1) {
%> checked="checked"<%
}
%> name="r1" value="<%= rp %>@<%= rev %>"/>
<input type="radio"
name="r2"<%
if (count == 0) {
%> checked="checked"<%
}
%> value="<%= rp %>@<%= 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><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 style='display: none'><%
for (String ifile : files) {
String jfile = ifile;
if (ifile.startsWith(subdir)
&& ifile.length() > subdir.length())
{
jfile = ifile.substring(subdir.length());
}
%>
<a class="revh" href="<%= context + Prefix.XREF_P + ifile + encodedRev
%>"><%= jfile %></a><%
}
%></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"
%>