history.jsp revision 57065c0b4d57ca1e0182adda16962b22987a5b95
6ae232055d4d8a97267517c5e50074c2c819941and<%--
6ae232055d4d8a97267517c5e50074c2c819941andCDDL HEADER START
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd
fd9abdda70912b99b24e3bf1a38f26fde908a74cndThe contents of this file are subject to the terms of the
fd9abdda70912b99b24e3bf1a38f26fde908a74cndCommon Development and Distribution License (the "License").
6ae232055d4d8a97267517c5e50074c2c819941andYou may not use this file except in compliance with the License.
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andSee LICENSE.txt included in this distribution for the specific
6ae232055d4d8a97267517c5e50074c2c819941andlanguage governing permissions and limitations under the License.
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc
6ae232055d4d8a97267517c5e50074c2c819941andWhen distributing Covered Code, include this CDDL HEADER in each
6ae232055d4d8a97267517c5e50074c2c819941andfile and include the License file at LICENSE.txt.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowenIf applicable, add the following below this CDDL HEADER, with the
2e545ce2450a9953665f701bb05350f0d3f26275ndfields enclosed by brackets "[]" replaced with your own identifying
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erboweninformation: Portions Copyright [yyyy] [name of copyright owner]
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
6ae232055d4d8a97267517c5e50074c2c819941andCDDL HEADER END
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andCopyright 2005 Sun Microsystems, Inc. All rights reserved.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowenUse is subject to license terms.
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
6ae232055d4d8a97267517c5e50074c2c819941andident "@(#)history.jsp 1.1 05/11/11 SMI"
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and--%><%@ page import = "javax.servlet.*,
b43f840409794ed298e8634f6284741f193b6c4ftakashijava.lang.*,
6ae232055d4d8a97267517c5e50074c2c819941andjavax.servlet.http.*,
6ae232055d4d8a97267517c5e50074c2c819941andjava.util.*,
6ae232055d4d8a97267517c5e50074c2c819941andjava.io.*,
b43f840409794ed298e8634f6284741f193b6c4ftakashijava.text.*,
11495c9f0bd33e51a25b4d532beadfbcf9b944a3nilgunorg.opensolaris.opengrok.analysis.*,
6ae232055d4d8a97267517c5e50074c2c819941andorg.opensolaris.opengrok.web.*,
1ac39787115a288f5e848344b1b1e8dccb1c58f1ndorg.opensolaris.opengrok.history.*,
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjungjava.util.regex.*
6ae232055d4d8a97267517c5e50074c2c819941and"
b43f840409794ed298e8634f6284741f193b6c4ftakashi%><%@include file="mast.jsp"%><%
b43f840409794ed298e8634f6284741f193b6c4ftakashiif (path.length() > 0 && valid) {
b43f840409794ed298e8634f6284741f193b6c4ftakashi boolean striked = false;
b43f840409794ed298e8634f6284741f193b6c4ftakashi String userPage = environment.getUserPage();
6ae232055d4d8a97267517c5e50074c2c819941and String bugPage = environment.getBugPage();
6ae232055d4d8a97267517c5e50074c2c819941and String bugRegex = environment.getBugPattern();
6ae232055d4d8a97267517c5e50074c2c819941and if(bugRegex == null || bugRegex.equals("")) {
6ae232055d4d8a97267517c5e50074c2c819941and bugRegex = "\\b([12456789][0-9]{6})\\b";
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and Pattern bugPattern = Pattern.compile(bugRegex);
6ae232055d4d8a97267517c5e50074c2c819941and String reviewPage = environment.getReviewPage();
6ae232055d4d8a97267517c5e50074c2c819941and String reviewRegex = environment.getReviewPattern();
6ae232055d4d8a97267517c5e50074c2c819941and if(reviewRegex == null || reviewRegex.equals("")) {
6ae232055d4d8a97267517c5e50074c2c819941and reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and Pattern reviewPattern = Pattern.compile(reviewRegex);
6ae232055d4d8a97267517c5e50074c2c819941and Format df = new SimpleDateFormat("dd-MMM-yyyy");
6ae232055d4d8a97267517c5e50074c2c819941and Date tstart = new Date();
6ae232055d4d8a97267517c5e50074c2c819941and File f = new File(rawSource + path);
6ae232055d4d8a97267517c5e50074c2c819941and if (!HistoryGuru.getInstance().hasHistory(f)) {
6ae232055d4d8a97267517c5e50074c2c819941and response.sendError(404, "No history");
6ae232055d4d8a97267517c5e50074c2c819941and return;
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and if (hr == null) {
6ae232055d4d8a97267517c5e50074c2c819941and response.sendError(404, "No history");
6ae232055d4d8a97267517c5e50074c2c819941and return;
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and%><form action="<%=context%>/diff<%=path%>">
6ae232055d4d8a97267517c5e50074c2c819941and<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
6ae232055d4d8a97267517c5e50074c2c819941and<tr>
6ae232055d4d8a97267517c5e50074c2c819941and <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar</tr>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<tr class="thead">
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar <td>Revision</td><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar if (!isDir) {
6ae232055d4d8a97267517c5e50074c2c819941and %><th><input type="submit" value=" Compare "/></th><%
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and %><td>Date</td><td>Author</td><td>Comments</td>
6ae232055d4d8a97267517c5e50074c2c819941and</tr><%
6ae232055d4d8a97267517c5e50074c2c819941andboolean alt = true;
6ae232055d4d8a97267517c5e50074c2c819941andwhile (hr.next()) {
6ae232055d4d8a97267517c5e50074c2c819941and String rev = hr.getRevision();
6ae232055d4d8a97267517c5e50074c2c819941and if (rev == null || rev.length() == 0) {
6ae232055d4d8a97267517c5e50074c2c819941and rev = "";
6ae232055d4d8a97267517c5e50074c2c819941and }
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar alt = !alt;
6ae232055d4d8a97267517c5e50074c2c819941and %><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
6ae232055d4d8a97267517c5e50074c2c819941and if (isDir) {
6ae232055d4d8a97267517c5e50074c2c819941and %><td>&nbsp;<%=rev%>&nbsp;</td><%
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh } else {
6ae232055d4d8a97267517c5e50074c2c819941and if(hr.isActive()) {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar String rp = Util.URIEncodePath(path);
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar%><td>&nbsp;<a name="<%=rev%>" href="<%= context +"/xref" + rp + "?r=" + Util.URIEncode(rev) %>"><%=rev%></a>&nbsp;</td><td align="center"><input type="radio" name="r1" value="<%=rp%>@<%=rev%>"/>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<input type="radio" name="r2" value="<%=rp%>@<%=rev%>"/></td><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar } else {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar striked = true;
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar }
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar}
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar%><td><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar Date date = hr.getDate();
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar if (date != null) {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar %><%=df.format(date)%><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar } else {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar %>&nbsp;<%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar }
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar%>&nbsp;</td>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<td>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarif(userPage != null && ! userPage.equals("")) {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar %><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar} else {
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar %><%= hr.getAuthor() %><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar}
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar%>&nbsp;</td><td><%
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarString cout=Util.htmlize(hr.getComment());
1f1b6bf13313fdd14a45e52e553d3ff28689b717coarif (bugPage != null && ! bugPage.equals("")){
6ae232055d4d8a97267517c5e50074c2c819941and cout=bugPattern.matcher(cout).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>"); }
6ae232055d4d8a97267517c5e50074c2c819941andif (reviewPage != null && ! reviewPage.equals("")) {
6ae232055d4d8a97267517c5e50074c2c819941and cout=reviewPattern.matcher(cout).replaceAll("<a href=\"" + reviewPage + "$1\">$1</a>"); }
6ae232055d4d8a97267517c5e50074c2c819941and %><%= cout %>
6ae232055d4d8a97267517c5e50074c2c819941and<%
6ae232055d4d8a97267517c5e50074c2c819941andSet<String> files = hr.getFiles();
6ae232055d4d8a97267517c5e50074c2c819941andif(files != null) {%><br/><%
6ae232055d4d8a97267517c5e50074c2c819941and for (String ifile : files) {
6ae232055d4d8a97267517c5e50074c2c819941and String jfile = ifile;
6ae232055d4d8a97267517c5e50074c2c819941and if ("/".equals(path)) {
6ae232055d4d8a97267517c5e50074c2c819941and jfile = ifile.substring(1);
6ae232055d4d8a97267517c5e50074c2c819941and } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
6ae232055d4d8a97267517c5e50074c2c819941and jfile = ifile.substring(path.length()+1);
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and if (rev == "") {
6ae232055d4d8a97267517c5e50074c2c819941and %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
6ae232055d4d8a97267517c5e50074c2c819941and } else {
6ae232055d4d8a97267517c5e50074c2c819941and %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and}
6ae232055d4d8a97267517c5e50074c2c819941and%></td></tr><%
6ae232055d4d8a97267517c5e50074c2c819941and}
6ae232055d4d8a97267517c5e50074c2c819941and %></table></form><%
6ae232055d4d8a97267517c5e50074c2c819941and hr.close();
6ae232055d4d8a97267517c5e50074c2c819941and if(striked) {
6ae232055d4d8a97267517c5e50074c2c819941and %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
6ae232055d4d8a97267517c5e50074c2c819941and }
6ae232055d4d8a97267517c5e50074c2c819941and %><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><%
6ae232055d4d8a97267517c5e50074c2c819941and}
6ae232055d4d8a97267517c5e50074c2c819941and%><%@include file="foot.jspf"%>
6ae232055d4d8a97267517c5e50074c2c819941and