history.jsp revision 1297
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreCDDL HEADER START
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreThe contents of this file are subject to the terms of the
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreCommon Development and Distribution License (the "License").
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreYou may not use this file except in compliance with the License.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreSee LICENSE.txt included in this distribution for the specific
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amorelanguage governing permissions and limitations under the License.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreWhen distributing Covered Code, include this CDDL HEADER in each
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amorefile and include the License file at LICENSE.txt.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreIf applicable, add the following below this CDDL HEADER, with the
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amorefields enclosed by brackets "[]" replaced with your own identifying
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreinformation: Portions Copyright [yyyy] [name of copyright owner]
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreCDDL HEADER END
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmoreCopyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'AmorePortions Copyright 2011 Jens Elkner.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore--%><%@page import="
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreorg.opensolaris.opengrok.history.HistoryEntry,
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreorg.opensolaris.opengrok.history.HistoryException,
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoreorg.opensolaris.opengrok.configuration.RuntimeEnvironment"
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore%><%/* ---------------------- history.jsp start --------------------- */
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore PageConfig cfg = PageConfig.get(request);
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String path = cfg.getPath();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String context = request.getContextPath();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore RuntimeEnvironment env = cfg.getEnv();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String uriEncodedName = cfg.getUriEncodedPath();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore boolean striked = false;
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String userPage = env.getUserPage();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String userPageSuffix = env.getUserPageSuffix();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (userPageSuffix == null) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore // Set to empty string so we can append it to the URL
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore // unconditionally later.
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore userPageSuffix = "";
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String bugPage = env.getBugPage();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String bugRegex = env.getBugPattern();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (bugRegex == null || bugRegex.equals("")) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore bugRegex = "\\b([12456789][0-9]{6})\\b";
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore Pattern bugPattern = Pattern.compile(bugRegex);
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String reviewPage = env.getReviewPage();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String reviewRegex = env.getReviewPattern();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if(reviewRegex == null || reviewRegex.equals("")) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore Pattern reviewPattern = Pattern.compile(reviewRegex);
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore Format df = new SimpleDateFormat("dd-MMM-yyyy");
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore History hist=null;
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore hist = HistoryGuru.getInstance().getHistory(f);
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore } catch (Exception e) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore // should not happen
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (hist != null) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore%><script type="text/javascript">/* <![CDATA[ */
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amoredocument.domReady.push(function() {domReadyHistory();});
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore/* ]]> */</script>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore<form action="<%= context + Prefix.DIFF_P + uriEncodedName %>">
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore<table class="src" id="revisions">
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <caption>History log of <a href="<%= context + Prefix.XREF_P
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore + uriEncodedName %>"><%= path %></a></caption>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <th>Revision</th><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <th><input type="submit" value=" Compare "/></th><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <th>Date</th>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <th>Author</th>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <th>Comments <%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><a href="#" onclick="javascript: toggle_filelist(); return false;">
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <span class="filelist-hidden">
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore (<<< Hide modified files)</span>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <span class="filelist">
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore (Show modified files >>>)</span></a><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore for (HistoryEntry entry : hist.getHistoryEntries()) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (rev == null || rev.length() == 0) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <td><%= rev %></td><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String rp = uriEncodedName;
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <td><a name="<%= rev %>" href="<%=
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore context + Prefix.XREF_P + rp + "?r=" + Util.URIEncode(rev) %>"><%=
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore rev %></a></td>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <input type="radio"<%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (count == 0 ) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %> disabled="disabled"<%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore } else if (count == 1) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %> checked="checked"<%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %> name="r1" value="<%= rp %>@<%= rev%>"/>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <input type="radio"
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (count == 0) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %> checked="checked"<%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %> value="<%= rp %>@<%= rev %>"/></td><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore striked = true;
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore <td><del><%= rev %></del></td>
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (date != null) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><%= df.format(date) %><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String author = entry.getAuthor();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (author == null) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %>(no author)<%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore } else if (userPage != null && userPage.length() > 0) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String alink = Util.getEmail(author);
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><a href="<%= userPage + Util.htmlize(alink) + userPageSuffix
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %>"><%= Util.htmlize(author)%></a><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><%= author %><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String cout = Util.htmlize(entry.getMessage());
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (bugPage != null && bugPage.length() > 0) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore cout = bugPattern.matcher(cout).replaceAll("<a href=\""
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore + bugPage + "$1\">$1</a>");
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (reviewPage != null && reviewPage.length() > 0) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore + reviewPage + "$1\">$1</a>");
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><%= cout %><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore Set<String> files = entry.getFiles();
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (files != null) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore %><span class="filelist-hidden"><br/><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore for (String ifile : files) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore String jfile = ifile;
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if ("/".equals(path)) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore } else if (ifile.startsWith(path)
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (rev == "") {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore<a class="h" href="<%= context + Prefix.XREF_P + ifile %>"><%= jfile %></a><br/><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore<a class="h" href="<%= context + Prefix.XREF_P + ifile %>?r=<%= rev %>"><%= jfile %></a><br/><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore if (striked) {
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore%><p><b>Note:</b> No associated file changes are available for
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amorerevisions with strike-through numbers (eg. <del>1.45</del>)</p><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore<p class="rssbadge"><a href="<%=context + Prefix.RSS_P + uriEncodedName
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore%>" title="RSS XML Feed of latest changes"><span id="rssi"></span></a></p><%
4297a3b0d0a35d80f86fff155e288e885a100e6dGarrett D'Amore/* ---------------------- history.jsp end --------------------- */