1132 |
18 Jun 09 |
nicklas |
1 |
<%-- $Id$ |
1132 |
18 Jun 09 |
nicklas |
2 |
------------------------------------------------------------------ |
1132 |
18 Jun 09 |
nicklas |
Copyright (C) 2009 Nicklas Nordborg |
1132 |
18 Jun 09 |
nicklas |
4 |
|
1132 |
18 Jun 09 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
1132 |
18 Jun 09 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
1132 |
18 Jun 09 |
nicklas |
7 |
|
1132 |
18 Jun 09 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1132 |
18 Jun 09 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
1132 |
18 Jun 09 |
nicklas |
10 |
as published by the Free Software Foundation; either version 2 |
1132 |
18 Jun 09 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1132 |
18 Jun 09 |
nicklas |
12 |
|
1132 |
18 Jun 09 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1132 |
18 Jun 09 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1132 |
18 Jun 09 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1132 |
18 Jun 09 |
nicklas |
16 |
GNU General Public License for more details. |
1132 |
18 Jun 09 |
nicklas |
17 |
|
1132 |
18 Jun 09 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
1132 |
18 Jun 09 |
nicklas |
19 |
along with this program; if not, write to the Free Software |
1132 |
18 Jun 09 |
nicklas |
20 |
Foundation, Inc., 59 Temple Place - Suite 330, |
1132 |
18 Jun 09 |
nicklas |
21 |
Boston, MA 02111-1307, USA. |
1132 |
18 Jun 09 |
nicklas |
22 |
------------------------------------------------------------------ |
1132 |
18 Jun 09 |
nicklas |
23 |
|
1134 |
22 Jun 09 |
nicklas |
24 |
@author Nicklas |
1132 |
18 Jun 09 |
nicklas |
25 |
--%> |
1132 |
18 Jun 09 |
nicklas |
26 |
<%@ page |
1132 |
18 Jun 09 |
nicklas |
27 |
pageEncoding="UTF-8" |
1132 |
18 Jun 09 |
nicklas |
28 |
session="false" |
1132 |
18 Jun 09 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
1132 |
18 Jun 09 |
nicklas |
30 |
import="net.sf.basedb.core.Presets" |
1132 |
18 Jun 09 |
nicklas |
31 |
import="net.sf.basedb.core.Presets.Preset" |
1132 |
18 Jun 09 |
nicklas |
32 |
import="net.sf.basedb.clients.web.Base" |
1134 |
22 Jun 09 |
nicklas |
33 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
1132 |
18 Jun 09 |
nicklas |
34 |
import="net.sf.basedb.clients.web.util.HTML" |
1132 |
18 Jun 09 |
nicklas |
35 |
%> |
1132 |
18 Jun 09 |
nicklas |
36 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1132 |
18 Jun 09 |
nicklas |
37 |
<% |
1132 |
18 Jun 09 |
nicklas |
38 |
final SessionControl sc = Base.getExistingSessionControl(request, true); |
1132 |
18 Jun 09 |
nicklas |
39 |
final String ID = sc.getId(); |
1132 |
18 Jun 09 |
nicklas |
40 |
|
1132 |
18 Jun 09 |
nicklas |
41 |
String presetsXml = sc.getUserDefaultSetting("net.sf.basedb.genepattern.options"); |
1132 |
18 Jun 09 |
nicklas |
42 |
Presets presets = new Presets(); |
1132 |
18 Jun 09 |
nicklas |
43 |
if (presetsXml != null) presets.loadFrom(presetsXml); |
1134 |
22 Jun 09 |
nicklas |
44 |
final String homeUrl = ExtensionsControl.getHomeUrl("net.sf.basedb.genepattern.options"); |
1132 |
18 Jun 09 |
nicklas |
45 |
%> |
1132 |
18 Jun 09 |
nicklas |
46 |
<base:page type="popup" title=""> |
1134 |
22 Jun 09 |
nicklas |
47 |
<base:head scripts="ajax.js"> |
1132 |
18 Jun 09 |
nicklas |
48 |
<script language="JavaScript"> |
1134 |
22 Jun 09 |
nicklas |
49 |
function doVisualize() |
1132 |
18 Jun 09 |
nicklas |
50 |
{ |
1132 |
18 Jun 09 |
nicklas |
51 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
52 |
frm.submit(); |
1132 |
18 Jun 09 |
nicklas |
53 |
} |
1134 |
22 Jun 09 |
nicklas |
54 |
function getModuleList() |
1132 |
18 Jun 09 |
nicklas |
55 |
{ |
1132 |
18 Jun 09 |
nicklas |
56 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
57 |
var url = '<%=homeUrl%>/Ajax.servlet?ID=<%=ID%>&cmd=ListModules'; |
1134 |
22 Jun 09 |
nicklas |
58 |
url += '&server=' + encodeURIComponent(frm['server'].value); |
1134 |
22 Jun 09 |
nicklas |
59 |
var request = Ajax.getXmlHttpRequest(); |
1134 |
22 Jun 09 |
nicklas |
60 |
request.open("GET", url, true); |
1134 |
22 Jun 09 |
nicklas |
61 |
Ajax.setReadyStateHandler(request, getModulesListCallback); |
1134 |
22 Jun 09 |
nicklas |
62 |
request.send(null); |
1134 |
22 Jun 09 |
nicklas |
63 |
document.getElementById('ajaxStatus').innerHTML = 'Please wait. . .'; |
1134 |
22 Jun 09 |
nicklas |
64 |
setTimeout('showProgress()', 250); |
1132 |
18 Jun 09 |
nicklas |
65 |
} |
1134 |
22 Jun 09 |
nicklas |
66 |
function showProgress() |
1132 |
18 Jun 09 |
nicklas |
67 |
{ |
1134 |
22 Jun 09 |
nicklas |
68 |
var progress = document.getElementById('ajaxStatus'); |
1134 |
22 Jun 09 |
nicklas |
69 |
if (progress.innerHTML.indexOf('Please wait') == 0) |
1134 |
22 Jun 09 |
nicklas |
70 |
{ |
1134 |
22 Jun 09 |
nicklas |
71 |
progress.innerHTML += ' .'; |
1134 |
22 Jun 09 |
nicklas |
72 |
setTimeout('showProgress()', 250); |
1134 |
22 Jun 09 |
nicklas |
73 |
} |
1134 |
22 Jun 09 |
nicklas |
74 |
} |
1134 |
22 Jun 09 |
nicklas |
75 |
|
1134 |
22 Jun 09 |
nicklas |
76 |
function getModulesListCallback(request) |
1134 |
22 Jun 09 |
nicklas |
77 |
{ |
1134 |
22 Jun 09 |
nicklas |
78 |
if (document.getElementById('ajaxStatus').innerHTML.indexOf('Please wait') != 0) return; |
1132 |
18 Jun 09 |
nicklas |
79 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
80 |
var responseText = request != null ? |
1134 |
22 Jun 09 |
nicklas |
81 |
request.responseText : |
1134 |
22 Jun 09 |
nicklas |
82 |
'status:error\nstacktrace:No response from server'; |
1134 |
22 Jun 09 |
nicklas |
83 |
var response = Ajax.parseResponse(responseText); |
1134 |
22 Jun 09 |
nicklas |
84 |
if (response.isError()) |
1134 |
22 Jun 09 |
nicklas |
85 |
{ |
1134 |
22 Jun 09 |
nicklas |
86 |
var stacktrace = response.getElements()[0]['stacktrace']; |
1134 |
22 Jun 09 |
nicklas |
87 |
document.getElementById('ajaxStatus').innerHTML = |
1134 |
22 Jun 09 |
nicklas |
88 |
'<div class="error stacktrace" style="width: 420px; height: 15em; overflow: auto;">' + stacktrace + '</div>'; |
1134 |
22 Jun 09 |
nicklas |
89 |
} |
1134 |
22 Jun 09 |
nicklas |
90 |
else |
1134 |
22 Jun 09 |
nicklas |
91 |
{ |
1134 |
22 Jun 09 |
nicklas |
92 |
var modules = response.getElements(); |
1134 |
22 Jun 09 |
nicklas |
93 |
modules.sort(compareGpModules); |
1134 |
22 Jun 09 |
nicklas |
94 |
var html = '<div style="width: 420px; height: 15em; overflow: auto;">'; |
1134 |
22 Jun 09 |
nicklas |
95 |
for (var i = 0; i < modules.length; i++) |
1134 |
22 Jun 09 |
nicklas |
96 |
{ |
1134 |
22 Jun 09 |
nicklas |
97 |
var type = modules[i]['taskType']; |
1134 |
22 Jun 09 |
nicklas |
98 |
if (type == 'Visualizer') |
1134 |
22 Jun 09 |
nicklas |
99 |
{ |
1134 |
22 Jun 09 |
nicklas |
100 |
html += '<a id="module.' + i + '" href="javascript:setModule('+i+')" title="' + modules[i]['description'] + '">'; |
1134 |
22 Jun 09 |
nicklas |
101 |
html += modules[i]['name'] + '</a><br>'; |
1134 |
22 Jun 09 |
nicklas |
102 |
} |
1134 |
22 Jun 09 |
nicklas |
103 |
} |
1134 |
22 Jun 09 |
nicklas |
104 |
html += '</div>'; |
1134 |
22 Jun 09 |
nicklas |
105 |
document.getElementById('ajaxStatus').innerHTML = html; |
1134 |
22 Jun 09 |
nicklas |
106 |
} |
1132 |
18 Jun 09 |
nicklas |
107 |
} |
1134 |
22 Jun 09 |
nicklas |
108 |
function compareGpModules(m1, m2) |
1132 |
18 Jun 09 |
nicklas |
109 |
{ |
1134 |
22 Jun 09 |
nicklas |
110 |
var type1 = m1['taskType']; |
1134 |
22 Jun 09 |
nicklas |
111 |
var type2 = m2['taskType']; |
1134 |
22 Jun 09 |
nicklas |
112 |
if (type1 < type2) return -1; |
1134 |
22 Jun 09 |
nicklas |
113 |
if (type1 > type2) return 1; |
1134 |
22 Jun 09 |
nicklas |
114 |
var name1 = m1['name']; |
1134 |
22 Jun 09 |
nicklas |
115 |
var name2 = m2['name']; |
1134 |
22 Jun 09 |
nicklas |
116 |
if (name1 < name2) return -1; |
1134 |
22 Jun 09 |
nicklas |
117 |
if (name1 > name2) return 1; |
1134 |
22 Jun 09 |
nicklas |
118 |
return 0; |
1134 |
22 Jun 09 |
nicklas |
119 |
} |
1134 |
22 Jun 09 |
nicklas |
120 |
function setModule(index) |
1134 |
22 Jun 09 |
nicklas |
121 |
{ |
1132 |
18 Jun 09 |
nicklas |
122 |
var frm = document.forms['visualizer']; |
1134 |
22 Jun 09 |
nicklas |
123 |
frm['module'].value = document.getElementById('module.'+index).innerHTML; |
1132 |
18 Jun 09 |
nicklas |
124 |
} |
1132 |
18 Jun 09 |
nicklas |
125 |
</script> |
1132 |
18 Jun 09 |
nicklas |
126 |
</base:head> |
1132 |
18 Jun 09 |
nicklas |
127 |
<base:body> |
1132 |
18 Jun 09 |
nicklas |
128 |
|
1132 |
18 Jun 09 |
nicklas |
129 |
<form action="Visualizer.servlet" method="post" name="visualizer"> |
1132 |
18 Jun 09 |
nicklas |
130 |
<input type="hidden" name="ID" value="<%=ID%>"> |
1134 |
22 Jun 09 |
nicklas |
131 |
<input type="hidden" name="cmd" value="SelectServerModule"> |
1132 |
18 Jun 09 |
nicklas |
132 |
|
1134 |
22 Jun 09 |
nicklas |
133 |
<h3 class="docked">Run visualizer</h3> |
1134 |
22 Jun 09 |
nicklas |
134 |
<div class="boxedbottom"> |
1132 |
18 Jun 09 |
nicklas |
135 |
<table class="form" cellspacing=0> |
1132 |
18 Jun 09 |
nicklas |
136 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
137 |
<td></td> |
1134 |
22 Jun 09 |
nicklas |
138 |
<td>Select a GenePattern visualizer module.</td> |
1134 |
22 Jun 09 |
nicklas |
139 |
</tr> |
1134 |
22 Jun 09 |
nicklas |
140 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
141 |
<td class="prompt">GenePattern server</td> |
1132 |
18 Jun 09 |
nicklas |
142 |
<td> |
1134 |
22 Jun 09 |
nicklas |
143 |
<select name="server" class="required"> |
1132 |
18 Jun 09 |
nicklas |
144 |
<% |
1132 |
18 Jun 09 |
nicklas |
145 |
for (Presets.Preset server : presets) |
1132 |
18 Jun 09 |
nicklas |
146 |
{ |
1132 |
18 Jun 09 |
nicklas |
147 |
%> |
1134 |
22 Jun 09 |
nicklas |
148 |
<option><%=HTML.encodeTags(server.getName())%> |
1132 |
18 Jun 09 |
nicklas |
149 |
<% |
1132 |
18 Jun 09 |
nicklas |
150 |
} |
1132 |
18 Jun 09 |
nicklas |
151 |
%> |
1132 |
18 Jun 09 |
nicklas |
152 |
</select> |
1132 |
18 Jun 09 |
nicklas |
153 |
</td> |
1132 |
18 Jun 09 |
nicklas |
154 |
</tr> |
1132 |
18 Jun 09 |
nicklas |
155 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
156 |
<td class="prompt">Visualizer module</td> |
1132 |
18 Jun 09 |
nicklas |
157 |
<td> |
1134 |
22 Jun 09 |
nicklas |
158 |
<input class="text required" type="text" name="module" size="40" value=""> |
1132 |
18 Jun 09 |
nicklas |
159 |
</td> |
1132 |
18 Jun 09 |
nicklas |
160 |
</tr> |
1132 |
18 Jun 09 |
nicklas |
161 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
162 |
<td class="prompt">Available modules</td> |
1134 |
22 Jun 09 |
nicklas |
163 |
<td> |
1134 |
22 Jun 09 |
nicklas |
164 |
<table border=0 cellspacing=0><tr><td><base:button |
1134 |
22 Jun 09 |
nicklas |
165 |
title="Get list" onclick="getModuleList()" |
1134 |
22 Jun 09 |
nicklas |
166 |
image="<%=homeUrl + "/images/genepattern.gif" %>" |
1134 |
22 Jun 09 |
nicklas |
167 |
/></td> |
1134 |
22 Jun 09 |
nicklas |
168 |
</tr></table> |
1134 |
22 Jun 09 |
nicklas |
169 |
</td> |
1132 |
18 Jun 09 |
nicklas |
170 |
</tr> |
1132 |
18 Jun 09 |
nicklas |
171 |
<tr> |
1134 |
22 Jun 09 |
nicklas |
172 |
<td class="prompt"></td> |
1134 |
22 Jun 09 |
nicklas |
173 |
<td id="ajaxStatus"></td> |
1132 |
18 Jun 09 |
nicklas |
174 |
</tr> |
1132 |
18 Jun 09 |
nicklas |
175 |
</table> |
1134 |
22 Jun 09 |
nicklas |
176 |
</div> |
1134 |
22 Jun 09 |
nicklas |
177 |
|
1134 |
22 Jun 09 |
nicklas |
178 |
|
1132 |
18 Jun 09 |
nicklas |
179 |
</form> |
1132 |
18 Jun 09 |
nicklas |
180 |
<table align="center"> |
1132 |
18 Jun 09 |
nicklas |
181 |
<tr> |
1132 |
18 Jun 09 |
nicklas |
182 |
<td width="50%"><base:button onclick="doVisualize();" title="Next" /></td> |
1132 |
18 Jun 09 |
nicklas |
183 |
<td width="50%"><base:button onclick="window.close();" title="Cancel" /></td> |
1132 |
18 Jun 09 |
nicklas |
184 |
</tr> |
1132 |
18 Jun 09 |
nicklas |
185 |
</table> |
1132 |
18 Jun 09 |
nicklas |
186 |
|
1132 |
18 Jun 09 |
nicklas |
187 |
</base:body> |
1132 |
18 Jun 09 |
nicklas |
188 |
</base:page> |