1794 |
19 Jan 06 |
nicklas |
1 |
<%-- $Id$ |
1794 |
19 Jan 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1794 |
19 Jan 06 |
nicklas |
4 |
|
2304 |
22 May 06 |
jari |
5 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
6 |
Available at http://base.thep.lu.se/ |
1794 |
19 Jan 06 |
nicklas |
7 |
|
1794 |
19 Jan 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1794 |
19 Jan 06 |
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 |
1794 |
19 Jan 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1794 |
19 Jan 06 |
nicklas |
12 |
|
1794 |
19 Jan 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1794 |
19 Jan 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1794 |
19 Jan 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1794 |
19 Jan 06 |
nicklas |
16 |
GNU General Public License for more details. |
1794 |
19 Jan 06 |
nicklas |
17 |
|
1794 |
19 Jan 06 |
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/>. |
1794 |
19 Jan 06 |
nicklas |
20 |
------------------------------------------------------------------ |
1794 |
19 Jan 06 |
nicklas |
21 |
|
1794 |
19 Jan 06 |
nicklas |
22 |
|
1794 |
19 Jan 06 |
nicklas |
23 |
@author Nicklas |
1794 |
19 Jan 06 |
nicklas |
24 |
@version 2.0 |
1794 |
19 Jan 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1794 |
19 Jan 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1794 |
19 Jan 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1794 |
19 Jan 06 |
nicklas |
29 |
import="net.sf.basedb.core.Item" |
1794 |
19 Jan 06 |
nicklas |
30 |
import="net.sf.basedb.core.SystemItems" |
1794 |
19 Jan 06 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
1794 |
19 Jan 06 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
1794 |
19 Jan 06 |
nicklas |
33 |
import="net.sf.basedb.core.Directory" |
1794 |
19 Jan 06 |
nicklas |
34 |
import="net.sf.basedb.core.PermissionDeniedException" |
1794 |
19 Jan 06 |
nicklas |
35 |
import="net.sf.basedb.core.BaseException" |
1794 |
19 Jan 06 |
nicklas |
36 |
import="net.sf.basedb.core.query.Orders" |
1794 |
19 Jan 06 |
nicklas |
37 |
import="net.sf.basedb.core.query.Hql" |
1794 |
19 Jan 06 |
nicklas |
38 |
import="net.sf.basedb.clients.web.Base" |
1794 |
19 Jan 06 |
nicklas |
39 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
40 |
import="net.sf.basedb.util.Values" |
5501 |
18 Nov 10 |
nicklas |
41 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
42 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
43 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
44 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
45 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5501 |
18 Nov 10 |
nicklas |
46 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
1794 |
19 Jan 06 |
nicklas |
47 |
import="java.util.List" |
1794 |
19 Jan 06 |
nicklas |
48 |
import="java.util.Set" |
1794 |
19 Jan 06 |
nicklas |
49 |
import="java.util.HashSet" |
1794 |
19 Jan 06 |
nicklas |
50 |
%> |
1794 |
19 Jan 06 |
nicklas |
51 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1794 |
19 Jan 06 |
nicklas |
52 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6137 |
19 Sep 12 |
nicklas |
53 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1794 |
19 Jan 06 |
nicklas |
54 |
<% |
1794 |
19 Jan 06 |
nicklas |
55 |
final Item itemType = Item.DIRECTORY; |
1794 |
19 Jan 06 |
nicklas |
56 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1794 |
19 Jan 06 |
nicklas |
57 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1794 |
19 Jan 06 |
nicklas |
58 |
final int itemId = cc.getId(); |
1794 |
19 Jan 06 |
nicklas |
59 |
final String ID = sc.getId(); |
1794 |
19 Jan 06 |
nicklas |
60 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
61 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
1794 |
19 Jan 06 |
nicklas |
62 |
try |
1794 |
19 Jan 06 |
nicklas |
63 |
{ |
1794 |
19 Jan 06 |
nicklas |
64 |
String title = null; |
1794 |
19 Jan 06 |
nicklas |
65 |
Directory directory = null; |
1794 |
19 Jan 06 |
nicklas |
66 |
Directory parent = null; |
3719 |
12 Sep 07 |
nicklas |
67 |
boolean autoCompress = false; |
4314 |
26 May 08 |
nicklas |
68 |
boolean autoShare = false; |
1794 |
19 Jan 06 |
nicklas |
69 |
|
1794 |
19 Jan 06 |
nicklas |
70 |
if (itemId == 0) |
1794 |
19 Jan 06 |
nicklas |
71 |
{ |
1794 |
19 Jan 06 |
nicklas |
72 |
title = "Create directory"; |
1794 |
19 Jan 06 |
nicklas |
73 |
parent = Directory.getById(dc, Values.getInt(request.getParameter("parent_id"), |
1794 |
19 Jan 06 |
nicklas |
74 |
SystemItems.getId(Directory.ROOT)) |
1794 |
19 Jan 06 |
nicklas |
75 |
); |
3719 |
12 Sep 07 |
nicklas |
76 |
autoCompress = parent.getAutoCompress(); |
4314 |
26 May 08 |
nicklas |
77 |
autoShare = parent.getAutoShare(); |
1794 |
19 Jan 06 |
nicklas |
78 |
cc.removeObject("item"); |
1794 |
19 Jan 06 |
nicklas |
79 |
} |
1794 |
19 Jan 06 |
nicklas |
80 |
else |
1794 |
19 Jan 06 |
nicklas |
81 |
{ |
1794 |
19 Jan 06 |
nicklas |
82 |
directory = Directory.getById(dc, itemId); |
6308 |
20 Aug 13 |
nicklas |
83 |
directory.checkPermission(Permission.WRITE); |
1794 |
19 Jan 06 |
nicklas |
84 |
parent = directory.getParent(); |
3719 |
12 Sep 07 |
nicklas |
85 |
autoCompress = directory.getAutoCompress(); |
4314 |
26 May 08 |
nicklas |
86 |
autoShare = directory.getAutoShare(); |
1794 |
19 Jan 06 |
nicklas |
87 |
cc.setObject("item", directory); |
1794 |
19 Jan 06 |
nicklas |
88 |
title = "Edit directory -- " + HTML.encodeTags(directory.getName()); |
1794 |
19 Jan 06 |
nicklas |
89 |
} |
6217 |
14 Dec 12 |
nicklas |
90 |
|
5501 |
18 Nov 10 |
nicklas |
91 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), directory); |
7604 |
25 Feb 19 |
nicklas |
92 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
1794 |
19 Jan 06 |
nicklas |
93 |
%> |
6308 |
20 Aug 13 |
nicklas |
94 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6308 |
20 Aug 13 |
nicklas |
95 |
<base:head scripts="tabcontrol-2.js,~directories.js" styles="tabcontrol.css"> |
5501 |
18 Nov 10 |
nicklas |
96 |
<ext:scripts context="<%=jspContext%>" /> |
5501 |
18 Nov 10 |
nicklas |
97 |
<ext:stylesheets context="<%=jspContext%>" /> |
1794 |
19 Jan 06 |
nicklas |
98 |
</base:head> |
6308 |
20 Aug 13 |
nicklas |
99 |
<base:body> |
5908 |
13 Dec 11 |
nicklas |
100 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
5908 |
13 Dec 11 |
nicklas |
101 |
|
6162 |
10 Oct 12 |
nicklas |
102 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="directory"> |
1794 |
19 Jan 06 |
nicklas |
103 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1794 |
19 Jan 06 |
nicklas |
104 |
<input type="hidden" name="parent_id" value="<%=parent.getId()%>"> |
5908 |
13 Dec 11 |
nicklas |
105 |
|
5908 |
13 Dec 11 |
nicklas |
106 |
<t:tabcontrol id="settings" |
5908 |
13 Dec 11 |
nicklas |
107 |
subclass="content dialogtabcontrol" |
5501 |
18 Nov 10 |
nicklas |
108 |
position="bottom" remember="<%=directory != null%>" |
5501 |
18 Nov 10 |
nicklas |
109 |
extensions="<%=invoker%>"> |
6308 |
20 Aug 13 |
nicklas |
110 |
<t:tab id="info" title="Directory" helpid="directory.edit"> |
5908 |
13 Dec 11 |
nicklas |
111 |
<table class="fullform input100"> |
1794 |
19 Jan 06 |
nicklas |
112 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
113 |
<th>Path</th> |
5908 |
13 Dec 11 |
nicklas |
114 |
<td colspan="2"><%=HTML.encodeTags(parent.getPath().toString())%></td> |
1794 |
19 Jan 06 |
nicklas |
115 |
</tr> |
1794 |
19 Jan 06 |
nicklas |
116 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
117 |
<th>Name</th> |
6308 |
20 Aug 13 |
nicklas |
118 |
<td><input class="text required auto-init" |
6308 |
20 Aug 13 |
nicklas |
119 |
data-auto-init="<%=directory == null ? "focus-select" : "focus" %>" |
6308 |
20 Aug 13 |
nicklas |
120 |
type="text" name="name" |
1794 |
19 Jan 06 |
nicklas |
121 |
value="<%=HTML.encodeTags(directory == null ? Values.getString(cc.getPropertyValue("name"), "New directory") : directory.getName())%>" |
5908 |
13 Dec 11 |
nicklas |
122 |
maxlength="<%=Directory.MAX_NAME_LENGTH%>"></td> |
5908 |
13 Dec 11 |
nicklas |
123 |
<td></td> |
1794 |
19 Jan 06 |
nicklas |
124 |
</tr> |
3719 |
12 Sep 07 |
nicklas |
125 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
126 |
<th>Compress new files</th> |
3719 |
12 Sep 07 |
nicklas |
127 |
<td> |
5812 |
17 Oct 11 |
nicklas |
128 |
<input type="radio" name="autoCompress" id="autoCompressNo" value="0" |
5812 |
17 Oct 11 |
nicklas |
129 |
<%=!autoCompress ? "checked" : ""%>><label for="autoCompressNo">no</label> |
5812 |
17 Oct 11 |
nicklas |
130 |
<input type="radio" name="autoCompress" id="autoCompressYes" value="1" |
5812 |
17 Oct 11 |
nicklas |
131 |
<%=autoCompress ? "checked" : ""%>><label for="autoCompressYes">yes</label> |
5812 |
17 Oct 11 |
nicklas |
132 |
<span title="Select this checkbox to set this property on all subdirectories"> |
5812 |
17 Oct 11 |
nicklas |
133 |
<input type="checkbox" name="autoCompressRecursive" id="autoCompressRecursive" value="1" |
5812 |
17 Oct 11 |
nicklas |
134 |
><label for="autoCompressRecursive">Recursive</label></span> |
3719 |
12 Sep 07 |
nicklas |
135 |
</td> |
5908 |
13 Dec 11 |
nicklas |
136 |
<td></td> |
3719 |
12 Sep 07 |
nicklas |
137 |
</tr> |
4314 |
26 May 08 |
nicklas |
138 |
<tr> |
5908 |
13 Dec 11 |
nicklas |
139 |
<th> |
4314 |
26 May 08 |
nicklas |
140 |
Share new files and sub-<br> |
4314 |
26 May 08 |
nicklas |
141 |
directories automatically |
5908 |
13 Dec 11 |
nicklas |
142 |
</th> |
4314 |
26 May 08 |
nicklas |
143 |
<td> |
5812 |
17 Oct 11 |
nicklas |
144 |
<input type="radio" name="autoShare" id="autoShareNo" value="0" |
5812 |
17 Oct 11 |
nicklas |
145 |
<%=!autoShare ? "checked" : ""%>><label for="autoShareNo">no</label> |
5812 |
17 Oct 11 |
nicklas |
146 |
<input type="radio" name="autoShare" id="autoShareYes" value="1" |
5812 |
17 Oct 11 |
nicklas |
147 |
<%=autoShare ? "checked" : ""%>><label for="autoShareYes">yes</label> |
5812 |
17 Oct 11 |
nicklas |
148 |
<span title="Select this checkbox to set this property on all subdirectories"> |
5812 |
17 Oct 11 |
nicklas |
149 |
<input type="checkbox" name="autoShareRecursive" id="autoShareRecursive" value="1" |
5812 |
17 Oct 11 |
nicklas |
150 |
><label for="autoShareRecursive">Recursive</label></span> |
4314 |
26 May 08 |
nicklas |
151 |
</td> |
5908 |
13 Dec 11 |
nicklas |
152 |
<td></td> |
4314 |
26 May 08 |
nicklas |
153 |
</tr> |
5908 |
13 Dec 11 |
nicklas |
154 |
<tr class="dynamic"> |
5908 |
13 Dec 11 |
nicklas |
155 |
<th>Description</th> |
5908 |
13 Dec 11 |
nicklas |
156 |
<td> |
6217 |
14 Dec 12 |
nicklas |
157 |
<textarea class="text" rows="4" name="description" id="description" |
1794 |
19 Jan 06 |
nicklas |
158 |
><%=HTML.encodeTags(directory == null ? cc.getPropertyValue("description") : directory.getDescription())%></textarea> |
1794 |
19 Jan 06 |
nicklas |
159 |
</td> |
5908 |
13 Dec 11 |
nicklas |
160 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
161 |
<base:zoom textarea="description" title="Description" /> |
5908 |
13 Dec 11 |
nicklas |
162 |
</td> |
1794 |
19 Jan 06 |
nicklas |
163 |
</tr> |
1794 |
19 Jan 06 |
nicklas |
164 |
</table> |
1794 |
19 Jan 06 |
nicklas |
165 |
</t:tab> |
1794 |
19 Jan 06 |
nicklas |
166 |
</t:tabcontrol> |
5908 |
13 Dec 11 |
nicklas |
167 |
</form> |
1794 |
19 Jan 06 |
nicklas |
168 |
|
5908 |
13 Dec 11 |
nicklas |
169 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
170 |
<base:icon image="required.png" />= required information |
5908 |
13 Dec 11 |
nicklas |
171 |
</div> |
5908 |
13 Dec 11 |
nicklas |
172 |
|
5908 |
13 Dec 11 |
nicklas |
173 |
<base:buttongroup subclass="dialogbuttons"> |
6308 |
20 Aug 13 |
nicklas |
174 |
<base:button id="btnSave" title="Save" /> |
6308 |
20 Aug 13 |
nicklas |
175 |
<base:button id="close" title="Cancel" /> |
5908 |
13 Dec 11 |
nicklas |
176 |
</base:buttongroup> |
1794 |
19 Jan 06 |
nicklas |
177 |
</base:body> |
1794 |
19 Jan 06 |
nicklas |
178 |
</base:page> |
1794 |
19 Jan 06 |
nicklas |
179 |
<% |
1794 |
19 Jan 06 |
nicklas |
180 |
} |
1794 |
19 Jan 06 |
nicklas |
181 |
finally |
1794 |
19 Jan 06 |
nicklas |
182 |
{ |
1794 |
19 Jan 06 |
nicklas |
183 |
if (dc != null) dc.close(); |
1794 |
19 Jan 06 |
nicklas |
184 |
} |
1794 |
19 Jan 06 |
nicklas |
185 |
%> |