0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield<%--
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield$Id$
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldCDDL HEADER START
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldThe contents of this file are subject to the terms of the
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldCommon Development and Distribution License (the "License").
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldYou may not use this file except in compliance with the License.
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldSee LICENSE.txt included in this distribution for the specific
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldlanguage governing permissions and limitations under the License.
6d14aa2b8a3d924fde5673073ae1c6bb4917f604Cam Cope
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldWhen distributing Covered Code, include this CDDL HEADER in each
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldfile and include the License file at LICENSE.txt.
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldIf applicable, add the following below this CDDL HEADER, with the
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldfields enclosed by brackets "[]" replaced with your own identifying
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldinformation: Portions Copyright [yyyy] [name of copyright owner]
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. WarfieldCDDL HEADER END
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane GraberCopyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane GraberPortions Copyright 2011, 2012 Jens Elkner.
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber--%><%@page import="
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldjava.io.File,
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldjava.text.Format,
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graberjava.text.SimpleDateFormat,
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graberjava.util.Date,
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfieldjava.util.EnumSet,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenjava.util.Set,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenjava.util.regex.Pattern,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.Info,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.configuration.Configuration,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.configuration.Project,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.history.History,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.history.HistoryEntry,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.history.HistoryGuru,
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engenorg.opensolaris.opengrok.web.PageConfig,
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graberorg.opensolaris.opengrok.web.Prefix,
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graberorg.opensolaris.opengrok.web.Util,
50066f4f7e8d53fe7b7a3acb039c7db5573f42dcStéphane Graberorg.opensolaris.opengrok.web.WebappListener"
50066f4f7e8d53fe7b7a3acb039c7db5573f42dcStéphane Graber%><%@
50066f4f7e8d53fe7b7a3acb039c7db5573f42dcStéphane Graber
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graberinclude file="mast.jspf"
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber%><%/* ---------------------- history.jsp start --------------------- */
6d14aa2b8a3d924fde5673073ae1c6bb4917f604Cam Cope{
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber PageConfig cfg = PageConfig.get(request);
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen String path = cfg.getPath();
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (path.length() > 0) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String context = request.getContextPath();
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield Configuration conf = cfg.getConfig();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String uriEncodedName = cfg.getUriEncodedPath();
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber boolean striked = false;
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String userPage = conf.getUserPage();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String userPageSuffix = conf.getUserPageSuffix();
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber if (userPageSuffix == null) {
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber // Set to empty string so we can append it to the URL
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber // unconditionally later.
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber userPageSuffix = "";
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber }
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String bugPage = conf.getBugPage();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String bugRegex = conf.getBugPattern();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber if (bugRegex == null || bugRegex.equals("")) {
8470f20027cc3344d55ae2f475f7d0723c354393Carsten Brandt bugRegex = "\\b([12456789][0-9]{6})\\b";
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield Pattern bugPattern = Pattern.compile(bugRegex);
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String reviewPage = conf.getReviewPage();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber String reviewRegex = conf.getReviewPattern();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber if(reviewRegex == null || reviewRegex.equals("")) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber Pattern reviewPattern = Pattern.compile(reviewRegex);
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield Format df = new SimpleDateFormat("dd-MMM-yyyy");
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber History hist = null;
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen try {
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen hist = HistoryGuru.getInstance()
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen .getHistory(new File(cfg.getSourceRootPath(), path),
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen true, cfg.isDir());
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen } catch (Exception e) {
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen // should not happen
47fcda9926100d3ffbd01d848943a7eaf78655ffStéphane Graber %><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen }
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen if (hist != null) {
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen%><script type="text/javascript">/* <![CDATA[ */
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight EngenO.hasFileList=<%= hist.hasFileList() %>;
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight EngenO.domReady.push(O.domReadyHistory);
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber/* ]]> */</script>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber<form action="<%= context + Prefix.DIFF_P + uriEncodedName %>">
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber<table class="src" id="revisions">
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <caption>History log of <a href="<%= context + Prefix.XREF_P
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber + uriEncodedName %>"><%= Util.htmlize(path) %></a></caption>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <thead>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <tr>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <th>Revision</th><%
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber if (!cfg.isDir()) {
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber %>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <th><button type="submit">Compare</button></th><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <th>Date</th>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <th>Author</th>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <th>Comments <a><span id="expand"></span> Expand </a></th>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield </tr>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield </thead>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <tbody>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield int count=0;
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String subdir = path;
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (!subdir.endsWith("/")) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield int idx = subdir.lastIndexOf('/');
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur assert(idx != 0);
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber subdir = subdir.substring(0, idx+1);
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber }
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber String htmlPath = Util.formQuoteEscape(path);
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber for (HistoryEntry entry : hist.getHistoryEntries()) {
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber String rev = entry.getRevision();
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur String encodedRev;
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur String fullRev = entry.getOldRevision();
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur if (rev == null || rev.length() == 0) {
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur rev = "";
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur encodedRev = "";
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur } else {
5fdd4b0c119f5bd14fed3d4a6424e5a4d00c360eS.Çağlar Onur encodedRev = "?r=" + Util.uriEncodeQueryValue(rev);
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber }
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi if (fullRev != null) {
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi fullRev = rev + " " + fullRev;
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi } else {
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi fullRev = rev;
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi }
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi %>
cdcae1034cb0e0ead1a3777ad5ce679e2a5883efTAMUKI Shoichi <tr><%
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber if (cfg.isDir()) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %>
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber <td><%= fullRev %></td><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield } else if (entry.isActive()) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <td><a name="<%= rev %>" href="<%=
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield context + Prefix.XREF_P + uriEncodedName + encodedRev %>"><%= fullRev %></a></td>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <td>
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber <input type="radio"<%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (count == 0 ) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %> disabled="disabled"<%
f3b8088dd8a65bc1ef7b0efcccfbe8c6c8d33202Dwight Engen } else if (count == 1) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %> checked="checked"<%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %> name="r1" value="<%= htmlPath %>@<%= rev %>"/>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <input type="radio"
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield name="r2"<%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (count == 0) {
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber %> checked="checked"<%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber %> value="<%= htmlPath %>@<%= rev %>"/></td><%
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber } else {
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber striked = true;
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber %>
d47961ebd65ea45ba32d48d7065ce6d15ad7200dStéphane Graber <td><del><%= rev %></del></td>
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber <td></td><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber %>
dfb5edcac0c825637d26b0a8ab5a7cf62485c857Stéphane Graber <td><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield Date date = entry.getDate();
370f2e811c154109df7aea6ea1f9788768d0dd76Stéphane Graber if (date != null) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %><%= df.format(date) %><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %></td>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <td><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String author = entry.getAuthor();
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (author == null) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %>(no author)<%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield } else if (userPage != null && userPage.length() > 0) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String alink = Util.getEmail(author);
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %><a href="<%= userPage + Util.uriEncodePath(alink) + userPageSuffix
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %>"><%= Util.htmlize(author)%></a><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield } else {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %><%= Util.htmlize(author) %><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield %></td>
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield <td><p><%
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield String cout = Util.htmlize(entry.getMessage());
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (bugPage != null && bugPage.length() > 0) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield cout = bugPattern.matcher(cout).replaceAll("<a href=\""
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield + bugPage + "$1\">$1</a>");
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield }
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield if (reviewPage != null && reviewPage.length() > 0) {
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
0af993195cbd57cff700c7c90ee8f95c2a1ef8aaMichael H. Warfield + reviewPage + "$1\">$1</a>");
}
%><%= cout %></p><%
Set<String> files = entry.getFiles();
if (files != null) {
%><div style='display: none'><%
for (String ifile : files) {
String jfile = ifile;
if (ifile.startsWith(subdir)
&& ifile.length() > subdir.length())
{
jfile = ifile.substring(subdir.length());
}
%>
<a class="revh" href="<%= context + Prefix.XREF_P + Util.uriEncodePath(ifile)
+ encodedRev %>"><%= Util.htmlize(jfile) %></a><%
}
%></div><%
}
%></td>
</tr><%
count++;
}
%>
</tbody>
</table>
</form><%
if (striked) {
%><p><b>Note:</b> No associated file changes are available for
revisions with strike-through numbers (eg. <del>1.45</del>)</p><%
}
%>
<p class="rssbadge"><a href="<%=context + Prefix.RSS_P + uriEncodedName
%>" title="RSS XML Feed of latest changes"><span id="rssi"></span></a></p><%
}
}
}
/* ---------------------- history.jsp end --------------------- */
%><%@
include file="foot.jspf"
%>