history.jsp revision 218
5205N/A<%--
5205N/ACDDL HEADER START
5205N/A
5205N/AThe contents of this file are subject to the terms of the
5205N/ACommon Development and Distribution License (the "License").
5205N/AYou may not use this file except in compliance with the License.
5205N/A
5205N/ASee LICENSE.txt included in this distribution for the specific
5205N/Alanguage governing permissions and limitations under the License.
5205N/A
5205N/AWhen distributing Covered Code, include this CDDL HEADER in each
5205N/Afile and include the License file at LICENSE.txt.
5205N/AIf applicable, add the following below this CDDL HEADER, with the
5205N/Afields enclosed by brackets "[]" replaced with your own identifying
5205N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
5205N/A
5205N/ACDDL HEADER END
5205N/A
5205N/ACopyright 2005 Sun Microsystems, Inc. All rights reserved.
5205N/AUse is subject to license terms.
5205N/A
5205N/Aident "@(#)history.jsp 1.1 05/11/11 SMI"
5205N/A
5205N/A--%><%@ page import = "javax.servlet.*,
5205N/Ajava.lang.*,
6208N/Ajavax.servlet.http.*,
5205N/Ajava.util.*,
5205N/Ajava.io.*,
5205N/Ajava.text.*,
5205N/Aorg.opensolaris.opengrok.analysis.*,
5205N/Aorg.opensolaris.opengrok.web.*,
5205N/Aorg.opensolaris.opengrok.history.*,
5205N/Ajava.util.regex.*
5205N/A"
5205N/A%><%@include file="mast.jsp"%><%
5205N/Aif (path.length() > 0 && valid) {
5205N/A boolean striked = false;
5205N/A String userPage = environment.getUserPage();
5205N/A String bugPage = environment.getBugPage();
5205N/A String bugRegex = environment.getBugPattern();
5205N/A if(bugRegex == null || bugRegex.equals("")) {
5205N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
5205N/A }
5205N/A Pattern bugPattern = Pattern.compile(bugRegex);
5205N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
5205N/A Date tstart = new Date();
5205N/A File f = new File(rawSource + path);
5205N/A HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
5205N/A
5205N/A if (hr == null) {
5205N/A response.sendError(404, "No history");
5205N/A return;
5205N/A }
5205N/A
5205N/A%><form action="<%=context%>/diff<%=path%>">
5205N/A<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
5205N/A<tr>
5205N/A <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
5205N/A</tr>
5205N/A<tr class="thead">
5205N/A <td>Revision</td><%
5205N/A if (!isDir) {
5205N/A %><th><input type="submit" value=" Compare "/></th><%
5205N/A }
5205N/A %><td>Date</td><td>Author</td><td>Comments</td>
5205N/A</tr><%
5205N/Aboolean alt = true;
5205N/Awhile (hr.next()) {
5205N/A String rev = hr.getRevision();
5205N/A if (rev == null || rev.length() == 0) {
5205N/A rev = "";
5205N/A } else {
5205N/A rev = Util.URIEncode(rev);
5205N/A }
5205N/A alt = !alt;
5205N/A %><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
5205N/A if (isDir) {
5205N/A %><td>&nbsp;<%=rev%>&nbsp;</td><%
5205N/A } else {
5205N/A if(hr.isActive()) {
5205N/A String rp = ((hr.getSourceRootPath() == null) ? path : hr.getSourceRootPath().toString());
5205N/A rp = Util.URIEncodePath(rp);
5205N/A%><td>&nbsp;<a name="<%=rev%>" href="<%= context +"/xref" + rp + "?r=" + rev %>"><%=rev%></a>&nbsp;</td><td align="center"><input type="radio" name="r1" value="<%=rp%>@<%=rev%>"/>
5205N/A<input type="radio" name="r2" value="<%=rp%>@<%=rev%>"/></td><%
5205N/A } else {
5205N/A striked = true;
5205N/A %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
5205N/A }
5205N/A}
5205N/A%><td><%
5205N/A Date date = hr.getDate();
5205N/A if (date != null) {
5205N/A %><%=df.format(date)%><%
5205N/A } else {
5205N/A %>&nbsp;<%
5205N/A }
5205N/A%>&nbsp;</td>
5205N/A<td>
5205N/A<%
5205N/A
5205N/Aif(userPage != null && ! userPage.equals("")) {
5205N/A %><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
5205N/A} else {
5205N/A %><%= hr.getAuthor() %><%
5205N/A}
5205N/A
5205N/A%>&nbsp;</td><td><%=
5205N/A(bugPage != null && ! bugPage.equals("")) ?
5205N/A bugPattern.matcher(Util.Htmlize(hr.getComment())).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>")
5205N/A : Util.Htmlize(hr.getComment())
5205N/A%><%
5205N/AList<String> files = hr.getFiles();
5205N/Aif(files != null) {%><br/><%
5205N/A for (String ifile : files) {
5205N/A String jfile = ifile;
5205N/A if ("/".equals(path)) {
5205N/A jfile = ifile.substring(1);
5205N/A } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
5205N/A jfile = ifile.substring(path.length()+1);
5205N/A }
5205N/A if (rev == "") {
6208N/A %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
5205N/A } else {
5205N/A %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%
}
}
}
%></td></tr><%
}
%></table></form><%
hr.close();
if(striked) {
%><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
}
%><p class="rssbadge"><a href="<%=context%>/rss<%=Util.URIEncodePath(path)%>"><img src="<%=context%>/<%=environment.getWebappLAF()%>/img/rss.png" width="80" height="15" alt="RSS XML Feed" title="RSS XML Feed of latest changes"/></a></p><%
}
%><%@include file="foot.jspf"%>