history.jsp revision 962
0N/A<%--
0N/ACDDL HEADER START
0N/A
0N/AThe contents of this file are subject to the terms of the
0N/ACommon Development and Distribution License (the "License").
0N/AYou may not use this file except in compliance with the License.
0N/A
0N/ASee LICENSE.txt included in this distribution for the specific
0N/Alanguage governing permissions and limitations under the License.
0N/A
0N/AWhen distributing Covered Code, include this CDDL HEADER in each
0N/Afile and include the License file at LICENSE.txt.
0N/AIf applicable, add the following below this CDDL HEADER, with the
0N/Afields enclosed by brackets "[]" replaced with your own identifying
0N/Ainformation: Portions Copyright [yyyy] [name of copyright owner]
0N/A
0N/ACDDL HEADER END
0N/A
0N/ACopyright 2005 Sun Microsystems, Inc. All rights reserved.
0N/AUse is subject to license terms.
0N/A
0N/Aident "@(#)history.jsp 1.1 05/11/11 SMI"
0N/A
0N/A--%><%@ page import = "javax.servlet.*,
0N/Ajava.lang.*,
0N/Ajavax.servlet.http.*,
0N/Ajava.util.*,
0N/Ajava.io.*,
0N/Ajava.text.*,
0N/Aorg.opensolaris.opengrok.analysis.*,
0N/Aorg.opensolaris.opengrok.web.*,
0N/Aorg.opensolaris.opengrok.history.*,
0N/Ajava.util.regex.*
0N/A"
962N/A%><%@include file="mast.jsp"%>
962N/A<% String hcontext = request.getContextPath(); %>
962N/A<script type="text/javascript" src="<%=hcontext%>/jquery-1.4.2.min.js"></script>
962N/A<script type="text/javascript">
893N/A// <![CDATA[
893N/Afunction toggle_filelist() {
962N/A $("span").each(function() {
962N/A if (this.className == "filelist") {
962N/A this.setAttribute("style", "display: none;");
962N/A this.className = "filelist-hidden";
962N/A } else if (this.className == "filelist-hidden") {
962N/A this.setAttribute("style", "display: inline;");
962N/A this.className = "filelist";
962N/A }
893N/A }
962N/A );
893N/A}
962N/A
962N/Afunction togglediffs() {
962N/A var cr2 = false;
962N/A var cr1 = false;
962N/A $("#revisions input[type=radio]").each(function() {
962N/A if (this.name=="r1") { if (this.checked) {cr1=true;return true;};
962N/A if (cr2) { this.style.visibility = 'visible'}
962N/A else {this.style.visibility = 'hidden'} }
962N/A else if (this.name=="r2") { if (this.checked) {cr2=true;return true;}
962N/A if (!cr1) { this.style.visibility = 'visible'}
962N/A else {this.style.visibility = 'hidden'} }
962N/A }
962N/A );
962N/A}
962N/A
962N/A$(document).ready(function(){
962N/A // start state should ALWAYS be: first row: r1 hidden, r2 checked ; second row: r1 clicked, (r2 hidden)(optionally)
962N/A // I cannot say what will happen if they are not like that, togglediffs will go mad !
962N/A $("#revisions input[type=radio]").bind("click",togglediffs);
962N/A togglediffs();
962N/A});
962N/A
893N/A// ]]>
893N/A</script><%
41N/Aif (path.length() > 0 && valid) {
0N/A boolean striked = false;
129N/A String userPage = environment.getUserPage();
129N/A String bugPage = environment.getBugPage();
129N/A String bugRegex = environment.getBugPattern();
88N/A if(bugRegex == null || bugRegex.equals("")) {
88N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
88N/A }
88N/A Pattern bugPattern = Pattern.compile(bugRegex);
318N/A String reviewPage = environment.getReviewPage();
318N/A String reviewRegex = environment.getReviewPattern();
318N/A if(reviewRegex == null || reviewRegex.equals("")) {
318N/A reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
318N/A }
318N/A Pattern reviewPattern = Pattern.compile(reviewRegex);
0N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
0N/A Date tstart = new Date();
50N/A File f = new File(rawSource + path);
256N/A if (!HistoryGuru.getInstance().hasHistory(f)) {
256N/A response.sendError(404, "No history");
256N/A return;
256N/A }
836N/A History hist = HistoryGuru.getInstance().getHistory(f);
50N/A
836N/A if (hist == null) {
50N/A response.sendError(404, "No history");
50N/A return;
0N/A }
50N/A
0N/A%><form action="<%=context%>/diff<%=path%>">
962N/A<table cellspacing="0" cellpadding="2" border="0" width="100%" class="src" id="revisions">
189N/A<tr>
189N/A <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
189N/A</tr>
189N/A<tr class="thead">
189N/A <td>Revision</td><%
189N/A if (!isDir) {
189N/A %><th><input type="submit" value=" Compare "/></th><%
189N/A }
900N/A %><td>Date</td><td>Author</td><td>Comments<%
900N/A if (hist.hasFileList()) {
900N/A %> <a href="#" onclick="javascript: toggle_filelist(); return false;">
893N/A <span class="filelist-hidden" style="display: none;">
893N/A (&lt;&lt;&lt; Hide modified files)
893N/A </span>
893N/A <span class="filelist" style="display: inline;">
893N/A (Show modified files &gt;&gt;&gt;)
893N/A </span>
900N/A </a><%
900N/A }
900N/A %></td>
189N/A</tr><%
962N/Aboolean alt = true;int count=0;
836N/Afor (HistoryEntry entry : hist.getHistoryEntries()) {
836N/A String rev = entry.getRevision();
189N/A if (rev == null || rev.length() == 0) {
189N/A rev = "";
189N/A }
0N/A alt = !alt;
189N/A %><tr valign="top" <%= alt ? "class=\"alt\"" : "" %>><%
189N/A if (isDir) {
189N/A %><td>&nbsp;<%=rev%>&nbsp;</td><%
189N/A } else {
836N/A if (entry.isActive()) {
558N/A String rp = Util.URIEncodePath(path);
962N/A%><td>&nbsp;<a name="<%=rev%>" href="<%= context +"/xref" + rp + "?r=" + Util.URIEncode(rev) %>"><%=rev%></a>&nbsp;</td><td align="center">
962N/A <input type="radio" <% if (count==0) {%>style="visibility:hidden"<% } else if (count==1) {%>checked<%} %> name="r1" value="<%=rp%>@<%=rev%>"/>
962N/A <input type="radio" name="r2" <% if (count==0) {%>checked<% } %> value="<%=rp%>@<%=rev%>"/></td><%
0N/A } else {
0N/A striked = true;
0N/A %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
0N/A }
0N/A}
194N/A%><td><%
836N/A Date date = entry.getDate();
217N/A if (date != null) {
194N/A %><%=df.format(date)%><%
194N/A } else {
217N/A %>&nbsp;<%
194N/A }
194N/A%>&nbsp;</td>
0N/A<td>
0N/A<%
0N/A
885N/AString author = entry.getAuthor();
885N/Aif (author == null) {
885N/A %>(no author)<%
885N/A} else if (userPage != null && ! userPage.equals("")) {
885N/A %><a href="<%= userPage + author %>"><%= author %></a><%
0N/A} else {
885N/A %><%= author %><%
0N/A}
0N/A
318N/A%>&nbsp;</td><td><%
836N/AString cout=Util.htmlize(entry.getMessage());
345N/Aif (bugPage != null && ! bugPage.equals("")){
318N/A cout=bugPattern.matcher(cout).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>"); }
318N/Aif (reviewPage != null && ! reviewPage.equals("")) {
318N/A cout=reviewPattern.matcher(cout).replaceAll("<a href=\"" + reviewPage + "$1\">$1</a>"); }
318N/A %><%= cout %>
318N/A<%
836N/ASet<String> files = entry.getFiles();
893N/Aif(files != null) {%><span class="filelist-hidden" style="display: none;"><br/><%
50N/A for (String ifile : files) {
50N/A String jfile = ifile;
50N/A if ("/".equals(path)) {
50N/A jfile = ifile.substring(1);
170N/A } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
50N/A jfile = ifile.substring(path.length()+1);
50N/A }
189N/A if (rev == "") {
189N/A %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
189N/A } else {
189N/A %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%
189N/A }
893N/A }%></span><%
0N/A}
0N/A%></td></tr><%
962N/Acount++;
0N/A}
0N/A %></table></form><%
0N/A if(striked) {
0N/A %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
0N/A }
218N/A %><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><%
0N/A}
66N/A%><%@include file="foot.jspf"%>