5877 |
16 Nov 11 |
nicklas |
1 |
<%-- $Id $ |
5877 |
16 Nov 11 |
nicklas |
2 |
------------------------------------------------------------------ |
5877 |
16 Nov 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5877 |
16 Nov 11 |
nicklas |
4 |
|
5877 |
16 Nov 11 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
5877 |
16 Nov 11 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
5877 |
16 Nov 11 |
nicklas |
7 |
|
5877 |
16 Nov 11 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
5877 |
16 Nov 11 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
5877 |
16 Nov 11 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
5877 |
16 Nov 11 |
nicklas |
11 |
of the License, or (at your option) any later version. |
5877 |
16 Nov 11 |
nicklas |
12 |
|
5877 |
16 Nov 11 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
5877 |
16 Nov 11 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5877 |
16 Nov 11 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5877 |
16 Nov 11 |
nicklas |
16 |
GNU General Public License for more details. |
5877 |
16 Nov 11 |
nicklas |
17 |
|
5877 |
16 Nov 11 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
5877 |
16 Nov 11 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5877 |
16 Nov 11 |
nicklas |
20 |
------------------------------------------------------------------ |
5877 |
16 Nov 11 |
nicklas |
21 |
--%> |
5877 |
16 Nov 11 |
nicklas |
22 |
<%@ page pageEncoding="UTF-8" session="false" |
5877 |
16 Nov 11 |
nicklas |
23 |
import="net.sf.basedb.core.SessionControl" |
5877 |
16 Nov 11 |
nicklas |
24 |
import="net.sf.basedb.core.DbControl" |
5877 |
16 Nov 11 |
nicklas |
25 |
import="net.sf.basedb.core.Item" |
5877 |
16 Nov 11 |
nicklas |
26 |
import="net.sf.basedb.core.ItemContext" |
5877 |
16 Nov 11 |
nicklas |
27 |
import="net.sf.basedb.core.Permission" |
5877 |
16 Nov 11 |
nicklas |
28 |
import="net.sf.basedb.core.ReporterCloneTemplate" |
5885 |
22 Nov 11 |
nicklas |
29 |
import="net.sf.basedb.core.ClonableProperty" |
5877 |
16 Nov 11 |
nicklas |
30 |
import="net.sf.basedb.core.ItemQuery" |
5877 |
16 Nov 11 |
nicklas |
31 |
import="net.sf.basedb.core.ItemResultList" |
5877 |
16 Nov 11 |
nicklas |
32 |
import="net.sf.basedb.core.Include" |
5877 |
16 Nov 11 |
nicklas |
33 |
import="net.sf.basedb.core.PermissionDeniedException" |
5877 |
16 Nov 11 |
nicklas |
34 |
import="net.sf.basedb.core.query.Orders" |
5877 |
16 Nov 11 |
nicklas |
35 |
import="net.sf.basedb.core.query.Hql" |
5877 |
16 Nov 11 |
nicklas |
36 |
import="net.sf.basedb.clients.web.Base" |
5877 |
16 Nov 11 |
nicklas |
37 |
import="net.sf.basedb.clients.web.util.HTML" |
5877 |
16 Nov 11 |
nicklas |
38 |
import="net.sf.basedb.util.Values" |
5877 |
16 Nov 11 |
nicklas |
39 |
import="net.sf.basedb.core.plugin.GuiContext" |
5877 |
16 Nov 11 |
nicklas |
40 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5877 |
16 Nov 11 |
nicklas |
41 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5877 |
16 Nov 11 |
nicklas |
42 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
43 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5877 |
16 Nov 11 |
nicklas |
44 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
5877 |
16 Nov 11 |
nicklas |
45 |
import="java.util.List" |
5877 |
16 Nov 11 |
nicklas |
46 |
import="java.util.Collections" |
5877 |
16 Nov 11 |
nicklas |
47 |
%> |
5877 |
16 Nov 11 |
nicklas |
48 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
5877 |
16 Nov 11 |
nicklas |
49 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
50 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
5877 |
16 Nov 11 |
nicklas |
51 |
<% |
5877 |
16 Nov 11 |
nicklas |
52 |
final Item itemType = Item.REPORTERCLONETEMPLATE; |
5877 |
16 Nov 11 |
nicklas |
53 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
5877 |
16 Nov 11 |
nicklas |
54 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
5877 |
16 Nov 11 |
nicklas |
55 |
final int itemId = cc.getId(); |
5877 |
16 Nov 11 |
nicklas |
56 |
final String ID = sc.getId(); |
5877 |
16 Nov 11 |
nicklas |
57 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
58 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
5877 |
16 Nov 11 |
nicklas |
59 |
try |
5877 |
16 Nov 11 |
nicklas |
60 |
{ |
5877 |
16 Nov 11 |
nicklas |
61 |
String title = null; |
5877 |
16 Nov 11 |
nicklas |
62 |
ReporterCloneTemplate template = null; |
5885 |
22 Nov 11 |
nicklas |
63 |
List<ClonableProperty> clonableProperties = null; |
5877 |
16 Nov 11 |
nicklas |
64 |
|
5877 |
16 Nov 11 |
nicklas |
65 |
if (itemId == 0) |
5877 |
16 Nov 11 |
nicklas |
66 |
{ |
5877 |
16 Nov 11 |
nicklas |
67 |
title = "Create reporter clone template"; |
5885 |
22 Nov 11 |
nicklas |
68 |
clonableProperties = ClonableProperty.getAllMandatory(); |
5877 |
16 Nov 11 |
nicklas |
69 |
cc.removeObject("item"); |
5877 |
16 Nov 11 |
nicklas |
70 |
} |
5877 |
16 Nov 11 |
nicklas |
71 |
else |
5877 |
16 Nov 11 |
nicklas |
72 |
{ |
5877 |
16 Nov 11 |
nicklas |
73 |
template = ReporterCloneTemplate.getById(dc, itemId); |
5877 |
16 Nov 11 |
nicklas |
74 |
template.checkPermission(Permission.WRITE); |
5885 |
22 Nov 11 |
nicklas |
75 |
clonableProperties = template.getClonableProperties(); |
5877 |
16 Nov 11 |
nicklas |
76 |
cc.setObject("item", template); |
5877 |
16 Nov 11 |
nicklas |
77 |
title = "Edit reporter clone template -- " + HTML.encodeTags(template.getName()); |
5877 |
16 Nov 11 |
nicklas |
78 |
} |
5877 |
16 Nov 11 |
nicklas |
79 |
|
5877 |
16 Nov 11 |
nicklas |
80 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), template); |
7604 |
25 Feb 19 |
nicklas |
81 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
5877 |
16 Nov 11 |
nicklas |
82 |
%> |
5877 |
16 Nov 11 |
nicklas |
83 |
|
6305 |
09 Aug 13 |
nicklas |
84 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6305 |
09 Aug 13 |
nicklas |
85 |
<base:head scripts="tabcontrol-2.js,~templates.js" styles="tabcontrol.css"> |
5877 |
16 Nov 11 |
nicklas |
86 |
<ext:scripts context="<%=jspContext%>" /> |
5877 |
16 Nov 11 |
nicklas |
87 |
<ext:stylesheets context="<%=jspContext%>" /> |
5877 |
16 Nov 11 |
nicklas |
88 |
</base:head> |
6305 |
09 Aug 13 |
nicklas |
89 |
<base:body> |
5921 |
10 Jan 12 |
nicklas |
90 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
6162 |
10 Oct 12 |
nicklas |
91 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="template"> |
5877 |
16 Nov 11 |
nicklas |
92 |
<input type="hidden" name="cmd" value="UpdateItem"> |
5877 |
16 Nov 11 |
nicklas |
93 |
|
5921 |
10 Jan 12 |
nicklas |
94 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
95 |
subclass="content dialogtabcontrol" |
6176 |
19 Oct 12 |
nicklas |
96 |
position="bottom" remember="<%=template != null%>" |
5877 |
16 Nov 11 |
nicklas |
97 |
extensions="<%=invoker%>"> |
6305 |
09 Aug 13 |
nicklas |
98 |
<t:tab id="info" title="Reporter clone template" helpid="reporterclonetemplate.edit"> |
5921 |
10 Jan 12 |
nicklas |
99 |
<table class="fullform input100 smaller"> |
5877 |
16 Nov 11 |
nicklas |
100 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
101 |
<th>Name</th> |
6305 |
09 Aug 13 |
nicklas |
102 |
<td><input class="text required auto-init" data-auto-init="<%=template == null ? "focus-select" : "focus" %>" |
6305 |
09 Aug 13 |
nicklas |
103 |
type="text" name="name" |
5877 |
16 Nov 11 |
nicklas |
104 |
value="<%=HTML.encodeTags(template == null ? Values.getString(cc.getPropertyValue("name"), "New reporter clone template") : template.getName())%>" |
5921 |
10 Jan 12 |
nicklas |
105 |
maxlength="<%=ReporterCloneTemplate.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
106 |
<td></td> |
5877 |
16 Nov 11 |
nicklas |
107 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
108 |
<tr class="big"> |
5921 |
10 Jan 12 |
nicklas |
109 |
<th>Properties</th> |
5877 |
16 Nov 11 |
nicklas |
110 |
<td> |
5921 |
10 Jan 12 |
nicklas |
111 |
<table style="width: 100%;"> |
5877 |
16 Nov 11 |
nicklas |
112 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
113 |
<td style="width: 47%;"> |
5877 |
16 Nov 11 |
nicklas |
114 |
<b>Cloned</b><br> |
6305 |
09 Aug 13 |
nicklas |
115 |
<select name="cloned_properties" id="cloned_properties" |
6305 |
09 Aug 13 |
nicklas |
116 |
data-to-id="uncloned_properties" |
6305 |
09 Aug 13 |
nicklas |
117 |
data-is-sorted="1" |
6305 |
09 Aug 13 |
nicklas |
118 |
multiple size="12" style="width: 100%;"> |
5877 |
16 Nov 11 |
nicklas |
119 |
<% |
5885 |
22 Nov 11 |
nicklas |
120 |
for (ClonableProperty cp : clonableProperties) |
5877 |
16 Nov 11 |
nicklas |
121 |
{ |
5877 |
16 Nov 11 |
nicklas |
122 |
%> |
5879 |
18 Nov 11 |
nicklas |
123 |
<option value="<%=cp.getName()%>" |
6147 |
21 Sep 12 |
nicklas |
124 |
style="<%=cp.isMandatory() ? "font-weight: bold;" : "" %>" |
6305 |
09 Aug 13 |
nicklas |
125 |
data-no-remove="<%=cp.isMandatory() ? 1 : 0%>" |
5879 |
18 Nov 11 |
nicklas |
126 |
title="<%=HTML.encodeTags(cp.getDescription())%>"><%=HTML.encodeTags(cp.getTitle())%><%=cp.isMandatory() ? " ×" : ""%> |
5877 |
16 Nov 11 |
nicklas |
127 |
<% |
5877 |
16 Nov 11 |
nicklas |
128 |
} |
5877 |
16 Nov 11 |
nicklas |
129 |
%> |
5877 |
16 Nov 11 |
nicklas |
130 |
</select> |
5877 |
16 Nov 11 |
nicklas |
131 |
</td> |
5877 |
16 Nov 11 |
nicklas |
132 |
|
6147 |
21 Sep 12 |
nicklas |
133 |
<td style="vertical-align: middle; padding: 5px; width: 6%;"> |
5921 |
10 Jan 12 |
nicklas |
134 |
<base:buttongroup vertical="true"> |
5921 |
10 Jan 12 |
nicklas |
135 |
<base:button |
6305 |
09 Aug 13 |
nicklas |
136 |
id="moveLeft" |
6305 |
09 Aug 13 |
nicklas |
137 |
data-from-id="uncloned_properties" |
6305 |
09 Aug 13 |
nicklas |
138 |
data-to-id="cloned_properties" |
5921 |
10 Jan 12 |
nicklas |
139 |
image="move_left.png" |
5921 |
10 Jan 12 |
nicklas |
140 |
tooltip="Clone the selected uncloned properties" |
5921 |
10 Jan 12 |
nicklas |
141 |
subclass="square" |
5921 |
10 Jan 12 |
nicklas |
142 |
/> |
5921 |
10 Jan 12 |
nicklas |
143 |
<base:button |
6305 |
09 Aug 13 |
nicklas |
144 |
id="moveRight" |
6305 |
09 Aug 13 |
nicklas |
145 |
data-from-id="cloned_properties" |
6305 |
09 Aug 13 |
nicklas |
146 |
data-to-id="uncloned_properties" |
5921 |
10 Jan 12 |
nicklas |
147 |
image="move_right.png" |
5921 |
10 Jan 12 |
nicklas |
148 |
tooltip="Do not cloned the selected properties" |
5921 |
10 Jan 12 |
nicklas |
149 |
subclass="square" |
5921 |
10 Jan 12 |
nicklas |
150 |
/> |
5921 |
10 Jan 12 |
nicklas |
151 |
</base:buttongroup> |
5877 |
16 Nov 11 |
nicklas |
152 |
</td> |
5877 |
16 Nov 11 |
nicklas |
153 |
|
5921 |
10 Jan 12 |
nicklas |
154 |
<td style="width: 47%;"> |
5877 |
16 Nov 11 |
nicklas |
155 |
<b>Not cloned</b><br> |
6305 |
09 Aug 13 |
nicklas |
156 |
<select name="uncloned_properties" id="uncloned_properties" |
6305 |
09 Aug 13 |
nicklas |
157 |
data-to-id="cloned_properties" |
6305 |
09 Aug 13 |
nicklas |
158 |
data-is-sorted="1" |
6305 |
09 Aug 13 |
nicklas |
159 |
multiple size="12" style="width: 100%;"> |
5877 |
16 Nov 11 |
nicklas |
160 |
<% |
5885 |
22 Nov 11 |
nicklas |
161 |
for (ClonableProperty cp : ClonableProperty.getAll()) |
5877 |
16 Nov 11 |
nicklas |
162 |
{ |
5885 |
22 Nov 11 |
nicklas |
163 |
if ((template == null && !cp.isMandatory()) || (template != null && !template.hasClonableProperty(cp.getName()))) |
5877 |
16 Nov 11 |
nicklas |
164 |
{ |
5877 |
16 Nov 11 |
nicklas |
165 |
%> |
5877 |
16 Nov 11 |
nicklas |
166 |
<option value="<%=cp.getName()%>" title="<%=HTML.encodeTags(cp.getDescription())%>"><%=HTML.encodeTags(cp.getTitle())%> |
5877 |
16 Nov 11 |
nicklas |
167 |
<% |
5877 |
16 Nov 11 |
nicklas |
168 |
} |
5877 |
16 Nov 11 |
nicklas |
169 |
} |
5877 |
16 Nov 11 |
nicklas |
170 |
%> |
5877 |
16 Nov 11 |
nicklas |
171 |
</select> |
5877 |
16 Nov 11 |
nicklas |
172 |
</td> |
5877 |
16 Nov 11 |
nicklas |
173 |
|
5877 |
16 Nov 11 |
nicklas |
174 |
</tr> |
5877 |
16 Nov 11 |
nicklas |
175 |
</table> |
5877 |
16 Nov 11 |
nicklas |
176 |
</td> |
5921 |
10 Jan 12 |
nicklas |
177 |
<td></td> |
5877 |
16 Nov 11 |
nicklas |
178 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
179 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
180 |
<th>Description</th> |
5921 |
10 Jan 12 |
nicklas |
181 |
<td> |
6217 |
14 Dec 12 |
nicklas |
182 |
<textarea class="text" rows="6" name="description" id="description" |
5877 |
16 Nov 11 |
nicklas |
183 |
><%=HTML.encodeTags(template == null ? cc.getPropertyValue("description") : template.getDescription())%></textarea> |
5877 |
16 Nov 11 |
nicklas |
184 |
</td> |
5921 |
10 Jan 12 |
nicklas |
185 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
186 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
187 |
</td> |
5877 |
16 Nov 11 |
nicklas |
188 |
</tr> |
5877 |
16 Nov 11 |
nicklas |
189 |
</table> |
5877 |
16 Nov 11 |
nicklas |
190 |
</t:tab> |
5921 |
10 Jan 12 |
nicklas |
191 |
</t:tabcontrol> |
5921 |
10 Jan 12 |
nicklas |
192 |
</form> |
5877 |
16 Nov 11 |
nicklas |
193 |
|
5921 |
10 Jan 12 |
nicklas |
194 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
195 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
196 |
</div> |
5877 |
16 Nov 11 |
nicklas |
197 |
|
5921 |
10 Jan 12 |
nicklas |
198 |
<base:buttongroup subclass="dialogbuttons"> |
6305 |
09 Aug 13 |
nicklas |
199 |
<base:button id="btnSave" title="Save" /> |
6305 |
09 Aug 13 |
nicklas |
200 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
201 |
</base:buttongroup> |
5877 |
16 Nov 11 |
nicklas |
202 |
</base:body> |
5877 |
16 Nov 11 |
nicklas |
203 |
</base:page> |
5877 |
16 Nov 11 |
nicklas |
204 |
<% |
5877 |
16 Nov 11 |
nicklas |
205 |
} |
5877 |
16 Nov 11 |
nicklas |
206 |
finally |
5877 |
16 Nov 11 |
nicklas |
207 |
{ |
5877 |
16 Nov 11 |
nicklas |
208 |
if (dc != null) dc.close(); |
5877 |
16 Nov 11 |
nicklas |
209 |
} |
5877 |
16 Nov 11 |
nicklas |
210 |
%> |