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++) { fent = files[i]; fent.setTimeFormat("MM/dd/yy HH:mm"); out.print("<TR><TD><IMG width=\"16\" height=\"16\" src=\"images/"+getFileType(fent.getDepotPath())+".png\"/></TD>"); out.print("<TD><A href=\"file.jsp?path="+fent.getDepotPath()+"\">"+fent.getName()+"</A></TD>"); out.print("<TD>"+fent.getHeadType()+"</TD>"); out.print("<TD><A href=\"view.jsp?path="+URLEncoder.encode(fent.getDepotPath()+"#"+fent.getHeadRev())+"\">"+fent.getHeadRev()+"</A></TD>"); out.print("<TD>"); if (1 < fent.getHeadRev()) { out.print("<A href=\"diff.jsp?path="+URLEncoder.encode(fent.getDepotPath())+"&r1="+(fent.getHeadRev()-1)+"&r2="+fent.getHeadRev()+"\">"+fent.getHeadAction()+"</A>"); } else { out.print(fent.getHeadAction()); } out.print("</TD>"); out.print("<TD>"+fent.getHeadTimeString()+"</TD>"); out.print("</TR>"); } out.print("</TABLE>");

Browse:


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

out.print("<BR/>");

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

out.print("<TABLE>");
out.print("<TR><TD><IMG width=\"16\" height=\"16\" src=\"images/root.png\"/></TD>");
out.print("<TD><A href=\"browse.jsp\">// - all depots</A></TD></TR>");
out.print("<TR><TD/><TD colspan=\"3\">"+Utils.formatDepotPath(path, "<A href=\"browse.jsp?path={0}\">{1}</A>", null, null, true)+"</TD></TR>");

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();
FileEntry fent;
if (0 < files.length) {

FileTypeRevActionModtime