history.jsp revision 1281
98N/A<%--
98N/A$Id$
98N/A
98N/ACDDL HEADER START
1265N/A
98N/AThe contents of this file are subject to the terms of the
98N/ACommon Development and Distribution License (the "License").
919N/AYou may not use this file except in compliance with the License.
919N/A
919N/ASee LICENSE.txt included in this distribution for the specific
919N/Alanguage governing permissions and limitations under the License.
919N/A
919N/AWhen distributing Covered Code, include this CDDL HEADER in each
919N/Afile and include the License file at LICENSE.txt.
919N/AIf applicable, add the following below this CDDL HEADER, with the
919N/Afields enclosed by brackets "[]" replaced with your own identifying
919N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
919N/A
919N/ACDDL HEADER END
919N/A
919N/ACopyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
919N/A
919N/APortions Copyright 2011 Jens Elkner.
919N/A
98N/A--%><%@page import="
98N/Ajava.text.Format,
98N/Ajava.text.SimpleDateFormat,
98N/Ajava.util.Date,
493N/Ajava.util.Set,
98N/Ajava.util.regex.Pattern,
98N/A
1333N/Aorg.opensolaris.opengrok.history.History,
98N/Aorg.opensolaris.opengrok.history.HistoryEntry,
911N/Aorg.opensolaris.opengrok.history.HistoryException,
1333N/Aorg.opensolaris.opengrok.configuration.RuntimeEnvironment"
1333N/A%><%@
1333N/A
911N/Ainclude file="mast.jsp"
98N/A
1178N/A%><%/* ---------------------- history.jsp start --------------------- */
1124N/A{
817N/A PageConfig cfg = PageConfig.get(request);
98N/A String path = cfg.getPath();
98N/A
493N/A if (path.length() > 0) {
98N/A String context = request.getContextPath();
98N/A RuntimeEnvironment env = cfg.getEnv();
493N/A String uriEncodedName = cfg.getUriEncodedPath();
98N/A
910N/A boolean striked = false;
910N/A String userPage = env.getUserPage();
910N/A String userPageSuffix = env.getUserPageSuffix();
1333N/A if (userPageSuffix == null) {
1333N/A // Set to empty string so we can append it to the URL
1333N/A // unconditionally later.
1333N/A userPageSuffix = "";
98N/A }
98N/A String bugPage = env.getBugPage();
998N/A String bugRegex = env.getBugPattern();
998N/A if (bugRegex == null || bugRegex.equals("")) {
998N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
998N/A }
998N/A Pattern bugPattern = Pattern.compile(bugRegex);
98N/A String reviewPage = env.getReviewPage();
998N/A String reviewRegex = env.getReviewPattern();
998N/A if(reviewRegex == null || reviewRegex.equals("")) {
998N/A reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
}
Pattern reviewPattern = Pattern.compile(reviewRegex);
Format df = new SimpleDateFormat("dd-MMM-yyyy");
File f = cfg.getResourceFile();
History hist=null;
try {
hist = HistoryGuru.getInstance().getHistory(f);
} catch (Exception e) {
// should not happen
%><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</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;">
<span class="filelist-hidden">
(&lt;&lt;&lt; Hide modified files)</span>
<span class="filelist">
(Show modified files &gt;&gt;&gt;)</span></a><%
}
%>
</th>
</tr>
</thead>
<tbody>
<%
int count=0;
for (HistoryEntry entry : hist.getHistoryEntries()) {
String rev = entry.getRevision();
if (rev == null || rev.length() == 0) {
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 + "?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="<%= 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) {
%><a href="<%= userPage + Util.htmlize(author) + userPageSuffix
%>"><%= Util.htmlize(author)%></a><%
} else {
%><%= author %><%
}
%></td>
<td><%
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 %><%
Set<String> files = entry.getFiles();
if (files != null) {
%><span class="filelist-hidden"><br/><%
for (String ifile : files) {
String jfile = ifile;
if ("/".equals(path)) {
jfile = ifile.substring(1);
} else if (ifile.startsWith(path)
&& ifile.length() > (path.length() + 1))
{
jfile = ifile.substring(path.length() + 1);
}
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/><%
}
}
%></span><%
}
%></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"
%>