3801 |
02 Oct 07 |
nicklas |
1 |
<%-- $Id$ |
3801 |
02 Oct 07 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
3801 |
02 Oct 07 |
nicklas |
4 |
|
3801 |
02 Oct 07 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
3801 |
02 Oct 07 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
3801 |
02 Oct 07 |
nicklas |
7 |
|
3801 |
02 Oct 07 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
3801 |
02 Oct 07 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
3801 |
02 Oct 07 |
nicklas |
11 |
of the License, or (at your option) any later version. |
3801 |
02 Oct 07 |
nicklas |
12 |
|
3801 |
02 Oct 07 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
3801 |
02 Oct 07 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3801 |
02 Oct 07 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3801 |
02 Oct 07 |
nicklas |
16 |
GNU General Public License for more details. |
3801 |
02 Oct 07 |
nicklas |
17 |
|
3801 |
02 Oct 07 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
3801 |
02 Oct 07 |
nicklas |
20 |
------------------------------------------------------------------ |
3801 |
02 Oct 07 |
nicklas |
21 |
|
3801 |
02 Oct 07 |
nicklas |
22 |
@author Nicklas |
3801 |
02 Oct 07 |
nicklas |
23 |
@version 2.0 |
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" |
7757 |
27 Nov 19 |
nicklas |
29 |
import="net.sf.basedb.core.BasicItem" |
3801 |
02 Oct 07 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
7757 |
27 Nov 19 |
nicklas |
31 |
import="net.sf.basedb.core.plugin.GuiContext" |
3801 |
02 Oct 07 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
3801 |
02 Oct 07 |
nicklas |
33 |
import="net.sf.basedb.core.Platform" |
3801 |
02 Oct 07 |
nicklas |
34 |
import="net.sf.basedb.core.PlatformVariant" |
3801 |
02 Oct 07 |
nicklas |
35 |
import="net.sf.basedb.core.PlatformFileType" |
3801 |
02 Oct 07 |
nicklas |
36 |
import="net.sf.basedb.core.DataFileType" |
5713 |
02 Sep 11 |
nicklas |
37 |
import="net.sf.basedb.core.Subtypable" |
5713 |
02 Sep 11 |
nicklas |
38 |
import="net.sf.basedb.core.ItemSubtype" |
3801 |
02 Oct 07 |
nicklas |
39 |
import="net.sf.basedb.core.FileSet" |
3801 |
02 Oct 07 |
nicklas |
40 |
import="net.sf.basedb.core.FileSetMember" |
3801 |
02 Oct 07 |
nicklas |
41 |
import="net.sf.basedb.core.File" |
3801 |
02 Oct 07 |
nicklas |
42 |
import="net.sf.basedb.core.FileStoreEnabled" |
5713 |
02 Sep 11 |
nicklas |
43 |
import="net.sf.basedb.core.UsableDataFileType" |
5713 |
02 Sep 11 |
nicklas |
44 |
import="net.sf.basedb.core.ItemSubtypeFileType" |
3812 |
10 Oct 07 |
nicklas |
45 |
import="net.sf.basedb.core.Nameable" |
3801 |
02 Oct 07 |
nicklas |
46 |
import="net.sf.basedb.core.ItemQuery" |
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.Orders" |
3801 |
02 Oct 07 |
nicklas |
50 |
import="net.sf.basedb.core.query.Expressions" |
3801 |
02 Oct 07 |
nicklas |
51 |
import="net.sf.basedb.core.query.Restrictions" |
3801 |
02 Oct 07 |
nicklas |
52 |
import="net.sf.basedb.core.query.Hql" |
4338 |
17 Jun 08 |
nicklas |
53 |
import="net.sf.basedb.util.NameableComparator" |
7757 |
27 Nov 19 |
nicklas |
54 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
3801 |
02 Oct 07 |
nicklas |
55 |
import="net.sf.basedb.clients.web.Base" |
3801 |
02 Oct 07 |
nicklas |
56 |
import="net.sf.basedb.clients.web.util.HTML" |
3801 |
02 Oct 07 |
nicklas |
57 |
import="net.sf.basedb.util.formatter.Formatter" |
3801 |
02 Oct 07 |
nicklas |
58 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
7757 |
27 Nov 19 |
nicklas |
59 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
7757 |
27 Nov 19 |
nicklas |
60 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
7757 |
27 Nov 19 |
nicklas |
61 |
import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerContext" |
7757 |
27 Nov 19 |
nicklas |
62 |
import="net.sf.basedb.clients.web.extensions.fileviewer.FileViewerUtil" |
3801 |
02 Oct 07 |
nicklas |
63 |
import="net.sf.basedb.util.Values" |
3801 |
02 Oct 07 |
nicklas |
64 |
import="java.util.Map" |
3812 |
10 Oct 07 |
nicklas |
65 |
import="java.util.Set" |
3812 |
10 Oct 07 |
nicklas |
66 |
import="java.util.HashSet" |
3801 |
02 Oct 07 |
nicklas |
67 |
import="java.util.HashMap" |
3812 |
10 Oct 07 |
nicklas |
68 |
import="java.util.List" |
3812 |
10 Oct 07 |
nicklas |
69 |
import="java.util.LinkedList" |
3812 |
10 Oct 07 |
nicklas |
70 |
import="java.util.Collection" |
3801 |
02 Oct 07 |
nicklas |
71 |
%> |
3801 |
02 Oct 07 |
nicklas |
72 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
3801 |
02 Oct 07 |
nicklas |
73 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
7757 |
27 Nov 19 |
nicklas |
74 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
3812 |
10 Oct 07 |
nicklas |
75 |
<%! |
3801 |
02 Oct 07 |
nicklas |
76 |
|
3812 |
10 Oct 07 |
nicklas |
77 |
private static class DataFile |
3812 |
10 Oct 07 |
nicklas |
78 |
{ |
3812 |
10 Oct 07 |
nicklas |
79 |
final DataFileType type; |
3812 |
10 Oct 07 |
nicklas |
80 |
final FileSetMember member; |
3812 |
10 Oct 07 |
nicklas |
81 |
final FileStoreEnabled parent; |
3812 |
10 Oct 07 |
nicklas |
82 |
DataFile(DataFileType type, FileSetMember member, FileStoreEnabled parent) |
3812 |
10 Oct 07 |
nicklas |
83 |
{ |
3812 |
10 Oct 07 |
nicklas |
84 |
this.type = type; |
3812 |
10 Oct 07 |
nicklas |
85 |
this.member = member; |
3812 |
10 Oct 07 |
nicklas |
86 |
this.parent = parent; |
3812 |
10 Oct 07 |
nicklas |
87 |
} |
3812 |
10 Oct 07 |
nicklas |
88 |
} |
3812 |
10 Oct 07 |
nicklas |
89 |
|
3812 |
10 Oct 07 |
nicklas |
90 |
%> |
3801 |
02 Oct 07 |
nicklas |
91 |
<% |
3801 |
02 Oct 07 |
nicklas |
92 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
3801 |
02 Oct 07 |
nicklas |
93 |
final String ID = sc.getId(); |
3801 |
02 Oct 07 |
nicklas |
94 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
3801 |
02 Oct 07 |
nicklas |
95 |
final int itemId = Values.getInt(request.getParameter("item_id")); |
3801 |
02 Oct 07 |
nicklas |
96 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
97 |
final DbControl dc = sc.newDbControl(":List data files"); |
3801 |
02 Oct 07 |
nicklas |
98 |
final ItemContext cc = sc.getCurrentContext(itemType); |
4338 |
17 Jun 08 |
nicklas |
99 |
final String root = request.getContextPath() + "/"; |
3801 |
02 Oct 07 |
nicklas |
100 |
|
3801 |
02 Oct 07 |
nicklas |
101 |
try |
3801 |
02 Oct 07 |
nicklas |
102 |
{ |
3801 |
02 Oct 07 |
nicklas |
103 |
final FileStoreEnabled item = (FileStoreEnabled)itemType.getById(dc, itemId); |
3801 |
02 Oct 07 |
nicklas |
104 |
final FileSet fileSet = item.hasFileSet() ? item.getFileSet() : null; |
3812 |
10 Oct 07 |
nicklas |
105 |
Collection<FileSet> parents = null; |
3812 |
10 Oct 07 |
nicklas |
106 |
try |
3812 |
10 Oct 07 |
nicklas |
107 |
{ |
3812 |
10 Oct 07 |
nicklas |
108 |
parents = item.getParentFileSets(); |
3812 |
10 Oct 07 |
nicklas |
109 |
} |
3812 |
10 Oct 07 |
nicklas |
110 |
catch (Throwable t) |
3812 |
10 Oct 07 |
nicklas |
111 |
{} |
3801 |
02 Oct 07 |
nicklas |
112 |
|
3801 |
02 Oct 07 |
nicklas |
113 |
Platform platform = null; |
3801 |
02 Oct 07 |
nicklas |
114 |
PlatformVariant variant = null; |
5698 |
15 Aug 11 |
nicklas |
115 |
ItemSubtype subtype = null; |
3801 |
02 Oct 07 |
nicklas |
116 |
try |
3801 |
02 Oct 07 |
nicklas |
117 |
{ |
3801 |
02 Oct 07 |
nicklas |
118 |
platform = item.getPlatform(); |
3801 |
02 Oct 07 |
nicklas |
119 |
variant = item.getVariant(); |
3801 |
02 Oct 07 |
nicklas |
120 |
} |
3801 |
02 Oct 07 |
nicklas |
121 |
catch (Throwable t) |
3801 |
02 Oct 07 |
nicklas |
122 |
{} |
5698 |
15 Aug 11 |
nicklas |
123 |
if (item instanceof Subtypable) |
5698 |
15 Aug 11 |
nicklas |
124 |
{ |
5698 |
15 Aug 11 |
nicklas |
125 |
try |
5698 |
15 Aug 11 |
nicklas |
126 |
{ |
5698 |
15 Aug 11 |
nicklas |
127 |
subtype = ((Subtypable)item).getItemSubtype(); |
5698 |
15 Aug 11 |
nicklas |
128 |
} |
5698 |
15 Aug 11 |
nicklas |
129 |
catch (Throwable t) |
5698 |
15 Aug 11 |
nicklas |
130 |
{} |
5698 |
15 Aug 11 |
nicklas |
131 |
} |
3801 |
02 Oct 07 |
nicklas |
132 |
|
3801 |
02 Oct 07 |
nicklas |
133 |
// Load member file types |
3812 |
10 Oct 07 |
nicklas |
134 |
List<DataFile> members = new LinkedList<DataFile>(); |
3812 |
10 Oct 07 |
nicklas |
135 |
Set<DataFileType> existing = new HashSet<DataFileType>(); |
3801 |
02 Oct 07 |
nicklas |
136 |
if (fileSet != null) |
3801 |
02 Oct 07 |
nicklas |
137 |
{ |
3801 |
02 Oct 07 |
nicklas |
138 |
ItemQuery<FileSetMember> query = fileSet.getMembers(); |
5713 |
02 Sep 11 |
nicklas |
139 |
query.order(Orders.asc(Hql.property("dataFileType.name"))); |
5713 |
02 Sep 11 |
nicklas |
140 |
query.order(Orders.asc(Hql.property("file.name"))); |
3801 |
02 Oct 07 |
nicklas |
141 |
for (FileSetMember member : query.list(dc)) |
3801 |
02 Oct 07 |
nicklas |
142 |
{ |
3802 |
03 Oct 07 |
nicklas |
143 |
DataFileType dft = null; |
3802 |
03 Oct 07 |
nicklas |
144 |
try |
3802 |
03 Oct 07 |
nicklas |
145 |
{ |
3802 |
03 Oct 07 |
nicklas |
146 |
dft = member.getDataFileType(); |
3812 |
10 Oct 07 |
nicklas |
147 |
existing.add(dft); |
3802 |
03 Oct 07 |
nicklas |
148 |
} |
3802 |
03 Oct 07 |
nicklas |
149 |
catch (Throwable t) |
3812 |
10 Oct 07 |
nicklas |
150 |
{} |
3812 |
10 Oct 07 |
nicklas |
151 |
members.add(new DataFile(dft, member, null)); |
3812 |
10 Oct 07 |
nicklas |
152 |
} |
3812 |
10 Oct 07 |
nicklas |
153 |
} |
3812 |
10 Oct 07 |
nicklas |
154 |
int numMembers = members.size(); |
3812 |
10 Oct 07 |
nicklas |
155 |
if (parents != null && !parents.isEmpty()) |
3812 |
10 Oct 07 |
nicklas |
156 |
{ |
3812 |
10 Oct 07 |
nicklas |
157 |
for (FileSet pFileSet : parents) |
3812 |
10 Oct 07 |
nicklas |
158 |
{ |
3812 |
10 Oct 07 |
nicklas |
159 |
try |
3802 |
03 Oct 07 |
nicklas |
160 |
{ |
3812 |
10 Oct 07 |
nicklas |
161 |
FileStoreEnabled parent = pFileSet.getItem(); |
3812 |
10 Oct 07 |
nicklas |
162 |
for (FileSetMember pMember : pFileSet.getMembers().list(dc)) |
3812 |
10 Oct 07 |
nicklas |
163 |
{ |
3812 |
10 Oct 07 |
nicklas |
164 |
DataFileType dft = null; |
3812 |
10 Oct 07 |
nicklas |
165 |
try |
3812 |
10 Oct 07 |
nicklas |
166 |
{ |
3812 |
10 Oct 07 |
nicklas |
167 |
dft = pMember.getDataFileType(); |
3812 |
10 Oct 07 |
nicklas |
168 |
} |
3812 |
10 Oct 07 |
nicklas |
169 |
catch (Throwable t) |
3812 |
10 Oct 07 |
nicklas |
170 |
{} |
3812 |
10 Oct 07 |
nicklas |
171 |
members.add(new DataFile(dft, pMember, parent)); |
3812 |
10 Oct 07 |
nicklas |
172 |
} |
3802 |
03 Oct 07 |
nicklas |
173 |
} |
3812 |
10 Oct 07 |
nicklas |
174 |
catch (Throwable t) |
3812 |
10 Oct 07 |
nicklas |
175 |
{} |
3801 |
02 Oct 07 |
nicklas |
176 |
} |
3801 |
02 Oct 07 |
nicklas |
177 |
} |
3812 |
10 Oct 07 |
nicklas |
178 |
int numParents = members.size() - numMembers; |
3812 |
10 Oct 07 |
nicklas |
179 |
|
3801 |
02 Oct 07 |
nicklas |
180 |
|
3801 |
02 Oct 07 |
nicklas |
181 |
// Load platform file types |
5713 |
02 Sep 11 |
nicklas |
182 |
Map<DataFileType, UsableDataFileType> usableFileTypes = |
5713 |
02 Sep 11 |
nicklas |
183 |
new HashMap<DataFileType, UsableDataFileType>(); |
3801 |
02 Oct 07 |
nicklas |
184 |
if (platform != null) |
3801 |
02 Oct 07 |
nicklas |
185 |
{ |
3801 |
02 Oct 07 |
nicklas |
186 |
ItemQuery<PlatformFileType> query = platform.getFileTypes(variant, variant == null); |
3801 |
02 Oct 07 |
nicklas |
187 |
for (PlatformFileType pft : query.list(dc)) |
3801 |
02 Oct 07 |
nicklas |
188 |
{ |
3802 |
03 Oct 07 |
nicklas |
189 |
DataFileType dft = null; |
3802 |
03 Oct 07 |
nicklas |
190 |
try |
3801 |
02 Oct 07 |
nicklas |
191 |
{ |
3802 |
03 Oct 07 |
nicklas |
192 |
dft = pft.getDataFileType(); |
5713 |
02 Sep 11 |
nicklas |
193 |
usableFileTypes.put(dft, pft); |
3812 |
10 Oct 07 |
nicklas |
194 |
if (dft.getItemType() == itemType && !existing.contains(dft)) |
3802 |
03 Oct 07 |
nicklas |
195 |
{ |
3812 |
10 Oct 07 |
nicklas |
196 |
members.add(new DataFile(dft, null, null)); |
3802 |
03 Oct 07 |
nicklas |
197 |
} |
3801 |
02 Oct 07 |
nicklas |
198 |
} |
3802 |
03 Oct 07 |
nicklas |
199 |
catch (Throwable t) |
3802 |
03 Oct 07 |
nicklas |
200 |
{} |
3801 |
02 Oct 07 |
nicklas |
201 |
} |
3801 |
02 Oct 07 |
nicklas |
202 |
} |
5698 |
15 Aug 11 |
nicklas |
203 |
|
5698 |
15 Aug 11 |
nicklas |
204 |
// Load subtype-related file types |
5698 |
15 Aug 11 |
nicklas |
205 |
if (subtype != null) |
5698 |
15 Aug 11 |
nicklas |
206 |
{ |
5713 |
02 Sep 11 |
nicklas |
207 |
ItemQuery<ItemSubtypeFileType> query = subtype.getDataFileTypes(); |
5713 |
02 Sep 11 |
nicklas |
208 |
for (ItemSubtypeFileType sft : query.list(dc)) |
5698 |
15 Aug 11 |
nicklas |
209 |
{ |
5713 |
02 Sep 11 |
nicklas |
210 |
DataFileType dft = null; |
5713 |
02 Sep 11 |
nicklas |
211 |
try |
5698 |
15 Aug 11 |
nicklas |
212 |
{ |
5713 |
02 Sep 11 |
nicklas |
213 |
dft = sft.getDataFileType(); |
5713 |
02 Sep 11 |
nicklas |
214 |
usableFileTypes.put(dft, sft); |
5713 |
02 Sep 11 |
nicklas |
215 |
if (dft.getItemType() == itemType && !existing.contains(dft)) |
5713 |
02 Sep 11 |
nicklas |
216 |
{ |
5713 |
02 Sep 11 |
nicklas |
217 |
members.add(new DataFile(dft, null, null)); |
5713 |
02 Sep 11 |
nicklas |
218 |
} |
5698 |
15 Aug 11 |
nicklas |
219 |
} |
5713 |
02 Sep 11 |
nicklas |
220 |
catch (Throwable t) |
5713 |
02 Sep 11 |
nicklas |
221 |
{} |
5698 |
15 Aug 11 |
nicklas |
222 |
} |
5698 |
15 Aug 11 |
nicklas |
223 |
} |
7757 |
27 Nov 19 |
nicklas |
224 |
|
7757 |
27 Nov 19 |
nicklas |
225 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, new GuiContext(itemType, GuiContext.Type.ITEM), null); |
7757 |
27 Nov 19 |
nicklas |
226 |
FileViewerContext fileContext = FileViewerContext.dataFile((BasicItem)item); |
7855 |
19 Oct 20 |
nicklas |
227 |
FileViewerUtil fileViewer = FileViewerUtil.getOrCreate(jspContext, fileContext); |
3801 |
02 Oct 07 |
nicklas |
228 |
%> |
4338 |
17 Jun 08 |
nicklas |
229 |
<base:page type="include"> |
3801 |
02 Oct 07 |
nicklas |
230 |
<base:body> |
7760 |
27 Nov 19 |
nicklas |
231 |
<ext:scripts context="<%=jspContext%>" /> |
5939 |
30 Jan 12 |
nicklas |
232 |
<base:section |
5939 |
30 Jan 12 |
nicklas |
233 |
id="datafiles" |
5939 |
30 Jan 12 |
nicklas |
234 |
title="<%="Data files (" + (numMembers + numParents) +")"%>" |
5939 |
30 Jan 12 |
nicklas |
235 |
context="<%=cc%>"> |
3801 |
02 Oct 07 |
nicklas |
236 |
<% |
3801 |
02 Oct 07 |
nicklas |
237 |
if (members.size() == 0) |
3801 |
02 Oct 07 |
nicklas |
238 |
{ |
3801 |
02 Oct 07 |
nicklas |
239 |
%> |
5939 |
30 Jan 12 |
nicklas |
240 |
<div class="messagecontainer note"> |
3801 |
02 Oct 07 |
nicklas |
241 |
No files have been added to this item |
3801 |
02 Oct 07 |
nicklas |
242 |
(or you don't have permission to view them). |
5939 |
30 Jan 12 |
nicklas |
243 |
</div> |
3801 |
02 Oct 07 |
nicklas |
244 |
<% |
3801 |
02 Oct 07 |
nicklas |
245 |
} |
3801 |
02 Oct 07 |
nicklas |
246 |
else |
3801 |
02 Oct 07 |
nicklas |
247 |
{ |
3801 |
02 Oct 07 |
nicklas |
248 |
%> |
3801 |
02 Oct 07 |
nicklas |
249 |
<tbl:table |
6143 |
20 Sep 12 |
nicklas |
250 |
id="tbl.datafiles" |
3801 |
02 Oct 07 |
nicklas |
251 |
columns="all" |
3801 |
02 Oct 07 |
nicklas |
252 |
> |
5939 |
30 Jan 12 |
nicklas |
253 |
<tbl:columndef |
5939 |
30 Jan 12 |
nicklas |
254 |
id="type" |
5939 |
30 Jan 12 |
nicklas |
255 |
title="Type" |
5939 |
30 Jan 12 |
nicklas |
256 |
/> |
5939 |
30 Jan 12 |
nicklas |
257 |
<tbl:columndef |
5939 |
30 Jan 12 |
nicklas |
258 |
id="file" |
5939 |
30 Jan 12 |
nicklas |
259 |
title="File" |
5939 |
30 Jan 12 |
nicklas |
260 |
/> |
5939 |
30 Jan 12 |
nicklas |
261 |
<tbl:columndef |
5939 |
30 Jan 12 |
nicklas |
262 |
id="required" |
5939 |
30 Jan 12 |
nicklas |
263 |
title="Required" |
5939 |
30 Jan 12 |
nicklas |
264 |
/> |
5939 |
30 Jan 12 |
nicklas |
265 |
<tbl:columndef |
5939 |
30 Jan 12 |
nicklas |
266 |
id="validation" |
5939 |
30 Jan 12 |
nicklas |
267 |
title="Validation" |
5939 |
30 Jan 12 |
nicklas |
268 |
/> |
5939 |
30 Jan 12 |
nicklas |
269 |
<tbl:data> |
5939 |
30 Jan 12 |
nicklas |
270 |
<tbl:headers> |
5939 |
30 Jan 12 |
nicklas |
271 |
<tbl:headerrow> |
5939 |
30 Jan 12 |
nicklas |
272 |
<tbl:columnheaders /> |
5939 |
30 Jan 12 |
nicklas |
273 |
</tbl:headerrow> |
7913 |
22 Feb 21 |
nicklas |
274 |
<tbl:columnsubtitles /> |
5939 |
30 Jan 12 |
nicklas |
275 |
</tbl:headers> |
5939 |
30 Jan 12 |
nicklas |
276 |
<tbl:rows> |
5939 |
30 Jan 12 |
nicklas |
277 |
<% |
5939 |
30 Jan 12 |
nicklas |
278 |
for (DataFile dataFile : members) |
3801 |
02 Oct 07 |
nicklas |
279 |
{ |
5939 |
30 Jan 12 |
nicklas |
280 |
FileSetMember member = dataFile.member; |
5939 |
30 Jan 12 |
nicklas |
281 |
DataFileType dft = dataFile.type; |
5939 |
30 Jan 12 |
nicklas |
282 |
FileStoreEnabled parent = dataFile.parent; |
5939 |
30 Jan 12 |
nicklas |
283 |
Boolean validFile = null; |
5939 |
30 Jan 12 |
nicklas |
284 |
String validationMessage = ""; |
5939 |
30 Jan 12 |
nicklas |
285 |
boolean readFile = true; |
5939 |
30 Jan 12 |
nicklas |
286 |
File file = null; |
5939 |
30 Jan 12 |
nicklas |
287 |
boolean readDataFileType = true; |
5939 |
30 Jan 12 |
nicklas |
288 |
if (member != null) |
3801 |
02 Oct 07 |
nicklas |
289 |
{ |
5939 |
30 Jan 12 |
nicklas |
290 |
try |
5698 |
15 Aug 11 |
nicklas |
291 |
{ |
5939 |
30 Jan 12 |
nicklas |
292 |
file = member.getFile(); |
5698 |
15 Aug 11 |
nicklas |
293 |
} |
5939 |
30 Jan 12 |
nicklas |
294 |
catch (PermissionDeniedException ex) |
5698 |
15 Aug 11 |
nicklas |
295 |
{ |
5939 |
30 Jan 12 |
nicklas |
296 |
readFile = false; |
5698 |
15 Aug 11 |
nicklas |
297 |
} |
5939 |
30 Jan 12 |
nicklas |
298 |
try |
5939 |
30 Jan 12 |
nicklas |
299 |
{ |
5939 |
30 Jan 12 |
nicklas |
300 |
dft = member.getDataFileType(); |
5939 |
30 Jan 12 |
nicklas |
301 |
} |
5939 |
30 Jan 12 |
nicklas |
302 |
catch (PermissionDeniedException ex) |
5939 |
30 Jan 12 |
nicklas |
303 |
{ |
5939 |
30 Jan 12 |
nicklas |
304 |
readDataFileType = false; |
5939 |
30 Jan 12 |
nicklas |
305 |
} |
3867 |
19 Oct 07 |
nicklas |
306 |
} |
5939 |
30 Jan 12 |
nicklas |
307 |
UsableDataFileType uft = usableFileTypes.get(dft); |
5939 |
30 Jan 12 |
nicklas |
308 |
boolean isRequired = uft == null ? false : uft.isRequired(); |
5939 |
30 Jan 12 |
nicklas |
309 |
boolean isPartOfPlatform = uft != null || (subtype != null && subtype.isAssociatedDataFileType(dft)); |
5939 |
30 Jan 12 |
nicklas |
310 |
String icon = null; |
5939 |
30 Jan 12 |
nicklas |
311 |
if (member == null) |
3867 |
19 Oct 07 |
nicklas |
312 |
{ |
5939 |
30 Jan 12 |
nicklas |
313 |
if (isRequired) |
5623 |
06 May 11 |
nicklas |
314 |
{ |
5946 |
03 Feb 12 |
nicklas |
315 |
icon = "warning.png"; |
5939 |
30 Jan 12 |
nicklas |
316 |
validationMessage = "Missing a required file"; |
5939 |
30 Jan 12 |
nicklas |
317 |
} |
5939 |
30 Jan 12 |
nicklas |
318 |
} |
5939 |
30 Jan 12 |
nicklas |
319 |
else |
5939 |
30 Jan 12 |
nicklas |
320 |
{ |
5939 |
30 Jan 12 |
nicklas |
321 |
validFile = member.isValid(); |
5939 |
30 Jan 12 |
nicklas |
322 |
if (Boolean.FALSE.equals(validFile)) |
5939 |
30 Jan 12 |
nicklas |
323 |
{ |
5623 |
06 May 11 |
nicklas |
324 |
validationMessage = HTML.encodeTags(member.getErrorMessage()); |
5939 |
30 Jan 12 |
nicklas |
325 |
icon = "error.png"; |
5939 |
30 Jan 12 |
nicklas |
326 |
} |
8144 |
21 Apr 23 |
nicklas |
327 |
else if (!isPartOfPlatform && parent == null) |
5939 |
30 Jan 12 |
nicklas |
328 |
{ |
5946 |
03 Feb 12 |
nicklas |
329 |
icon = "warning.png"; |
5939 |
30 Jan 12 |
nicklas |
330 |
if (platform != null) |
5939 |
30 Jan 12 |
nicklas |
331 |
{ |
5939 |
30 Jan 12 |
nicklas |
332 |
validationMessage = "This file is not part of the <i>" + HTML.encodeTags(platform.getName()) + "</i> platform"; |
5939 |
30 Jan 12 |
nicklas |
333 |
} |
5939 |
30 Jan 12 |
nicklas |
334 |
else if (subtype != null) |
5939 |
30 Jan 12 |
nicklas |
335 |
{ |
5939 |
30 Jan 12 |
nicklas |
336 |
validationMessage = "This file is not part of the <i>" + HTML.encodeTags(subtype.getName()) + "</i> subtype"; |
5939 |
30 Jan 12 |
nicklas |
337 |
} |
5623 |
06 May 11 |
nicklas |
338 |
} |
5939 |
30 Jan 12 |
nicklas |
339 |
else if (Boolean.TRUE.equals(validFile)) |
5939 |
30 Jan 12 |
nicklas |
340 |
{ |
5939 |
30 Jan 12 |
nicklas |
341 |
if (member.getErrorMessage() != null) |
5939 |
30 Jan 12 |
nicklas |
342 |
{ |
5939 |
30 Jan 12 |
nicklas |
343 |
validationMessage = HTML.encodeTags(member.getErrorMessage()); |
5946 |
03 Feb 12 |
nicklas |
344 |
icon = "warning.png"; |
5939 |
30 Jan 12 |
nicklas |
345 |
} |
5939 |
30 Jan 12 |
nicklas |
346 |
else |
5939 |
30 Jan 12 |
nicklas |
347 |
{ |
5939 |
30 Jan 12 |
nicklas |
348 |
validationMessage = "Ok"; |
5939 |
30 Jan 12 |
nicklas |
349 |
icon = "ok.png"; |
5939 |
30 Jan 12 |
nicklas |
350 |
} |
5939 |
30 Jan 12 |
nicklas |
351 |
} |
5623 |
06 May 11 |
nicklas |
352 |
else |
5623 |
06 May 11 |
nicklas |
353 |
{ |
5939 |
30 Jan 12 |
nicklas |
354 |
validationMessage = "<i>- not validated -</i>"; |
5623 |
06 May 11 |
nicklas |
355 |
} |
3802 |
03 Oct 07 |
nicklas |
356 |
} |
5939 |
30 Jan 12 |
nicklas |
357 |
%> |
5939 |
30 Jan 12 |
nicklas |
358 |
<tbl:row> |
5939 |
30 Jan 12 |
nicklas |
359 |
<tbl:cell column="type"><base:icon |
5946 |
03 Feb 12 |
nicklas |
360 |
image="deleted.png" |
5939 |
30 Jan 12 |
nicklas |
361 |
tooltip="This item has been scheduled for deletion" |
5939 |
30 Jan 12 |
nicklas |
362 |
visible="<%=dft != null && dft.isRemoved()%>" |
5939 |
30 Jan 12 |
nicklas |
363 |
/><%=Base.getLinkedName(ID, dft, !readDataFileType, true)%></tbl:cell> |
5939 |
30 Jan 12 |
nicklas |
364 |
<tbl:cell column="file"><base:icon |
5946 |
03 Feb 12 |
nicklas |
365 |
image="deleted.png" |
5939 |
30 Jan 12 |
nicklas |
366 |
tooltip="This item has been scheduled for deletion" |
5939 |
30 Jan 12 |
nicklas |
367 |
visible="<%=file != null && file.isRemoved()%>" |
5939 |
30 Jan 12 |
nicklas |
368 |
/> |
7757 |
27 Nov 19 |
nicklas |
369 |
<%=Base.getLinkedName(ID, file, !readFile, true)%> |
5939 |
30 Jan 12 |
nicklas |
370 |
<% |
7757 |
27 Nov 19 |
nicklas |
371 |
if (file != null) |
7757 |
27 Nov 19 |
nicklas |
372 |
{ |
7757 |
27 Nov 19 |
nicklas |
373 |
fileContext.setCurrentDataFile(file, dft, member); |
7757 |
27 Nov 19 |
nicklas |
374 |
fileViewer.render(); |
7757 |
27 Nov 19 |
nicklas |
375 |
} |
5939 |
30 Jan 12 |
nicklas |
376 |
if (parent != null) |
5939 |
30 Jan 12 |
nicklas |
377 |
{ |
5939 |
30 Jan 12 |
nicklas |
378 |
%> |
5939 |
30 Jan 12 |
nicklas |
379 |
<i>(inherited from <%=Base.getLinkedName(ID, (Nameable)parent, false, true)%>)</i> |
5939 |
30 Jan 12 |
nicklas |
380 |
<% |
5939 |
30 Jan 12 |
nicklas |
381 |
} |
5939 |
30 Jan 12 |
nicklas |
382 |
%> |
5939 |
30 Jan 12 |
nicklas |
383 |
</tbl:cell> |
5939 |
30 Jan 12 |
nicklas |
384 |
<tbl:cell column="required"><%=isRequired ? "yes" : "no" %></tbl:cell> |
5939 |
30 Jan 12 |
nicklas |
385 |
<tbl:cell column="validation"> |
5939 |
30 Jan 12 |
nicklas |
386 |
<base:icon image="<%=icon%>" visible="<%=icon != null %>" /> |
5939 |
30 Jan 12 |
nicklas |
387 |
<%=validationMessage %> |
5939 |
30 Jan 12 |
nicklas |
388 |
</tbl:cell> |
5939 |
30 Jan 12 |
nicklas |
389 |
</tbl:row> |
5939 |
30 Jan 12 |
nicklas |
390 |
<% |
3802 |
03 Oct 07 |
nicklas |
391 |
} |
3801 |
02 Oct 07 |
nicklas |
392 |
%> |
5939 |
30 Jan 12 |
nicklas |
393 |
</tbl:rows> |
5939 |
30 Jan 12 |
nicklas |
394 |
</tbl:data> |
3801 |
02 Oct 07 |
nicklas |
395 |
</tbl:table> |
3801 |
02 Oct 07 |
nicklas |
396 |
<% |
3801 |
02 Oct 07 |
nicklas |
397 |
} |
3801 |
02 Oct 07 |
nicklas |
398 |
%> |
5939 |
30 Jan 12 |
nicklas |
399 |
</base:section> |
3801 |
02 Oct 07 |
nicklas |
400 |
</base:body> |
3801 |
02 Oct 07 |
nicklas |
401 |
</base:page> |
3801 |
02 Oct 07 |
nicklas |
402 |
<% |
3801 |
02 Oct 07 |
nicklas |
403 |
} |
3801 |
02 Oct 07 |
nicklas |
404 |
finally |
3801 |
02 Oct 07 |
nicklas |
405 |
{ |
3801 |
02 Oct 07 |
nicklas |
406 |
if (dc != null) dc.close(); |
3801 |
02 Oct 07 |
nicklas |
407 |
} |
3801 |
02 Oct 07 |
nicklas |
408 |
|
3801 |
02 Oct 07 |
nicklas |
409 |
%> |