source: trunk/www/common/import/select_file.jsp @ 3679

Last change on this file since 3679 was 3679, checked in by Jari Häkkinen, 14 years ago

Changing the pesky "a (ä) character to a.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 6.0 KB
Line 
1<%-- $Id: select_file.jsp 3679 2007-08-17 07:18:29Z jari $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Jari Hakkinen, Nicklas Nordborg, Martin Svensson
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 2
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330,
22  Boston, MA  02111-1307, USA.
23  ------------------------------------------------------------------
24
25  @author Nicklas
26  @version 2.0
27--%>
28<%@ page session="false"
29  import="net.sf.basedb.core.SessionControl"
30  import="net.sf.basedb.core.DbControl"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.File"
34  import="net.sf.basedb.core.PluginConfiguration"
35  import="net.sf.basedb.core.PluginType"
36  import="net.sf.basedb.core.ItemQuery"
37  import="net.sf.basedb.core.ItemResultList"
38  import="net.sf.basedb.core.Include"
39  import="net.sf.basedb.core.Job"
40  import="net.sf.basedb.core.Location"
41  import="net.sf.basedb.core.query.Hql"
42  import="net.sf.basedb.core.query.Expressions"
43  import="net.sf.basedb.core.query.Restrictions"
44  import="net.sf.basedb.core.query.Orders"
45  import="net.sf.basedb.core.plugin.GuiContext"
46  import="net.sf.basedb.core.plugin.Plugin"
47  import="net.sf.basedb.core.plugin.AutoDetectingImporter"
48  import="net.sf.basedb.clients.web.Base"
49  import="net.sf.basedb.clients.web.util.HTML"
50  import="net.sf.basedb.util.Values"
51  import="java.util.List"
52%>
53<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
54<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
55
56<%
57final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
58final String ID = sc.getId();
59final Item itemType = Item.valueOf(request.getParameter("item_type"));
60final String subContext = Values.getString(request.getParameter("subcontext"), "");
61final ItemContext currentContext = sc.getCurrentContext(itemType, subContext);
62final GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
63final GuiContext context = new GuiContext(itemType, contextType);
64final String title = request.getParameter("title");
65final DbControl dc = sc.newDbControl();
66try
67{
68  List<File> recentFiles = (List<File>)currentContext.getRecent(dc, Item.FILE);
69  %>
70  <base:page type="popup" title="<%=title%>">
71  <base:head>
72    <script language="JavaScript">
73    function doImport()
74    {
75      var frm = document.forms['import'];
76      if (Main.trimString(frm.path.value) == '')
77      {
78        alert("You must select a file to import from");
79        frm.path.focus();
80      }
81      else
82      {
83        frm.submit();
84      }
85    }
86    function browseOnClick()
87    {
88      var frm = document.forms['import'];
89      var url = '../../filemanager/index.jsp?ID=<%=ID%>&cmd=SelectOne&title=Select+file+to+import&callback=setFileCallback';
90      url += '&filter:INT:location=<%=Location.PRIMARY.getValue()%>';
91      Main.openPopup(url, 'SelectFile', 1000, 700);
92    }
93    function setFileCallback(fileId, path)
94    {
95      var frm = document.forms['import'];
96      frm.file_id.value = fileId;
97      frm.path.value = path;
98    }
99    function recentFileOnChange()
100    {
101      var frm = document.forms['import'];
102      var selected = frm.recentFile[frm.recentFile.selectedIndex];
103      setFileCallback(selected.value, selected.text);
104      frm.recentFile.selectedIndex = 0;
105    }
106    </script>
107  </base:head>
108  <base:body>
109    <form name="import" action="index.jsp" method="get" onsubmit="return false;">
110    <input type="hidden" name="ID" value="<%=ID%>">
111    <input type="hidden" name="cmd" value="AutoDetect">
112    <input type="hidden" name="item_type" value="<%=itemType.name()%>">
113    <input type="hidden" name="subcontext" value="<%=subContext%>">
114    <input type="hidden" name="context_type" value="<%=contextType.name()%>">
115    <input type="hidden" name="title" value="<%=title%>">
116    <input type="hidden" name="job_name" value="<%=HTML.encodeTags(request.getParameter("job_name"))%>">
117    <input type="hidden" name="job_description" value="<%=HTML.encodeTags(request.getParameter("job_description"))%>">
118    <input type="hidden" name="plugindefinition_id" value="<%=request.getParameter("plugindefinition_id")%>">
119    <input type="hidden" name="file_id" value="">
120   
121    <h3 class="docked"><%=title%> <base:help helpid="import.autodetect.selectfile" /></h3>
122    <div class="boxed">
123      <div class="helpmessage">
124      Select a file to import from.
125      </div>
126      <table class="form" width="100%">
127      <tr valign="top">
128        <td class="prompt">File</td>
129        <td>
130          <table border="0" cellspacing="0" cellpadding="0">
131          <tr>
132          <td><input type="text" class="text required" name="path" size="60" value="">&nbsp;</td>
133          <td><base:button 
134              title="Browse&hellip;"
135              onclick="browseOnClick()"
136              />
137          </td>
138          </tr>
139          </table>
140        </td>
141      </tr>
142      <%
143      if (recentFiles.size() > 0)
144      {
145        %>
146        <tr>
147          <td class="prompt">Recently used</td>
148          <td>
149            <select name="recentFile" onchange="recentFileOnChange()">
150            <option value="">
151            <%
152            for (File recent : recentFiles)
153            {
154              String path = HTML.encodeTags(recent.getPath().toString());
155              %>
156              <option value="<%=recent.getId()%>"><%=path%>
157              <%
158            }
159            %>
160            </select>
161          </td>
162        </tr>
163        <%
164      }
165      %>
166      </table>
167      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
168    </div>
169    </form>
170 
171    <table align="center">
172    <tr>
173      <td width="50%"><base:button onclick="doImport();" title="Next" /></td>
174      <td width="50%"><base:button onclick="window.close();" title="Cancel" /></td>
175    </tr>
176    </table>
177  </base:body>
178  </base:page>
179  <%
180}
181finally
182{
183  if (dc != null) dc.close();
184}
185%>
186
Note: See TracBrowser for help on using the repository browser.