Home | History | Annotate | Download | only in web
      1 <%-- 
      2 CDDL HEADER START
      3 
      4 The contents of this file are subject to the terms of the
      5 Common Development and Distribution License (the "License").  
      6 You may not use this file except in compliance with the License.
      7 
      8 See LICENSE.txt included in this distribution for the specific
      9 language governing permissions and limitations under the License.
     10 
     11 When distributing Covered Code, include this CDDL HEADER in each
     12 file and include the License file at LICENSE.txt.
     13 If applicable, add the following below this CDDL HEADER, with the
     14 fields enclosed by brackets "[]" replaced with your own identifying
     15 information: Portions Copyright [yyyy] [name of copyright owner]
     16 
     17 CDDL HEADER END
     18 
     19 Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
     20 Use is subject to license terms.
     21 
     22 ident	"@(#)history.jsp 1.1     05/11/11 SMI"
     23 
     24 --%><%@ page import = "javax.servlet.*,
     25 java.lang.*,
     26 javax.servlet.http.*,
     27 java.util.*,
     28 java.io.*,
     29 java.text.*,  
     30 org.opensolaris.opengrok.analysis.*,
     31 org.opensolaris.opengrok.web.*,
     32 org.opensolaris.opengrok.history.*,
     33 java.util.regex.*
     34 "
     35 %><%@include file="mast.jsp"%><%
     36 if (path.length() > 0 && valid) {
     37     boolean striked = false;
     38     String userPage = environment.getUserPage();
     39     String bugPage = environment.getBugPage();
     40     String bugRegex = environment.getBugPattern();
     41     if(bugRegex == null || bugRegex.equals("")) {
     42         bugRegex = "\\b([12456789][0-9]{6})\\b";
     43     }
     44     Pattern bugPattern = Pattern.compile(bugRegex);
     45     String reviewPage = environment.getReviewPage();
     46     String reviewRegex = environment.getReviewPattern();
     47     if(reviewRegex == null || reviewRegex.equals("")) {
     48         reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
     49     }
     50     Pattern reviewPattern = Pattern.compile(reviewRegex);
     51     Format df = new SimpleDateFormat("dd-MMM-yyyy");
     52     Date tstart = new Date();
     53     File f = new File(rawSource + path);
     54     if (!HistoryGuru.getInstance().hasHistory(f)) {
     55         response.sendError(404, "No history");
     56         return;        
     57     }
     58     HistoryReader hr = HistoryGuru.getInstance().getHistoryReader(f);
     59 
     60     if (hr == null) {
     61         response.sendError(404, "No history");
     62         return;
     63     }
     64     
     65 %><form action="<%=context%>/diff<%=path%>">
     66 <table cellspacing="0" cellpadding="2" border="0" width="100%" class="src">
     67 <tr>
     68     <td colspan="4"><span class="pagetitle">History log of <a href="<%= context +"/xref" + path %>"><%=path%></a></span></td>
     69 </tr>
     70 <tr class="thead">
     71     <td>Revision</td><%
     72     if (!isDir) {
     73         %><th><input type="submit" value=" Compare "/></th><%
     74     }
     75     %><td>Date</td><td>Author</td><td>Comments</td>
     76 </tr><%
     77 boolean alt = true;
     78 while (hr.next()) {
     79     String rev = hr.getRevision();
     80     if (rev == null || rev.length() == 0) {
     81         rev = "";
     82     }
     83     alt = !alt;
     84     %><tr  valign="top" <%= alt ?  "class=\"alt\"" : "" %>><%
     85     if (isDir) {
     86     %><td>&nbsp;<%=rev%>&nbsp;</td><%
     87     } else {
     88         if(hr.isActive()) {
     89 	  String rp = ((hr.getSourceRootPath() == null) ? path : hr.getSourceRootPath().toString());
     90 	  rp = Util.URIEncodePath(rp);
     91 %><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%>"/>
     92 <input type="radio" name="r2" value="<%=rp%>@<%=rev%>"/></td><%
     93         } else {
     94             striked = true;
     95   %><td><strike>&nbsp;<%=rev%>&nbsp; </strike></td><td>&nbsp;</td><%
     96         }
     97 }
     98 %><td><% 
     99         Date date = hr.getDate(); 
    100         if (date != null) {
    101             %><%=df.format(date)%><%
    102         } else {
    103             %>&nbsp;<%
    104         }
    105 %>&nbsp;</td>
    106 <td>
    107 <%
    108 
    109 if(userPage != null && ! userPage.equals("")) {
    110 	%><a href="<%= userPage + hr.getAuthor() %>"><%= hr.getAuthor() %></a><%
    111 } else {
    112 	%><%= hr.getAuthor() %><%
    113 }
    114 
    115 %>&nbsp;</td><td><%
    116 String cout=Util.htmlize(hr.getComment());
    117 if (bugPage != null && ! bugPage.equals("")){
    118         cout=bugPattern.matcher(cout).replaceAll("<a href=\"" + bugPage + "$1\">$1</a>"); }
    119 if (reviewPage != null && ! reviewPage.equals("")) {
    120     cout=reviewPattern.matcher(cout).replaceAll("<a href=\"" + reviewPage + "$1\">$1</a>"); }
    121 	%><%= cout  %>
    122 <%
    123 List<String> files = hr.getFiles();
    124 if(files != null) {%><br/><%
    125     for (String ifile : files) {
    126         String jfile = ifile;
    127         if ("/".equals(path)) {
    128             jfile = ifile.substring(1);
    129         } else if (ifile.startsWith(path) && ifile.length() > (path.length()+1)) {
    130             jfile = ifile.substring(path.length()+1);
    131         }
    132         if (rev == "") {
    133             %><a class="h" href="<%=context%>/xref<%=ifile%>"><%=jfile%></a><br/><%
    134         } else {
    135             %><a class="h" href="<%=context%>/xref<%=ifile%>?r=<%=rev%>"><%=jfile%></a><br/><%            
    136         }
    137     }
    138 }
    139 %></td></tr><%
    140 }
    141 	%></table></form><%
    142         hr.close();
    143         if(striked) {
    144             %><p><b>Note:</b> No associated file changes are available for revisions with strike-through numbers (eg. <strike>1.45</strike>)</p><%
    145         }
    146         %><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><%
    147 }
    148 %><%@include file="foot.jspf"%>
    149