history.jsp revision 1281
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
1262N/ACopyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A
1186N/APortions Copyright 2011 Jens Elkner.
1186N/A
1186N/A--%><%@page import="
1186N/Ajava.text.Format,
1186N/Ajava.text.SimpleDateFormat,
1186N/Ajava.util.Date,
1186N/Ajava.util.Set,
1186N/Ajava.util.regex.Pattern,
0N/A
1186N/Aorg.opensolaris.opengrok.history.History,
1186N/Aorg.opensolaris.opengrok.history.HistoryEntry,
1186N/Aorg.opensolaris.opengrok.history.HistoryException,
1186N/Aorg.opensolaris.opengrok.configuration.RuntimeEnvironment"
1186N/A%><%@
1186N/A
1186N/Ainclude file="mast.jsp"
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();
1281N/A RuntimeEnvironment env = cfg.getEnv();
1281N/A String uriEncodedName = cfg.getUriEncodedPath();
962N/A
1281N/A boolean striked = false;
1281N/A String userPage = env.getUserPage();
1281N/A String userPageSuffix = env.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 }
1281N/A String bugPage = env.getBugPage();
1281N/A String bugRegex = env.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);
1281N/A String reviewPage = env.getReviewPage();
1281N/A String reviewRegex = env.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");
1281N/A File f = cfg.getResourceFile();
1281N/A History hist=null;
1281N/A try {
1281N/A hist = HistoryGuru.getInstance().getHistory(f);
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[ */
1186N/Adocument.domReady.push(function() {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
1281N/A + uriEncodedName %>"><%= path %></a></caption>
1281N/A <thead>
1281N/A <tr>
1281N/A <th>Revision</th><%
1281N/A if (!cfg.isDir()) {
1281N/A %>
1281N/A <th><input type="submit" value=" Compare "/></th><%
1281N/A }
1281N/A %>
1281N/A <th>Date</th>
1281N/A <th>Author</th>
1281N/A <th>Comments <%
1281N/A if (hist.hasFileList()) {
1281N/A %><a href="#" onclick="javascript: toggle_filelist(); return false;">
1281N/A <span class="filelist-hidden">
1281N/A (&lt;&lt;&lt; Hide modified files)</span>
1281N/A <span class="filelist">
1281N/A (Show modified files &gt;&gt;&gt;)</span></a><%
1281N/A }
1281N/A %>
1281N/A </th>
1281N/A </tr>
1281N/A </thead>
1281N/A <tbody>
1281N/A <%
1281N/A int count=0;
1281N/A for (HistoryEntry entry : hist.getHistoryEntries()) {
1281N/A String rev = entry.getRevision();
1281N/A if (rev == null || rev.length() == 0) {
1281N/A rev = "";
1281N/A }
1281N/A %>
1281N/A <tr><%
1281N/A if (cfg.isDir()) {
1281N/A %>
1281N/A <td><%= rev %></td><%
1281N/A } else {
1281N/A if (entry.isActive()) {
1281N/A String rp = uriEncodedName;
1281N/A %>
1281N/A <td><a name="<%= rev %>" href="<%=
1281N/A context + Prefix.XREF_P + rp + "?r=" + Util.URIEncode(rev) %>"><%=
1281N/A rev %></a></td>
1281N/A <td>
1281N/A <input type="radio"<%
1281N/A if (count == 0 ) {
1281N/A %> disabled="disabled"<%
1281N/A } else if (count == 1) {
1281N/A %> checked="checked"<%
1281N/A }
1281N/A %> name="r1" value="<%= rp %>@<%= rev%>"/>
1281N/A <input type="radio"
1281N/A name="r2"<%
1281N/A if (count == 0) {
1281N/A %> checked="checked"<%
1281N/A }
1281N/A %> value="<%= rp %>@<%= rev %>"/></td><%
1281N/A } else {
1281N/A striked = true;
1281N/A %>
1281N/A <td><del><%= rev %></del></td>
1281N/A <td></td><%
1281N/A }
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) {
1281N/A %><a href="<%= userPage + Util.htmlize(author) + userPageSuffix
1281N/A %>"><%= Util.htmlize(author)%></a><%
1281N/A } else {
1281N/A %><%= author %><%
1281N/A }
1281N/A %></td>
1281N/A <td><%
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 }
1281N/A %><%= cout %><%
1281N/A Set<String> files = entry.getFiles();
1281N/A if (files != null) {
1281N/A %><span class="filelist-hidden"><br/><%
1281N/A for (String ifile : files) {
1281N/A String jfile = ifile;
1281N/A if ("/".equals(path)) {
1281N/A jfile = ifile.substring(1);
1281N/A } else if (ifile.startsWith(path)
1281N/A && ifile.length() > (path.length() + 1))
1281N/A {
1281N/A jfile = ifile.substring(path.length() + 1);
1281N/A }
1281N/A if (rev == "") {
1281N/A %>
1186N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>"><%= jfile %></a><br/><%
1281N/A } else {
1281N/A %>
1186N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>?r=<%= rev %>"><%= jfile %></a><br/><%
1281N/A }
1281N/A }
1281N/A %></span><%
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
1186N/A%>