1 | <%-- $Id: options.jsp 1108 2009-06-04 07:18:10Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2009 Nicklas Nordborg |
---|
4 | |
---|
5 | This file is part of BASE - BioArray Software Environment. |
---|
6 | Available at http://base.thep.lu.se/ |
---|
7 | |
---|
8 | BASE is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License |
---|
10 | as published by the Free Software Foundation; either version 2 |
---|
11 | of the License, or (at your option) any later version. |
---|
12 | |
---|
13 | BASE is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
21 | Boston, MA 02111-1307, USA. |
---|
22 | ------------------------------------------------------------------ |
---|
23 | |
---|
24 | @author Jari, Nicklas |
---|
25 | --%> |
---|
26 | <%@ page |
---|
27 | pageEncoding="UTF-8" |
---|
28 | session="false" |
---|
29 | import="net.sf.basedb.core.Application" |
---|
30 | import="net.sf.basedb.core.BioAssaySet" |
---|
31 | import="net.sf.basedb.core.Experiment" |
---|
32 | import="net.sf.basedb.core.Directory" |
---|
33 | import="net.sf.basedb.core.User" |
---|
34 | import="net.sf.basedb.core.DbControl" |
---|
35 | import="net.sf.basedb.core.SessionControl" |
---|
36 | import="net.sf.basedb.core.Path" |
---|
37 | import="net.sf.basedb.core.Presets" |
---|
38 | import="net.sf.basedb.core.Presets.Preset" |
---|
39 | import="net.sf.basedb.clients.web.Base" |
---|
40 | import="net.sf.basedb.clients.web.util.HTML" |
---|
41 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
42 | import="net.sf.basedb.util.Values" |
---|
43 | %> |
---|
44 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
45 | <%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
---|
46 | |
---|
47 | <% |
---|
48 | final SessionControl sc = Base.getExistingSessionControl(request, true); |
---|
49 | final String ID = sc.getId(); |
---|
50 | final float scale = Base.getScale(sc); |
---|
51 | DbControl dc = null; |
---|
52 | try |
---|
53 | { |
---|
54 | dc = sc.newDbControl(); |
---|
55 | final User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
56 | String presetsXml = sc.getUserDefaultSetting("net.sf.basedb.genepattern.options"); |
---|
57 | Presets presets = new Presets(); |
---|
58 | if (presetsXml != null) presets.loadFrom(presetsXml); |
---|
59 | %> |
---|
60 | <base:page type="popup" title="<%="GenePattern options for "+HTML.encodeTags(user.getName())%>"> |
---|
61 | <base:head scripts="tabcontrol.js" styles="tabcontrol.css"> |
---|
62 | <script language="JavaScript"> |
---|
63 | function saveSettings() |
---|
64 | { |
---|
65 | document.forms['options'].submit(); |
---|
66 | } |
---|
67 | function addServer() |
---|
68 | { |
---|
69 | Main.openPopup('edit_server.jsp?ID=<%=ID%>&gpServer=', 'EditGPServer', 600, 400); |
---|
70 | } |
---|
71 | function editServer() |
---|
72 | { |
---|
73 | var frm = document.forms['options']; |
---|
74 | if (frm.servers.selectedIndex < 0) |
---|
75 | { |
---|
76 | alert('No server has been selected'); |
---|
77 | return; |
---|
78 | } |
---|
79 | var gpServer = frm.servers[frm.servers.selectedIndex].text; |
---|
80 | Main.openPopup('edit_server.jsp?ID=<%=ID%>&gpServer=' + encodeURIComponent(gpServer), 'EditGPServer', 600, 400); |
---|
81 | } |
---|
82 | function removeServer() |
---|
83 | { |
---|
84 | var frm = document.forms['options']; |
---|
85 | if (frm.servers.selectedIndex < 0) |
---|
86 | { |
---|
87 | alert('No server has been selected'); |
---|
88 | return; |
---|
89 | } |
---|
90 | var gpServer = frm.servers[frm.servers.selectedIndex].text; |
---|
91 | Main.openPopup('submit.jsp?ID=<%=ID%>&cmd=RemoveServer&gpServer=' + encodeURIComponent(gpServer), 'RemoveGPServer', 300, 200); |
---|
92 | } |
---|
93 | </script> |
---|
94 | </base:head> |
---|
95 | <base:body> |
---|
96 | <form action="submit.jsp?ID=<%=ID%>" method="post" name="options" onsubmit="return false;"> |
---|
97 | <input type=hidden name="cmd" value="SaveOptions"> |
---|
98 | |
---|
99 | <h3 class="docked">GenePattern options for <%=HTML.encodeTags(user.getName())%></h3> |
---|
100 | <t:tabcontrol id="options" |
---|
101 | contentstyle="<%="height: "+(int)(scale*280)+"px;"%>" |
---|
102 | position="bottom"> |
---|
103 | |
---|
104 | <t:tab id="option" title="GenePattern servers"> |
---|
105 | <table class="form" cellspacing=0> |
---|
106 | <tr> |
---|
107 | <td class="prompt">GenePattern servers</td> |
---|
108 | <tr> |
---|
109 | <td> |
---|
110 | <select name="servers" multiple="multiple" size="10" style="width: 25em;"> |
---|
111 | <% |
---|
112 | String selected = "selected"; |
---|
113 | for (Presets.Preset server : presets) |
---|
114 | { |
---|
115 | %> |
---|
116 | <option <%=selected%>><%=HTML.encodeTags(server.getName())%> |
---|
117 | <% |
---|
118 | selected = ""; |
---|
119 | } |
---|
120 | %> |
---|
121 | </select> |
---|
122 | </td> |
---|
123 | <td> |
---|
124 | <table width="100"> |
---|
125 | <tr><td><base:button title="Edit… " image="configure.png" onclick="editServer()" /></td></tr> |
---|
126 | <tr><td><base:button title="Add… " onclick="addServer()" /></td></tr> |
---|
127 | <tr><td><base:button title="Remove…" onclick="removeServer()" /></td></tr> |
---|
128 | </table> |
---|
129 | </td> |
---|
130 | </tr> |
---|
131 | </table> |
---|
132 | |
---|
133 | </t:tab> |
---|
134 | </t:tabcontrol> |
---|
135 | <p> |
---|
136 | <table align="center"> |
---|
137 | <tr> |
---|
138 | <td><base:button onclick="window.close();" title="Close" /></td> |
---|
139 | </tr> |
---|
140 | </table> |
---|
141 | </base:body> |
---|
142 | </base:page> |
---|
143 | <% |
---|
144 | } |
---|
145 | finally |
---|
146 | { |
---|
147 | if (dc != null) dc.close(); |
---|
148 | } |
---|
149 | %> |
---|