1134 |
22 Jun 09 |
nicklas |
1 |
<%-- $Id$ |
1134 |
22 Jun 09 |
nicklas |
2 |
------------------------------------------------------------------ |
1134 |
22 Jun 09 |
nicklas |
Copyright (C) 2009 Nicklas Nordborg |
1134 |
22 Jun 09 |
nicklas |
4 |
|
1134 |
22 Jun 09 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
1134 |
22 Jun 09 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
1134 |
22 Jun 09 |
nicklas |
7 |
|
1134 |
22 Jun 09 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1134 |
22 Jun 09 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
1134 |
22 Jun 09 |
nicklas |
10 |
as published by the Free Software Foundation; either version 2 |
1134 |
22 Jun 09 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1134 |
22 Jun 09 |
nicklas |
12 |
|
1134 |
22 Jun 09 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1134 |
22 Jun 09 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1134 |
22 Jun 09 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1134 |
22 Jun 09 |
nicklas |
16 |
GNU General Public License for more details. |
1134 |
22 Jun 09 |
nicklas |
17 |
|
1134 |
22 Jun 09 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
1134 |
22 Jun 09 |
nicklas |
19 |
along with this program; if not, write to the Free Software |
1134 |
22 Jun 09 |
nicklas |
20 |
Foundation, Inc., 59 Temple Place - Suite 330, |
1134 |
22 Jun 09 |
nicklas |
21 |
Boston, MA 02111-1307, USA. |
1134 |
22 Jun 09 |
nicklas |
22 |
------------------------------------------------------------------ |
1134 |
22 Jun 09 |
nicklas |
23 |
|
1134 |
22 Jun 09 |
nicklas |
24 |
@author Nicklas |
1134 |
22 Jun 09 |
nicklas |
25 |
--%> |
1134 |
22 Jun 09 |
nicklas |
26 |
<%@ page |
1134 |
22 Jun 09 |
nicklas |
27 |
pageEncoding="UTF-8" |
1134 |
22 Jun 09 |
nicklas |
28 |
session="false" |
1134 |
22 Jun 09 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
1134 |
22 Jun 09 |
nicklas |
30 |
import="net.sf.basedb.core.PluginParameter" |
1134 |
22 Jun 09 |
nicklas |
31 |
import="net.sf.basedb.core.ParameterType" |
1134 |
22 Jun 09 |
nicklas |
32 |
import="net.sf.basedb.core.FileParameterType" |
1134 |
22 Jun 09 |
nicklas |
33 |
import="net.sf.basedb.util.Enumeration" |
1134 |
22 Jun 09 |
nicklas |
34 |
import="net.sf.basedb.clients.web.Base" |
1134 |
22 Jun 09 |
nicklas |
35 |
import="net.sf.basedb.clients.web.util.HTML" |
1134 |
22 Jun 09 |
nicklas |
36 |
import="java.util.List" |
1134 |
22 Jun 09 |
nicklas |
37 |
%> |
1134 |
22 Jun 09 |
nicklas |
38 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1134 |
22 Jun 09 |
nicklas |
39 |
<% |
1134 |
22 Jun 09 |
nicklas |
40 |
final SessionControl sc = Base.getExistingSessionControl(request, true); |
1134 |
22 Jun 09 |
nicklas |
41 |
final String ID = sc.getId(); |
1134 |
22 Jun 09 |
nicklas |
42 |
|
1134 |
22 Jun 09 |
nicklas |
43 |
final List<PluginParameter> moduleParameters = |
1134 |
22 Jun 09 |
nicklas |
44 |
(List<PluginParameter>)request.getAttribute("moduleParameters"); |
1134 |
22 Jun 09 |
nicklas |
45 |
final String module = request.getParameter("module"); |
1134 |
22 Jun 09 |
nicklas |
46 |
final String server = request.getParameter("server"); |
1134 |
22 Jun 09 |
nicklas |
47 |
%> |
1134 |
22 Jun 09 |
nicklas |
48 |
<base:page type="popup" title="<%=HTML.encodeTags(module)%>"> |
1134 |
22 Jun 09 |
nicklas |
49 |
<base:head> |
1134 |
22 Jun 09 |
nicklas |
50 |
<script language="JavaScript"> |
1134 |
22 Jun 09 |
nicklas |
51 |
var lastFileInputName; |
1134 |
22 Jun 09 |
nicklas |
52 |
function browseOnClick(inputName) |
1134 |
22 Jun 09 |
nicklas |
53 |
{ |
1134 |
22 Jun 09 |
nicklas |
54 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
55 |
var url = getRoot() + 'filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&callback=setFileCallback'; |
1134 |
22 Jun 09 |
nicklas |
56 |
lastFileInputName = inputName; |
1134 |
22 Jun 09 |
nicklas |
57 |
Main.openPopup(url, 'SelectFile', 1000, 700); |
1134 |
22 Jun 09 |
nicklas |
58 |
} |
1134 |
22 Jun 09 |
nicklas |
59 |
function setFileCallback(fileId, path, inputName) |
1134 |
22 Jun 09 |
nicklas |
60 |
{ |
1134 |
22 Jun 09 |
nicklas |
61 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
62 |
if (!inputName) inputName = lastFileInputName; |
1134 |
22 Jun 09 |
nicklas |
63 |
frm[inputName].value = path; |
1134 |
22 Jun 09 |
nicklas |
64 |
} |
1134 |
22 Jun 09 |
nicklas |
65 |
function doVisualize() |
1134 |
22 Jun 09 |
nicklas |
66 |
{ |
1134 |
22 Jun 09 |
nicklas |
67 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
68 |
frm.submit(); |
1134 |
22 Jun 09 |
nicklas |
69 |
} |
1134 |
22 Jun 09 |
nicklas |
70 |
</script> |
1134 |
22 Jun 09 |
nicklas |
71 |
</base:head> |
1134 |
22 Jun 09 |
nicklas |
72 |
<base:body> |
1134 |
22 Jun 09 |
nicklas |
73 |
|
1134 |
22 Jun 09 |
nicklas |
74 |
<form action="Visualizer.servlet" method="post" name="visualizer"> |
1134 |
22 Jun 09 |
nicklas |
75 |
<input type="hidden" name="ID" value="<%=ID%>"> |
1134 |
22 Jun 09 |
nicklas |
76 |
<input type="hidden" name="cmd" value="RunVisualizerApplet"> |
1134 |
22 Jun 09 |
nicklas |
77 |
<input type="hidden" name="server" value="<%=server%>"> |
1134 |
22 Jun 09 |
nicklas |
78 |
<input type="hidden" name="module" value="<%=module%>"> |
1134 |
22 Jun 09 |
nicklas |
79 |
|
1134 |
22 Jun 09 |
nicklas |
80 |
<h3 class="docked"><%=HTML.encodeTags(module)%></h3> |
1134 |
22 Jun 09 |
nicklas |
81 |
<div class="boxedbottom"> |
1134 |
22 Jun 09 |
nicklas |
82 |
<table class="form"> |
1134 |
22 Jun 09 |
nicklas |
83 |
<% |
1134 |
22 Jun 09 |
nicklas |
84 |
for (PluginParameter pp : moduleParameters) |
1134 |
22 Jun 09 |
nicklas |
85 |
{ |
1134 |
22 Jun 09 |
nicklas |
86 |
ParameterType pType = pp.getParameterType(); |
1134 |
22 Jun 09 |
nicklas |
87 |
String pName = pp.getName(); |
1134 |
22 Jun 09 |
nicklas |
88 |
boolean required = pType.getNotNull(); |
1134 |
22 Jun 09 |
nicklas |
89 |
Object defaultValue = pp.getDefaultValue(); |
1134 |
22 Jun 09 |
nicklas |
90 |
if (defaultValue == null) defaultValue = ""; |
1134 |
22 Jun 09 |
nicklas |
91 |
%> |
1134 |
22 Jun 09 |
nicklas |
92 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
93 |
<td class="prompt"><%=HTML.encodeTags(pp.getLabel())%></td> |
1134 |
22 Jun 09 |
nicklas |
94 |
<td> |
1134 |
22 Jun 09 |
nicklas |
95 |
<% |
1134 |
22 Jun 09 |
nicklas |
96 |
if (pType.isEnumeration()) |
1134 |
22 Jun 09 |
nicklas |
97 |
{ |
1134 |
22 Jun 09 |
nicklas |
98 |
Enumeration<String, String> options = pType.getEnumeration(); |
1134 |
22 Jun 09 |
nicklas |
99 |
%> |
1134 |
22 Jun 09 |
nicklas |
100 |
<select name="<%=pName%>" title="<%=HTML.encodeTags(pp.getDescription())%>"> |
1134 |
22 Jun 09 |
nicklas |
101 |
<% |
1134 |
22 Jun 09 |
nicklas |
102 |
for (int i = 0; i < options.size(); ++i) |
1134 |
22 Jun 09 |
nicklas |
103 |
{ |
1134 |
22 Jun 09 |
nicklas |
104 |
%> |
1134 |
22 Jun 09 |
nicklas |
105 |
<option value="<%=HTML.encodeTags(options.getKey(i))%>"><%=HTML.encodeTags(options.getValue(i))%> |
1134 |
22 Jun 09 |
nicklas |
106 |
<% |
1134 |
22 Jun 09 |
nicklas |
107 |
} |
1134 |
22 Jun 09 |
nicklas |
108 |
%> |
1134 |
22 Jun 09 |
nicklas |
109 |
</select> |
1134 |
22 Jun 09 |
nicklas |
110 |
<% |
1134 |
22 Jun 09 |
nicklas |
111 |
} |
1134 |
22 Jun 09 |
nicklas |
112 |
else if (pType instanceof FileParameterType) |
1134 |
22 Jun 09 |
nicklas |
113 |
{ |
1134 |
22 Jun 09 |
nicklas |
114 |
%> |
1134 |
22 Jun 09 |
nicklas |
115 |
<table border="0" cellspacing="0" cellpadding="0"> |
1134 |
22 Jun 09 |
nicklas |
116 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
117 |
<td><input type="text" class="text <%=required ? "required" : ""%>" |
1134 |
22 Jun 09 |
nicklas |
118 |
name="<%=pName%>" size="50" value="<%=defaultValue%>" |
1134 |
22 Jun 09 |
nicklas |
119 |
title="<%=HTML.encodeTags(pp.getDescription())%>"> </td> |
1134 |
22 Jun 09 |
nicklas |
120 |
<td><base:button |
1134 |
22 Jun 09 |
nicklas |
121 |
title="Browse…" |
1134 |
22 Jun 09 |
nicklas |
122 |
onclick="<%="browseOnClick('"+pName+"')"%>" |
1134 |
22 Jun 09 |
nicklas |
123 |
/> |
1134 |
22 Jun 09 |
nicklas |
124 |
</td> |
1134 |
22 Jun 09 |
nicklas |
125 |
</tr> |
1134 |
22 Jun 09 |
nicklas |
126 |
</table> |
1134 |
22 Jun 09 |
nicklas |
127 |
<% |
1134 |
22 Jun 09 |
nicklas |
128 |
} |
1134 |
22 Jun 09 |
nicklas |
129 |
else |
1134 |
22 Jun 09 |
nicklas |
130 |
{ |
1134 |
22 Jun 09 |
nicklas |
131 |
%> |
1134 |
22 Jun 09 |
nicklas |
132 |
Unsupported parameter type. Please report this issue to the developers. |
1134 |
22 Jun 09 |
nicklas |
133 |
<% |
1134 |
22 Jun 09 |
nicklas |
134 |
} |
1134 |
22 Jun 09 |
nicklas |
135 |
%> |
1134 |
22 Jun 09 |
nicklas |
136 |
</td> |
1134 |
22 Jun 09 |
nicklas |
137 |
</tr> |
1134 |
22 Jun 09 |
nicklas |
138 |
<% |
1134 |
22 Jun 09 |
nicklas |
139 |
} |
1134 |
22 Jun 09 |
nicklas |
140 |
%> |
1134 |
22 Jun 09 |
nicklas |
141 |
</table> |
1134 |
22 Jun 09 |
nicklas |
142 |
</div> |
1134 |
22 Jun 09 |
nicklas |
143 |
|
1134 |
22 Jun 09 |
nicklas |
144 |
</form> |
1134 |
22 Jun 09 |
nicklas |
145 |
|
1134 |
22 Jun 09 |
nicklas |
146 |
<table align="center"> |
1134 |
22 Jun 09 |
nicklas |
147 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
148 |
<td width="50%"><base:button onclick="doVisualize();" title="Next" /></td> |
1134 |
22 Jun 09 |
nicklas |
149 |
<td width="50%"><base:button onclick="window.close();" title="Cancel" /></td> |
1134 |
22 Jun 09 |
nicklas |
150 |
</tr> |
1134 |
22 Jun 09 |
nicklas |
151 |
</table> |
1134 |
22 Jun 09 |
nicklas |
152 |
|
1134 |
22 Jun 09 |
nicklas |
153 |
</base:body> |
1134 |
22 Jun 09 |
nicklas |
154 |
</base:page> |