1281N/A<%--
1186N/A$Id$
1186N/A
0N/ACDDL HEADER START
0N/A
0N/AThe contents of this file are subject to the terms of the
1281N/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
1297N/ACopyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A
1356N/APortions Copyright 2011, 2012 Jens Elkner.
1186N/A
1186N/A--%><%@page import="
1466N/Ajava.io.File,
1186N/Ajava.text.Format,
1186N/Ajava.text.SimpleDateFormat,
1186N/Ajava.util.Date,
1478N/Ajava.util.EnumSet,
1186N/Ajava.util.Set,
1186N/Ajava.util.regex.Pattern,
0N/A
1478N/Aorg.opensolaris.opengrok.Info,
1478N/Aorg.opensolaris.opengrok.configuration.Configuration,
1478N/Aorg.opensolaris.opengrok.configuration.Project,
1186N/Aorg.opensolaris.opengrok.history.History,
1186N/Aorg.opensolaris.opengrok.history.HistoryEntry,
1355N/Aorg.opensolaris.opengrok.history.HistoryGuru,
1478N/Aorg.opensolaris.opengrok.web.PageConfig,
1478N/Aorg.opensolaris.opengrok.web.Prefix,
1478N/Aorg.opensolaris.opengrok.web.Util,
1478N/Aorg.opensolaris.opengrok.web.WebappListener"
1186N/A%><%@
1186N/A
1478N/Ainclude file="mast.jspf"
962N/A
1186N/A%><%/* ---------------------- history.jsp start --------------------- */
1186N/A{
1281N/A PageConfig cfg = PageConfig.get(request);
1281N/A String path = cfg.getPath();
1281N/A
1281N/A if (path.length() > 0) {
1281N/A String context = request.getContextPath();
1470N/A Configuration conf = cfg.getConfig();
1281N/A String uriEncodedName = cfg.getUriEncodedPath();
962N/A
1281N/A boolean striked = false;
1470N/A String userPage = conf.getUserPage();
1470N/A String userPageSuffix = conf.getUserPageSuffix();
1281N/A if (userPageSuffix == null) {
1281N/A // Set to empty string so we can append it to the URL
1281N/A // unconditionally later.
1281N/A userPageSuffix = "";
1281N/A }
1470N/A String bugPage = conf.getBugPage();
1470N/A String bugRegex = conf.getBugPattern();
1281N/A if (bugRegex == null || bugRegex.equals("")) {
1281N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
1281N/A }
1281N/A Pattern bugPattern = Pattern.compile(bugRegex);
1470N/A String reviewPage = conf.getReviewPage();
1470N/A String reviewRegex = conf.getReviewPattern();
1281N/A if(reviewRegex == null || reviewRegex.equals("")) {
1281N/A reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
1281N/A }
1281N/A Pattern reviewPattern = Pattern.compile(reviewRegex);
1281N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
1466N/A History hist = null;
1281N/A try {
1466N/A hist = HistoryGuru.getInstance()
1466N/A .getHistory(new File(cfg.getSourceRootPath(), path),
1466N/A true, cfg.isDir());
1281N/A } catch (Exception e) {
1281N/A // should not happen
1281N/A %><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
1281N/A }
1281N/A if (hist != null) {
1186N/A%><script type="text/javascript">/* <![CDATA[ */
1355N/AO.hasFileList=<%= hist.hasFileList() %>;
1354N/AO.domReady.push(O.domReadyHistory);
1186N/A/* ]]> */</script>
1186N/A<form action="<%= context + Prefix.DIFF_P + uriEncodedName %>">
1186N/A<table class="src" id="revisions">
1281N/A <caption>History log of <a href="<%= context + Prefix.XREF_P
1466N/A + uriEncodedName %>"><%= Util.htmlize(path) %></a></caption>
1281N/A <thead>
1281N/A <tr>
1281N/A <th>Revision</th><%
1281N/A if (!cfg.isDir()) {
1281N/A %>
1390N/A <th><button type="submit">Compare</button></th><%
1281N/A }
1281N/A %>
1281N/A <th>Date</th>
1281N/A <th>Author</th>
1469N/A <th>Comments <a><span id="expand"></span> Expand </a></th>
1281N/A </tr>
1281N/A </thead>
1281N/A <tbody>
1281N/A <%
1481N/A int count=0;
1481N/A String subdir = path;
1481N/A if (!subdir.endsWith("/")) {
1481N/A int idx = subdir.lastIndexOf('/');
1481N/A assert(idx != 0);
1481N/A subdir = subdir.substring(0, idx+1);
1481N/A }
1481N/A String htmlPath = Util.formQuoteEscape(path);
1481N/A for (HistoryEntry entry : hist.getHistoryEntries()) {
1481N/A String rev = entry.getRevision();
1481N/A String encodedRev;
1481N/A String fullRev = entry.getOldRevision();
1481N/A if (rev == null || rev.length() == 0) {
1481N/A rev = "";
1481N/A encodedRev = "";
1481N/A } else {
1481N/A encodedRev = "?r=" + Util.uriEncodeQueryValue(rev);
1481N/A }
1481N/A if (fullRev != null) {
1481N/A fullRev = rev + " " + fullRev;
1481N/A } else {
1481N/A fullRev = rev;
1481N/A }
1281N/A %>
1281N/A <tr><%
1281N/A if (cfg.isDir()) {
1281N/A %>
1481N/A <td><%= fullRev %></td><%
1355N/A } else if (entry.isActive()) {
1281N/A %>
1281N/A <td><a name="<%= rev %>" href="<%=
1481N/A context + Prefix.XREF_P + uriEncodedName + encodedRev %>"><%= fullRev %></a></td>
1281N/A <td>
1281N/A <input type="radio"<%
1355N/A if (count == 0 ) {
1281N/A %> disabled="disabled"<%
1355N/A } else if (count == 1) {
1281N/A %> checked="checked"<%
1355N/A }
1466N/A %> name="r1" value="<%= htmlPath %>@<%= rev %>"/>
1281N/A <input type="radio"
1281N/A name="r2"<%
1355N/A if (count == 0) {
1281N/A %> checked="checked"<%
1355N/A }
1466N/A %> value="<%= htmlPath %>@<%= rev %>"/></td><%
1355N/A } else {
1355N/A striked = true;
1281N/A %>
1281N/A <td><del><%= rev %></del></td>
1281N/A <td></td><%
1281N/A }
1281N/A %>
1281N/A <td><%
1281N/A Date date = entry.getDate();
1281N/A if (date != null) {
1281N/A %><%= df.format(date) %><%
1281N/A }
1281N/A %></td>
1281N/A <td><%
1281N/A String author = entry.getAuthor();
1281N/A if (author == null) {
1281N/A %>(no author)<%
1281N/A } else if (userPage != null && userPage.length() > 0) {
1466N/A String alink = Util.getEmail(author);
1469N/A %><a href="<%= userPage + Util.uriEncodePath(alink) + userPageSuffix
1281N/A %>"><%= Util.htmlize(author)%></a><%
1281N/A } else {
1466N/A %><%= Util.htmlize(author) %><%
1281N/A }
1281N/A %></td>
1423N/A <td><p><%
1281N/A String cout = Util.htmlize(entry.getMessage());
1281N/A if (bugPage != null && bugPage.length() > 0) {
1281N/A cout = bugPattern.matcher(cout).replaceAll("<a href=\""
1281N/A + bugPage + "$1\">$1</a>");
1281N/A }
1281N/A if (reviewPage != null && reviewPage.length() > 0) {
1281N/A cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
1281N/A + reviewPage + "$1\">$1</a>");
1281N/A }
1423N/A %><%= cout %></p><%
1281N/A Set<String> files = entry.getFiles();
1281N/A if (files != null) {
1423N/A %><div style='display: none'><%
1281N/A for (String ifile : files) {
1281N/A String jfile = ifile;
1355N/A if (ifile.startsWith(subdir)
1355N/A && ifile.length() > subdir.length())
1281N/A {
1355N/A jfile = ifile.substring(subdir.length());
1281N/A }
1355N/A %>
1469N/A<a class="revh" href="<%= context + Prefix.XREF_P + Util.uriEncodePath(ifile)
1466N/A + encodedRev %>"><%= Util.htmlize(jfile) %></a><%
1281N/A }
1423N/A %></div><%
1281N/A }
1281N/A %></td>
1281N/A </tr><%
1281N/A count++;
1281N/A }
1281N/A %>
1281N/A </tbody>
1186N/A</table>
1186N/A</form><%
1281N/A if (striked) {
1281N/A%><p><b>Note:</b> No associated file changes are available for
1186N/Arevisions with strike-through numbers (eg. <del>1.45</del>)</p><%
1281N/A }
1186N/A%>
1186N/A<p class="rssbadge"><a href="<%=context + Prefix.RSS_P + uriEncodedName
1186N/A%>" title="RSS XML Feed of latest changes"><span id="rssi"></span></a></p><%
1281N/A }
1281N/A }
0N/A}
1186N/A/* ---------------------- history.jsp end --------------------- */
1186N/A%><%@
0N/A
1186N/Ainclude file="foot.jspf"
1186N/A
1297N/A%>