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

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

References #162: Upgrade to MeV 4.3

Fixes some problems when starting export for bioassay sets that doesn't have a tdms file already.

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