source: extensions/net.sf.basedb.mev/trunk/resources/launch_export.jsp @ 1068

Last change on this file since 1068 was 1068, checked in by Nicklas Nordborg, 13 years ago

Fixes #214: Move TDMS export to this extension

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.6 KB
Line 
1<%-- $Id: launch_export.jsp 1068 2009-05-15 09:01:50Z 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.ItemContext"
37  import="net.sf.basedb.core.Item"
38  import="net.sf.basedb.core.Path"
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<%
46final SessionControl sc = Base.getExistingSessionControl(request, true);
47final String ID = sc.getId();
48final int bioAssaySetId = Values.getInt(request.getParameter("bioassayset_id"));
49final String title = "Create MeV TDMS file?";
50DbControl dc = null;
51String defaultPath = "/";
52String defaultFileName = "";
53String jobName = "Create MeV TDMS file";
54try
55{
56  dc = sc.newDbControl();
57  BioAssaySet bas = BioAssaySet.getById(dc, bioAssaySetId);
58  ItemContext cc = sc.getCurrentContext(Item.BIOASSAYSET);
59  cc.setId(bioAssaySetId);
60  defaultFileName = Path.makeSafeFilename(bas.getName() + ".tdms.txt", "");
61  jobName += " for " + bas.getName();
62  try
63  {
64    Experiment exp = bas.getExperiment();
65    Directory dir = exp.getDirectory();
66    if (dir == null)
67    {
68      User user = User.getById(dc, sc.getLoggedInUserId());
69      dir = user.getHomeDirectory();
70    }
71    if (dir != null)
72    {
73      defaultPath = dir.getPath().toString() + "/";
74    }
75  }
76  catch (Throwable t)
77  {}
78
79}
80finally
81{
82  if (dc != null) dc.close();
83}
84%>
85<base:page type="popup" title="<%=title%>">
86<base:head>
87  <script language="JavaScript">
88  function createTDMS()
89  {
90    var url = getRoot()+'common/plugin/index.jsp?ID='+getSessionId();
91    url += '&cmd=NewJob&plugin_class=net.sf.basedb.mev.plugin.TdmsExporterPlugin';
92    url += '&item_type=BIOASSAYSET&context_type=ITEM';
93    url += '&job_name=' + encodeURIComponent('<%=jobName%>');
94    url += '&parameter:saveAs='+encodeURIComponent('<%=HTML.javaScriptEncode(defaultPath+defaultFileName)%>');
95    url += '&parameter:attachToBioAssaySet=true';
96    Main.openPopup(url, 'CreateTDMSFile2', 740, 540);
97    window.close();
98  }
99  </script>
100</base:head>
101<base:body>
102
103  <base:note type="question" title="<%=title%>">
104  The selected bioassay is not associated with a MeV TDMS file.
105  Do you wish to create one with the MeV TDMS exporter plug-in?
106  <br><br>
107  </base:note>
108  <p>
109    <table align="center">
110    <tr>
111      <td width="50%"><base:button onclick="createTDMS()" title="Yes" /></td>
112      <td width="50%"><base:button onclick="window.close()" title="No" /></td>
113    </tr>
114    </table>
115  </div>
116
117</base:body>
118</base:page>
Note: See TracBrowser for help on using the repository browser.