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