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