history.jsp revision 189
98N/A<%--
98N/ACDDL HEADER START
1123N/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 2005 Sun Microsystems, Inc. All rights reserved.
919N/AUse is subject to license terms.
919N/A
919N/Aident "@(#)history.jsp 1.1 05/11/11 SMI"
98N/A
98N/A--%><%@ page import = "javax.servlet.*,
98N/Ajava.lang.*,
98N/Ajavax.servlet.http.*,
810N/Ajava.util.*,
810N/Ajava.io.*,
810N/Ajava.text.*,
810N/Aorg.opensolaris.opengrok.analysis.*,
354N/Aorg.opensolaris.opengrok.web.*,
354N/Aorg.opensolaris.opengrok.history.*,
354N/Ajava.util.regex.*
354N/A"
354N/A%><%@include file="mast.jsp"%><%
354N/Aif (path.length() > 0 && valid) {
354N/A boolean striked = false;
354N/A String userPage = environment.getUserPage();
606N/A String bugPage = environment.getBugPage();
810N/A String bugRegex = environment.getBugPattern();
1123N/A if(bugRegex == null || bugRegex.equals("")) {
606N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
354N/A }
810N/A Pattern bugPattern = Pattern.compile(bugRegex);
824N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
810N/A Date tstart = new Date();
830N/A File f = new File(rawSource + path);
1026N/A HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
810N/A
1029N/A if (hr == null) {
1123N/A response.sendError(404, "No history");
1123N/A return;
1123N/A }
1123N/A
1123N/A%><form action="<%=context%>/diff<%=path%>">
810N/A<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
810N/A<tr>
810N/A <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
1123N/A</tr>
810N/A<tr class="thead">
851N/A <td>Revision</td><%
851N/A if (!isDir) {
810N/A %><th><input type="submit" value=" Compare "/></th><%
810N/A }
810N/A %><td>Date</td><td>Author</td><td>Comments</td>
810N/A</tr><%
810N/Aboolean alt = true;
851N/Awhile (hr.next()) {
810N/A String rev = hr.getRevision();
851N/A if (rev == null || rev.length() == 0) {
810N/A rev = "";
810N/A } else {
810N/A rev = Util.URIEncode(rev);
810N/A }
810N/A alt = !alt;
810N/A %><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
851N/A if (isDir) {
810N/A %><td>&nbsp;<%=rev%>&nbsp;</td><%
851N/A } else {
1010N/A if(hr.isActive()) {
851N/A String rp = ((hr.getSourceRootPath() == null) ? path : hr.getSourceRootPath().toString());
810N/A rp = Util.URIEncodePath(rp);
810N/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%>"/>
810N/A<input type="radio" name="r2" value="<%=rp%>@<%=rev%>"/></td><%
810N/A } else {
810N/A striked = true;
810N/A %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
810N/A }
1029N/A}
810N/A%><td><%= df.format(hr.getDate()) %>&nbsp;</td>
851N/A<td>
851N/A<%
851N/A
851N/Aif(userPage != null && ! userPage.equals("")) {
851N/A %><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
98N/A} else {
824N/A %><%= hr.getAuthor() %><%
98N/A}
98N/A
830N/A%>&nbsp;</td><td><%=
1026N/A(bugPage != null && ! bugPage.equals("")) ?
851N/A bugPattern.matcher(Util.Htmlize(hr.getComment())).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>")
824N/A : Util.Htmlize(hr.getComment())
571N/A%><%
98N/AList<String> files = hr.getFiles();
98N/Aif(files != null) {%><br/><%
98N/A for (String ifile : files) {
1029N/A String jfile = ifile;
1123N/A if ("/".equals(path)) {
1123N/A jfile = ifile.substring(1);
1123N/A } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
1123N/A jfile = ifile.substring(path.length()+1);
1123N/A }
341N/A if (rev == "") {
366N/A %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
354N/A } else {
425N/A %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%
325N/A }
456N/A }
577N/A}
325N/A%></td></tr><%
354N/A}
278N/A %></table></form><%
98N/A hr.close();
543N/A if(striked) {
98N/A %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
749N/A }
749N/A %><p class="rssbadge"><a href="<%=context%>/rss<%=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><%
98N/A}
151N/A%><%@include file="foot.jspf"%>
137N/A