-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowfiles.jsp
73 lines (62 loc) · 2.86 KB
/
showfiles.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<%@ page import="java.io.*, java.util.*" %>
<HTML>
<HEAD>
<TITLE>Index of Files</TITLE>
</HEAD>
<BODY>
<H1>Index of Files</H1>
<A target="_blank" HREF="<%= "/implicit/research/data/jsprefresh.jsp?user="+request.getParameter("user")%>">clear jsp cache </A>
<br/>
<%
String loc=request.getRequestURL().toString();
//start path after implicit/ , end before showFiles.jsp
loc=loc.substring(loc.indexOf("it/")+2,loc.lastIndexOf("/"));
String file= application.getRealPath("/")+"user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/";
File f = new File(file);
String [] fileNames = f.list();
File [] fileObjects= f.listFiles();
HashMap sizeMap=new HashMap();
for (int i = 0; i < fileObjects.length; i++) {
sizeMap.put(fileNames[i],fileObjects[i]);
}
java.util.Arrays.sort(fileNames, String.CASE_INSENSITIVE_ORDER);
%>
<UL>
<%
for (int i = 0; i < fileNames.length; i++) {
if(!((File)sizeMap.get(fileNames[i])).isDirectory()){
%>
<LI>
<A target="_blank" HREF="<%= "/implicit/user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/"+fileNames[i] %>"><%= fileNames[i] %></A>
<%
if( fileNames[i].contains("expt.xml"))
{%>
<A target="_blank" HREF="<%= "/implicit/Validate?study=/user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/"+fileNames[i] %>">Run study validator </A>
<A target="_blank" HREF="<%= "/implicit/Launch?study=/user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/"+fileNames[i]+"&refresh=true" %>">Test the study </A>
<A target="_blank" HREF="<%= "/implicit/StudyTest?study=Launch?study=/user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/"+fileNames[i] %>">Run data tester </A>
<%
}else{
if (fileNames[i].contains(".js") && (!(fileNames[i].contains(".jsp")))){
%>
<A target="_blank" HREF="<%= "/implicit/user/bgoldenberg/validateFile.jsp?study=/user/"+request.getParameter("user")
+"/"+request.getParameter("study")+"/"+fileNames[i]+"&file="+fileNames[i] %>">Run JShint </A>
<%
}
}
%>
(<%= Long.toString(((File)sizeMap.get(fileNames[i])).length()) %> bytes long)
<%
}
}
%>
</UL>
</BODY>
</HTML>