list.jsp revision 1368
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoCDDL HEADER START
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoThe contents of this file are subject to the terms of the
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoCommon Development and Distribution License (the "License").
9afe19d634946d50eab30e3b90cb5cebcde39eeaDaniel LezcanoYou may not use this file except in compliance with the License.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoSee LICENSE.txt included in this distribution for the specific
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanolanguage governing permissions and limitations under the License.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoWhen distributing Covered Code, include this CDDL HEADER in each
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanofile and include the License file at LICENSE.txt.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoIf applicable, add the following below this CDDL HEADER, with the
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanofields enclosed by brackets "[]" replaced with your own identifying
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoinformation: Portions Copyright [yyyy] [name of copyright owner]
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoCDDL HEADER END
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoCopyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoPortions Copyright 2011 Jens Elkner.
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano--%><%@page import="org.opensolaris.opengrok.util.IOUtils"%>
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano<%@ page session="false" errorPage="error.jsp" import="
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoorg.opensolaris.opengrok.analysis.FileAnalyzer.Genre,
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcanoorg.opensolaris.opengrok.analysis.FileAnalyzerFactory,
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // need to set it here since requesting parameters
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano cfg = PageConfig.get(request);
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Annotation annotation = cfg.getAnnotation();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano if (annotation != null) {
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano float r = annotation.getWidestRevision() * 1.15f;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano float a = annotation.getWidestAuthor() * 1.15f;
998dc19ad6f62fcc7722e596c8cbaa488a5a5e93dlezcano + ".blame .r { width: " + (r == 0 ? 6 : r) + "ex; } "
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano + ".blame .a { width: " + (a == 0 ? 6 : a) + "ex; } "
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano + "</style>");
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano%><%@include
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano/* ---------------------- list.jsp start --------------------- */
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano cfg = PageConfig.get(request);
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano File resourceFile = cfg.getResourceFile();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano String path = cfg.getPath();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano String basename = resourceFile.getName();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano String rawPath = request.getContextPath() + Prefix.RAW_P + path;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Reader r = null;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // valid resource is requested
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // mast.jsp assures, that resourceFile is valid and not /
f79d43bbe70a01454049b77d6f15f6369744959eStéphane Graber Project activeProject = Project.getProject(resourceFile);
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano String cookieValue = cfg.getRequestedProjectsAsString();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano if (activeProject != null) {
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Set<String> projects = cfg.getRequestedProjects();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano if (!projects.contains(activeProject.getDescription())) {
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // update cookie
99e4008cad9e959b683c6f48411fcf15a92be3b5Michel Normand cookieValue = cookieValue.length() == 0
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano : activeProject.getDescription() + '/' + cookieValue;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano Cookie cookie = new Cookie("OpenGrokProject", cookieValue);
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // TODO hmmm, projects.jspf doesn't set a path
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano // directory listing
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano List<String> files = cfg.getResourceFileList();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano ArrayList<String> readMes = new ArrayList<String>();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano int offset = -1;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano EftarFileReader.FNode parentFNode = null;
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano EftarFileReader desc = cfg.getEftarReader();
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano if (desc != null) {
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano parentFNode = desc.getNode(path);
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano if (parentFNode != null) {
d823d5b966f49d975a09a8512d084389d6d7ffc7dlezcano%><table id="dirlist">
IgnoredNames ignoredNames = cfg.getIgnoredNames();
if (path.length() != 0) {
long lastm = resourceFile.getParentFile().lastModified();
<td><%= now-lastm < 86400000 ? "Today" : dateFormatter.format(lastm) %></td>
if (ignoredNames.ignore(file)) {
readMes.add(file);
boolean isDir = child.isDirectory();
long lastm = child.lastModified();
<td><a href="<%= Util.URIEncodePath(file) %>"><%= isDir ? "<b>" + file + "</b>" : file %></a></td>
<td><%= now-lastm < 86400000 ? "Today" : dateFormatter.format(lastm) %></td>
String briefDesc = desc.getChildTag(parentFNode, file); %>
if (readMes.size() != 0) {
File[] xrefs = cfg.findDataFiles(readMes);
for (int i=0; i < xrefs.length; i++) {
readme = new File(resourceFile, readMes.get(i));
g = AnalyzerGuru.getGenre(in);
IOUtils.close(in);
if (g == Genre.IMAGE) {
<h3><%= readMes.get(i) %></h3>
<img src="<%= Util.URIEncodePath(rawPath + '/' + image) %>"/><%
} else if (rev.length() != 0) {
FileAnalyzerFactory a = AnalyzerGuru.find(basename);
Genre g = AnalyzerGuru.getGenre(a);
in = HistoryGuru.getInstance()
error = e.getMessage();
a = AnalyzerGuru.find(in);
g = AnalyzerGuru.getGenre(a);
Binary file [Click <a href="<%= Util.URIEncodePath(rawPath) %>?<%= rev
rev.substring(2) %></span>
if (g == Genre.PLAIN) {
Annotation annotation = cfg.getAnnotation();
//annotation.writeTooltipMap(out);
AnalyzerGuru.writeXref(a, r, out, defs,
annotation, Project.getProject(resourceFile));
} else if (g == Genre.IMAGE) {
<img src="<%= Util.URIEncodePath(rawPath) %>?<%= rev %>"/>
} else if (g == Genre.HTML) {
Util.dump(out, r);
%> Click <a href="<%= Util.URIEncodePath(rawPath) %>?<%=
error = e.getMessage();
try { r.close(); in = null;}
try { in.close(); }
} else if (g == Genre.IMAGE) {
<img src="<%= Util.URIEncodePath(rawPath) %>?<%= rev %>"/>
Binary file [Click <a href="<%= Util.URIEncodePath(rawPath) %>?<%= rev
if (!cfg.annotate()) {
xrefFile = cfg.findDataFile();
FileAnalyzerFactory a = AnalyzerGuru.find(basename);
Genre g = AnalyzerGuru.getGenre(a);
a = AnalyzerGuru.find(bin);
g = AnalyzerGuru.getGenre(a);
if (g == Genre.IMAGE) {
<img src="<%= Util.URIEncodePath(rawPath) %>"/>
} else if ( g == Genre.HTML) {
Util.dump(out, r);
} else if (g == Genre.PLAIN) {
Definitions defs = IndexDatabase.getDefinitions(resourceFile);
Annotation annotation = cfg.getAnnotation();
AnalyzerGuru.writeXref(a, r, out, defs, annotation,
Project.getProject(resourceFile));
Click <a href="<%= Util.URIEncodePath(rawPath) %>">download <%= basename %></a><%
try { r.close(); bin = null; }
try { bin.close(); }
/* ---------------------- list.jsp end --------------------- */
include file="foot.jspf"