5370 |
23 Jun 10 |
nicklas |
1 |
<%-- $Id $ |
5370 |
23 Jun 10 |
nicklas |
2 |
------------------------------------------------------------------ |
5370 |
23 Jun 10 |
nicklas |
Copyright (C) 2010 Nicklas Nordborg |
5370 |
23 Jun 10 |
nicklas |
4 |
|
5370 |
23 Jun 10 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
5370 |
23 Jun 10 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
5370 |
23 Jun 10 |
nicklas |
7 |
|
5370 |
23 Jun 10 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
5370 |
23 Jun 10 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
5370 |
23 Jun 10 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
5370 |
23 Jun 10 |
nicklas |
11 |
of the License, or (at your option) any later version. |
5370 |
23 Jun 10 |
nicklas |
12 |
|
5370 |
23 Jun 10 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
5370 |
23 Jun 10 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5370 |
23 Jun 10 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5370 |
23 Jun 10 |
nicklas |
16 |
GNU General Public License for more details. |
5370 |
23 Jun 10 |
nicklas |
17 |
|
5370 |
23 Jun 10 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
5370 |
23 Jun 10 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5370 |
23 Jun 10 |
nicklas |
20 |
------------------------------------------------------------------ |
5370 |
23 Jun 10 |
nicklas |
21 |
|
5370 |
23 Jun 10 |
nicklas |
22 |
@author Nicklas |
5370 |
23 Jun 10 |
nicklas |
23 |
--%> |
5426 |
24 Sep 10 |
nicklas |
24 |
<%@ page pageEncoding="UTF-8" session="false" |
5370 |
23 Jun 10 |
nicklas |
25 |
import="net.sf.basedb.core.SessionControl" |
5370 |
23 Jun 10 |
nicklas |
26 |
import="net.sf.basedb.core.DbControl" |
5370 |
23 Jun 10 |
nicklas |
27 |
import="net.sf.basedb.core.Item" |
5370 |
23 Jun 10 |
nicklas |
28 |
import="net.sf.basedb.core.ItemContext" |
5370 |
23 Jun 10 |
nicklas |
29 |
import="net.sf.basedb.core.Permission" |
5370 |
23 Jun 10 |
nicklas |
30 |
import="net.sf.basedb.core.PermissionTemplate" |
5370 |
23 Jun 10 |
nicklas |
31 |
import="net.sf.basedb.core.PermissionDeniedException" |
5370 |
23 Jun 10 |
nicklas |
32 |
import="net.sf.basedb.clients.web.Base" |
5370 |
23 Jun 10 |
nicklas |
33 |
import="net.sf.basedb.clients.web.util.HTML" |
5370 |
23 Jun 10 |
nicklas |
34 |
import="net.sf.basedb.util.Values" |
5501 |
18 Nov 10 |
nicklas |
35 |
import="net.sf.basedb.core.plugin.GuiContext" |
5501 |
18 Nov 10 |
nicklas |
36 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5501 |
18 Nov 10 |
nicklas |
37 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5501 |
18 Nov 10 |
nicklas |
38 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
39 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5501 |
18 Nov 10 |
nicklas |
40 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5370 |
23 Jun 10 |
nicklas |
41 |
%> |
5370 |
23 Jun 10 |
nicklas |
42 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5370 |
23 Jun 10 |
nicklas |
43 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6142 |
20 Sep 12 |
nicklas |
44 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
5370 |
23 Jun 10 |
nicklas |
45 |
<% |
5370 |
23 Jun 10 |
nicklas |
46 |
final Item itemType = Item.PERMISSIONTEMPLATE; |
5370 |
23 Jun 10 |
nicklas |
47 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5370 |
23 Jun 10 |
nicklas |
48 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
5370 |
23 Jun 10 |
nicklas |
49 |
final int itemId = cc.getId(); |
5370 |
23 Jun 10 |
nicklas |
50 |
final String ID = sc.getId(); |
5370 |
23 Jun 10 |
nicklas |
51 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
52 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
5370 |
23 Jun 10 |
nicklas |
53 |
try |
5370 |
23 Jun 10 |
nicklas |
54 |
{ |
5370 |
23 Jun 10 |
nicklas |
55 |
String title = null; |
5370 |
23 Jun 10 |
nicklas |
56 |
PermissionTemplate template = null; |
5370 |
23 Jun 10 |
nicklas |
57 |
|
5370 |
23 Jun 10 |
nicklas |
58 |
if (itemId == 0) |
5370 |
23 Jun 10 |
nicklas |
59 |
{ |
5370 |
23 Jun 10 |
nicklas |
60 |
title = "Create permission template"; |
5370 |
23 Jun 10 |
nicklas |
61 |
cc.removeObject("item"); |
5370 |
23 Jun 10 |
nicklas |
62 |
} |
5370 |
23 Jun 10 |
nicklas |
63 |
else |
5370 |
23 Jun 10 |
nicklas |
64 |
{ |
5370 |
23 Jun 10 |
nicklas |
65 |
template = PermissionTemplate.getById(dc, itemId); |
5370 |
23 Jun 10 |
nicklas |
66 |
template.checkPermission(Permission.WRITE); |
5370 |
23 Jun 10 |
nicklas |
67 |
cc.setObject("item", template); |
5370 |
23 Jun 10 |
nicklas |
68 |
title = "Edit permission template -- " + HTML.encodeTags(template.getName()); |
5370 |
23 Jun 10 |
nicklas |
69 |
} |
5370 |
23 Jun 10 |
nicklas |
70 |
|
5501 |
18 Nov 10 |
nicklas |
71 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), template); |
7604 |
25 Feb 19 |
nicklas |
72 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
5370 |
23 Jun 10 |
nicklas |
73 |
%> |
6311 |
23 Aug 13 |
nicklas |
74 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6311 |
23 Aug 13 |
nicklas |
75 |
<base:head scripts="tabcontrol-2.js,~templates.js" styles="tabcontrol.css"> |
5501 |
18 Nov 10 |
nicklas |
76 |
<ext:scripts context="<%=jspContext%>" /> |
5501 |
18 Nov 10 |
nicklas |
77 |
<ext:stylesheets context="<%=jspContext%>" /> |
5370 |
23 Jun 10 |
nicklas |
78 |
</base:head> |
6311 |
23 Aug 13 |
nicklas |
79 |
<base:body> |
5909 |
14 Dec 11 |
nicklas |
80 |
<h1><%=title%> <base:help tabcontrol="settings"/></h1> |
6162 |
10 Oct 12 |
nicklas |
81 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="template"> |
5370 |
23 Jun 10 |
nicklas |
82 |
<input type="hidden" name="cmd" value="UpdateItem"> |
5370 |
23 Jun 10 |
nicklas |
83 |
|
5909 |
14 Dec 11 |
nicklas |
84 |
<t:tabcontrol id="settings" |
5909 |
14 Dec 11 |
nicklas |
85 |
subclass="content dialogtabcontrol" |
5501 |
18 Nov 10 |
nicklas |
86 |
position="bottom" remember="<%=template != null%>" |
5501 |
18 Nov 10 |
nicklas |
87 |
extensions="<%=invoker%>"> |
6311 |
23 Aug 13 |
nicklas |
88 |
<t:tab id="info" title="Permission template" helpid="permissiontemplate.edit"> |
5909 |
14 Dec 11 |
nicklas |
89 |
<table class="fullform input100 smaller"> |
5370 |
23 Jun 10 |
nicklas |
90 |
<tr> |
5909 |
14 Dec 11 |
nicklas |
91 |
<th>Name</th> |
6311 |
23 Aug 13 |
nicklas |
92 |
<td><input class="text required auto-init" data-auto-init="<%=template == null ? "focus-select" : "focus" %>" |
6311 |
23 Aug 13 |
nicklas |
93 |
type="text" name="name" |
5370 |
23 Jun 10 |
nicklas |
94 |
value="<%=HTML.encodeTags(template == null ? Values.getString(cc.getPropertyValue("name"), "New template") : template.getName())%>" |
5909 |
14 Dec 11 |
nicklas |
95 |
maxlength="<%=PermissionTemplate.MAX_NAME_LENGTH%>"></td> |
5909 |
14 Dec 11 |
nicklas |
96 |
<td></td> |
5370 |
23 Jun 10 |
nicklas |
97 |
</tr> |
5909 |
14 Dec 11 |
nicklas |
98 |
<tr class="dynamic"> |
5909 |
14 Dec 11 |
nicklas |
99 |
<th>Description</th> |
5909 |
14 Dec 11 |
nicklas |
100 |
<td> |
6217 |
14 Dec 12 |
nicklas |
101 |
<textarea class="text" rows="6" name="description" id="description" |
5370 |
23 Jun 10 |
nicklas |
102 |
><%=HTML.encodeTags(template == null ? cc.getPropertyValue("description") : template.getDescription())%></textarea> |
5370 |
23 Jun 10 |
nicklas |
103 |
</td> |
5909 |
14 Dec 11 |
nicklas |
104 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
105 |
<base:zoom textarea="description" title="Description" /> |
5909 |
14 Dec 11 |
nicklas |
106 |
</td> |
5370 |
23 Jun 10 |
nicklas |
107 |
</tr> |
5370 |
23 Jun 10 |
nicklas |
108 |
</table> |
5370 |
23 Jun 10 |
nicklas |
109 |
</t:tab> |
5370 |
23 Jun 10 |
nicklas |
110 |
</t:tabcontrol> |
5909 |
14 Dec 11 |
nicklas |
111 |
</form> |
5909 |
14 Dec 11 |
nicklas |
112 |
|
5909 |
14 Dec 11 |
nicklas |
113 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
114 |
<base:icon image="required.png" />= required information |
5909 |
14 Dec 11 |
nicklas |
115 |
</div> |
5370 |
23 Jun 10 |
nicklas |
116 |
|
5909 |
14 Dec 11 |
nicklas |
117 |
<base:buttongroup subclass="dialogbuttons"> |
6311 |
23 Aug 13 |
nicklas |
118 |
<base:button id="btnSave" title="Save" /> |
6311 |
23 Aug 13 |
nicklas |
119 |
<base:button id="close" title="Cancel" /> |
5909 |
14 Dec 11 |
nicklas |
120 |
</base:buttongroup> |
5370 |
23 Jun 10 |
nicklas |
121 |
</base:body> |
5370 |
23 Jun 10 |
nicklas |
122 |
</base:page> |
5370 |
23 Jun 10 |
nicklas |
123 |
<% |
5370 |
23 Jun 10 |
nicklas |
124 |
} |
5370 |
23 Jun 10 |
nicklas |
125 |
finally |
5370 |
23 Jun 10 |
nicklas |
126 |
{ |
5370 |
23 Jun 10 |
nicklas |
127 |
if (dc != null) dc.close(); |
5370 |
23 Jun 10 |
nicklas |
128 |
} |
5370 |
23 Jun 10 |
nicklas |
129 |
%> |