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