history.jsp revision 1262
0N/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
0N/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{
1186N/A PageConfig cfg = PageConfig.get(request);
1186N/A String path = cfg.getPath();
1186N/A
1186N/A if (path.length() > 0) {
1186N/A String context = request.getContextPath();
1186N/A RuntimeEnvironment env = cfg.getEnv();
1186N/A String uriEncodedName = cfg.getUriEncodedPath();
962N/A
1186N/A boolean striked = false;
1186N/A String userPage = env.getUserPage();
1262N/A String userPageSuffix = env.getUserPageSuffix();
1262N/A if (userPageSuffix == null) {
1262N/A // Set to empty string so we can append it to the URL
1262N/A // unconditionally later.
1262N/A userPageSuffix = "";
1262N/A }
1186N/A String bugPage = env.getBugPage();
1186N/A String bugRegex = env.getBugPattern();
1186N/A if (bugRegex == null || bugRegex.equals("")) {
1186N/A bugRegex = "\\b([12456789][0-9]{6})\\b";
1186N/A }
1186N/A Pattern bugPattern = Pattern.compile(bugRegex);
1186N/A String reviewPage = env.getReviewPage();
1186N/A String reviewRegex = env.getReviewPattern();
1186N/A if(reviewRegex == null || reviewRegex.equals("")) {
1186N/A reviewRegex = "\\b(\\d{4}/\\d{3})\\b";
1186N/A }
1186N/A Pattern reviewPattern = Pattern.compile(reviewRegex);
1186N/A Format df = new SimpleDateFormat("dd-MMM-yyyy");
1186N/A File f = cfg.getResourceFile();
1186N/A History hist=null;
1186N/A try {
1186N/A hist = HistoryGuru.getInstance().getHistory(f);
1186N/A } catch (Exception e) {
1186N/A // should not happen
1186N/A %><h3>Problem</h3><p class="error"><%= e.getMessage() %></p><%
1186N/A }
1186N/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">
1186N/A <caption>History log of <a href="<%= context + Prefix.XREF_P
1186N/A + uriEncodedName %>"><%= path %></a></caption>
1186N/A <thead>
1186N/A <tr>
1186N/A <th>Revision</th><%
1186N/A if (!cfg.isDir()) {
1186N/A %>
1186N/A <th><input type="submit" value=" Compare "/></th><%
1186N/A }
1186N/A %>
1186N/A <th>Date</th>
1186N/A <th>Author</th>
1186N/A <th>Comments <%
1186N/A if (hist.hasFileList()) {
1186N/A %><a href="#" onclick="javascript: toggle_filelist(); return false;">
1186N/A <span class="filelist-hidden">
1186N/A (&lt;&lt;&lt; Hide modified files)</span>
1186N/A <span class="filelist">
1186N/A (Show modified files &gt;&gt;&gt;)</span></a><%
1186N/A }
1186N/A %>
1186N/A </th>
1186N/A </tr>
1186N/A </thead>
1186N/A <tbody>
1186N/A <%
1186N/A int count=0;
1186N/A for (HistoryEntry entry : hist.getHistoryEntries()) {
1186N/A String rev = entry.getRevision();
1186N/A if (rev == null || rev.length() == 0) {
1186N/A rev = "";
1186N/A }
1186N/A %>
1186N/A <tr><%
1186N/A if (cfg.isDir()) {
1186N/A %>
1186N/A <td><%= rev %></td><%
1186N/A } else {
1186N/A if (entry.isActive()) {
1186N/A String rp = uriEncodedName;
1186N/A %>
1186N/A <td><a name="<%= rev %>" href="<%=
1186N/A context + Prefix.XREF_P + rp + "?r=" + Util.URIEncode(rev) %>"><%=
1186N/A rev %></a></td>
1186N/A <td>
1186N/A <input type="radio"<%
1186N/A if (count == 0 ) {
1186N/A %> disabled="disabled"<%
1186N/A } else if (count == 1) {
1186N/A %> checked="checked"<%
1186N/A }
1186N/A %> name="r1" value="<%= rp %>@<%= rev%>"/>
1186N/A <input type="radio"
1186N/A name="r2"<%
1186N/A if (count == 0) {
1186N/A %> checked="checked"<%
1186N/A }
1186N/A %> value="<%= rp %>@<%= rev %>"/></td><%
1186N/A } else {
1186N/A striked = true;
1186N/A %>
1186N/A <td><del><%= rev %></del></td>
1186N/A <td></td><%
1186N/A }
1186N/A }
1186N/A %>
1186N/A <td><%
1186N/A Date date = entry.getDate();
1186N/A if (date != null) {
1186N/A %><%= df.format(date) %><%
1186N/A }
1186N/A %></td>
1186N/A <td><%
1186N/A String author = entry.getAuthor();
1186N/A if (author == null) {
1186N/A %>(no author)<%
1186N/A } else if (userPage != null && userPage.length() > 0) {
1262N/A %><a href="<%= userPage + Util.htmlize(author) + userPageSuffix
1186N/A %>"><%= Util.htmlize(author)%></a><%
1186N/A } else {
1186N/A %><%= author %><%
1186N/A }
1186N/A %></td>
1186N/A <td><%
1186N/A String cout = Util.htmlize(entry.getMessage());
1186N/A if (bugPage != null && bugPage.length() > 0) {
1186N/A cout = bugPattern.matcher(cout).replaceAll("<a href=\""
1186N/A + bugPage + "$1\">$1</a>");
1186N/A }
1186N/A if (reviewPage != null && reviewPage.length() > 0) {
1186N/A cout = reviewPattern.matcher(cout).replaceAll("<a href=\""
1186N/A + reviewPage + "$1\">$1</a>");
1186N/A }
1186N/A %><%= cout %><%
1186N/A Set<String> files = entry.getFiles();
1186N/A if (files != null) {
1186N/A %><span class="filelist-hidden"><br/><%
1186N/A for (String ifile : files) {
1186N/A String jfile = ifile;
1186N/A if ("/".equals(path)) {
1186N/A jfile = ifile.substring(1);
1186N/A } else if (ifile.startsWith(path)
1186N/A && ifile.length() > (path.length() + 1))
1186N/A {
1186N/A jfile = ifile.substring(path.length() + 1);
1186N/A }
1186N/A if (rev == "") {
1186N/A %>
1186N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>"><%= jfile %></a><br/><%
1186N/A } else {
1186N/A %>
1186N/A<a class="h" href="<%= context + Prefix.XREF_P + ifile %>?r=<%= rev %>"><%= jfile %></a><br/><%
1186N/A }
1186N/A }
1186N/A %></span><%
1186N/A }
1186N/A %></td>
1186N/A </tr><%
1186N/A count++;
1186N/A }
1186N/A %>
1186N/A </tbody>
1186N/A</table>
1186N/A</form><%
1186N/A if (striked) {
1186N/A%><p><b>Note:</b> No associated file changes are available for
1186N/Arevisions with strike-through numbers (eg. <del>1.45</del>)</p><%
1186N/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><%
1186N/A }
1186N/A }
0N/A}
1186N/A/* ---------------------- history.jsp end --------------------- */
1186N/A%><%@
0N/A
1186N/Ainclude file="foot.jspf"
1186N/A
1186N/A%>