3851 |
17 Oct 07 |
nicklas |
1 |
<%-- $Id:select_files.jsp 3820 2007-10-12 10:03:18Z nicklas $ |
3801 |
02 Oct 07 |
nicklas |
2 |
------------------------------------------------------------------ |
3801 |
02 Oct 07 |
nicklas |
Copyright (C) 2005 Nicklas Nordborg |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg |
3801 |
02 Oct 07 |
nicklas |
Copyright (C) 2007 Nicklas Nordborg |
3801 |
02 Oct 07 |
nicklas |
6 |
|
3801 |
02 Oct 07 |
nicklas |
7 |
This file is part of BASE - BioArray Software Environment. |
3801 |
02 Oct 07 |
nicklas |
8 |
Available at http://base.thep.lu.se/ |
3801 |
02 Oct 07 |
nicklas |
9 |
|
3801 |
02 Oct 07 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
3801 |
02 Oct 07 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
3801 |
02 Oct 07 |
nicklas |
13 |
of the License, or (at your option) any later version. |
3801 |
02 Oct 07 |
nicklas |
14 |
|
3801 |
02 Oct 07 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
3801 |
02 Oct 07 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3801 |
02 Oct 07 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3801 |
02 Oct 07 |
nicklas |
18 |
GNU General Public License for more details. |
3801 |
02 Oct 07 |
nicklas |
19 |
|
3801 |
02 Oct 07 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
3801 |
02 Oct 07 |
nicklas |
22 |
------------------------------------------------------------------ |
3801 |
02 Oct 07 |
nicklas |
23 |
|
3801 |
02 Oct 07 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
3801 |
02 Oct 07 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
3801 |
02 Oct 07 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
3801 |
02 Oct 07 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
3802 |
03 Oct 07 |
nicklas |
29 |
import="net.sf.basedb.core.ItemContext" |
3801 |
02 Oct 07 |
nicklas |
30 |
import="net.sf.basedb.core.Type" |
3801 |
02 Oct 07 |
nicklas |
31 |
import="net.sf.basedb.core.BasicItem" |
3801 |
02 Oct 07 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
3801 |
02 Oct 07 |
nicklas |
33 |
import="net.sf.basedb.core.Nameable" |
3801 |
02 Oct 07 |
nicklas |
34 |
import="net.sf.basedb.core.FileStoreEnabled" |
3801 |
02 Oct 07 |
nicklas |
35 |
import="net.sf.basedb.core.FileSet" |
3801 |
02 Oct 07 |
nicklas |
36 |
import="net.sf.basedb.core.FileSetMember" |
3801 |
02 Oct 07 |
nicklas |
37 |
import="net.sf.basedb.core.File" |
3801 |
02 Oct 07 |
nicklas |
38 |
import="net.sf.basedb.core.Platform" |
3801 |
02 Oct 07 |
nicklas |
39 |
import="net.sf.basedb.core.PlatformVariant" |
3801 |
02 Oct 07 |
nicklas |
40 |
import="net.sf.basedb.core.PlatformFileType" |
5713 |
02 Sep 11 |
nicklas |
41 |
import="net.sf.basedb.core.UsableDataFileType" |
3801 |
02 Oct 07 |
nicklas |
42 |
import="net.sf.basedb.core.DataFileType" |
5698 |
15 Aug 11 |
nicklas |
43 |
import="net.sf.basedb.core.Subtypable" |
5698 |
15 Aug 11 |
nicklas |
44 |
import="net.sf.basedb.core.ItemSubtype" |
3801 |
02 Oct 07 |
nicklas |
45 |
import="net.sf.basedb.core.ItemQuery" |
3801 |
02 Oct 07 |
nicklas |
46 |
import="net.sf.basedb.core.Include" |
3801 |
02 Oct 07 |
nicklas |
47 |
import="net.sf.basedb.core.ItemResultList" |
3801 |
02 Oct 07 |
nicklas |
48 |
import="net.sf.basedb.core.PermissionDeniedException" |
3801 |
02 Oct 07 |
nicklas |
49 |
import="net.sf.basedb.core.query.Expressions" |
3801 |
02 Oct 07 |
nicklas |
50 |
import="net.sf.basedb.core.query.Restrictions" |
3801 |
02 Oct 07 |
nicklas |
51 |
import="net.sf.basedb.core.query.Hql" |
3801 |
02 Oct 07 |
nicklas |
52 |
import="net.sf.basedb.core.query.Orders" |
3801 |
02 Oct 07 |
nicklas |
53 |
import="net.sf.basedb.clients.web.Base" |
3801 |
02 Oct 07 |
nicklas |
54 |
import="net.sf.basedb.clients.web.util.HTML" |
3801 |
02 Oct 07 |
nicklas |
55 |
import="net.sf.basedb.util.formatter.Formatter" |
3801 |
02 Oct 07 |
nicklas |
56 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
3801 |
02 Oct 07 |
nicklas |
57 |
import="net.sf.basedb.clients.web.formatter.FormatterSettings" |
3801 |
02 Oct 07 |
nicklas |
58 |
import="net.sf.basedb.util.Values" |
6256 |
25 Mar 13 |
nicklas |
59 |
import="org.json.simple.JSONObject" |
6256 |
25 Mar 13 |
nicklas |
60 |
import="org.json.simple.JSONArray" |
3801 |
02 Oct 07 |
nicklas |
61 |
import="java.util.ArrayList" |
3801 |
02 Oct 07 |
nicklas |
62 |
import="java.util.List" |
3801 |
02 Oct 07 |
nicklas |
63 |
import="java.util.Date" |
5713 |
02 Sep 11 |
nicklas |
64 |
import="java.util.Map" |
5713 |
02 Sep 11 |
nicklas |
65 |
import="java.util.HashMap" |
3801 |
02 Oct 07 |
nicklas |
66 |
%> |
3801 |
02 Oct 07 |
nicklas |
67 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
3801 |
02 Oct 07 |
nicklas |
68 |
<% |
3801 |
02 Oct 07 |
nicklas |
69 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
3801 |
02 Oct 07 |
nicklas |
70 |
final String ID = sc.getId(); |
3801 |
02 Oct 07 |
nicklas |
71 |
final float scale = Base.getScale(sc); |
3801 |
02 Oct 07 |
nicklas |
72 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
3801 |
02 Oct 07 |
nicklas |
73 |
final int itemId = Values.getInt(request.getParameter("item_id")); |
3801 |
02 Oct 07 |
nicklas |
74 |
final int platformId = Values.getInt(request.getParameter("platform_id"), -1); |
3801 |
02 Oct 07 |
nicklas |
75 |
final int variantId = Values.getInt(request.getParameter("variant_id"), -1); |
5698 |
15 Aug 11 |
nicklas |
76 |
final int itemSubtypeId = Values.getInt(request.getParameter("itemsubtype_id"), -1); |
3802 |
03 Oct 07 |
nicklas |
77 |
final ItemContext cc = sc.getCurrentContext(itemType); |
3801 |
02 Oct 07 |
nicklas |
78 |
|
7954 |
12 May 21 |
nicklas |
79 |
final DbControl dc = sc.newDbControl(":Select data files"); |
3801 |
02 Oct 07 |
nicklas |
80 |
try |
3801 |
02 Oct 07 |
nicklas |
81 |
{ |
3801 |
02 Oct 07 |
nicklas |
82 |
|
3801 |
02 Oct 07 |
nicklas |
83 |
// Get the current item; null if we are editing a new item |
3801 |
02 Oct 07 |
nicklas |
84 |
final FileStoreEnabled item = itemId == 0 ? null : (FileStoreEnabled)itemType.getById(dc, itemId); |
3801 |
02 Oct 07 |
nicklas |
85 |
FileSet fileSet = null; |
5713 |
02 Sep 11 |
nicklas |
86 |
// Get the current files organized per data file type |
5713 |
02 Sep 11 |
nicklas |
87 |
Map<DataFileType, List<FileSetMember>> members = new HashMap<DataFileType, List<FileSetMember>>(); |
3801 |
02 Oct 07 |
nicklas |
88 |
if (item != null && item.hasFileSet()) |
3801 |
02 Oct 07 |
nicklas |
89 |
{ |
3801 |
02 Oct 07 |
nicklas |
90 |
fileSet = item.getFileSet(); |
5713 |
02 Sep 11 |
nicklas |
91 |
ItemQuery<FileSetMember> query = fileSet.getMembers(); |
5713 |
02 Sep 11 |
nicklas |
92 |
query.order(Orders.asc(Hql.property("dataFileType.name"))); |
5713 |
02 Sep 11 |
nicklas |
93 |
query.order(Orders.asc(Hql.property("file.name"))); |
5713 |
02 Sep 11 |
nicklas |
94 |
List<FileSetMember> all = query.list(dc); |
5713 |
02 Sep 11 |
nicklas |
95 |
for (FileSetMember m : all) |
5713 |
02 Sep 11 |
nicklas |
96 |
{ |
5713 |
02 Sep 11 |
nicklas |
97 |
DataFileType dft = m.getDataFileType(); |
5713 |
02 Sep 11 |
nicklas |
98 |
List<FileSetMember> tmp = members.get(dft); |
5713 |
02 Sep 11 |
nicklas |
99 |
if (tmp == null) |
5713 |
02 Sep 11 |
nicklas |
100 |
{ |
5713 |
02 Sep 11 |
nicklas |
101 |
tmp = new ArrayList<FileSetMember>(); |
5713 |
02 Sep 11 |
nicklas |
102 |
members.put(dft, tmp); |
5713 |
02 Sep 11 |
nicklas |
103 |
} |
5713 |
02 Sep 11 |
nicklas |
104 |
tmp.add(m); |
5713 |
02 Sep 11 |
nicklas |
105 |
} |
3801 |
02 Oct 07 |
nicklas |
106 |
} |
3801 |
02 Oct 07 |
nicklas |
107 |
|
5698 |
15 Aug 11 |
nicklas |
108 |
// Get the current platform/variant/itemsubtype |
3801 |
02 Oct 07 |
nicklas |
109 |
// -- if not submitted in URL use values from current item |
3801 |
02 Oct 07 |
nicklas |
110 |
PlatformVariant variant = null; |
3801 |
02 Oct 07 |
nicklas |
111 |
Platform platform = null; |
5698 |
15 Aug 11 |
nicklas |
112 |
ItemSubtype itemSubtype = null; |
3802 |
03 Oct 07 |
nicklas |
113 |
boolean deniedPlatform = false; |
3802 |
03 Oct 07 |
nicklas |
114 |
try |
3801 |
02 Oct 07 |
nicklas |
115 |
{ |
5698 |
15 Aug 11 |
nicklas |
116 |
if (itemSubtypeId > 0) |
5698 |
15 Aug 11 |
nicklas |
117 |
{ |
5698 |
15 Aug 11 |
nicklas |
118 |
itemSubtype = ItemSubtype.getById(dc, itemSubtypeId); |
5698 |
15 Aug 11 |
nicklas |
119 |
} |
5698 |
15 Aug 11 |
nicklas |
120 |
else if (item instanceof Subtypable) |
5698 |
15 Aug 11 |
nicklas |
121 |
{ |
5698 |
15 Aug 11 |
nicklas |
122 |
itemSubtype = ((Subtypable)item).getItemSubtype(); |
5698 |
15 Aug 11 |
nicklas |
123 |
} |
3802 |
03 Oct 07 |
nicklas |
124 |
if (variantId > 0) |
3802 |
03 Oct 07 |
nicklas |
125 |
{ |
3802 |
03 Oct 07 |
nicklas |
126 |
variant = PlatformVariant.getById(dc, variantId); |
3802 |
03 Oct 07 |
nicklas |
127 |
platform = variant.getPlatform(); |
3802 |
03 Oct 07 |
nicklas |
128 |
} |
3802 |
03 Oct 07 |
nicklas |
129 |
else if (platformId > 0) |
3802 |
03 Oct 07 |
nicklas |
130 |
{ |
3802 |
03 Oct 07 |
nicklas |
131 |
platform = Platform.getById(dc, platformId); |
3802 |
03 Oct 07 |
nicklas |
132 |
} |
3802 |
03 Oct 07 |
nicklas |
133 |
else if (item != null) |
3802 |
03 Oct 07 |
nicklas |
134 |
{ |
3802 |
03 Oct 07 |
nicklas |
135 |
variant = item.getVariant(); |
3802 |
03 Oct 07 |
nicklas |
136 |
platform = item.getPlatform(); |
3802 |
03 Oct 07 |
nicklas |
137 |
} |
3801 |
02 Oct 07 |
nicklas |
138 |
} |
3802 |
03 Oct 07 |
nicklas |
139 |
catch (PermissionDeniedException ex) |
3801 |
02 Oct 07 |
nicklas |
140 |
{ |
3802 |
03 Oct 07 |
nicklas |
141 |
deniedPlatform = true; |
3801 |
02 Oct 07 |
nicklas |
142 |
} |
3801 |
02 Oct 07 |
nicklas |
143 |
|
3801 |
02 Oct 07 |
nicklas |
144 |
// Query to load data file types for specific itemType/platform/variant |
3801 |
02 Oct 07 |
nicklas |
145 |
final ItemQuery<DataFileType> fileTypeQuery = |
5698 |
15 Aug 11 |
nicklas |
146 |
Base.getDataFileTypes(itemType, item, platform, variant, itemSubtype); |
3801 |
02 Oct 07 |
nicklas |
147 |
List<DataFileType> fileTypes = fileTypeQuery.list(dc); |
6256 |
25 Mar 13 |
nicklas |
148 |
boolean validationSupport = false; |
6256 |
25 Mar 13 |
nicklas |
149 |
JSONArray jsonFileTypes = new JSONArray(); |
6256 |
25 Mar 13 |
nicklas |
150 |
|
3801 |
02 Oct 07 |
nicklas |
151 |
String title = "Select data files for " + |
3801 |
02 Oct 07 |
nicklas |
152 |
HTML.encodeTags((item instanceof Nameable ? ((Nameable)item).getName() : |
3801 |
02 Oct 07 |
nicklas |
153 |
(item == null ? " new item" : item.toString()))); |
3801 |
02 Oct 07 |
nicklas |
154 |
%> |
6256 |
25 Mar 13 |
nicklas |
155 |
<base:page type="iframe" title="<%=title%>" id="select-datafiles"> |
6256 |
25 Mar 13 |
nicklas |
156 |
<base:head scripts="~datafiles.js"> |
5713 |
02 Sep 11 |
nicklas |
157 |
<style> |
5915 |
16 Dec 11 |
nicklas |
158 |
.filelist |
5915 |
16 Dec 11 |
nicklas |
159 |
{ |
6611 |
20 Nov 14 |
nicklas |
160 |
margin: 1px; |
6611 |
20 Nov 14 |
nicklas |
161 |
border-width: 1px; |
6611 |
20 Nov 14 |
nicklas |
162 |
border-radius: 4px; |
5713 |
02 Sep 11 |
nicklas |
163 |
} |
5915 |
16 Dec 11 |
nicklas |
164 |
|
6611 |
20 Nov 14 |
nicklas |
165 |
.filelist:hover |
5915 |
16 Dec 11 |
nicklas |
166 |
{ |
6611 |
20 Nov 14 |
nicklas |
167 |
margin: 0; |
6611 |
20 Nov 14 |
nicklas |
168 |
border-width: 2px; |
5713 |
02 Sep 11 |
nicklas |
169 |
} |
5916 |
19 Dec 11 |
nicklas |
170 |
|
5919 |
09 Jan 12 |
nicklas |
171 |
.filelist td |
5919 |
09 Jan 12 |
nicklas |
172 |
{ |
5919 |
09 Jan 12 |
nicklas |
173 |
padding: 1px; |
5919 |
09 Jan 12 |
nicklas |
174 |
} |
5919 |
09 Jan 12 |
nicklas |
175 |
|
5915 |
16 Dec 11 |
nicklas |
176 |
.fileaction |
5915 |
16 Dec 11 |
nicklas |
177 |
{ |
5916 |
19 Dec 11 |
nicklas |
178 |
width: 40px; |
5713 |
02 Sep 11 |
nicklas |
179 |
text-align: center; |
5916 |
19 Dec 11 |
nicklas |
180 |
white-space: nowrap; |
5713 |
02 Sep 11 |
nicklas |
181 |
} |
5916 |
19 Dec 11 |
nicklas |
182 |
|
5919 |
09 Jan 12 |
nicklas |
183 |
.filelist img |
5919 |
09 Jan 12 |
nicklas |
184 |
{ |
5919 |
09 Jan 12 |
nicklas |
185 |
vertical-align: middle; |
5919 |
09 Jan 12 |
nicklas |
186 |
} |
5919 |
09 Jan 12 |
nicklas |
187 |
|
5915 |
16 Dec 11 |
nicklas |
188 |
.recentfiles |
5915 |
16 Dec 11 |
nicklas |
189 |
{ |
5713 |
02 Sep 11 |
nicklas |
190 |
position: absolute; |
5713 |
02 Sep 11 |
nicklas |
191 |
top: 0px; |
6611 |
20 Nov 14 |
nicklas |
192 |
left: 10px; |
6611 |
20 Nov 14 |
nicklas |
193 |
border-width: 1px; |
6611 |
20 Nov 14 |
nicklas |
194 |
border-top-width: 0; |
6611 |
20 Nov 14 |
nicklas |
195 |
background-color: #FFFFFF; |
6611 |
20 Nov 14 |
nicklas |
196 |
color: #000000; |
6611 |
20 Nov 14 |
nicklas |
197 |
box-shadow: 3px 3px 5px #CCCCCC; |
5713 |
02 Sep 11 |
nicklas |
198 |
text-align: left; |
5713 |
02 Sep 11 |
nicklas |
199 |
} |
5915 |
16 Dec 11 |
nicklas |
200 |
.recentfiles .recentfile |
5915 |
16 Dec 11 |
nicklas |
201 |
{ |
5713 |
02 Sep 11 |
nicklas |
202 |
padding: 2px; |
5713 |
02 Sep 11 |
nicklas |
203 |
} |
5915 |
16 Dec 11 |
nicklas |
204 |
|
5915 |
16 Dec 11 |
nicklas |
205 |
.recentfiles .recentfile:hover |
5915 |
16 Dec 11 |
nicklas |
206 |
{ |
5713 |
02 Sep 11 |
nicklas |
207 |
cursor: pointer; |
6611 |
20 Nov 14 |
nicklas |
208 |
padding: 0; |
6611 |
20 Nov 14 |
nicklas |
209 |
border-width: 2px; |
5915 |
16 Dec 11 |
nicklas |
210 |
border-radius: 4px; |
5713 |
02 Sep 11 |
nicklas |
211 |
} |
6611 |
20 Nov 14 |
nicklas |
212 |
|
5713 |
02 Sep 11 |
nicklas |
213 |
</style> |
3801 |
02 Oct 07 |
nicklas |
214 |
</base:head> |
6256 |
25 Mar 13 |
nicklas |
215 |
<base:body> |
5916 |
19 Dec 11 |
nicklas |
216 |
<form name="datafiles"> |
6611 |
20 Nov 14 |
nicklas |
217 |
<div class="absolutefull"> |
3801 |
02 Oct 07 |
nicklas |
218 |
<% |
5714 |
05 Sep 11 |
nicklas |
219 |
boolean hasNonPlatformFiles = false; |
5713 |
02 Sep 11 |
nicklas |
220 |
boolean activateCheckBoxes = false; |
3807 |
05 Oct 07 |
nicklas |
221 |
if (fileTypes.size() == 0) |
3802 |
03 Oct 07 |
nicklas |
222 |
{ |
5698 |
15 Aug 11 |
nicklas |
223 |
String what = ""; |
5698 |
15 Aug 11 |
nicklas |
224 |
if (platform != null) |
5698 |
15 Aug 11 |
nicklas |
225 |
{ |
5698 |
15 Aug 11 |
nicklas |
226 |
what = "'" + HTML.encodeTags(platform.getName()) + "' platform"; |
5698 |
15 Aug 11 |
nicklas |
227 |
} |
5698 |
15 Aug 11 |
nicklas |
228 |
else if (itemSubtype != null) |
5698 |
15 Aug 11 |
nicklas |
229 |
{ |
5698 |
15 Aug 11 |
nicklas |
230 |
what = "'" + HTML.encodeTags(itemSubtype.getName()) + "' subtype"; |
5698 |
15 Aug 11 |
nicklas |
231 |
} |
3802 |
03 Oct 07 |
nicklas |
232 |
%> |
6611 |
20 Nov 14 |
nicklas |
233 |
<div class="absolutefull bg-filled-50"> |
5915 |
16 Dec 11 |
nicklas |
234 |
<div class="messagecontainer error"> |
5698 |
15 Aug 11 |
nicklas |
235 |
The <%=what%> doesn't define any file types for |
5698 |
15 Aug 11 |
nicklas |
236 |
<%=itemType.toString() %> items. |
3807 |
05 Oct 07 |
nicklas |
237 |
</div> |
6611 |
20 Nov 14 |
nicklas |
238 |
</div> |
3807 |
05 Oct 07 |
nicklas |
239 |
<% |
3807 |
05 Oct 07 |
nicklas |
240 |
} |
3807 |
05 Oct 07 |
nicklas |
241 |
else if (deniedPlatform) |
3807 |
05 Oct 07 |
nicklas |
242 |
{ |
3807 |
05 Oct 07 |
nicklas |
243 |
%> |
6611 |
20 Nov 14 |
nicklas |
244 |
<div class="absolutefull bg-filled-50"> |
5915 |
16 Dec 11 |
nicklas |
245 |
<div class="messagecontainer error">Denied</div> |
6611 |
20 Nov 14 |
nicklas |
246 |
</div> |
3802 |
03 Oct 07 |
nicklas |
247 |
<% |
3802 |
03 Oct 07 |
nicklas |
248 |
} |
3807 |
05 Oct 07 |
nicklas |
249 |
else |
3801 |
02 Oct 07 |
nicklas |
250 |
{ |
3807 |
05 Oct 07 |
nicklas |
251 |
%> |
5915 |
16 Dec 11 |
nicklas |
252 |
<table class="fullform larger"> |
3807 |
05 Oct 07 |
nicklas |
253 |
<% |
3807 |
05 Oct 07 |
nicklas |
254 |
for (DataFileType dft : fileTypes) |
3802 |
03 Oct 07 |
nicklas |
255 |
{ |
5713 |
02 Sep 11 |
nicklas |
256 |
String dftId = Integer.toString(dft.getId()); |
5713 |
02 Sep 11 |
nicklas |
257 |
String fullLabel = dft.getName(); |
5713 |
02 Sep 11 |
nicklas |
258 |
String label = Values.trimString(fullLabel, 25); |
4873 |
02 Apr 09 |
martin |
259 |
|
5713 |
02 Sep 11 |
nicklas |
260 |
UsableDataFileType usable = null; |
5713 |
02 Sep 11 |
nicklas |
261 |
if (platform != null) |
3802 |
03 Oct 07 |
nicklas |
262 |
{ |
5713 |
02 Sep 11 |
nicklas |
263 |
usable = platform.getFileType(dft, variant, false); |
5713 |
02 Sep 11 |
nicklas |
264 |
if (usable == null && variant != null) |
3807 |
05 Oct 07 |
nicklas |
265 |
{ |
5713 |
02 Sep 11 |
nicklas |
266 |
// If file type is not registered with a variant, also check if it is inherited from platform |
5713 |
02 Sep 11 |
nicklas |
267 |
usable = platform.getFileType(dft, null, false); |
3807 |
05 Oct 07 |
nicklas |
268 |
} |
3802 |
03 Oct 07 |
nicklas |
269 |
} |
5713 |
02 Sep 11 |
nicklas |
270 |
else if (itemSubtype != null) |
3802 |
03 Oct 07 |
nicklas |
271 |
{ |
5713 |
02 Sep 11 |
nicklas |
272 |
usable = itemSubtype.getAssociatedDataFileType(dft, false); |
3802 |
03 Oct 07 |
nicklas |
273 |
} |
5713 |
02 Sep 11 |
nicklas |
274 |
|
5713 |
02 Sep 11 |
nicklas |
275 |
boolean isPartOfPlatform = usable != null; |
5713 |
02 Sep 11 |
nicklas |
276 |
boolean isRequired = usable == null ? false : usable.isRequired(); |
5713 |
02 Sep 11 |
nicklas |
277 |
boolean allowMultiple = usable == null ? false : usable.getAllowMultiple(); |
5713 |
02 Sep 11 |
nicklas |
278 |
boolean hasValidator = dft.hasActiveValidator(dc); |
5713 |
02 Sep 11 |
nicklas |
279 |
validationSupport |= hasValidator; |
5713 |
02 Sep 11 |
nicklas |
280 |
List<FileSetMember> files = members.get(dft); |
7605 |
26 Feb 19 |
nicklas |
281 |
List<File> recentFiles = cc.getRecent(dc, Item.FILE, dft.getExternalId()); |
6256 |
25 Mar 13 |
nicklas |
282 |
|
6256 |
25 Mar 13 |
nicklas |
283 |
JSONObject jsonFileType = new JSONObject(); |
6256 |
25 Mar 13 |
nicklas |
284 |
jsonFileType.put("id", dft.getId()); |
6256 |
25 Mar 13 |
nicklas |
285 |
jsonFileType.put("name", dft.getName()); |
6256 |
25 Mar 13 |
nicklas |
286 |
jsonFileType.put("extension", dft.getExtension()); |
6256 |
25 Mar 13 |
nicklas |
287 |
jsonFileType.put("hasValidator", hasValidator); |
6256 |
25 Mar 13 |
nicklas |
288 |
jsonFileType.put("allowMultiple", allowMultiple); |
6256 |
25 Mar 13 |
nicklas |
289 |
jsonFileTypes.add(jsonFileType); |
3807 |
05 Oct 07 |
nicklas |
290 |
%> |
5915 |
16 Dec 11 |
nicklas |
291 |
<tr> |
6124 |
13 Sep 12 |
nicklas |
292 |
<th title="<%=HTML.encodeTags(fullLabel)%>" style="overflow: hidden;"> |
5713 |
02 Sep 11 |
nicklas |
293 |
<% |
5713 |
02 Sep 11 |
nicklas |
294 |
if (!isPartOfPlatform && !deniedPlatform) |
5713 |
02 Sep 11 |
nicklas |
295 |
{ |
5713 |
02 Sep 11 |
nicklas |
296 |
hasNonPlatformFiles = true; |
5713 |
02 Sep 11 |
nicklas |
297 |
%> |
5946 |
03 Feb 12 |
nicklas |
298 |
<base:icon image="warning.png" |
5915 |
16 Dec 11 |
nicklas |
299 |
tooltip="This file is not part of the platform/subtype" |
6611 |
20 Nov 14 |
nicklas |
300 |
style="float: left; margin-right: 4px; vertical-align: top;" |
5915 |
16 Dec 11 |
nicklas |
301 |
/> |
5713 |
02 Sep 11 |
nicklas |
302 |
<% |
5713 |
02 Sep 11 |
nicklas |
303 |
} |
3867 |
19 Oct 07 |
nicklas |
304 |
%> |
5915 |
16 Dec 11 |
nicklas |
305 |
<%=HTML.encodeTags(label)%> |
5915 |
16 Dec 11 |
nicklas |
306 |
</th> |
6256 |
25 Mar 13 |
nicklas |
307 |
<td> |
6611 |
20 Nov 14 |
nicklas |
308 |
<div class="filelist input interactable <%=isRequired ? "required" : "" %>" id="container.<%=dftId%>"> |
5915 |
16 Dec 11 |
nicklas |
309 |
<table style="width: 100%;"> |
5916 |
19 Dec 11 |
nicklas |
310 |
<tr><td id="filelist.<%=dftId%>" class="files"> |
5915 |
16 Dec 11 |
nicklas |
311 |
<% |
5915 |
16 Dec 11 |
nicklas |
312 |
if (files != null && files.size() > 0) |
5713 |
02 Sep 11 |
nicklas |
313 |
{ |
5915 |
16 Dec 11 |
nicklas |
314 |
for (FileSetMember fm : files) |
5915 |
16 Dec 11 |
nicklas |
315 |
{ |
5915 |
16 Dec 11 |
nicklas |
316 |
File file = fm.getFile(); |
5915 |
16 Dec 11 |
nicklas |
317 |
%> |
5915 |
16 Dec 11 |
nicklas |
318 |
<div id="filelist.<%=dftId%>.<%=file.getId()%>" class="file"> |
5915 |
16 Dec 11 |
nicklas |
319 |
<%=file.getPath() %> |
6256 |
25 Mar 13 |
nicklas |
320 |
<base:icon |
6256 |
25 Mar 13 |
nicklas |
321 |
id="<%="remove." + dftId+"."+file.getId()%>" |
6256 |
25 Mar 13 |
nicklas |
322 |
data-file-id="<%=file.getId()%>" |
6256 |
25 Mar 13 |
nicklas |
323 |
image="remove.png" visible="<%=allowMultiple %>" |
5915 |
16 Dec 11 |
nicklas |
324 |
tooltip="Remove this file" |
5915 |
16 Dec 11 |
nicklas |
325 |
/> |
5915 |
16 Dec 11 |
nicklas |
326 |
</div> |
5915 |
16 Dec 11 |
nicklas |
327 |
<% |
5915 |
16 Dec 11 |
nicklas |
328 |
} |
5713 |
02 Sep 11 |
nicklas |
329 |
} |
5713 |
02 Sep 11 |
nicklas |
330 |
%> |
5915 |
16 Dec 11 |
nicklas |
331 |
</td> |
5915 |
16 Dec 11 |
nicklas |
332 |
<td class="fileaction"> |
6256 |
25 Mar 13 |
nicklas |
333 |
<base:icon |
6256 |
25 Mar 13 |
nicklas |
334 |
id="<%="showrecent." + dftId%>" |
6256 |
25 Mar 13 |
nicklas |
335 |
image="mini_scroll_down.png" |
5915 |
16 Dec 11 |
nicklas |
336 |
visible="<%=recentFiles.size() >= 0 %>" |
5915 |
16 Dec 11 |
nicklas |
337 |
tooltip="Select a recently used file" |
5915 |
16 Dec 11 |
nicklas |
338 |
/> |
6256 |
25 Mar 13 |
nicklas |
339 |
<base:icon id="<%="addfile." + dftId%>" |
6256 |
25 Mar 13 |
nicklas |
340 |
image="add.png" |
5915 |
16 Dec 11 |
nicklas |
341 |
visible="<%=allowMultiple %>" |
6256 |
25 Mar 13 |
nicklas |
342 |
tooltip="Browse for files in the BASE file system" |
5915 |
16 Dec 11 |
nicklas |
343 |
/> |
6256 |
25 Mar 13 |
nicklas |
344 |
<base:icon id="<%="browsefile." + dftId%>" |
6256 |
25 Mar 13 |
nicklas |
345 |
image="browse.png" |
6256 |
25 Mar 13 |
nicklas |
346 |
tooltip="Browse for a file in the BASE file system" |
5915 |
16 Dec 11 |
nicklas |
347 |
visible="<%=!allowMultiple%>" |
5915 |
16 Dec 11 |
nicklas |
348 |
/> |
5915 |
16 Dec 11 |
nicklas |
349 |
</td> |
5915 |
16 Dec 11 |
nicklas |
350 |
</tr> |
5915 |
16 Dec 11 |
nicklas |
351 |
</table> |
5915 |
16 Dec 11 |
nicklas |
352 |
</div> |
5915 |
16 Dec 11 |
nicklas |
353 |
|
5714 |
05 Sep 11 |
nicklas |
354 |
<div id="recentfiles.<%=dftId%>" style="display: none;" class="recentfiles"> |
6611 |
20 Nov 14 |
nicklas |
355 |
<div class="recentfile interactable" |
6256 |
25 Mar 13 |
nicklas |
356 |
data-file-id="0" |
5714 |
05 Sep 11 |
nicklas |
357 |
id="recentfile.<%=dftId%>.0" |
5714 |
05 Sep 11 |
nicklas |
358 |
><i>- clear -</i></div> |
5714 |
05 Sep 11 |
nicklas |
359 |
<% |
5714 |
05 Sep 11 |
nicklas |
360 |
for (File recent : recentFiles) |
5714 |
05 Sep 11 |
nicklas |
361 |
{ |
5714 |
05 Sep 11 |
nicklas |
362 |
%> |
6611 |
20 Nov 14 |
nicklas |
363 |
<div class="recentfile interactable" |
6256 |
25 Mar 13 |
nicklas |
364 |
data-file-id="<%=recent.getId()%>" |
5714 |
05 Sep 11 |
nicklas |
365 |
id="recentfile.<%=dftId%>.<%=recent.getId()%>" |
5714 |
05 Sep 11 |
nicklas |
366 |
><%=HTML.encodeTags(recent.getPath().toString())%></div> |
5713 |
02 Sep 11 |
nicklas |
367 |
<% |
5714 |
05 Sep 11 |
nicklas |
368 |
} |
5714 |
05 Sep 11 |
nicklas |
369 |
%> |
5714 |
05 Sep 11 |
nicklas |
370 |
</div> |
5713 |
02 Sep 11 |
nicklas |
371 |
</td> |
3807 |
05 Oct 07 |
nicklas |
372 |
</tr> |
3807 |
05 Oct 07 |
nicklas |
373 |
<% |
3807 |
05 Oct 07 |
nicklas |
374 |
} |
3807 |
05 Oct 07 |
nicklas |
375 |
%> |
5916 |
19 Dec 11 |
nicklas |
376 |
<% |
5916 |
19 Dec 11 |
nicklas |
377 |
if (validationSupport) |
5916 |
19 Dec 11 |
nicklas |
378 |
{ |
5916 |
19 Dec 11 |
nicklas |
379 |
%> |
5916 |
19 Dec 11 |
nicklas |
380 |
<tr> |
5916 |
19 Dec 11 |
nicklas |
381 |
<th><label for="validateFiles"><b>Validate files</b></label></th> |
5916 |
19 Dec 11 |
nicklas |
382 |
<td> |
5916 |
19 Dec 11 |
nicklas |
383 |
<span title="Enabled this check box to validate and extract metadata from selected files"> |
5916 |
19 Dec 11 |
nicklas |
384 |
<input type="checkbox" value="1" name="datafiles.validate" id="validateFiles"> |
5916 |
19 Dec 11 |
nicklas |
385 |
</span> |
5916 |
19 Dec 11 |
nicklas |
386 |
</td> |
5916 |
19 Dec 11 |
nicklas |
387 |
</tr> |
5916 |
19 Dec 11 |
nicklas |
388 |
<% |
5916 |
19 Dec 11 |
nicklas |
389 |
} |
5916 |
19 Dec 11 |
nicklas |
390 |
%> |
5915 |
16 Dec 11 |
nicklas |
391 |
<tr class="dynamic"> |
5915 |
16 Dec 11 |
nicklas |
392 |
<th></th> |
6611 |
20 Nov 14 |
nicklas |
393 |
<td style="vertical-align: bottom;"> |
5916 |
19 Dec 11 |
nicklas |
394 |
<% |
6611 |
20 Nov 14 |
nicklas |
395 |
if (hasNonPlatformFiles) |
6611 |
20 Nov 14 |
nicklas |
396 |
{ |
6611 |
20 Nov 14 |
nicklas |
397 |
if (platform != null) |
6611 |
20 Nov 14 |
nicklas |
398 |
{ |
6611 |
20 Nov 14 |
nicklas |
399 |
%> |
6611 |
20 Nov 14 |
nicklas |
400 |
<div class="legend"> |
6611 |
20 Nov 14 |
nicklas |
401 |
<base:icon image="warning.png" /> |
6611 |
20 Nov 14 |
nicklas |
402 |
= the file type is not part of the <i><%=HTML.encodeTags(platform.getName())%></i> platform |
6611 |
20 Nov 14 |
nicklas |
403 |
</div> |
6611 |
20 Nov 14 |
nicklas |
404 |
<% |
6611 |
20 Nov 14 |
nicklas |
405 |
} |
6611 |
20 Nov 14 |
nicklas |
406 |
else if (itemSubtype != null) |
6611 |
20 Nov 14 |
nicklas |
407 |
{ |
6611 |
20 Nov 14 |
nicklas |
408 |
%> |
6611 |
20 Nov 14 |
nicklas |
409 |
<div class="legend" style="padding: 3px;"> |
6611 |
20 Nov 14 |
nicklas |
410 |
<base:icon image="warning.png" /> |
6611 |
20 Nov 14 |
nicklas |
411 |
= the file type is not part of the <i><%=HTML.encodeTags(itemSubtype.getName())%></i> subtype |
6611 |
20 Nov 14 |
nicklas |
412 |
</div> |
6611 |
20 Nov 14 |
nicklas |
413 |
<% |
6611 |
20 Nov 14 |
nicklas |
414 |
} |
6611 |
20 Nov 14 |
nicklas |
415 |
} |
5916 |
19 Dec 11 |
nicklas |
416 |
%> |
5916 |
19 Dec 11 |
nicklas |
417 |
<% |
5916 |
19 Dec 11 |
nicklas |
418 |
} |
6611 |
20 Nov 14 |
nicklas |
419 |
%> |
6611 |
20 Nov 14 |
nicklas |
420 |
</td> |
6611 |
20 Nov 14 |
nicklas |
421 |
</tr> |
3807 |
05 Oct 07 |
nicklas |
422 |
</table> |
5713 |
02 Sep 11 |
nicklas |
423 |
</div> |
5916 |
19 Dec 11 |
nicklas |
424 |
</form> |
6256 |
25 Mar 13 |
nicklas |
425 |
<div id="page-data" class="datacontainer" |
6256 |
25 Mar 13 |
nicklas |
426 |
data-filetypes="<%=HTML.encodeTags(jsonFileTypes.toJSONString()) %>" |
6256 |
25 Mar 13 |
nicklas |
427 |
></div> |
5713 |
02 Sep 11 |
nicklas |
428 |
|
3801 |
02 Oct 07 |
nicklas |
429 |
</base:body> |
3801 |
02 Oct 07 |
nicklas |
430 |
</base:page> |
3801 |
02 Oct 07 |
nicklas |
431 |
<% |
3801 |
02 Oct 07 |
nicklas |
432 |
} |
3801 |
02 Oct 07 |
nicklas |
433 |
finally |
3801 |
02 Oct 07 |
nicklas |
434 |
{ |
3801 |
02 Oct 07 |
nicklas |
435 |
if (dc != null) dc.close(); |
3801 |
02 Oct 07 |
nicklas |
436 |
} |
3801 |
02 Oct 07 |
nicklas |
437 |
%> |