public String getFileType(String file) { String lower = file.toLowerCase(); if (file.endsWith(".sh") || file.endsWith(".csh")) return "shellscript"; if (file.endsWith(".html") || file.endsWith(".htm")) return "html"; if (file.endsWith(".c")) return "source_c"; if (file.endsWith(".h")) return "source_h"; if (file.endsWith(".java")) return "source_java"; if (file.endsWith(".pl")) return "source_pl"; if (file.endsWith(".cpp")) return "source_cpp"; if (file.endsWith(".py")) return "source_py"; if (lower.endsWith("readme") || lower.endsWith("readme.txt")) return "readme"; if (file.endsWith(".txt")) return "txt"; if (file.endsWith(".tar")) return "tar"; if (file.endsWith(".tgz")) return "tgz"; if (file.endsWith(".deb") || file.endsWith("/debian/control") || file.endsWith("/debian/changelog") || file.endsWith("/debian/rules") || file.endsWith("/debian/postinst") || file.endsWith("/debian/preinst") || file.endsWith("/debian/postrm") || file.endsWith("/debian/prerm")) return "deb"; if (file.endsWith(".pdf")) return "pdf"; if (file.endsWith(".ps")) return "postscript"; if (lower.endsWith("makefile")) return "make"; if (file.endsWith(".png") || file.endsWith(".gif") || file.endsWith(".jpg") || file.endsWith(".bmp")) return "image"; if (file.endsWith(".wav") || file.endsWith(".mp3")) return "sound"; if (file.endsWith(".mpg") || file.endsWith(".avi")) return "video"; return "unknown"; } title="P4JSP Browser";
} for (i = 0; i < files.length; i++) { files[i].setTimeFormat("MM/dd/yy HH:mm"); out.print("<TR><TD><IMG width=\"16\" height=\"16\" src=\"images/"+getFileType(files[i].getDepotPath())+".png\"/></TD>"); out.print("<TD><A href=\"file.jsp?path="+files[i].getDepotPath()+"\">"+files[i].getName()+"</A></TD>"); out.print("<TD>"+files[i].getHeadType()+"</TD>"); out.print("<TD>"+files[i].getHeadRev()+"</TD>"); out.print("<TD>"+files[i].getHeadTimeString()+"</TD>"); out.print("</TR>"); } out.print("</TABLE>");

Browse:



String path = request.getParameter("path");
if (null == path) path = "//";
if (!path.endsWith("/")) path += "/";

out.print(Utils.formatDepotPath(path, "<A href=\"browse.jsp?path={0}\">{1}</A>", null, null, true));
out.print("<BR/>");

DirEntry dir = new DirEntry(env, path);
String[] dirs = dir.getDirNames();
int i;

out.print("<TABLE>");
for (i = 0; i < dirs.length; i++) {
  out.print("<TR><TD><IMG width=\"16\" height=\"16\" src=\"images/folder.png\"/></TD>");
  out.print("<TD><A href=\"browse.jsp?path="+path+dirs[i]+"\">"+dirs[i]+"</A></TD></TR>");
}
FileEntry[] files = dir.getFiles();
if (0 < files.length) {

FileTypeRevModtime