history.jsp revision f55049a9dfaebece0d2318396299917eb3f571cf
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<%--
c92c50783e4e93699f2a42643b8f200b9b719c87Automatic UpdaterCDDL HEADER START
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsThe contents of this file are subject to the terms of the
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic UpdaterCommon Development and Distribution License (the "License").
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsYou may not use this file except in compliance with the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsSee LICENSE.txt included in this distribution for the specific
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewslanguage governing permissions and limitations under the License.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsWhen distributing Covered Code, include this CDDL HEADER in each
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfile and include the License file at LICENSE.txt.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsIf applicable, add the following below this CDDL HEADER, with the
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsfields enclosed by brackets "[]" replaced with your own identifying
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsinformation: Portions Copyright [yyyy] [name of copyright owner]
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox UserCDDL HEADER END
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsCopyright 2005 Sun Microsystems, Inc. All rights reserved.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsUse is subject to license terms.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
e21a2904f02a03fa06b6db04d348f65fe9c67b2bMark Andrewsident "@(#)history.jsp 1.1 05/11/11 SMI"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews--%><%@ page import = "javax.servlet.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsjava.lang.*,
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updaterjavax.servlet.http.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsjava.util.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsjava.io.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsjava.text.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsorg.opensolaris.opengrok.analysis.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsorg.opensolaris.opengrok.web.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsorg.opensolaris.opengrok.history.*,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsjava.util.regex.*
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><%@include file="mast.jsp"%><%
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updaterif (path.length() > 0 && valid) {
9b469e3c59015b1a4899c9d8395168126fe094fdAutomatic Updater boolean striked = false;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String userPage = environment.getUserPage();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String bugPage = environment.getBugPage();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String bugRegex = environment.getBugPattern();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if(bugRegex == null || bugRegex.equals("")) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews bugRegex = "\\b([12456789][0-9]{6})\\b";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews Pattern bugPattern = Pattern.compile(bugRegex);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews Format df = new SimpleDateFormat("dd-MMM-yyyy");
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews Date tstart = new Date();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews File f = new File(rawSource + path);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (hr == null) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews response.sendError(404, "No history");
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews return;
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><form action="<%=context%>/diff<%=path%>">
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<tr>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews</tr>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<tr class="thead">
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews <td>Revision</td><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (!isDir) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><th><input type="submit" value=" Compare "/></th><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><td>Date</td><td>Author</td><td>Comments</td>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews</tr><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsboolean alt = true;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewswhile (hr.next()) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String rev = hr.getRevision();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (rev == null || rev.length() == 0) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews rev = "";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews rev = Util.URIEncode(rev);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews alt = !alt;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (isDir) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><td>&nbsp;<%=rev%>&nbsp;</td><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if(hr.isActive()) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String rp = ((hr.getSourceRootPath() == null) ? path : hr.getSourceRootPath().toString());
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews rp = Util.URIEncodePath(rp);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><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%>"/>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<input type="radio" name="r2" value="<%=rp%>@<%=rev%>"/></td><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews striked = true;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><td><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews Date date = hr.getDate();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (date != null) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><%=df.format(date)%><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %>&nbsp;<%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%>&nbsp;</td>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<td>
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews<%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsif(userPage != null && ! userPage.equals("")) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews} else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><%= hr.getAuthor() %><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%>&nbsp;</td><td><%=
f6da30bb5447c23d880b09f601441e70c5313557Mark Andrews(bugPage != null && ! bugPage.equals("")) ?
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews bugPattern.matcher(Util.Htmlize(hr.getComment())).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>")
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews : Util.Htmlize(hr.getComment())
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark AndrewsList<String> files = hr.getFiles();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsif(files != null) {%><br/><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews for (String ifile : files) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews String jfile = ifile;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if ("/".equals(path)) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews jfile = ifile.substring(1);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews jfile = ifile.substring(path.length()+1);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (rev == "") {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews } else {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%></td></tr><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %></table></form><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews hr.close();
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if(striked) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews }
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews %><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><%
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews}
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews%><%@include file="foot.jspf"%>
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User