5568 |
10 Feb 11 |
nicklas |
1 |
<%-- $Id$ |
5568 |
10 Feb 11 |
nicklas |
2 |
------------------------------------------------------------------ |
5568 |
10 Feb 11 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
5568 |
10 Feb 11 |
nicklas |
Copyright (C) 2007 Nicklas Nordborg |
5568 |
10 Feb 11 |
nicklas |
5 |
|
5568 |
10 Feb 11 |
nicklas |
6 |
This file is part of BASE - BioArray Software Environment. |
5568 |
10 Feb 11 |
nicklas |
7 |
Available at http://base.thep.lu.se/ |
5568 |
10 Feb 11 |
nicklas |
8 |
|
5568 |
10 Feb 11 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
5568 |
10 Feb 11 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
5568 |
10 Feb 11 |
nicklas |
11 |
as published by the Free Software Foundation; either version 3 |
5568 |
10 Feb 11 |
nicklas |
12 |
of the License, or (at your option) any later version. |
5568 |
10 Feb 11 |
nicklas |
13 |
|
5568 |
10 Feb 11 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
5568 |
10 Feb 11 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5568 |
10 Feb 11 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5568 |
10 Feb 11 |
nicklas |
17 |
GNU General Public License for more details. |
5568 |
10 Feb 11 |
nicklas |
18 |
|
5568 |
10 Feb 11 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
5568 |
10 Feb 11 |
nicklas |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5568 |
10 Feb 11 |
nicklas |
21 |
------------------------------------------------------------------ |
5568 |
10 Feb 11 |
nicklas |
22 |
|
5568 |
10 Feb 11 |
nicklas |
23 |
|
5568 |
10 Feb 11 |
nicklas |
24 |
@author Nicklas |
5568 |
10 Feb 11 |
nicklas |
25 |
@version 2.0 |
5568 |
10 Feb 11 |
nicklas |
26 |
--%> |
5568 |
10 Feb 11 |
nicklas |
27 |
<%@ page pageEncoding="UTF-8" session="false" |
5568 |
10 Feb 11 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
5568 |
10 Feb 11 |
nicklas |
29 |
import="net.sf.basedb.core.DbControl" |
5568 |
10 Feb 11 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
5570 |
16 Feb 11 |
nicklas |
31 |
import="net.sf.basedb.core.Config" |
5568 |
10 Feb 11 |
nicklas |
32 |
import="net.sf.basedb.core.SystemItems" |
5568 |
10 Feb 11 |
nicklas |
33 |
import="net.sf.basedb.core.ItemContext" |
5568 |
10 Feb 11 |
nicklas |
34 |
import="net.sf.basedb.core.Permission" |
5568 |
10 Feb 11 |
nicklas |
35 |
import="net.sf.basedb.core.Directory" |
5568 |
10 Feb 11 |
nicklas |
36 |
import="net.sf.basedb.core.File" |
5568 |
10 Feb 11 |
nicklas |
37 |
import="net.sf.basedb.core.FileServer" |
5630 |
13 May 11 |
nicklas |
38 |
import="net.sf.basedb.core.ItemSubtype" |
5568 |
10 Feb 11 |
nicklas |
39 |
import="net.sf.basedb.core.Location" |
5568 |
10 Feb 11 |
nicklas |
40 |
import="net.sf.basedb.core.ItemQuery" |
5568 |
10 Feb 11 |
nicklas |
41 |
import="net.sf.basedb.core.ItemResultList" |
5568 |
10 Feb 11 |
nicklas |
42 |
import="net.sf.basedb.core.PermissionDeniedException" |
5568 |
10 Feb 11 |
nicklas |
43 |
import="net.sf.basedb.core.BaseException" |
5568 |
10 Feb 11 |
nicklas |
44 |
import="net.sf.basedb.core.query.Orders" |
5568 |
10 Feb 11 |
nicklas |
45 |
import="net.sf.basedb.core.query.Hql" |
5568 |
10 Feb 11 |
nicklas |
46 |
import="net.sf.basedb.clients.web.Base" |
5568 |
10 Feb 11 |
nicklas |
47 |
import="net.sf.basedb.clients.web.util.HTML" |
5568 |
10 Feb 11 |
nicklas |
48 |
import="net.sf.basedb.util.Values" |
5568 |
10 Feb 11 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.GuiContext" |
5568 |
10 Feb 11 |
nicklas |
50 |
import="java.util.List" |
5568 |
10 Feb 11 |
nicklas |
51 |
import="java.util.Set" |
5568 |
10 Feb 11 |
nicklas |
52 |
import="java.util.HashSet" |
5568 |
10 Feb 11 |
nicklas |
53 |
import="java.nio.charset.Charset" |
5568 |
10 Feb 11 |
nicklas |
54 |
%> |
5568 |
10 Feb 11 |
nicklas |
55 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5568 |
10 Feb 11 |
nicklas |
56 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
5568 |
10 Feb 11 |
nicklas |
57 |
<% |
5568 |
10 Feb 11 |
nicklas |
58 |
final Item itemType = Item.FILE; |
5568 |
10 Feb 11 |
nicklas |
59 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5568 |
10 Feb 11 |
nicklas |
60 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
5568 |
10 Feb 11 |
nicklas |
61 |
final int itemId = cc.getId(); |
5568 |
10 Feb 11 |
nicklas |
62 |
final String ID = sc.getId(); |
5568 |
10 Feb 11 |
nicklas |
63 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
64 |
final DbControl dc = sc.newDbControl(":Edit multiple files"); |
5568 |
10 Feb 11 |
nicklas |
65 |
try |
5568 |
10 Feb 11 |
nicklas |
66 |
{ |
5568 |
10 Feb 11 |
nicklas |
67 |
if (cc.getSelected().size() == 0) |
5568 |
10 Feb 11 |
nicklas |
68 |
{ |
5568 |
10 Feb 11 |
nicklas |
69 |
throw new PermissionDeniedException("No files have been selected"); |
5568 |
10 Feb 11 |
nicklas |
70 |
} |
5568 |
10 Feb 11 |
nicklas |
71 |
String title = "Edit " + cc.getSelected().size() + " files"; |
5568 |
10 Feb 11 |
nicklas |
72 |
|
5568 |
10 Feb 11 |
nicklas |
73 |
// Query to retrieve file types |
5630 |
13 May 11 |
nicklas |
74 |
final ItemQuery<ItemSubtype> fileTypeQuery = ItemSubtype.getQuery(itemType); |
5568 |
10 Feb 11 |
nicklas |
75 |
fileTypeQuery.order(Orders.asc(Hql.property("name"))); |
5568 |
10 Feb 11 |
nicklas |
76 |
fileTypeQuery.setCacheResult(true); |
5568 |
10 Feb 11 |
nicklas |
77 |
%> |
5568 |
10 Feb 11 |
nicklas |
78 |
<base:page type="popup" title="<%=title%>"> |
6308 |
20 Aug 13 |
nicklas |
79 |
<base:head scripts="tabcontrol-2.js,~edit_multiple_file.js" styles="tabcontrol.css" /> |
5568 |
10 Feb 11 |
nicklas |
80 |
<base:body> |
5908 |
13 Dec 11 |
nicklas |
81 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
5908 |
13 Dec 11 |
nicklas |
82 |
|
6162 |
10 Oct 12 |
nicklas |
83 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="file"> |
5568 |
10 Feb 11 |
nicklas |
84 |
<input type="hidden" name="cmd" value="UpdateMultipleItems"> |
5908 |
13 Dec 11 |
nicklas |
85 |
|
5908 |
13 Dec 11 |
nicklas |
86 |
<t:tabcontrol id="settings" |
5908 |
13 Dec 11 |
nicklas |
87 |
subclass="content dialogtabcontrol" |
5568 |
10 Feb 11 |
nicklas |
88 |
position="bottom"> |
6308 |
20 Aug 13 |
nicklas |
89 |
<t:tab id="info" title="Properties" helpid="file.edit"> |
5908 |
13 Dec 11 |
nicklas |
90 |
<table class="fullform input100"> |
5568 |
10 Feb 11 |
nicklas |
91 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
92 |
<th>Write protected</th> |
5568 |
10 Feb 11 |
nicklas |
93 |
<td> |
5812 |
17 Oct 11 |
nicklas |
94 |
<input type="radio" name="write_protected" id="writeProtectedKeep" value="keep" checked><label for="writeProtectedKeep">No change</label> |
5812 |
17 Oct 11 |
nicklas |
95 |
<input type="radio" name="write_protected" id="writeProtectedNo" value="0"><label for="writeProtectedNo">No</label> |
5812 |
17 Oct 11 |
nicklas |
96 |
<input type="radio" name="write_protected" id="writeProtectedYes" value="1"><label for="writeProtectedYes">Yes</label></td> |
5568 |
10 Feb 11 |
nicklas |
97 |
</tr> |
5908 |
13 Dec 11 |
nicklas |
98 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
99 |
<th>Type</th> |
5908 |
13 Dec 11 |
nicklas |
100 |
<td> |
5568 |
10 Feb 11 |
nicklas |
101 |
<select name="filetype_id"> |
5568 |
10 Feb 11 |
nicklas |
102 |
<option value="keep" selected>- no change - |
5568 |
10 Feb 11 |
nicklas |
103 |
<option value="0">- none - |
5568 |
10 Feb 11 |
nicklas |
104 |
<% |
5630 |
13 May 11 |
nicklas |
105 |
ItemResultList<ItemSubtype> fileTypes = fileTypeQuery.list(dc); |
5630 |
13 May 11 |
nicklas |
106 |
for (ItemSubtype fileType : fileTypes) |
5568 |
10 Feb 11 |
nicklas |
107 |
{ |
5568 |
10 Feb 11 |
nicklas |
108 |
int id = fileType.getId(); |
5568 |
10 Feb 11 |
nicklas |
109 |
%> |
5568 |
10 Feb 11 |
nicklas |
110 |
<option value="<%=id%>"><%=HTML.encodeTags(fileType.getName())%> |
5568 |
10 Feb 11 |
nicklas |
111 |
<% |
5568 |
10 Feb 11 |
nicklas |
112 |
} |
5568 |
10 Feb 11 |
nicklas |
113 |
%> |
5568 |
10 Feb 11 |
nicklas |
114 |
</select> |
5568 |
10 Feb 11 |
nicklas |
115 |
</td> |
5568 |
10 Feb 11 |
nicklas |
116 |
</tr> |
5568 |
10 Feb 11 |
nicklas |
117 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
118 |
<th>MIME type</th> |
5568 |
10 Feb 11 |
nicklas |
119 |
<td> |
6308 |
20 Aug 13 |
nicklas |
120 |
<input type="checkbox" name="keepMimeType" |
6308 |
20 Aug 13 |
nicklas |
121 |
id="keepMimeType" value="1" checked><label for="keepMimeType">No change</label><br> |
5908 |
13 Dec 11 |
nicklas |
122 |
<table style="width: 100%;"> |
5569 |
16 Feb 11 |
nicklas |
123 |
<tr> |
6217 |
14 Dec 12 |
nicklas |
124 |
<td style="width: 98%;"><input class="text" type="text" name="mimeType" disabled |
5908 |
13 Dec 11 |
nicklas |
125 |
value="" maxlength="<%=File.MAX_MIMETYPE_LENGTH%>"></td> |
6308 |
20 Aug 13 |
nicklas |
126 |
<td><base:button id="selectMimeType" title="Select…"/></td> |
5569 |
16 Feb 11 |
nicklas |
127 |
</tr> |
5569 |
16 Feb 11 |
nicklas |
128 |
</table> |
5569 |
16 Feb 11 |
nicklas |
129 |
</td> |
5568 |
10 Feb 11 |
nicklas |
130 |
</tr> |
5568 |
10 Feb 11 |
nicklas |
131 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
132 |
<th>Character set</th> |
5568 |
10 Feb 11 |
nicklas |
133 |
<td> |
5568 |
10 Feb 11 |
nicklas |
134 |
<select name="characterSet"> |
5568 |
10 Feb 11 |
nicklas |
135 |
<option value="keep">- no change - |
5568 |
10 Feb 11 |
nicklas |
136 |
<option value="">- n/a - |
5568 |
10 Feb 11 |
nicklas |
137 |
<% |
5570 |
16 Feb 11 |
nicklas |
138 |
int numCommon = Config.getCommonCharsets().size(); |
5570 |
16 Feb 11 |
nicklas |
139 |
int i = 0; |
5570 |
16 Feb 11 |
nicklas |
140 |
for (String charset : Config.getAllCharsets()) |
5568 |
10 Feb 11 |
nicklas |
141 |
{ |
5568 |
10 Feb 11 |
nicklas |
142 |
%> |
5570 |
16 Feb 11 |
nicklas |
143 |
<option value="<%=charset%>" <%=i==numCommon ? "style=\"border-top: 1px solid #666666;\"" : "" %>><%=charset%> |
5568 |
10 Feb 11 |
nicklas |
144 |
<% |
5570 |
16 Feb 11 |
nicklas |
145 |
i++; |
5568 |
10 Feb 11 |
nicklas |
146 |
} |
5568 |
10 Feb 11 |
nicklas |
147 |
%> |
5568 |
10 Feb 11 |
nicklas |
148 |
</select> |
5568 |
10 Feb 11 |
nicklas |
149 |
</td> |
5568 |
10 Feb 11 |
nicklas |
150 |
</tr> |
5908 |
13 Dec 11 |
nicklas |
151 |
<tr class="dynamic"> |
5908 |
13 Dec 11 |
nicklas |
152 |
<th></th> |
5908 |
13 Dec 11 |
nicklas |
153 |
<td></td> |
5908 |
13 Dec 11 |
nicklas |
154 |
</tr> |
5568 |
10 Feb 11 |
nicklas |
155 |
</table> |
5568 |
10 Feb 11 |
nicklas |
156 |
</t:tab> |
5568 |
10 Feb 11 |
nicklas |
157 |
</t:tabcontrol> |
5908 |
13 Dec 11 |
nicklas |
158 |
</form> |
5568 |
10 Feb 11 |
nicklas |
159 |
|
5908 |
13 Dec 11 |
nicklas |
160 |
<base:buttongroup subclass="dialogbuttons"> |
6308 |
20 Aug 13 |
nicklas |
161 |
<base:button id="btnSave" title="Save" /> |
6308 |
20 Aug 13 |
nicklas |
162 |
<base:button id="close" title="Cancel" /> |
5908 |
13 Dec 11 |
nicklas |
163 |
</base:buttongroup> |
5568 |
10 Feb 11 |
nicklas |
164 |
</base:body> |
5568 |
10 Feb 11 |
nicklas |
165 |
</base:page> |
5568 |
10 Feb 11 |
nicklas |
166 |
<% |
5568 |
10 Feb 11 |
nicklas |
167 |
} |
5568 |
10 Feb 11 |
nicklas |
168 |
finally |
5568 |
10 Feb 11 |
nicklas |
169 |
{ |
5568 |
10 Feb 11 |
nicklas |
170 |
if (dc != null) dc.close(); |
5568 |
10 Feb 11 |
nicklas |
171 |
} |
5568 |
10 Feb 11 |
nicklas |
172 |
%> |