source: trunk/www/filemanager/select_file.jsp @ 5953

Last change on this file since 5953 was 5953, checked in by Nicklas Nordborg, 10 years ago

References #1655: GUI improvements

Select file/directory and "save as" dialogs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.3 KB
Line 
1<%-- $Id: select_file.jsp 5953 2012-02-10 13:35:22Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, 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 3
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 BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21
22  @author Nicklas
23  @version 2.0
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.*"
27  import="net.sf.basedb.clients.web.*"
28%>
29<%@ taglib
30  prefix="base" uri="/WEB-INF/base.tld"
31%>
32<%
33SessionControl sc = Base.getExistingSessionControl(pageContext, Permission.DENIED, Item.FILE);
34String ID = sc.getId();
35String requestTitle = request.getParameter("title");
36String callback = request.getParameter("callback");
37final ModeInfo mode = ModeInfo.get(request.getParameter("mode"));
38final String title = mode.generateTitle("file", "files");
39%>
40<base:page title="<%=requestTitle == null ? title : requestTitle%>" type="popup">
41<base:head >
42  <script language="JavaScript">
43  var selected = new Array();
44  function setSelected(fileId, path)
45  {
46    selected[0] = {'id': fileId, 'path': path};
47    updatePath();
48  }
49  function addSelected(fileId, path)
50  {
51    if (getSelectedFileIndex(fileId) == -1)
52    {
53      selected[selected.length] = {'id': fileId, 'path': path};
54    }
55    updatePath();
56  }
57  function removeSelected(fileId)
58  {
59    var index = getSelectedFileIndex(fileId);
60    if (index >= 0) selected.splice(index, 1);
61    updatePath();
62  }
63 
64  function getSelectedFileIndex(fileId)
65  {
66    for (var i = 0; i < selected.length; i++)
67    {
68      if (selected[i].id == fileId) return i;
69    }
70    return -1;
71  }
72 
73  function updatePath()
74  {
75    var path = '';
76    for (var i = 0; i < selected.length; i++)
77    {
78      if (path != '') path += ', ';
79      path += selected[i].path;
80    }
81    document.getElementById('files').innerHTML = path;
82   
83  }
84  function returnSelected()
85  {
86    for (var i = 0; i < selected.length; i++)
87    {
88      window.opener.<%=callback%>(selected[i].id, selected[i].path);
89    }
90    window.close();
91  }
92  </script>
93</base:head>
94<base:body>
95  <h1><%=requestTitle == null ? title : requestTitle%></h1>
96  <div class="content bottomborder">
97    <div id="f1" class="absolutefull" style="bottom: 5em;"><iframe 
98      name="manager" id="idManager" src="frameset.jsp?ID=<%=ID%>&mode=<%=mode.getName()%>" 
99      style="width: 100%; height: 100%;"></iframe></div>
100
101    <div class="absolutefull topborder" style="top: auto; height: 5em;" id="controls">
102      <table class="fullform">
103        <tr class="dynamic">
104          <th>Selected file(s)</th>
105          <td id="files"></td>
106        </tr>
107      </table>
108    </div>
109  </div>
110 
111  <base:buttongroup subclass="dialogbuttons">
112    <base:button onclick="returnSelected();" title="Ok"  />
113    <base:button onclick="window.top.close();" title="Cancel" />
114  </base:buttongroup>
115</base:body>
116</base:page>
Note: See TracBrowser for help on using the repository browser.