2305 |
22 May 06 |
jari |
1 |
<%-- $Id$ |
2305 |
22 May 06 |
jari |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
6137 |
19 Sep 12 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
6137 |
19 Sep 12 |
nicklas |
Copyright (C) 2007 Johan Enell, Nicklas Nordborg, Martin Svensson |
2305 |
22 May 06 |
jari |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
2305 |
22 May 06 |
jari |
9 |
|
2305 |
22 May 06 |
jari |
10 |
BASE is free software; you can redistribute it and/or |
2305 |
22 May 06 |
jari |
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 |
2305 |
22 May 06 |
jari |
13 |
of the License, or (at your option) any later version. |
2305 |
22 May 06 |
jari |
14 |
|
2305 |
22 May 06 |
jari |
15 |
BASE is distributed in the hope that it will be useful, |
2305 |
22 May 06 |
jari |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2305 |
22 May 06 |
jari |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2305 |
22 May 06 |
jari |
18 |
GNU General Public License for more details. |
2305 |
22 May 06 |
jari |
19 |
|
2305 |
22 May 06 |
jari |
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/>. |
2305 |
22 May 06 |
jari |
22 |
------------------------------------------------------------------ |
2305 |
22 May 06 |
jari |
23 |
|
6137 |
19 Sep 12 |
nicklas |
24 |
|
2305 |
22 May 06 |
jari |
25 |
@author Nicklas |
2305 |
22 May 06 |
jari |
26 |
@version 2.0 |
2305 |
22 May 06 |
jari |
27 |
--%> |
5426 |
24 Sep 10 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" |
6137 |
19 Sep 12 |
nicklas |
29 |
import="net.sf.basedb.core.Application" |
2305 |
22 May 06 |
jari |
30 |
import="net.sf.basedb.core.SessionControl" |
2305 |
22 May 06 |
jari |
31 |
import="net.sf.basedb.core.DbControl" |
6137 |
19 Sep 12 |
nicklas |
32 |
import="net.sf.basedb.core.Config" |
6137 |
19 Sep 12 |
nicklas |
33 |
import="net.sf.basedb.core.Item" |
6137 |
19 Sep 12 |
nicklas |
34 |
import="net.sf.basedb.core.SystemItems" |
6137 |
19 Sep 12 |
nicklas |
35 |
import="net.sf.basedb.core.ItemContext" |
2305 |
22 May 06 |
jari |
36 |
import="net.sf.basedb.core.Permission" |
6137 |
19 Sep 12 |
nicklas |
37 |
import="net.sf.basedb.core.Directory" |
6137 |
19 Sep 12 |
nicklas |
38 |
import="net.sf.basedb.core.File" |
6137 |
19 Sep 12 |
nicklas |
39 |
import="net.sf.basedb.core.User" |
6137 |
19 Sep 12 |
nicklas |
40 |
import="net.sf.basedb.core.Group" |
6137 |
19 Sep 12 |
nicklas |
41 |
import="net.sf.basedb.core.Quota" |
6137 |
19 Sep 12 |
nicklas |
42 |
import="net.sf.basedb.core.QuotaType" |
6137 |
19 Sep 12 |
nicklas |
43 |
import="net.sf.basedb.core.ItemSubtype" |
6137 |
19 Sep 12 |
nicklas |
44 |
import="net.sf.basedb.core.Location" |
6137 |
19 Sep 12 |
nicklas |
45 |
import="net.sf.basedb.core.PluginDefinition" |
6137 |
19 Sep 12 |
nicklas |
46 |
import="net.sf.basedb.core.Include" |
6137 |
19 Sep 12 |
nicklas |
47 |
import="net.sf.basedb.core.ItemQuery" |
6137 |
19 Sep 12 |
nicklas |
48 |
import="net.sf.basedb.core.ItemResultList" |
6137 |
19 Sep 12 |
nicklas |
49 |
import="net.sf.basedb.core.PermissionDeniedException" |
6137 |
19 Sep 12 |
nicklas |
50 |
import="net.sf.basedb.core.BaseException" |
6137 |
19 Sep 12 |
nicklas |
51 |
import="net.sf.basedb.core.query.Orders" |
6137 |
19 Sep 12 |
nicklas |
52 |
import="net.sf.basedb.core.query.Hql" |
6137 |
19 Sep 12 |
nicklas |
53 |
import="net.sf.basedb.util.zip.FileUnpacker" |
2305 |
22 May 06 |
jari |
54 |
import="net.sf.basedb.clients.web.Base" |
6137 |
19 Sep 12 |
nicklas |
55 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
56 |
import="net.sf.basedb.util.Values" |
6137 |
19 Sep 12 |
nicklas |
57 |
import="java.util.List" |
6137 |
19 Sep 12 |
nicklas |
58 |
import="java.util.Set" |
6137 |
19 Sep 12 |
nicklas |
59 |
import="java.util.HashSet" |
6137 |
19 Sep 12 |
nicklas |
60 |
import="java.nio.charset.Charset" |
6308 |
20 Aug 13 |
nicklas |
61 |
import="org.json.simple.JSONObject" |
6308 |
20 Aug 13 |
nicklas |
62 |
import="org.json.simple.JSONArray" |
2305 |
22 May 06 |
jari |
63 |
%> |
6137 |
19 Sep 12 |
nicklas |
64 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
6137 |
19 Sep 12 |
nicklas |
65 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
2305 |
22 May 06 |
jari |
66 |
<% |
6137 |
19 Sep 12 |
nicklas |
67 |
final Item itemType = Item.FILE; |
6137 |
19 Sep 12 |
nicklas |
68 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
6137 |
19 Sep 12 |
nicklas |
69 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
6137 |
19 Sep 12 |
nicklas |
70 |
final int itemId = cc.getId(); |
6137 |
19 Sep 12 |
nicklas |
71 |
final String ID = sc.getId(); |
6137 |
19 Sep 12 |
nicklas |
72 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
73 |
final DbControl dc = sc.newDbControl(":Upload file"); |
6137 |
19 Sep 12 |
nicklas |
74 |
try |
6137 |
19 Sep 12 |
nicklas |
75 |
{ |
6137 |
19 Sep 12 |
nicklas |
76 |
String title = null; |
6137 |
19 Sep 12 |
nicklas |
77 |
File file = null; |
6137 |
19 Sep 12 |
nicklas |
78 |
Directory directory = null; |
6137 |
19 Sep 12 |
nicklas |
79 |
boolean readCurrentSubtype = true; |
6137 |
19 Sep 12 |
nicklas |
80 |
int currentSubtypeId = 0; |
6137 |
19 Sep 12 |
nicklas |
81 |
Boolean compress = Application.autoCompressionEnabled() ? null : false; // null == auto |
6137 |
19 Sep 12 |
nicklas |
82 |
|
6137 |
19 Sep 12 |
nicklas |
83 |
if (itemId == 0) |
5395 |
27 Aug 10 |
nicklas |
84 |
{ |
6137 |
19 Sep 12 |
nicklas |
85 |
title = "Upload new file"; |
6137 |
19 Sep 12 |
nicklas |
86 |
currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), 0); |
6137 |
19 Sep 12 |
nicklas |
87 |
if (currentSubtypeId == 0) |
5747 |
15 Sep 11 |
nicklas |
88 |
{ |
6137 |
19 Sep 12 |
nicklas |
89 |
currentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0), 0); |
5747 |
15 Sep 11 |
nicklas |
90 |
} |
6137 |
19 Sep 12 |
nicklas |
91 |
directory = Directory.getById(dc, Values.getInt(request.getParameter("directory_id"), SystemItems.getId(Directory.ROOT))); |
6137 |
19 Sep 12 |
nicklas |
92 |
cc.removeObject("item"); |
6137 |
19 Sep 12 |
nicklas |
93 |
if (directory.getAutoCompress()) compress = true; |
5395 |
27 Aug 10 |
nicklas |
94 |
} |
6137 |
19 Sep 12 |
nicklas |
95 |
else |
6137 |
19 Sep 12 |
nicklas |
96 |
{ |
6137 |
19 Sep 12 |
nicklas |
97 |
file = File.getById(dc, itemId); |
6137 |
19 Sep 12 |
nicklas |
98 |
file.checkPermission(Permission.WRITE); |
6137 |
19 Sep 12 |
nicklas |
99 |
|
6137 |
19 Sep 12 |
nicklas |
100 |
directory = file.getDirectory(); |
6137 |
19 Sep 12 |
nicklas |
101 |
cc.setObject("item", file); |
6137 |
19 Sep 12 |
nicklas |
102 |
title = "Upload again -- " + HTML.encodeTags(file.getName()); |
6137 |
19 Sep 12 |
nicklas |
103 |
try |
6137 |
19 Sep 12 |
nicklas |
104 |
{ |
6137 |
19 Sep 12 |
nicklas |
105 |
ItemSubtype subtype = file.getItemSubtype(); |
6137 |
19 Sep 12 |
nicklas |
106 |
if (subtype != null) currentSubtypeId = subtype.getId(); |
6137 |
19 Sep 12 |
nicklas |
107 |
} |
6137 |
19 Sep 12 |
nicklas |
108 |
catch (PermissionDeniedException ex) |
6137 |
19 Sep 12 |
nicklas |
109 |
{ |
6137 |
19 Sep 12 |
nicklas |
110 |
readCurrentSubtype = false; |
6137 |
19 Sep 12 |
nicklas |
111 |
} |
6137 |
19 Sep 12 |
nicklas |
112 |
} |
6137 |
19 Sep 12 |
nicklas |
113 |
|
6137 |
19 Sep 12 |
nicklas |
114 |
if (file == null || file.getLocation() != Location.PRIMARY) |
6137 |
19 Sep 12 |
nicklas |
115 |
{ |
6137 |
19 Sep 12 |
nicklas |
116 |
// Check quota |
6137 |
19 Sep 12 |
nicklas |
117 |
User user = User.getById(dc, sc.getLoggedInUserId()); |
6137 |
19 Sep 12 |
nicklas |
118 |
QuotaType totalQuotaType = QuotaType.getById(dc, SystemItems.getId(QuotaType.TOTAL)); |
6137 |
19 Sep 12 |
nicklas |
119 |
QuotaType fileQuotaType = QuotaType.getById(dc, SystemItems.getId(QuotaType.FILE)); |
6137 |
19 Sep 12 |
nicklas |
120 |
|
6137 |
19 Sep 12 |
nicklas |
121 |
if (user.hasExceededQuota(totalQuotaType, Location.PRIMARY) |
6137 |
19 Sep 12 |
nicklas |
122 |
|| user.hasExceededQuota(fileQuotaType, Location.PRIMARY)) |
6137 |
19 Sep 12 |
nicklas |
123 |
{ |
6137 |
19 Sep 12 |
nicklas |
124 |
throw new PermissionDeniedException("Quota has been exceeded"); |
6137 |
19 Sep 12 |
nicklas |
125 |
} |
6137 |
19 Sep 12 |
nicklas |
126 |
} |
6137 |
19 Sep 12 |
nicklas |
127 |
|
6137 |
19 Sep 12 |
nicklas |
128 |
// Query to retrieve file types |
6137 |
19 Sep 12 |
nicklas |
129 |
final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType); |
6137 |
19 Sep 12 |
nicklas |
130 |
subtypesQuery.include(Include.ALL); |
6137 |
19 Sep 12 |
nicklas |
131 |
|
6308 |
20 Aug 13 |
nicklas |
132 |
JSONArray jsonZipFormats = new JSONArray(); |
6308 |
20 Aug 13 |
nicklas |
133 |
if (file == null) |
6308 |
20 Aug 13 |
nicklas |
134 |
{ |
6308 |
20 Aug 13 |
nicklas |
135 |
// Query to retreive FileUnpacker plugins (used for new uploads only) |
6308 |
20 Aug 13 |
nicklas |
136 |
final ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(null, "net.sf.basedb.util.zip.FileUnpacker"); |
6308 |
20 Aug 13 |
nicklas |
137 |
pluginQuery.order(Orders.asc(Hql.property("name"))); |
6308 |
20 Aug 13 |
nicklas |
138 |
pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS); |
6308 |
20 Aug 13 |
nicklas |
139 |
List<PluginDefinition> plugins = pluginQuery.list(dc); |
6137 |
19 Sep 12 |
nicklas |
140 |
|
6308 |
20 Aug 13 |
nicklas |
141 |
for (PluginDefinition plugin : plugins) |
6137 |
19 Sep 12 |
nicklas |
142 |
{ |
6308 |
20 Aug 13 |
nicklas |
143 |
FileUnpacker unpacker = plugin.newInstance(FileUnpacker.class, sc, null, null); |
6308 |
20 Aug 13 |
nicklas |
144 |
JSONObject jsonZipFormat = new JSONObject(); |
6308 |
20 Aug 13 |
nicklas |
145 |
jsonZipFormat.put("id", plugin.getId()); |
6308 |
20 Aug 13 |
nicklas |
146 |
jsonZipFormat.put("name", unpacker.getFormatName()); |
6308 |
20 Aug 13 |
nicklas |
147 |
JSONArray jsonExtensions = new JSONArray(); |
6308 |
20 Aug 13 |
nicklas |
148 |
jsonExtensions.addAll(unpacker.getExtensions()); |
6308 |
20 Aug 13 |
nicklas |
149 |
jsonZipFormat.put("extensions", jsonExtensions); |
6308 |
20 Aug 13 |
nicklas |
150 |
jsonZipFormats.add(jsonZipFormat); |
6137 |
19 Sep 12 |
nicklas |
151 |
} |
6308 |
20 Aug 13 |
nicklas |
152 |
} |
6308 |
20 Aug 13 |
nicklas |
153 |
%> |
6308 |
20 Aug 13 |
nicklas |
154 |
<base:page type="popup" title="<%=title%>" id="select-file"> |
6309 |
21 Aug 13 |
nicklas |
155 |
<base:head scripts="~upload.js" styles="progressbar.css" /> |
6309 |
21 Aug 13 |
nicklas |
156 |
<base:body data-notify-on-error="1"> |
6137 |
19 Sep 12 |
nicklas |
157 |
<div id="selectForm" class="absolutefull"> |
6308 |
20 Aug 13 |
nicklas |
158 |
<h1><%=title%> <base:help helpid="file.upload"/></h1> |
6137 |
19 Sep 12 |
nicklas |
159 |
|
6308 |
20 Aug 13 |
nicklas |
160 |
<div id="page-data" class="datacontainer" |
6308 |
20 Aug 13 |
nicklas |
161 |
data-zip-formats="<%=HTML.encodeTags(jsonZipFormats.toJSONString()) %>" |
7985 |
22 Jun 21 |
nicklas |
162 |
data-directory-id="<%=directory.getId()%>" |
6308 |
20 Aug 13 |
nicklas |
163 |
></div> |
6308 |
20 Aug 13 |
nicklas |
164 |
|
7985 |
22 Jun 21 |
nicklas |
165 |
<form name="file"> |
6308 |
20 Aug 13 |
nicklas |
166 |
<div class="content"> |
6308 |
20 Aug 13 |
nicklas |
167 |
<table class="fullform input100 bottomborder"> |
6137 |
19 Sep 12 |
nicklas |
168 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
169 |
<th>Directory</th> |
6137 |
19 Sep 12 |
nicklas |
170 |
<td colspan="2"><%=HTML.encodeTags(directory.getPath().toString())%></td> |
6137 |
19 Sep 12 |
nicklas |
171 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
172 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
173 |
<th>File</th> |
6137 |
19 Sep 12 |
nicklas |
174 |
<td> |
6308 |
20 Aug 13 |
nicklas |
175 |
<input class="text required" type="file" name="the_file" id="the_file" size="40"> |
6137 |
19 Sep 12 |
nicklas |
176 |
</td> |
6137 |
19 Sep 12 |
nicklas |
177 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
178 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
179 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
180 |
<th></th> |
6137 |
19 Sep 12 |
nicklas |
181 |
<td> |
7985 |
22 Jun 21 |
nicklas |
182 |
<input type="checkbox" name="write_protected" id="writeProtected" value="1" |
6137 |
19 Sep 12 |
nicklas |
183 |
<%=(file != null && file.isWriteProtected()) || |
6137 |
19 Sep 12 |
nicklas |
184 |
(file == null && Values.getBoolean(cc.getPropertyValue("writeProtected"))) ? "checked" : ""%>> |
7985 |
22 Jun 21 |
nicklas |
185 |
<label for="writeProtected">Write protected</label> |
6137 |
19 Sep 12 |
nicklas |
186 |
<% |
6137 |
19 Sep 12 |
nicklas |
187 |
if (file == null) |
6137 |
19 Sep 12 |
nicklas |
188 |
{ |
6137 |
19 Sep 12 |
nicklas |
189 |
%> |
7985 |
22 Jun 21 |
nicklas |
190 |
<input type="checkbox" name="replace_existing" id="replaceExisting" value="1"> |
7985 |
22 Jun 21 |
nicklas |
191 |
<label for="replaceExisting">Replace existing</label> |
6137 |
19 Sep 12 |
nicklas |
192 |
<% |
6137 |
19 Sep 12 |
nicklas |
193 |
} |
6137 |
19 Sep 12 |
nicklas |
194 |
else |
6137 |
19 Sep 12 |
nicklas |
195 |
{ |
6137 |
19 Sep 12 |
nicklas |
196 |
%> |
7985 |
22 Jun 21 |
nicklas |
197 |
<input type="checkbox" name="check_md5" id="checkMd5"> |
7985 |
22 Jun 21 |
nicklas |
198 |
<label for="checkMd5">Validate MD5</label> |
6137 |
19 Sep 12 |
nicklas |
199 |
<% |
6137 |
19 Sep 12 |
nicklas |
200 |
} |
6137 |
19 Sep 12 |
nicklas |
201 |
%> |
6137 |
19 Sep 12 |
nicklas |
202 |
</td> |
6137 |
19 Sep 12 |
nicklas |
203 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
204 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
205 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
206 |
<th>Store compressed</th> |
6137 |
19 Sep 12 |
nicklas |
207 |
<td> |
7985 |
22 Jun 21 |
nicklas |
208 |
<select name="compressed"> |
6137 |
19 Sep 12 |
nicklas |
209 |
<% |
6137 |
19 Sep 12 |
nicklas |
210 |
if (Application.autoCompressionEnabled()) |
6137 |
19 Sep 12 |
nicklas |
211 |
{ |
6137 |
19 Sep 12 |
nicklas |
212 |
%> |
6137 |
19 Sep 12 |
nicklas |
213 |
<option value="" <%=compress == null ? "selected" : "" %>>- auto - |
6137 |
19 Sep 12 |
nicklas |
214 |
<% |
6137 |
19 Sep 12 |
nicklas |
215 |
} |
6137 |
19 Sep 12 |
nicklas |
216 |
%> |
6137 |
19 Sep 12 |
nicklas |
217 |
<option value="1" <%=Boolean.TRUE.equals(compress) ? "selected" : ""%>>yes |
6137 |
19 Sep 12 |
nicklas |
218 |
<option value="0" <%=Boolean.FALSE.equals(compress) ? "selected" : ""%>>no |
6137 |
19 Sep 12 |
nicklas |
219 |
</select> |
6137 |
19 Sep 12 |
nicklas |
220 |
</td> |
6137 |
19 Sep 12 |
nicklas |
221 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
222 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
223 |
<tr > |
6137 |
19 Sep 12 |
nicklas |
224 |
<th>Type</th> |
6137 |
19 Sep 12 |
nicklas |
225 |
<td> |
7985 |
22 Jun 21 |
nicklas |
226 |
<select name="subtype_id" |
6137 |
19 Sep 12 |
nicklas |
227 |
<%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>> |
6137 |
19 Sep 12 |
nicklas |
228 |
<% |
6137 |
19 Sep 12 |
nicklas |
229 |
if (!readCurrentSubtype) |
6137 |
19 Sep 12 |
nicklas |
230 |
{ |
6137 |
19 Sep 12 |
nicklas |
231 |
%> |
6137 |
19 Sep 12 |
nicklas |
232 |
<option value="-1">- denied - |
6137 |
19 Sep 12 |
nicklas |
233 |
<% |
6137 |
19 Sep 12 |
nicklas |
234 |
} |
6137 |
19 Sep 12 |
nicklas |
235 |
else |
6137 |
19 Sep 12 |
nicklas |
236 |
{ |
6137 |
19 Sep 12 |
nicklas |
237 |
%> |
6137 |
19 Sep 12 |
nicklas |
238 |
<option value="0">- none - |
6137 |
19 Sep 12 |
nicklas |
239 |
<% |
6137 |
19 Sep 12 |
nicklas |
240 |
for (ItemSubtype subtype : subtypesQuery.list(dc)) |
6137 |
19 Sep 12 |
nicklas |
241 |
{ |
6137 |
19 Sep 12 |
nicklas |
242 |
int id = subtype.getId(); |
6137 |
19 Sep 12 |
nicklas |
243 |
boolean current = id == currentSubtypeId; |
6137 |
19 Sep 12 |
nicklas |
244 |
%> |
6137 |
19 Sep 12 |
nicklas |
245 |
<option |
6137 |
19 Sep 12 |
nicklas |
246 |
value="<%=current && file != null ? -id : id%>" |
6137 |
19 Sep 12 |
nicklas |
247 |
<%=current ? "selected" : ""%> |
6137 |
19 Sep 12 |
nicklas |
248 |
title="<%=HTML.encodeTags(subtype.getDescription())%>" |
6137 |
19 Sep 12 |
nicklas |
249 |
><%=HTML.encodeTags(subtype.getName())%> |
6137 |
19 Sep 12 |
nicklas |
250 |
<% |
6137 |
19 Sep 12 |
nicklas |
251 |
} |
6137 |
19 Sep 12 |
nicklas |
252 |
} |
6137 |
19 Sep 12 |
nicklas |
253 |
%> |
6137 |
19 Sep 12 |
nicklas |
254 |
</select> |
6137 |
19 Sep 12 |
nicklas |
255 |
</td> |
6137 |
19 Sep 12 |
nicklas |
256 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
257 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
258 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
259 |
<th>Character set</th> |
6137 |
19 Sep 12 |
nicklas |
260 |
<td> |
7985 |
22 Jun 21 |
nicklas |
261 |
<select name="charset"> |
6137 |
19 Sep 12 |
nicklas |
262 |
<option value="">- n/a - |
6137 |
19 Sep 12 |
nicklas |
263 |
<% |
6137 |
19 Sep 12 |
nicklas |
264 |
String currentCharset = file == null ? null : file.getCharacterSet(); |
6137 |
19 Sep 12 |
nicklas |
265 |
int numCommon = Config.getCommonCharsets().size(); |
6137 |
19 Sep 12 |
nicklas |
266 |
int i = 0; |
6137 |
19 Sep 12 |
nicklas |
267 |
boolean hasSelected = false; |
6137 |
19 Sep 12 |
nicklas |
268 |
for (String charset : Config.getAllCharsets()) |
6137 |
19 Sep 12 |
nicklas |
269 |
{ |
6137 |
19 Sep 12 |
nicklas |
270 |
boolean selected = false; |
6137 |
19 Sep 12 |
nicklas |
271 |
if (!hasSelected) |
6137 |
19 Sep 12 |
nicklas |
272 |
{ |
6137 |
19 Sep 12 |
nicklas |
273 |
selected = charset.equalsIgnoreCase(currentCharset); |
6137 |
19 Sep 12 |
nicklas |
274 |
hasSelected |= selected; |
6137 |
19 Sep 12 |
nicklas |
275 |
} |
6137 |
19 Sep 12 |
nicklas |
276 |
%> |
6137 |
19 Sep 12 |
nicklas |
277 |
<option value="<%=charset%>" <%=selected ? "selected" : ""%> |
6137 |
19 Sep 12 |
nicklas |
278 |
<%=i==numCommon ? "style=\"border-top: 1px solid #666666;\"" : "" %>><%=charset%> |
6137 |
19 Sep 12 |
nicklas |
279 |
<% |
6137 |
19 Sep 12 |
nicklas |
280 |
i++; |
6137 |
19 Sep 12 |
nicklas |
281 |
} |
6137 |
19 Sep 12 |
nicklas |
282 |
if (!hasSelected && currentCharset != null) |
6137 |
19 Sep 12 |
nicklas |
283 |
{ |
6137 |
19 Sep 12 |
nicklas |
284 |
%> |
6137 |
19 Sep 12 |
nicklas |
285 |
<option value="<%=currentCharset%>" selected><%=currentCharset%> |
6137 |
19 Sep 12 |
nicklas |
286 |
<% |
6137 |
19 Sep 12 |
nicklas |
287 |
} |
6137 |
19 Sep 12 |
nicklas |
288 |
%> |
6137 |
19 Sep 12 |
nicklas |
289 |
</select> |
6137 |
19 Sep 12 |
nicklas |
290 |
</td> |
6137 |
19 Sep 12 |
nicklas |
291 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
292 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
293 |
<% |
6137 |
19 Sep 12 |
nicklas |
294 |
if (file == null) |
6137 |
19 Sep 12 |
nicklas |
295 |
{ |
6137 |
19 Sep 12 |
nicklas |
296 |
%> |
6137 |
19 Sep 12 |
nicklas |
297 |
<tr class="big"> |
6137 |
19 Sep 12 |
nicklas |
298 |
<th>Compressed file</th> |
6137 |
19 Sep 12 |
nicklas |
299 |
<td> |
7985 |
22 Jun 21 |
nicklas |
300 |
<select name="zip_format" disabled> |
6137 |
19 Sep 12 |
nicklas |
301 |
</select><br> |
6137 |
19 Sep 12 |
nicklas |
302 |
|
7985 |
22 Jun 21 |
nicklas |
303 |
<input type="checkbox" name="zip_unpack" id="zipUnpack" disabled |
7985 |
22 Jun 21 |
nicklas |
304 |
><label for="zipUnpack">Unpack file</label><br> |
7985 |
22 Jun 21 |
nicklas |
305 |
<input type="checkbox" name="zip_overwrite" id="zipOverwrite" disabled |
7985 |
22 Jun 21 |
nicklas |
306 |
><label for="zipOverwrite">Overwrite existing files</label><br> |
7985 |
22 Jun 21 |
nicklas |
307 |
<input type="checkbox" name="zip_keep" id="zipKeep" disabled checked |
7985 |
22 Jun 21 |
nicklas |
308 |
><label for="zipKeep">Keep the compressed file</label><br> |
6137 |
19 Sep 12 |
nicklas |
309 |
</td> |
6137 |
19 Sep 12 |
nicklas |
310 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
311 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
312 |
<% |
6137 |
19 Sep 12 |
nicklas |
313 |
} |
6137 |
19 Sep 12 |
nicklas |
314 |
%> |
6137 |
19 Sep 12 |
nicklas |
315 |
<tr class="dynamic"> |
6137 |
19 Sep 12 |
nicklas |
316 |
<th>Description</th> |
6137 |
19 Sep 12 |
nicklas |
317 |
<td> |
7985 |
22 Jun 21 |
nicklas |
318 |
<textarea class="text" rows="4" name="description" id="description" |
6137 |
19 Sep 12 |
nicklas |
319 |
><%=HTML.encodeTags(file == null ? cc.getPropertyValue("description") : file.getDescription())%></textarea> |
6137 |
19 Sep 12 |
nicklas |
320 |
</td> |
6137 |
19 Sep 12 |
nicklas |
321 |
<td style="width: 20px;"> |
7985 |
22 Jun 21 |
nicklas |
322 |
<base:zoom textarea="description" title="Description" /> |
6137 |
19 Sep 12 |
nicklas |
323 |
</td> |
6137 |
19 Sep 12 |
nicklas |
324 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
325 |
</table> |
6308 |
20 Aug 13 |
nicklas |
326 |
</div> |
6137 |
19 Sep 12 |
nicklas |
327 |
</form> |
6137 |
19 Sep 12 |
nicklas |
328 |
|
6308 |
20 Aug 13 |
nicklas |
329 |
<div class="legend" style="height: 1.75rem;"> |
6137 |
19 Sep 12 |
nicklas |
330 |
<base:icon image="required.png" />= required information |
6137 |
19 Sep 12 |
nicklas |
331 |
</div> |
6137 |
19 Sep 12 |
nicklas |
332 |
|
6137 |
19 Sep 12 |
nicklas |
333 |
<base:buttongroup subclass="dialogbuttons"> |
6308 |
20 Aug 13 |
nicklas |
334 |
<base:button id="btnUpload" image="upload.png" title="Upload" /> |
6308 |
20 Aug 13 |
nicklas |
335 |
<base:button id="close" title="Cancel" /> |
6137 |
19 Sep 12 |
nicklas |
336 |
</base:buttongroup> |
6137 |
19 Sep 12 |
nicklas |
337 |
</div> |
6137 |
19 Sep 12 |
nicklas |
338 |
|
6137 |
19 Sep 12 |
nicklas |
339 |
<div id="progressForm" class="absolutefull" style="display:none;"> |
6137 |
19 Sep 12 |
nicklas |
340 |
<h1 class="docked" id="fileName">Preparing file upload...</h1> |
6137 |
19 Sep 12 |
nicklas |
341 |
<div class="content"> |
6607 |
19 Nov 14 |
nicklas |
342 |
<table class="fullcc bg-filled-50 bottomborder"><tr><td> |
6137 |
19 Sep 12 |
nicklas |
343 |
<table class="progressbar" style="width: 100%;"> |
6137 |
19 Sep 12 |
nicklas |
344 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
345 |
<td style="width: 2em;"></td> |
6137 |
19 Sep 12 |
nicklas |
346 |
<td style=""> |
6308 |
20 Aug 13 |
nicklas |
347 |
<table class="bar" style="width: 100%;"> |
6137 |
19 Sep 12 |
nicklas |
348 |
<tr> |
6308 |
20 Aug 13 |
nicklas |
349 |
<td style="width: 0%;" class="percentDone" id="percentDone"> </td> |
6308 |
20 Aug 13 |
nicklas |
350 |
<td style="width: 100%;" class="percentRemain" id="percentRemain"> </td> |
6137 |
19 Sep 12 |
nicklas |
351 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
352 |
</table> |
6137 |
19 Sep 12 |
nicklas |
353 |
</td> |
6308 |
20 Aug 13 |
nicklas |
354 |
<td style="width: 3em;" class="percentText" id="percentText">0%</td> |
6137 |
19 Sep 12 |
nicklas |
355 |
<td style="width: 2em;"></td> |
6137 |
19 Sep 12 |
nicklas |
356 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
357 |
<tr> |
6137 |
19 Sep 12 |
nicklas |
358 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
359 |
<td colspan="2" style="text-align: left;"> |
7985 |
22 Jun 21 |
nicklas |
360 |
<table class="transfer-info"> |
7985 |
22 Jun 21 |
nicklas |
361 |
<tr><th>Transferred</th><td><span id="transferredBytes">0 bytes</span> of <span id="totalBytes">unknown</span></td></tr> |
7985 |
22 Jun 21 |
nicklas |
362 |
<tr><th>Time</th><td><span id="transferTime">0s</span> <span id="transferRate"></span></td></tr> |
7985 |
22 Jun 21 |
nicklas |
363 |
<tr><th>Remain</th><td><span id="remainTime">unknown</span></td></tr> |
7985 |
22 Jun 21 |
nicklas |
364 |
<tr id="message"></tr> |
7985 |
22 Jun 21 |
nicklas |
365 |
</table> |
6137 |
19 Sep 12 |
nicklas |
366 |
</td> |
6137 |
19 Sep 12 |
nicklas |
367 |
<td></td> |
6137 |
19 Sep 12 |
nicklas |
368 |
</tr> |
6137 |
19 Sep 12 |
nicklas |
369 |
</table> |
6308 |
20 Aug 13 |
nicklas |
370 |
</td> |
6308 |
20 Aug 13 |
nicklas |
371 |
</tr> |
6308 |
20 Aug 13 |
nicklas |
372 |
</table> |
6137 |
19 Sep 12 |
nicklas |
373 |
</div> |
6137 |
19 Sep 12 |
nicklas |
374 |
|
6137 |
19 Sep 12 |
nicklas |
375 |
<base:buttongroup subclass="dialogbuttons"> |
6308 |
20 Aug 13 |
nicklas |
376 |
<base:button id="btnAbort" image="cancel.png" title="Abort..." /> |
6137 |
19 Sep 12 |
nicklas |
377 |
</base:buttongroup> |
6137 |
19 Sep 12 |
nicklas |
378 |
</div> |
6137 |
19 Sep 12 |
nicklas |
379 |
|
7985 |
22 Jun 21 |
nicklas |
380 |
<div id="uploadFailed" class="absolutefull" style="display:none;"> |
7985 |
22 Jun 21 |
nicklas |
381 |
<h1 class="docked" id="failTitle">Upload failed</h1> |
7985 |
22 Jun 21 |
nicklas |
382 |
<div class="content bg-filled-50 bottomborder"> |
7985 |
22 Jun 21 |
nicklas |
383 |
<table style="margin: auto; height: 100%;"> |
7985 |
22 Jun 21 |
nicklas |
384 |
<tr><td> |
7986 |
29 Jun 21 |
nicklas |
385 |
<div class="messagecontainer error" id="failMessage" style="width: 30em; text-align: center;"> |
7985 |
22 Jun 21 |
nicklas |
386 |
</div> |
7985 |
22 Jun 21 |
nicklas |
387 |
</td></tr> |
7985 |
22 Jun 21 |
nicklas |
388 |
</table> |
7985 |
22 Jun 21 |
nicklas |
389 |
</div> |
7985 |
22 Jun 21 |
nicklas |
390 |
|
7985 |
22 Jun 21 |
nicklas |
391 |
<base:buttongroup subclass="dialogbuttons"> |
7985 |
22 Jun 21 |
nicklas |
392 |
<base:button id="failClose" title="Close" /> |
7985 |
22 Jun 21 |
nicklas |
393 |
</base:buttongroup> |
7985 |
22 Jun 21 |
nicklas |
394 |
</div> |
6137 |
19 Sep 12 |
nicklas |
395 |
|
6137 |
19 Sep 12 |
nicklas |
396 |
</base:body> |
6137 |
19 Sep 12 |
nicklas |
397 |
</base:page> |
6137 |
19 Sep 12 |
nicklas |
398 |
<% |
6137 |
19 Sep 12 |
nicklas |
399 |
} |
6137 |
19 Sep 12 |
nicklas |
400 |
finally |
6137 |
19 Sep 12 |
nicklas |
401 |
{ |
6137 |
19 Sep 12 |
nicklas |
402 |
if (dc != null) dc.close(); |
6137 |
19 Sep 12 |
nicklas |
403 |
} |
6137 |
19 Sep 12 |
nicklas |
404 |
%> |
6137 |
19 Sep 12 |
nicklas |
405 |
|
6137 |
19 Sep 12 |
nicklas |
406 |
|
6137 |
19 Sep 12 |
nicklas |
407 |
|