1855 |
27 Jan 06 |
nicklas |
1 |
<%-- $Id$ |
1855 |
27 Jan 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
1855 |
27 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/ |
1855 |
27 Jan 06 |
nicklas |
7 |
|
1855 |
27 Jan 06 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1855 |
27 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 |
1855 |
27 Jan 06 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1855 |
27 Jan 06 |
nicklas |
12 |
|
1855 |
27 Jan 06 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1855 |
27 Jan 06 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1855 |
27 Jan 06 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1855 |
27 Jan 06 |
nicklas |
16 |
GNU General Public License for more details. |
1855 |
27 Jan 06 |
nicklas |
17 |
|
1855 |
27 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/>. |
1855 |
27 Jan 06 |
nicklas |
20 |
------------------------------------------------------------------ |
1855 |
27 Jan 06 |
nicklas |
21 |
|
1855 |
27 Jan 06 |
nicklas |
22 |
@author Nicklas |
1855 |
27 Jan 06 |
nicklas |
23 |
@version 2.0 |
1855 |
27 Jan 06 |
nicklas |
24 |
--%> |
5426 |
24 Sep 10 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
1855 |
27 Jan 06 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
1855 |
27 Jan 06 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
1855 |
27 Jan 06 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
1855 |
27 Jan 06 |
nicklas |
29 |
import="net.sf.basedb.core.Permission" |
1855 |
27 Jan 06 |
nicklas |
30 |
import="net.sf.basedb.core.AnnotationType" |
2875 |
08 Nov 06 |
nicklas |
31 |
import="net.sf.basedb.core.Protocol" |
8083 |
20 Oct 22 |
nicklas |
32 |
import="net.sf.basedb.core.Project" |
1855 |
27 Jan 06 |
nicklas |
33 |
import="net.sf.basedb.core.AnnotationSet" |
2166 |
19 Apr 06 |
nicklas |
34 |
import="net.sf.basedb.core.Annotation" |
1855 |
27 Jan 06 |
nicklas |
35 |
import="net.sf.basedb.core.Annotatable" |
3979 |
19 Nov 07 |
nicklas |
36 |
import="net.sf.basedb.core.AnnotatableProxy" |
4544 |
25 Sep 08 |
nicklas |
37 |
import="net.sf.basedb.core.Unit" |
2166 |
19 Apr 06 |
nicklas |
38 |
import="net.sf.basedb.core.Nameable" |
5984 |
24 Feb 12 |
nicklas |
39 |
import="net.sf.basedb.core.Subtypable" |
5984 |
24 Feb 12 |
nicklas |
40 |
import="net.sf.basedb.core.ItemSubtype" |
6568 |
21 Oct 14 |
nicklas |
41 |
import="net.sf.basedb.core.BioPlate" |
6568 |
21 Oct 14 |
nicklas |
42 |
import="net.sf.basedb.core.BioPlateType" |
7587 |
06 Feb 19 |
nicklas |
43 |
import="net.sf.basedb.core.RawDataType" |
7587 |
06 Feb 19 |
nicklas |
44 |
import="net.sf.basedb.core.RawBioAssay" |
1855 |
27 Jan 06 |
nicklas |
45 |
import="net.sf.basedb.core.ItemQuery" |
1855 |
27 Jan 06 |
nicklas |
46 |
import="net.sf.basedb.core.ItemResultList" |
6784 |
18 Mar 15 |
nicklas |
47 |
import="net.sf.basedb.core.Include" |
1855 |
27 Jan 06 |
nicklas |
48 |
import="net.sf.basedb.core.PermissionDeniedException" |
2166 |
19 Apr 06 |
nicklas |
49 |
import="net.sf.basedb.core.query.Orders" |
2166 |
19 Apr 06 |
nicklas |
50 |
import="net.sf.basedb.core.query.Hql" |
6568 |
21 Oct 14 |
nicklas |
51 |
import="net.sf.basedb.core.query.Restrictions" |
6568 |
21 Oct 14 |
nicklas |
52 |
import="net.sf.basedb.core.query.Expressions" |
5123 |
09 Oct 09 |
nicklas |
53 |
import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" |
5123 |
09 Oct 09 |
nicklas |
54 |
import="net.sf.basedb.core.snapshot.AnnotationSnapshot" |
5123 |
09 Oct 09 |
nicklas |
55 |
import="net.sf.basedb.core.snapshot.SnapshotManager" |
8083 |
20 Oct 22 |
nicklas |
56 |
import="net.sf.basedb.core.snapshot.ProjectFilter" |
8083 |
20 Oct 22 |
nicklas |
57 |
import="net.sf.basedb.core.snapshot.AnnotationTypeFilter" |
1855 |
27 Jan 06 |
nicklas |
58 |
import="net.sf.basedb.clients.web.Base" |
1855 |
27 Jan 06 |
nicklas |
59 |
import="net.sf.basedb.clients.web.util.HTML" |
5074 |
24 Aug 09 |
nicklas |
60 |
import="net.sf.basedb.util.NameableComparator" |
7587 |
06 Feb 19 |
nicklas |
61 |
import="net.sf.basedb.util.units.UnitConverter" |
2942 |
22 Nov 06 |
nicklas |
62 |
import="net.sf.basedb.util.formatter.Formatter" |
4544 |
25 Sep 08 |
nicklas |
63 |
import="net.sf.basedb.util.formatter.PrefixSuffixFormatter" |
2942 |
22 Nov 06 |
nicklas |
64 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
2753 |
20 Oct 06 |
nicklas |
65 |
import="net.sf.basedb.util.Values" |
8083 |
20 Oct 22 |
nicklas |
66 |
import="net.sf.basedb.util.filter.Filter" |
8083 |
20 Oct 22 |
nicklas |
67 |
import="net.sf.basedb.util.filter.AllOfFilter" |
8083 |
20 Oct 22 |
nicklas |
68 |
import="java.util.Arrays" |
7587 |
06 Feb 19 |
nicklas |
69 |
import="java.util.Collections" |
5123 |
09 Oct 09 |
nicklas |
70 |
import="java.util.ArrayList" |
1855 |
27 Jan 06 |
nicklas |
71 |
import="java.util.List" |
5074 |
24 Aug 09 |
nicklas |
72 |
import="java.util.Set" |
5074 |
24 Aug 09 |
nicklas |
73 |
import="java.util.HashSet" |
5074 |
24 Aug 09 |
nicklas |
74 |
import="java.util.TreeSet" |
5074 |
24 Aug 09 |
nicklas |
75 |
import="java.util.Map" |
5074 |
24 Aug 09 |
nicklas |
76 |
import="java.util.HashMap" |
6922 |
02 Jun 15 |
nicklas |
77 |
import="java.util.Date" |
1855 |
27 Jan 06 |
nicklas |
78 |
%> |
1855 |
27 Jan 06 |
nicklas |
79 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1855 |
27 Jan 06 |
nicklas |
80 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
1855 |
27 Jan 06 |
nicklas |
81 |
|
1855 |
27 Jan 06 |
nicklas |
82 |
<% |
1855 |
27 Jan 06 |
nicklas |
83 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1855 |
27 Jan 06 |
nicklas |
84 |
final String ID = sc.getId(); |
1855 |
27 Jan 06 |
nicklas |
85 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
1855 |
27 Jan 06 |
nicklas |
86 |
final int itemId = Values.getInt(request.getParameter("item_id")); |
1855 |
27 Jan 06 |
nicklas |
87 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
88 |
final DbControl dc = sc.newDbControl(":List annotations"); |
1855 |
27 Jan 06 |
nicklas |
89 |
|
5074 |
24 Aug 09 |
nicklas |
90 |
Set<AnnotationType> annotationTypes = null; |
5074 |
24 Aug 09 |
nicklas |
91 |
Set<AnnotationType> protocolParameters = null; |
5123 |
09 Oct 09 |
nicklas |
92 |
Map<AnnotationType, AnnotationSnapshot> existing = null; |
5074 |
24 Aug 09 |
nicklas |
93 |
|
8083 |
20 Oct 22 |
nicklas |
94 |
boolean hasProjectSpecificAnnotationType = false; |
8083 |
20 Oct 22 |
nicklas |
95 |
AnnotationTypeFilter annotationTypeFilter = null; |
8083 |
20 Oct 22 |
nicklas |
96 |
Filter<AnnotationSnapshot> projectFilter = null; |
8083 |
20 Oct 22 |
nicklas |
97 |
|
1855 |
27 Jan 06 |
nicklas |
98 |
try |
1855 |
27 Jan 06 |
nicklas |
99 |
{ |
3979 |
19 Nov 07 |
nicklas |
100 |
final Annotatable item = (Annotatable)itemType.getById(dc, itemId); |
7213 |
19 Oct 16 |
nicklas |
101 |
final boolean writePermission = item.hasPermission(Permission.RESTRICTED_WRITE); |
5123 |
09 Oct 09 |
nicklas |
102 |
final SnapshotManager manager = new SnapshotManager(); |
5123 |
09 Oct 09 |
nicklas |
103 |
|
3979 |
19 Nov 07 |
nicklas |
104 |
ItemQuery<AnnotationType> annotationTypeQuery = null; |
3979 |
19 Nov 07 |
nicklas |
105 |
String message = null; |
3979 |
19 Nov 07 |
nicklas |
106 |
boolean isProxy = item instanceof AnnotatableProxy; |
3979 |
19 Nov 07 |
nicklas |
107 |
|
5074 |
24 Aug 09 |
nicklas |
108 |
// Load all annotation types that are possible for this item type |
3979 |
19 Nov 07 |
nicklas |
109 |
if (isProxy) |
3979 |
19 Nov 07 |
nicklas |
110 |
{ |
3979 |
19 Nov 07 |
nicklas |
111 |
AnnotatableProxy proxy = (AnnotatableProxy)item; |
3979 |
19 Nov 07 |
nicklas |
112 |
annotationTypeQuery = Base.getAnnotationTypesQuery(proxy); |
3979 |
19 Nov 07 |
nicklas |
113 |
message = proxy.getAnnotationMessage(); |
3979 |
19 Nov 07 |
nicklas |
114 |
} |
3979 |
19 Nov 07 |
nicklas |
115 |
else |
3979 |
19 Nov 07 |
nicklas |
116 |
{ |
3979 |
19 Nov 07 |
nicklas |
117 |
annotationTypeQuery = Base.getAnnotationTypesQuery(itemType, false); |
3979 |
19 Nov 07 |
nicklas |
118 |
} |
7604 |
25 Feb 19 |
nicklas |
119 |
annotationTypes = new TreeSet<AnnotationType>(new NameableComparator<>(false)); |
5074 |
24 Aug 09 |
nicklas |
120 |
annotationTypes.addAll(annotationTypeQuery.list(dc)); |
2166 |
19 Apr 06 |
nicklas |
121 |
|
5123 |
09 Oct 09 |
nicklas |
122 |
final AnnotationSetSnapshot snapshot = item.isAnnotated() ? |
5123 |
09 Oct 09 |
nicklas |
123 |
manager.getSnapshot(dc, item.getAnnotationSet().getId()) : null; |
5123 |
09 Oct 09 |
nicklas |
124 |
List<AnnotationSnapshot> inheritedAnnotations = null; |
5123 |
09 Oct 09 |
nicklas |
125 |
if (snapshot != null) |
2166 |
19 Apr 06 |
nicklas |
126 |
{ |
5123 |
09 Oct 09 |
nicklas |
127 |
// Load the existing primary and inherited annotations |
5123 |
09 Oct 09 |
nicklas |
128 |
existing = new HashMap<AnnotationType, AnnotationSnapshot>(); |
5123 |
09 Oct 09 |
nicklas |
129 |
inheritedAnnotations = new ArrayList<AnnotationSnapshot>(); |
5123 |
09 Oct 09 |
nicklas |
130 |
for (AnnotationSnapshot a : manager.findAnnotations(dc, snapshot, null, true)) |
5074 |
24 Aug 09 |
nicklas |
131 |
{ |
6037 |
29 Mar 12 |
nicklas |
132 |
AnnotationType at = a.getAnnotationType(dc); |
6937 |
07 Aug 15 |
nicklas |
133 |
if (a.getSource() == Annotation.Source.PRIMARY) |
5074 |
24 Aug 09 |
nicklas |
134 |
{ |
6037 |
29 Mar 12 |
nicklas |
135 |
existing.put(a.getAnnotationType(dc), a); |
8083 |
20 Oct 22 |
nicklas |
136 |
hasProjectSpecificAnnotationType |= at.getProjectAnnotations(); |
5074 |
24 Aug 09 |
nicklas |
137 |
} |
6037 |
29 Mar 12 |
nicklas |
138 |
else |
6037 |
29 Mar 12 |
nicklas |
139 |
{ |
6037 |
29 Mar 12 |
nicklas |
140 |
inheritedAnnotations.add(a); |
6037 |
29 Mar 12 |
nicklas |
141 |
} |
5074 |
24 Aug 09 |
nicklas |
142 |
} |
6922 |
02 Jun 15 |
nicklas |
143 |
Collections.sort(inheritedAnnotations, AnnotationSnapshot.sortByAnnotationType(dc)); |
5074 |
24 Aug 09 |
nicklas |
144 |
annotationTypes.addAll(existing.keySet()); |
2166 |
19 Apr 06 |
nicklas |
145 |
} |
5074 |
24 Aug 09 |
nicklas |
146 |
|
8083 |
20 Oct 22 |
nicklas |
147 |
if (hasProjectSpecificAnnotationType) |
8083 |
20 Oct 22 |
nicklas |
148 |
{ |
8083 |
20 Oct 22 |
nicklas |
149 |
manager.setAllProjects(); |
8083 |
20 Oct 22 |
nicklas |
150 |
annotationTypeFilter = new AnnotationTypeFilter(); |
8083 |
20 Oct 22 |
nicklas |
151 |
projectFilter = new AllOfFilter<>(Arrays.asList(annotationTypeFilter, new ProjectFilter(dc))); |
8083 |
20 Oct 22 |
nicklas |
152 |
} |
8083 |
20 Oct 22 |
nicklas |
153 |
|
5074 |
24 Aug 09 |
nicklas |
154 |
// Load the possible protocol parameters |
5074 |
24 Aug 09 |
nicklas |
155 |
Protocol protocol = null; |
5074 |
24 Aug 09 |
nicklas |
156 |
boolean readProtocol = true; |
5074 |
24 Aug 09 |
nicklas |
157 |
try |
5074 |
24 Aug 09 |
nicklas |
158 |
{ |
5074 |
24 Aug 09 |
nicklas |
159 |
protocol = item.getProtocol(); |
5074 |
24 Aug 09 |
nicklas |
160 |
} |
5074 |
24 Aug 09 |
nicklas |
161 |
catch (PermissionDeniedException ex) |
5074 |
24 Aug 09 |
nicklas |
162 |
{ |
5074 |
24 Aug 09 |
nicklas |
163 |
readProtocol = false; |
5074 |
24 Aug 09 |
nicklas |
164 |
} |
5074 |
24 Aug 09 |
nicklas |
165 |
ItemQuery<AnnotationType> parameterQuery = Base.getProtocolParametersQuery(protocol); |
5074 |
24 Aug 09 |
nicklas |
166 |
if (parameterQuery != null) |
5074 |
24 Aug 09 |
nicklas |
167 |
{ |
5074 |
24 Aug 09 |
nicklas |
168 |
protocolParameters = new HashSet<AnnotationType>(parameterQuery.list(dc)); |
5074 |
24 Aug 09 |
nicklas |
169 |
annotationTypes.removeAll(protocolParameters); |
5074 |
24 Aug 09 |
nicklas |
170 |
} |
8083 |
20 Oct 22 |
nicklas |
171 |
|
6568 |
21 Oct 14 |
nicklas |
172 |
// Load the current subtype |
6568 |
21 Oct 14 |
nicklas |
173 |
// NOTE! User may have selected a different subtype in the form than what is |
6568 |
21 Oct 14 |
nicklas |
174 |
// currently saved so if a subtype_id is sent in the request we use that |
6568 |
21 Oct 14 |
nicklas |
175 |
String selectedCategoryName = null; |
6568 |
21 Oct 14 |
nicklas |
176 |
try |
6568 |
21 Oct 14 |
nicklas |
177 |
{ |
6568 |
21 Oct 14 |
nicklas |
178 |
ItemSubtype subtype = null; |
6568 |
21 Oct 14 |
nicklas |
179 |
if (item instanceof Subtypable) |
6568 |
21 Oct 14 |
nicklas |
180 |
{ |
6568 |
21 Oct 14 |
nicklas |
181 |
subtype = ((Subtypable)item).getItemSubtype(); |
6568 |
21 Oct 14 |
nicklas |
182 |
} |
6568 |
21 Oct 14 |
nicklas |
183 |
else if (item instanceof BioPlate) |
6568 |
21 Oct 14 |
nicklas |
184 |
{ |
6568 |
21 Oct 14 |
nicklas |
185 |
BioPlateType bpt = ((BioPlate)item).getBioPlateType(); |
6568 |
21 Oct 14 |
nicklas |
186 |
subtype = bpt.getItemSubtype(); |
6568 |
21 Oct 14 |
nicklas |
187 |
if (subtype == null) selectedCategoryName = bpt.getName(); |
6568 |
21 Oct 14 |
nicklas |
188 |
} |
7587 |
06 Feb 19 |
nicklas |
189 |
else if (item instanceof RawBioAssay) |
7587 |
06 Feb 19 |
nicklas |
190 |
{ |
7587 |
06 Feb 19 |
nicklas |
191 |
RawDataType rdt = ((RawBioAssay)item).getRawDataType(); |
7587 |
06 Feb 19 |
nicklas |
192 |
selectedCategoryName = rdt.getName(); |
7587 |
06 Feb 19 |
nicklas |
193 |
} |
6568 |
21 Oct 14 |
nicklas |
194 |
if (subtype != null) selectedCategoryName = subtype.getName(); |
6568 |
21 Oct 14 |
nicklas |
195 |
} |
6568 |
21 Oct 14 |
nicklas |
196 |
catch (PermissionDeniedException ex) |
6568 |
21 Oct 14 |
nicklas |
197 |
{} |
6568 |
21 Oct 14 |
nicklas |
198 |
Set<AnnotationType> annotationTypesInCategory = new HashSet<AnnotationType>(); |
6568 |
21 Oct 14 |
nicklas |
199 |
if (selectedCategoryName != null) |
6568 |
21 Oct 14 |
nicklas |
200 |
{ |
6568 |
21 Oct 14 |
nicklas |
201 |
ItemQuery<AnnotationType> query = AnnotationType.getQuery(item.getType()); |
6784 |
18 Mar 15 |
nicklas |
202 |
query.setIncludes(Include.ALL); |
6568 |
21 Oct 14 |
nicklas |
203 |
query.join(Hql.innerJoin("categories", "ct")); |
6568 |
21 Oct 14 |
nicklas |
204 |
query.restrict(Restrictions.eq(Hql.property("ct", "name"), Expressions.string(selectedCategoryName))); |
6568 |
21 Oct 14 |
nicklas |
205 |
annotationTypesInCategory.addAll(query.list(dc)); |
6568 |
21 Oct 14 |
nicklas |
206 |
} |
6922 |
02 Jun 15 |
nicklas |
207 |
Formatter<Date> dateTimeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
8083 |
20 Oct 22 |
nicklas |
208 |
String projectValuesTitle = "<div class=\"project-values\"><div>Project values</div><div></div><div></div><div class=\"last-modified\">Last modified</div></div>"; |
5074 |
24 Aug 09 |
nicklas |
209 |
%> |
6255 |
22 Mar 13 |
nicklas |
210 |
<base:page type="iframe" id="list-annotations"> |
6568 |
21 Oct 14 |
nicklas |
211 |
<base:head scripts="~list.js" styles="table.css"> |
6568 |
21 Oct 14 |
nicklas |
212 |
<style> |
6568 |
21 Oct 14 |
nicklas |
213 |
#annotations-data.all |
6568 |
21 Oct 14 |
nicklas |
214 |
{} |
6568 |
21 Oct 14 |
nicklas |
215 |
|
6568 |
21 Oct 14 |
nicklas |
216 |
#annotations-data.values .novalues |
6568 |
21 Oct 14 |
nicklas |
217 |
{ |
6568 |
21 Oct 14 |
nicklas |
218 |
display: none; |
6568 |
21 Oct 14 |
nicklas |
219 |
} |
6568 |
21 Oct 14 |
nicklas |
220 |
|
6568 |
21 Oct 14 |
nicklas |
221 |
#annotations-data.category .nocategory |
6568 |
21 Oct 14 |
nicklas |
222 |
{ |
6568 |
21 Oct 14 |
nicklas |
223 |
display: none; |
6568 |
21 Oct 14 |
nicklas |
224 |
} |
6938 |
19 Aug 15 |
nicklas |
225 |
|
6939 |
21 Aug 15 |
nicklas |
226 |
.edit-annotation |
6938 |
19 Aug 15 |
nicklas |
227 |
{ |
6939 |
21 Aug 15 |
nicklas |
228 |
float: right; |
6938 |
19 Aug 15 |
nicklas |
229 |
} |
8083 |
20 Oct 22 |
nicklas |
230 |
|
8083 |
20 Oct 22 |
nicklas |
231 |
.project-values |
8083 |
20 Oct 22 |
nicklas |
232 |
{ |
8083 |
20 Oct 22 |
nicklas |
233 |
display: grid; |
8083 |
20 Oct 22 |
nicklas |
234 |
grid-template-columns: 1fr 1fr 18px 12em; |
8083 |
20 Oct 22 |
nicklas |
235 |
} |
8083 |
20 Oct 22 |
nicklas |
236 |
|
8083 |
20 Oct 22 |
nicklas |
237 |
.project-values div |
8083 |
20 Oct 22 |
nicklas |
238 |
{ |
8083 |
20 Oct 22 |
nicklas |
239 |
padding: 1px 2px; |
8083 |
20 Oct 22 |
nicklas |
240 |
border-bottom-width: 1px; |
8083 |
20 Oct 22 |
nicklas |
241 |
border-bottom-style: dotted; |
8083 |
20 Oct 22 |
nicklas |
242 |
} |
8083 |
20 Oct 22 |
nicklas |
243 |
|
8083 |
20 Oct 22 |
nicklas |
244 |
/* Remove borders on last row */ |
8083 |
20 Oct 22 |
nicklas |
245 |
.project-values div:nth-last-child(-n+4) |
8083 |
20 Oct 22 |
nicklas |
246 |
{ |
8083 |
20 Oct 22 |
nicklas |
247 |
border-bottom-width: 0; |
8083 |
20 Oct 22 |
nicklas |
248 |
} |
8083 |
20 Oct 22 |
nicklas |
249 |
|
8083 |
20 Oct 22 |
nicklas |
250 |
.project-values .default-value |
8083 |
20 Oct 22 |
nicklas |
251 |
{ |
8083 |
20 Oct 22 |
nicklas |
252 |
font-style: italic; |
8083 |
20 Oct 22 |
nicklas |
253 |
} |
8083 |
20 Oct 22 |
nicklas |
254 |
|
8083 |
20 Oct 22 |
nicklas |
255 |
.project-values .current-value::before |
8083 |
20 Oct 22 |
nicklas |
256 |
{ |
8083 |
20 Oct 22 |
nicklas |
257 |
font-weight: bold; |
8083 |
20 Oct 22 |
nicklas |
258 |
content: '›'; |
8083 |
20 Oct 22 |
nicklas |
259 |
margin-right: 2px; |
8083 |
20 Oct 22 |
nicklas |
260 |
} |
8083 |
20 Oct 22 |
nicklas |
261 |
|
8083 |
20 Oct 22 |
nicklas |
262 |
.project-values .other-value::before |
8083 |
20 Oct 22 |
nicklas |
263 |
{ |
8083 |
20 Oct 22 |
nicklas |
264 |
font-weight: bold; |
8083 |
20 Oct 22 |
nicklas |
265 |
content: '›'; |
8083 |
20 Oct 22 |
nicklas |
266 |
color: transparent; |
8083 |
20 Oct 22 |
nicklas |
267 |
margin-right: 2px; |
8083 |
20 Oct 22 |
nicklas |
268 |
} |
8083 |
20 Oct 22 |
nicklas |
269 |
|
8083 |
20 Oct 22 |
nicklas |
270 |
/* Span accross first 2 columns */ |
8083 |
20 Oct 22 |
nicklas |
271 |
.project-values .no-default |
8083 |
20 Oct 22 |
nicklas |
272 |
{ |
8083 |
20 Oct 22 |
nicklas |
273 |
font-style: italic; |
8083 |
20 Oct 22 |
nicklas |
274 |
grid-column-start: 1; |
8083 |
20 Oct 22 |
nicklas |
275 |
grid-column-end: 3; |
8083 |
20 Oct 22 |
nicklas |
276 |
} |
8083 |
20 Oct 22 |
nicklas |
277 |
|
8083 |
20 Oct 22 |
nicklas |
278 |
.last-modified |
8083 |
20 Oct 22 |
nicklas |
279 |
{ |
8083 |
20 Oct 22 |
nicklas |
280 |
white-space: nowrap; |
8083 |
20 Oct 22 |
nicklas |
281 |
border-left-width: 1px; |
8083 |
20 Oct 22 |
nicklas |
282 |
border-left-style: dotted; |
8083 |
20 Oct 22 |
nicklas |
283 |
} |
6568 |
21 Oct 14 |
nicklas |
284 |
</style> |
6568 |
21 Oct 14 |
nicklas |
285 |
</base:head> |
1855 |
27 Jan 06 |
nicklas |
286 |
<base:body> |
5935 |
26 Jan 12 |
nicklas |
287 |
<% |
5935 |
26 Jan 12 |
nicklas |
288 |
if (message != null) |
5935 |
26 Jan 12 |
nicklas |
289 |
{ |
5935 |
26 Jan 12 |
nicklas |
290 |
%> |
5935 |
26 Jan 12 |
nicklas |
291 |
<div class="messagecontainer note"><%=message%></div> |
1855 |
27 Jan 06 |
nicklas |
292 |
<% |
5935 |
26 Jan 12 |
nicklas |
293 |
} |
5935 |
26 Jan 12 |
nicklas |
294 |
%> |
5935 |
26 Jan 12 |
nicklas |
295 |
<base:section |
5935 |
26 Jan 12 |
nicklas |
296 |
id="primaryAnnotations" |
5935 |
26 Jan 12 |
nicklas |
297 |
title="<%="Primary annotations (" + annotationTypes.size() + ")"%>" |
5935 |
26 Jan 12 |
nicklas |
298 |
> |
5935 |
26 Jan 12 |
nicklas |
299 |
<% |
6568 |
21 Oct 14 |
nicklas |
300 |
int allWithValues = 0; |
6568 |
21 Oct 14 |
nicklas |
301 |
int allOfCategory = 0; |
1855 |
27 Jan 06 |
nicklas |
302 |
if (annotationTypes.size() == 0) |
1855 |
27 Jan 06 |
nicklas |
303 |
{ |
1855 |
27 Jan 06 |
nicklas |
304 |
%> |
5935 |
26 Jan 12 |
nicklas |
305 |
<div class="messagecontainer note"> |
2166 |
19 Apr 06 |
nicklas |
306 |
No annotation types has been defined for this type of item |
2166 |
19 Apr 06 |
nicklas |
307 |
(or you don't have permission to view them). |
5935 |
26 Jan 12 |
nicklas |
308 |
</div> |
1855 |
27 Jan 06 |
nicklas |
309 |
<% |
1855 |
27 Jan 06 |
nicklas |
310 |
} |
1855 |
27 Jan 06 |
nicklas |
311 |
else |
1855 |
27 Jan 06 |
nicklas |
312 |
{ |
1855 |
27 Jan 06 |
nicklas |
313 |
%> |
5935 |
26 Jan 12 |
nicklas |
314 |
<tbl:table |
5935 |
26 Jan 12 |
nicklas |
315 |
id="annotations" |
5935 |
26 Jan 12 |
nicklas |
316 |
columns="all" |
7943 |
04 May 21 |
nicklas |
317 |
stickyheaders="<%=null%>" |
1855 |
27 Jan 06 |
nicklas |
318 |
> |
5935 |
26 Jan 12 |
nicklas |
319 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
320 |
id="annotation" |
5935 |
26 Jan 12 |
nicklas |
321 |
title="Annotation" |
5935 |
26 Jan 12 |
nicklas |
322 |
/> |
5935 |
26 Jan 12 |
nicklas |
323 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
324 |
id="values" |
8083 |
20 Oct 22 |
nicklas |
325 |
title="<%=hasProjectSpecificAnnotationType ? "Current values" : "Values" %>" |
5935 |
26 Jan 12 |
nicklas |
326 |
/> |
6922 |
02 Jun 15 |
nicklas |
327 |
<tbl:columndef |
8083 |
20 Oct 22 |
nicklas |
328 |
id="projectValues" |
8083 |
20 Oct 22 |
nicklas |
329 |
title="<%=projectValuesTitle%>" |
8083 |
20 Oct 22 |
nicklas |
330 |
tooltip="Project values" |
8083 |
20 Oct 22 |
nicklas |
331 |
show="<%=hasProjectSpecificAnnotationType ? "always" : "never" %>" |
8083 |
20 Oct 22 |
nicklas |
332 |
style="padding: 0;" |
7334 |
11 Apr 17 |
nicklas |
333 |
/> |
7334 |
11 Apr 17 |
nicklas |
334 |
<tbl:columndef |
6922 |
02 Jun 15 |
nicklas |
335 |
id="lastModified" |
6922 |
02 Jun 15 |
nicklas |
336 |
title="Last modified" |
6922 |
02 Jun 15 |
nicklas |
337 |
formatter="<%=dateTimeFormatter%>" |
8083 |
20 Oct 22 |
nicklas |
338 |
show="<%=hasProjectSpecificAnnotationType ? "never" : "always" %>" |
6922 |
02 Jun 15 |
nicklas |
339 |
/> |
5935 |
26 Jan 12 |
nicklas |
340 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
341 |
id="description" |
5935 |
26 Jan 12 |
nicklas |
342 |
title="Description" |
5935 |
26 Jan 12 |
nicklas |
343 |
/> |
6568 |
21 Oct 14 |
nicklas |
344 |
<tbl:data id="annotations-data"> |
5935 |
26 Jan 12 |
nicklas |
345 |
<tbl:headers> |
5935 |
26 Jan 12 |
nicklas |
346 |
<tbl:headerrow> |
7943 |
04 May 21 |
nicklas |
347 |
<tbl:header colspan="5" subclass="bottomborder" style="padding: 5px;"> |
7943 |
04 May 21 |
nicklas |
348 |
<b>View:</b> |
7943 |
04 May 21 |
nicklas |
349 |
<% |
7943 |
04 May 21 |
nicklas |
350 |
if (selectedCategoryName != null) |
7943 |
04 May 21 |
nicklas |
351 |
{ |
7943 |
04 May 21 |
nicklas |
352 |
%> |
7943 |
04 May 21 |
nicklas |
353 |
<label><input type="radio" name="view" id="view_category" value="category" checked>All of <i><%=HTML.encodeTags(selectedCategoryName)%></i> category</label> (<span id="allOfCategory">?</span>) |
7943 |
04 May 21 |
nicklas |
354 |
<% |
7943 |
04 May 21 |
nicklas |
355 |
} |
7943 |
04 May 21 |
nicklas |
356 |
%> |
7943 |
04 May 21 |
nicklas |
357 |
<label><input type="radio" name="view" id="view_values" value="values" <%=selectedCategoryName == null ? "checked" : ""%>>All with values</label> (<span id="allWithValues">?</span>) |
7943 |
04 May 21 |
nicklas |
358 |
<label><input type="radio" name="view" id="view_all" value="all">All annotations</label> (<%=annotationTypes.size()%>) |
7943 |
04 May 21 |
nicklas |
359 |
</tbl:header> |
7943 |
04 May 21 |
nicklas |
360 |
</tbl:headerrow> |
7943 |
04 May 21 |
nicklas |
361 |
<tbl:headerrow> |
5935 |
26 Jan 12 |
nicklas |
362 |
<tbl:columnheaders /> |
5935 |
26 Jan 12 |
nicklas |
363 |
</tbl:headerrow> |
5935 |
26 Jan 12 |
nicklas |
364 |
</tbl:headers> |
5935 |
26 Jan 12 |
nicklas |
365 |
<tbl:rows> |
5935 |
26 Jan 12 |
nicklas |
366 |
<% |
5935 |
26 Jan 12 |
nicklas |
367 |
for (AnnotationType at : annotationTypes) |
5935 |
26 Jan 12 |
nicklas |
368 |
{ |
7206 |
19 Oct 16 |
nicklas |
369 |
// Permission for creating a new annotation |
7206 |
19 Oct 16 |
nicklas |
370 |
boolean annotatePermission = writePermission & at.hasPermission(Permission.USE); |
5935 |
26 Jan 12 |
nicklas |
371 |
AnnotationSnapshot a = existing != null ? existing.get(at) : null; |
5935 |
26 Jan 12 |
nicklas |
372 |
List<?> values = null; |
7605 |
26 Feb 19 |
nicklas |
373 |
Formatter<Object> formatter = null; |
7334 |
11 Apr 17 |
nicklas |
374 |
boolean projectSpecific = false; |
5935 |
26 Jan 12 |
nicklas |
375 |
if (a != null) |
5935 |
26 Jan 12 |
nicklas |
376 |
{ |
6939 |
21 Aug 15 |
nicklas |
377 |
Annotation ann = a.getThisAnnotation(dc); |
7206 |
19 Oct 16 |
nicklas |
378 |
// Permission on this annotation |
7206 |
19 Oct 16 |
nicklas |
379 |
annotatePermission = ann.hasPermission(Permission.WRITE); |
6939 |
21 Aug 15 |
nicklas |
380 |
values = a.getActualValues(ann.getUnitConverter(null), ann.getValueType()); |
5935 |
26 Jan 12 |
nicklas |
381 |
formatter = FormatterFactory.getAnnotationFormatter(sc, ann, null); |
7334 |
11 Apr 17 |
nicklas |
382 |
projectSpecific = a.getProjectId() != 0; |
5935 |
26 Jan 12 |
nicklas |
383 |
} |
5935 |
26 Jan 12 |
nicklas |
384 |
if (values != null || !at.isRemoved()) |
5935 |
26 Jan 12 |
nicklas |
385 |
{ |
6568 |
21 Oct 14 |
nicklas |
386 |
String rowClass = ""; |
8160 |
07 Jun 23 |
nicklas |
387 |
String prefix = ""; |
8160 |
07 Jun 23 |
nicklas |
388 |
String sep = ", "; |
8160 |
07 Jun 23 |
nicklas |
389 |
String suffix = ""; |
6568 |
21 Oct 14 |
nicklas |
390 |
if (values == null || values.size() == 0) |
6568 |
21 Oct 14 |
nicklas |
391 |
{ |
6568 |
21 Oct 14 |
nicklas |
392 |
rowClass += " novalues"; |
6568 |
21 Oct 14 |
nicklas |
393 |
} |
6568 |
21 Oct 14 |
nicklas |
394 |
else |
6568 |
21 Oct 14 |
nicklas |
395 |
{ |
8160 |
07 Jun 23 |
nicklas |
396 |
// Multi-valued text annotation that is not an enum is displayed as a bullet list |
8160 |
07 Jun 23 |
nicklas |
397 |
if (values.size() > 1 && at.getValueType().isText() && !at.isEnumeration()) |
8160 |
07 Jun 23 |
nicklas |
398 |
{ |
8160 |
07 Jun 23 |
nicklas |
399 |
prefix = "<ul class=\"bullet-list\"><li>"; |
8160 |
07 Jun 23 |
nicklas |
400 |
sep = "<li>"; |
8160 |
07 Jun 23 |
nicklas |
401 |
suffix = "</ul>"; |
8160 |
07 Jun 23 |
nicklas |
402 |
} |
6568 |
21 Oct 14 |
nicklas |
403 |
allWithValues++; |
6568 |
21 Oct 14 |
nicklas |
404 |
} |
6568 |
21 Oct 14 |
nicklas |
405 |
if (!annotationTypesInCategory.contains(at)) |
6568 |
21 Oct 14 |
nicklas |
406 |
{ |
6568 |
21 Oct 14 |
nicklas |
407 |
rowClass += " nocategory"; |
6568 |
21 Oct 14 |
nicklas |
408 |
} |
6568 |
21 Oct 14 |
nicklas |
409 |
else |
6568 |
21 Oct 14 |
nicklas |
410 |
{ |
6568 |
21 Oct 14 |
nicklas |
411 |
allOfCategory++; |
6568 |
21 Oct 14 |
nicklas |
412 |
} |
6568 |
21 Oct 14 |
nicklas |
413 |
%> |
6568 |
21 Oct 14 |
nicklas |
414 |
<tbl:row subclass="<%=rowClass%>"> |
5935 |
26 Jan 12 |
nicklas |
415 |
<tbl:cell column="annotation"><base:icon |
5946 |
03 Feb 12 |
nicklas |
416 |
image="deleted.png" |
5935 |
26 Jan 12 |
nicklas |
417 |
tooltip="This item has been scheduled for deletion" |
5935 |
26 Jan 12 |
nicklas |
418 |
visible="<%=at.isRemoved()%>" |
6939 |
21 Aug 15 |
nicklas |
419 |
/><%=Base.getLinkedName(ID, at, false, true)%></tbl:cell> |
8083 |
20 Oct 22 |
nicklas |
420 |
<tbl:cell column="values" clazz="<%=projectSpecific ? "cell ps-annotation" : "cell" %>" disableOverflowCheck="true"> |
8083 |
20 Oct 22 |
nicklas |
421 |
<base:icon image="<%=a==null?"edit_create.png":"edit.png" %>" subclass="edit-annotation auto-init link" |
6939 |
21 Aug 15 |
nicklas |
422 |
data-auto-init="edit-annotation" |
6939 |
21 Aug 15 |
nicklas |
423 |
data-annotation="<%=a!=null ? a.getThisAnnotationId() : 0 %>" |
6939 |
21 Aug 15 |
nicklas |
424 |
data-annotation-type="<%=at.getId()%>" |
6939 |
21 Aug 15 |
nicklas |
425 |
data-item-type="<%=itemType.name()%>" |
6939 |
21 Aug 15 |
nicklas |
426 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
427 |
tooltip="<%=a==null?"Create this annotation":"Modify the values of this annotation"%>" |
7206 |
19 Oct 16 |
nicklas |
428 |
visible="<%=annotatePermission %>" |
6939 |
21 Aug 15 |
nicklas |
429 |
/> |
8160 |
07 Jun 23 |
nicklas |
430 |
<%=values == null || values.size() == 0 ? "<i>- no values -</i>" : prefix+Values.getString(values, sep, true, formatter)+suffix%> |
5935 |
26 Jan 12 |
nicklas |
431 |
</tbl:cell> |
8083 |
20 Oct 22 |
nicklas |
432 |
<tbl:cell column="projectValues" disableOverflowCheck="true" style="padding:0;"> |
8083 |
20 Oct 22 |
nicklas |
433 |
<div class="project-values"> |
7334 |
11 Apr 17 |
nicklas |
434 |
<% |
8083 |
20 Oct 22 |
nicklas |
435 |
if (at.getProjectAnnotations()) |
7334 |
11 Apr 17 |
nicklas |
436 |
{ |
8083 |
20 Oct 22 |
nicklas |
437 |
annotationTypeFilter.setAnnotationType(at); |
8083 |
20 Oct 22 |
nicklas |
438 |
List<AnnotationSnapshot> projectValues = manager.findAnnotations(dc, snapshot, projectFilter, false); |
8083 |
20 Oct 22 |
nicklas |
439 |
projectValues.sort(AnnotationSnapshot.sortByProject(dc, true)); |
8083 |
20 Oct 22 |
nicklas |
440 |
int numValues = projectValues.size(); |
8083 |
20 Oct 22 |
nicklas |
441 |
if (numValues == 0 || projectValues.get(0).getProjectId() != 0) |
8083 |
20 Oct 22 |
nicklas |
442 |
{ |
8083 |
20 Oct 22 |
nicklas |
443 |
%> |
8083 |
20 Oct 22 |
nicklas |
444 |
<div class="no-default"><%=numValues > 0 ? "No default value":""%></div> |
8083 |
20 Oct 22 |
nicklas |
445 |
<div><base:icon image="edit_create.png" subclass="edit-annotation auto-init link" |
8083 |
20 Oct 22 |
nicklas |
446 |
data-auto-init="edit-annotation" |
8083 |
20 Oct 22 |
nicklas |
447 |
data-annotation="0" |
8083 |
20 Oct 22 |
nicklas |
448 |
data-annotation-type="<%=at.getId()%>" |
8083 |
20 Oct 22 |
nicklas |
449 |
data-project="0" |
8083 |
20 Oct 22 |
nicklas |
450 |
data-item-type="<%=itemType.name()%>" |
8083 |
20 Oct 22 |
nicklas |
451 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
452 |
tooltip="Create a default value" |
8083 |
20 Oct 22 |
nicklas |
453 |
visible="<%=annotatePermission %>" |
8083 |
20 Oct 22 |
nicklas |
454 |
/></div> |
8083 |
20 Oct 22 |
nicklas |
455 |
<div class="last-modified"></div> |
8083 |
20 Oct 22 |
nicklas |
456 |
<% |
8083 |
20 Oct 22 |
nicklas |
457 |
} |
8083 |
20 Oct 22 |
nicklas |
458 |
if (numValues > 0) |
8083 |
20 Oct 22 |
nicklas |
459 |
{ |
8083 |
20 Oct 22 |
nicklas |
460 |
for (AnnotationSnapshot pv : projectValues) |
8083 |
20 Oct 22 |
nicklas |
461 |
{ |
8083 |
20 Oct 22 |
nicklas |
462 |
boolean isDefault = pv.getProjectId() == 0; |
8083 |
20 Oct 22 |
nicklas |
463 |
boolean isCurrent = pv == a; |
8083 |
20 Oct 22 |
nicklas |
464 |
Annotation ann = pv.getThisAnnotation(dc); |
8083 |
20 Oct 22 |
nicklas |
465 |
values = pv.getActualValues(ann.getUnitConverter(null), ann.getValueType()); |
8083 |
20 Oct 22 |
nicklas |
466 |
formatter = FormatterFactory.getAnnotationFormatter(sc, ann, null); |
8083 |
20 Oct 22 |
nicklas |
467 |
if (numValues > 1) |
8083 |
20 Oct 22 |
nicklas |
468 |
{ |
8083 |
20 Oct 22 |
nicklas |
469 |
%> |
8083 |
20 Oct 22 |
nicklas |
470 |
<div class="<%=isCurrent?"current-value":"other-value"%><%=isDefault ? " default-value":""%>"><%=isDefault ? "Default" : pv.getProject(dc).getName() %></div> |
8083 |
20 Oct 22 |
nicklas |
471 |
<div><%=Values.getString(values, ", ", true, formatter) %></div> |
8083 |
20 Oct 22 |
nicklas |
472 |
<% |
8083 |
20 Oct 22 |
nicklas |
473 |
} |
8083 |
20 Oct 22 |
nicklas |
474 |
else |
8083 |
20 Oct 22 |
nicklas |
475 |
{ |
8083 |
20 Oct 22 |
nicklas |
476 |
%> |
8083 |
20 Oct 22 |
nicklas |
477 |
<div></div><div></div> |
8083 |
20 Oct 22 |
nicklas |
478 |
<% |
8083 |
20 Oct 22 |
nicklas |
479 |
} |
8083 |
20 Oct 22 |
nicklas |
480 |
%> |
8083 |
20 Oct 22 |
nicklas |
481 |
<div><base:icon image="edit.png" subclass="edit-annotation auto-init link" |
8083 |
20 Oct 22 |
nicklas |
482 |
data-auto-init="edit-annotation" |
8083 |
20 Oct 22 |
nicklas |
483 |
data-annotation="<%=pv.getThisAnnotationId()%>" |
8083 |
20 Oct 22 |
nicklas |
484 |
data-annotation-type="<%=at.getId()%>" |
8083 |
20 Oct 22 |
nicklas |
485 |
data-project="<%=pv.getProjectId()%>" |
8083 |
20 Oct 22 |
nicklas |
486 |
data-item-type="<%=itemType.name()%>" |
8083 |
20 Oct 22 |
nicklas |
487 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
488 |
tooltip="<%=isDefault ? "Modify the default value" : "Modify the value in this project"%>" |
8083 |
20 Oct 22 |
nicklas |
489 |
visible="<%=annotatePermission %>" |
8083 |
20 Oct 22 |
nicklas |
490 |
/></div> |
8083 |
20 Oct 22 |
nicklas |
491 |
<div class="last-modified"><%=dateTimeFormatter.format(pv.getThisLastUpdate())%></div> |
8083 |
20 Oct 22 |
nicklas |
492 |
<% |
8083 |
20 Oct 22 |
nicklas |
493 |
} |
8083 |
20 Oct 22 |
nicklas |
494 |
} |
8083 |
20 Oct 22 |
nicklas |
495 |
} |
8083 |
20 Oct 22 |
nicklas |
496 |
else if (a != null) |
8083 |
20 Oct 22 |
nicklas |
497 |
{ |
7334 |
11 Apr 17 |
nicklas |
498 |
%> |
8083 |
20 Oct 22 |
nicklas |
499 |
<div></div><div></div><div></div> |
8083 |
20 Oct 22 |
nicklas |
500 |
<div class="last-modified"><%=dateTimeFormatter.format(a.getThisLastUpdate())%></div> |
7334 |
11 Apr 17 |
nicklas |
501 |
<% |
7334 |
11 Apr 17 |
nicklas |
502 |
} |
7334 |
11 Apr 17 |
nicklas |
503 |
%> |
8083 |
20 Oct 22 |
nicklas |
504 |
</div> |
7334 |
11 Apr 17 |
nicklas |
505 |
</tbl:cell> |
6922 |
02 Jun 15 |
nicklas |
506 |
<tbl:cell column="lastModified" value="<%=a == null ? null : a.getThisLastUpdate() %>" /> |
5935 |
26 Jan 12 |
nicklas |
507 |
<tbl:cell column="description"><%=HTML.encodeTags(at.getDescription())%></tbl:cell> |
5935 |
26 Jan 12 |
nicklas |
508 |
</tbl:row> |
5935 |
26 Jan 12 |
nicklas |
509 |
<% |
5935 |
26 Jan 12 |
nicklas |
510 |
} |
5935 |
26 Jan 12 |
nicklas |
511 |
} |
5935 |
26 Jan 12 |
nicklas |
512 |
%> |
5935 |
26 Jan 12 |
nicklas |
513 |
</tbl:rows> |
5935 |
26 Jan 12 |
nicklas |
514 |
</tbl:data> |
5935 |
26 Jan 12 |
nicklas |
515 |
</tbl:table> |
5935 |
26 Jan 12 |
nicklas |
516 |
<% |
5935 |
26 Jan 12 |
nicklas |
517 |
} |
5935 |
26 Jan 12 |
nicklas |
518 |
%> |
6568 |
21 Oct 14 |
nicklas |
519 |
<div id="annotations-stat" class="datacontainer" |
6568 |
21 Oct 14 |
nicklas |
520 |
data-all-with-values="<%=allWithValues %>" |
6568 |
21 Oct 14 |
nicklas |
521 |
data-all-of-category="<%=allOfCategory%>" |
6568 |
21 Oct 14 |
nicklas |
522 |
></div> |
5935 |
26 Jan 12 |
nicklas |
523 |
</base:section> |
5935 |
26 Jan 12 |
nicklas |
524 |
|
5935 |
26 Jan 12 |
nicklas |
525 |
<% |
5935 |
26 Jan 12 |
nicklas |
526 |
if (protocolParameters != null) |
5935 |
26 Jan 12 |
nicklas |
527 |
{ |
5935 |
26 Jan 12 |
nicklas |
528 |
%> |
5935 |
26 Jan 12 |
nicklas |
529 |
<base:section |
5935 |
26 Jan 12 |
nicklas |
530 |
id="parameterSection" |
5935 |
26 Jan 12 |
nicklas |
531 |
title="<%="Protocol parameters for " + HTML.encodeTags(protocol.getName()) + |
5935 |
26 Jan 12 |
nicklas |
532 |
" (" + protocolParameters.size() + ")"%>" |
5935 |
26 Jan 12 |
nicklas |
533 |
> |
5935 |
26 Jan 12 |
nicklas |
534 |
<% |
5935 |
26 Jan 12 |
nicklas |
535 |
if (protocolParameters.size() == 0) |
5935 |
26 Jan 12 |
nicklas |
536 |
{ |
5935 |
26 Jan 12 |
nicklas |
537 |
%> |
5935 |
26 Jan 12 |
nicklas |
538 |
<div class="messagecontainer note"> |
5935 |
26 Jan 12 |
nicklas |
539 |
No protocol parameters has been defined for the protocol |
5935 |
26 Jan 12 |
nicklas |
540 |
<%=Base.getLinkedName(ID, protocol, !readProtocol, true)%> |
5935 |
26 Jan 12 |
nicklas |
541 |
(or you don't have permission to view them). |
5935 |
26 Jan 12 |
nicklas |
542 |
</div> |
5935 |
26 Jan 12 |
nicklas |
543 |
<% |
5935 |
26 Jan 12 |
nicklas |
544 |
} |
5935 |
26 Jan 12 |
nicklas |
545 |
else |
5935 |
26 Jan 12 |
nicklas |
546 |
{ |
5935 |
26 Jan 12 |
nicklas |
547 |
%> |
2875 |
08 Nov 06 |
nicklas |
548 |
<tbl:table |
5935 |
26 Jan 12 |
nicklas |
549 |
id="parameters" |
2875 |
08 Nov 06 |
nicklas |
550 |
columns="all" |
2875 |
08 Nov 06 |
nicklas |
551 |
> |
2875 |
08 Nov 06 |
nicklas |
552 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
553 |
id="parameter" |
5935 |
26 Jan 12 |
nicklas |
554 |
title="Parameter" |
2875 |
08 Nov 06 |
nicklas |
555 |
/> |
2875 |
08 Nov 06 |
nicklas |
556 |
<tbl:columndef |
2875 |
08 Nov 06 |
nicklas |
557 |
id="values" |
8083 |
20 Oct 22 |
nicklas |
558 |
title="<%=hasProjectSpecificAnnotationType ? "Current values" : "Values" %>" |
2875 |
08 Nov 06 |
nicklas |
559 |
/> |
6922 |
02 Jun 15 |
nicklas |
560 |
<tbl:columndef |
8083 |
20 Oct 22 |
nicklas |
561 |
id="projectValues" |
8083 |
20 Oct 22 |
nicklas |
562 |
title="<%=projectValuesTitle%>" |
8083 |
20 Oct 22 |
nicklas |
563 |
tooltip="Project values" |
8083 |
20 Oct 22 |
nicklas |
564 |
show="<%=hasProjectSpecificAnnotationType ? "always" : "never" %>" |
8083 |
20 Oct 22 |
nicklas |
565 |
style="padding: 0;" |
7334 |
11 Apr 17 |
nicklas |
566 |
/> |
7334 |
11 Apr 17 |
nicklas |
567 |
<tbl:columndef |
6922 |
02 Jun 15 |
nicklas |
568 |
id="lastModified" |
6922 |
02 Jun 15 |
nicklas |
569 |
title="Last modified" |
6922 |
02 Jun 15 |
nicklas |
570 |
formatter="<%=dateTimeFormatter%>" |
8083 |
20 Oct 22 |
nicklas |
571 |
show="<%=hasProjectSpecificAnnotationType ? "never" : "always" %>" |
6922 |
02 Jun 15 |
nicklas |
572 |
/> |
2875 |
08 Nov 06 |
nicklas |
573 |
<tbl:columndef |
2875 |
08 Nov 06 |
nicklas |
574 |
id="description" |
2875 |
08 Nov 06 |
nicklas |
575 |
title="Description" |
2875 |
08 Nov 06 |
nicklas |
576 |
/> |
2875 |
08 Nov 06 |
nicklas |
577 |
<tbl:data> |
5929 |
18 Jan 12 |
nicklas |
578 |
<tbl:headers> |
5929 |
18 Jan 12 |
nicklas |
579 |
<tbl:headerrow> |
5929 |
18 Jan 12 |
nicklas |
580 |
<tbl:columnheaders /> |
5929 |
18 Jan 12 |
nicklas |
581 |
</tbl:headerrow> |
5929 |
18 Jan 12 |
nicklas |
582 |
</tbl:headers> |
2875 |
08 Nov 06 |
nicklas |
583 |
<tbl:rows> |
2875 |
08 Nov 06 |
nicklas |
584 |
<% |
5935 |
26 Jan 12 |
nicklas |
585 |
for (AnnotationType at : protocolParameters) |
2875 |
08 Nov 06 |
nicklas |
586 |
{ |
7206 |
19 Oct 16 |
nicklas |
587 |
// Permission for creating a new annotation |
7206 |
19 Oct 16 |
nicklas |
588 |
boolean annotatePermission = writePermission & at.hasPermission(Permission.USE); |
5123 |
09 Oct 09 |
nicklas |
589 |
AnnotationSnapshot a = existing != null ? existing.get(at) : null; |
8083 |
20 Oct 22 |
nicklas |
590 |
List<?> values = null; |
7605 |
26 Feb 19 |
nicklas |
591 |
Formatter<Object> formatter = null; |
7334 |
11 Apr 17 |
nicklas |
592 |
boolean projectSpecific = false; |
4544 |
25 Sep 08 |
nicklas |
593 |
if (a != null) |
4544 |
25 Sep 08 |
nicklas |
594 |
{ |
6939 |
21 Aug 15 |
nicklas |
595 |
Annotation ann = a.getThisAnnotation(dc); |
7206 |
19 Oct 16 |
nicklas |
596 |
// Permission on this annotation |
7206 |
19 Oct 16 |
nicklas |
597 |
annotatePermission = ann.hasPermission(Permission.WRITE); |
6939 |
21 Aug 15 |
nicklas |
598 |
values = a.getActualValues(ann.getUnitConverter(null), ann.getValueType()); |
5123 |
09 Oct 09 |
nicklas |
599 |
formatter = FormatterFactory.getAnnotationFormatter(sc, ann, null); |
7334 |
11 Apr 17 |
nicklas |
600 |
projectSpecific = a.getProjectId() != 0; |
4544 |
25 Sep 08 |
nicklas |
601 |
} |
3888 |
29 Oct 07 |
nicklas |
602 |
if (values != null || !at.isRemoved()) |
3888 |
29 Oct 07 |
nicklas |
603 |
{ |
5935 |
26 Jan 12 |
nicklas |
604 |
%> |
3888 |
29 Oct 07 |
nicklas |
605 |
<tbl:row> |
5935 |
26 Jan 12 |
nicklas |
606 |
<tbl:cell column="parameter"><base:icon |
5946 |
03 Feb 12 |
nicklas |
607 |
image="deleted.png" |
3888 |
29 Oct 07 |
nicklas |
608 |
tooltip="This item has been scheduled for deletion" |
3888 |
29 Oct 07 |
nicklas |
609 |
visible="<%=at.isRemoved()%>" |
3888 |
29 Oct 07 |
nicklas |
610 |
/><%=Base.getLinkedName(ID, at, false, true)%></tbl:cell> |
8083 |
20 Oct 22 |
nicklas |
611 |
<tbl:cell column="values" clazz="<%=projectSpecific ? "cell ps-annotation" : "cell" %>" disableOverflowCheck="true"> |
5935 |
26 Jan 12 |
nicklas |
612 |
<%=values == null || values.size() == 0 ? "<i>- no values -</i>" : Values.getString(values, ", ", true, formatter)%> |
8083 |
20 Oct 22 |
nicklas |
613 |
<base:icon image="<%=a==null?"edit_create.png":"edit.png" %>" subclass="edit-annotation auto-init link" |
6939 |
21 Aug 15 |
nicklas |
614 |
data-auto-init="edit-annotation" |
7206 |
19 Oct 16 |
nicklas |
615 |
data-annotation="<%=a!=null ? a.getThisAnnotationId() : 0 %>" |
7206 |
19 Oct 16 |
nicklas |
616 |
data-annotation-type="<%=at.getId()%>" |
7206 |
19 Oct 16 |
nicklas |
617 |
data-item-type="<%=itemType.name()%>" |
7206 |
19 Oct 16 |
nicklas |
618 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
619 |
tooltip="<%=a==null?"Create this protocol parameter":"Modify the values of this protocol parameter"%>" |
7206 |
19 Oct 16 |
nicklas |
620 |
visible="<%=annotatePermission %>" |
6939 |
21 Aug 15 |
nicklas |
621 |
/> |
3888 |
29 Oct 07 |
nicklas |
622 |
</tbl:cell> |
8083 |
20 Oct 22 |
nicklas |
623 |
<tbl:cell column="projectValues" disableOverflowCheck="true" style="padding:0;"> |
8083 |
20 Oct 22 |
nicklas |
624 |
<div class="project-values"> |
7334 |
11 Apr 17 |
nicklas |
625 |
<% |
8083 |
20 Oct 22 |
nicklas |
626 |
if (at.getProjectAnnotations()) |
7334 |
11 Apr 17 |
nicklas |
627 |
{ |
8083 |
20 Oct 22 |
nicklas |
628 |
annotationTypeFilter.setAnnotationType(at); |
8083 |
20 Oct 22 |
nicklas |
629 |
List<AnnotationSnapshot> projectValues = manager.findAnnotations(dc, snapshot, projectFilter, false); |
8083 |
20 Oct 22 |
nicklas |
630 |
projectValues.sort(AnnotationSnapshot.sortByProject(dc, true)); |
8083 |
20 Oct 22 |
nicklas |
631 |
int numValues = projectValues.size(); |
8083 |
20 Oct 22 |
nicklas |
632 |
if (numValues == 0 || projectValues.get(0).getProjectId() != 0) |
8083 |
20 Oct 22 |
nicklas |
633 |
{ |
8083 |
20 Oct 22 |
nicklas |
634 |
%> |
8083 |
20 Oct 22 |
nicklas |
635 |
<div class="no-default"><%=numValues > 0 ? "No default value":""%></div> |
8083 |
20 Oct 22 |
nicklas |
636 |
<div><base:icon image="edit_create.png" subclass="edit-annotation auto-init link" |
8083 |
20 Oct 22 |
nicklas |
637 |
data-auto-init="edit-annotation" |
8083 |
20 Oct 22 |
nicklas |
638 |
data-annotation="0" |
8083 |
20 Oct 22 |
nicklas |
639 |
data-annotation-type="<%=at.getId()%>" |
8083 |
20 Oct 22 |
nicklas |
640 |
data-project="0" |
8083 |
20 Oct 22 |
nicklas |
641 |
data-item-type="<%=itemType.name()%>" |
8083 |
20 Oct 22 |
nicklas |
642 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
643 |
tooltip="Create a default value" |
8083 |
20 Oct 22 |
nicklas |
644 |
visible="<%=annotatePermission %>" |
8083 |
20 Oct 22 |
nicklas |
645 |
/></div> |
8083 |
20 Oct 22 |
nicklas |
646 |
<div class="last-modified"></div> |
8083 |
20 Oct 22 |
nicklas |
647 |
<% |
8083 |
20 Oct 22 |
nicklas |
648 |
} |
8083 |
20 Oct 22 |
nicklas |
649 |
if (numValues > 0) |
8083 |
20 Oct 22 |
nicklas |
650 |
{ |
8083 |
20 Oct 22 |
nicklas |
651 |
for (AnnotationSnapshot pv : projectValues) |
8083 |
20 Oct 22 |
nicklas |
652 |
{ |
8083 |
20 Oct 22 |
nicklas |
653 |
boolean isDefault = pv.getProjectId() == 0; |
8083 |
20 Oct 22 |
nicklas |
654 |
boolean isCurrent = pv == a; |
8083 |
20 Oct 22 |
nicklas |
655 |
Annotation ann = pv.getThisAnnotation(dc); |
8083 |
20 Oct 22 |
nicklas |
656 |
values = pv.getActualValues(ann.getUnitConverter(null), ann.getValueType()); |
8083 |
20 Oct 22 |
nicklas |
657 |
formatter = FormatterFactory.getAnnotationFormatter(sc, ann, null); |
8083 |
20 Oct 22 |
nicklas |
658 |
if (numValues > 1) |
8083 |
20 Oct 22 |
nicklas |
659 |
{ |
8083 |
20 Oct 22 |
nicklas |
660 |
%> |
8083 |
20 Oct 22 |
nicklas |
661 |
<div class="<%=isCurrent?"current-value":"other-value"%><%=isDefault ? " default-value":""%>"><%=isDefault ? "Default" : pv.getProject(dc).getName() %></div> |
8083 |
20 Oct 22 |
nicklas |
662 |
<div><%=Values.getString(values, ", ", true, formatter) %></div> |
8083 |
20 Oct 22 |
nicklas |
663 |
<% |
8083 |
20 Oct 22 |
nicklas |
664 |
} |
8083 |
20 Oct 22 |
nicklas |
665 |
else |
8083 |
20 Oct 22 |
nicklas |
666 |
{ |
8083 |
20 Oct 22 |
nicklas |
667 |
%> |
8083 |
20 Oct 22 |
nicklas |
668 |
<div></div><div></div> |
8083 |
20 Oct 22 |
nicklas |
669 |
<% |
8083 |
20 Oct 22 |
nicklas |
670 |
} |
8083 |
20 Oct 22 |
nicklas |
671 |
%> |
8083 |
20 Oct 22 |
nicklas |
672 |
<div><base:icon image="edit.png" subclass="edit-annotation auto-init link" |
8083 |
20 Oct 22 |
nicklas |
673 |
data-auto-init="edit-annotation" |
8083 |
20 Oct 22 |
nicklas |
674 |
data-annotation="<%=pv.getThisAnnotationId()%>" |
8083 |
20 Oct 22 |
nicklas |
675 |
data-annotation-type="<%=at.getId()%>" |
8083 |
20 Oct 22 |
nicklas |
676 |
data-project="<%=pv.getProjectId()%>" |
8083 |
20 Oct 22 |
nicklas |
677 |
data-item-type="<%=itemType.name()%>" |
8083 |
20 Oct 22 |
nicklas |
678 |
data-item-id="<%=itemId %>" |
8083 |
20 Oct 22 |
nicklas |
679 |
tooltip="Modify the values of this protocol parameter" |
8083 |
20 Oct 22 |
nicklas |
680 |
visible="<%=annotatePermission %>" |
8083 |
20 Oct 22 |
nicklas |
681 |
/></div> |
8083 |
20 Oct 22 |
nicklas |
682 |
<div class="last-modified"><%=dateTimeFormatter.format(pv.getThisLastUpdate())%></div> |
8083 |
20 Oct 22 |
nicklas |
683 |
<% |
8083 |
20 Oct 22 |
nicklas |
684 |
} |
8083 |
20 Oct 22 |
nicklas |
685 |
} |
8083 |
20 Oct 22 |
nicklas |
686 |
} |
8083 |
20 Oct 22 |
nicklas |
687 |
else if (a != null) |
8083 |
20 Oct 22 |
nicklas |
688 |
{ |
7334 |
11 Apr 17 |
nicklas |
689 |
%> |
8083 |
20 Oct 22 |
nicklas |
690 |
<div></div><div></div><div></div> |
8083 |
20 Oct 22 |
nicklas |
691 |
<div class="last-modified"><%=dateTimeFormatter.format(a.getThisLastUpdate())%></div> |
7334 |
11 Apr 17 |
nicklas |
692 |
<% |
7334 |
11 Apr 17 |
nicklas |
693 |
} |
7334 |
11 Apr 17 |
nicklas |
694 |
%> |
8083 |
20 Oct 22 |
nicklas |
695 |
</div> |
7334 |
11 Apr 17 |
nicklas |
696 |
</tbl:cell> |
6922 |
02 Jun 15 |
nicklas |
697 |
<tbl:cell column="lastModified" value="<%=a == null ? null : a.getThisLastUpdate() %>" /> |
3888 |
29 Oct 07 |
nicklas |
698 |
<tbl:cell column="description"><%=HTML.encodeTags(at.getDescription())%></tbl:cell> |
3888 |
29 Oct 07 |
nicklas |
699 |
</tbl:row> |
3888 |
29 Oct 07 |
nicklas |
700 |
<% |
3888 |
29 Oct 07 |
nicklas |
701 |
} |
2875 |
08 Nov 06 |
nicklas |
702 |
} |
2875 |
08 Nov 06 |
nicklas |
703 |
%> |
2875 |
08 Nov 06 |
nicklas |
704 |
</tbl:rows> |
2875 |
08 Nov 06 |
nicklas |
705 |
</tbl:data> |
2875 |
08 Nov 06 |
nicklas |
706 |
</tbl:table> |
5935 |
26 Jan 12 |
nicklas |
707 |
<% |
5935 |
26 Jan 12 |
nicklas |
708 |
} |
5935 |
26 Jan 12 |
nicklas |
709 |
%> |
5935 |
26 Jan 12 |
nicklas |
710 |
</base:section> |
5935 |
26 Jan 12 |
nicklas |
711 |
<% |
5935 |
26 Jan 12 |
nicklas |
712 |
} |
5935 |
26 Jan 12 |
nicklas |
713 |
if (!isProxy) |
5935 |
26 Jan 12 |
nicklas |
714 |
{ |
5935 |
26 Jan 12 |
nicklas |
715 |
int numInherited = inheritedAnnotations == null ? 0 : inheritedAnnotations.size(); |
5935 |
26 Jan 12 |
nicklas |
716 |
%> |
5935 |
26 Jan 12 |
nicklas |
717 |
<base:section |
5935 |
26 Jan 12 |
nicklas |
718 |
id="inherited" |
6922 |
02 Jun 15 |
nicklas |
719 |
title="<%="Inherited annotations (" + numInherited + ")"%>" |
5935 |
26 Jan 12 |
nicklas |
720 |
> |
5044 |
11 Aug 09 |
martin |
721 |
<% |
5935 |
26 Jan 12 |
nicklas |
722 |
if (numInherited == 0) |
5044 |
11 Aug 09 |
martin |
723 |
{ |
5044 |
11 Aug 09 |
martin |
724 |
%> |
5935 |
26 Jan 12 |
nicklas |
725 |
<div class="messagecontainer note"> |
5935 |
26 Jan 12 |
nicklas |
726 |
No annotations are inherited by this item. |
5044 |
11 Aug 09 |
martin |
727 |
(or you don't have permission to view them). |
5935 |
26 Jan 12 |
nicklas |
728 |
</div> |
2875 |
08 Nov 06 |
nicklas |
729 |
<% |
2875 |
08 Nov 06 |
nicklas |
730 |
} |
5044 |
11 Aug 09 |
martin |
731 |
else |
5044 |
11 Aug 09 |
martin |
732 |
{ |
2166 |
19 Apr 06 |
nicklas |
733 |
%> |
5935 |
26 Jan 12 |
nicklas |
734 |
<tbl:table |
5935 |
26 Jan 12 |
nicklas |
735 |
id="inheritedAnnotations" |
5935 |
26 Jan 12 |
nicklas |
736 |
columns="all" |
2166 |
19 Apr 06 |
nicklas |
737 |
> |
5935 |
26 Jan 12 |
nicklas |
738 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
739 |
id="annotation" |
5935 |
26 Jan 12 |
nicklas |
740 |
title="Annotation" |
5935 |
26 Jan 12 |
nicklas |
741 |
/> |
5935 |
26 Jan 12 |
nicklas |
742 |
<tbl:columndef |
6937 |
07 Aug 15 |
nicklas |
743 |
id="values" |
6937 |
07 Aug 15 |
nicklas |
744 |
title="Values" |
6937 |
07 Aug 15 |
nicklas |
745 |
/> |
6937 |
07 Aug 15 |
nicklas |
746 |
<tbl:columndef |
6939 |
21 Aug 15 |
nicklas |
747 |
id="item" |
6939 |
21 Aug 15 |
nicklas |
748 |
title="Parent item" |
6922 |
02 Jun 15 |
nicklas |
749 |
/> |
6922 |
02 Jun 15 |
nicklas |
750 |
<tbl:columndef |
6939 |
21 Aug 15 |
nicklas |
751 |
id="note" |
6939 |
21 Aug 15 |
nicklas |
752 |
title="Note" |
5935 |
26 Jan 12 |
nicklas |
753 |
/> |
6922 |
02 Jun 15 |
nicklas |
754 |
<tbl:columndef |
6922 |
02 Jun 15 |
nicklas |
755 |
id="lastModified" |
6922 |
02 Jun 15 |
nicklas |
756 |
title="Last modified" |
6922 |
02 Jun 15 |
nicklas |
757 |
formatter="<%=dateTimeFormatter %>" |
6922 |
02 Jun 15 |
nicklas |
758 |
/> |
5935 |
26 Jan 12 |
nicklas |
759 |
<tbl:columndef |
5935 |
26 Jan 12 |
nicklas |
760 |
id="description" |
5935 |
26 Jan 12 |
nicklas |
761 |
title="Description" |
5935 |
26 Jan 12 |
nicklas |
762 |
/> |
5935 |
26 Jan 12 |
nicklas |
763 |
<tbl:data> |
5935 |
26 Jan 12 |
nicklas |
764 |
<tbl:headers> |
5935 |
26 Jan 12 |
nicklas |
765 |
<tbl:headerrow> |
5935 |
26 Jan 12 |
nicklas |
766 |
<tbl:columnheaders /> |
5935 |
26 Jan 12 |
nicklas |
767 |
</tbl:headerrow> |
5935 |
26 Jan 12 |
nicklas |
768 |
</tbl:headers> |
5935 |
26 Jan 12 |
nicklas |
769 |
<tbl:rows> |
5935 |
26 Jan 12 |
nicklas |
770 |
<% |
5935 |
26 Jan 12 |
nicklas |
771 |
for (AnnotationSnapshot a : inheritedAnnotations) |
5935 |
26 Jan 12 |
nicklas |
772 |
{ |
7206 |
19 Oct 16 |
nicklas |
773 |
boolean annotatePermission = a.hasPermission(dc, Permission.WRITE); |
5935 |
26 Jan 12 |
nicklas |
774 |
AnnotationType at = a.getAnnotationType(dc); |
6922 |
02 Jun 15 |
nicklas |
775 |
AnnotationSnapshot from = a.getInheritedFrom(); |
6922 |
02 Jun 15 |
nicklas |
776 |
|
6922 |
02 Jun 15 |
nicklas |
777 |
// About this annotation |
5935 |
26 Jan 12 |
nicklas |
778 |
String name = HTML.encodeTags(at.getName()); |
5935 |
26 Jan 12 |
nicklas |
779 |
String description = HTML.encodeTags(at.getDescription()); |
6922 |
02 Jun 15 |
nicklas |
780 |
Date lastModified = a.getThisLastUpdate(); |
6962 |
01 Oct 15 |
nicklas |
781 |
boolean isUpToDate = a.isUpToDate(); |
6922 |
02 Jun 15 |
nicklas |
782 |
|
6922 |
02 Jun 15 |
nicklas |
783 |
// Which item are we inheriting from? |
6922 |
02 Jun 15 |
nicklas |
784 |
Nameable fromItem = null; |
6922 |
02 Jun 15 |
nicklas |
785 |
String fromType = null; |
5935 |
26 Jan 12 |
nicklas |
786 |
boolean writeInherited = false; |
6922 |
02 Jun 15 |
nicklas |
787 |
if (from != null) |
2166 |
19 Apr 06 |
nicklas |
788 |
{ |
6922 |
02 Jun 15 |
nicklas |
789 |
fromType = from.getThisItemType().toString(); |
6922 |
02 Jun 15 |
nicklas |
790 |
if (lastModified == null) |
6922 |
02 Jun 15 |
nicklas |
791 |
{ |
6922 |
02 Jun 15 |
nicklas |
792 |
lastModified = from.getThisLastUpdate(); |
6922 |
02 Jun 15 |
nicklas |
793 |
} |
5984 |
24 Feb 12 |
nicklas |
794 |
try |
5984 |
24 Feb 12 |
nicklas |
795 |
{ |
6922 |
02 Jun 15 |
nicklas |
796 |
fromItem = (Nameable)from.getThisItem(dc); |
6922 |
02 Jun 15 |
nicklas |
797 |
writeInherited = fromItem.hasPermission(Permission.WRITE); |
6922 |
02 Jun 15 |
nicklas |
798 |
if (fromItem instanceof Subtypable) |
6922 |
02 Jun 15 |
nicklas |
799 |
{ |
6922 |
02 Jun 15 |
nicklas |
800 |
ItemSubtype subtype = ((Subtypable)fromItem).getItemSubtype(); |
6922 |
02 Jun 15 |
nicklas |
801 |
if (subtype != null) fromType = subtype.getName(); |
6922 |
02 Jun 15 |
nicklas |
802 |
} |
5984 |
24 Feb 12 |
nicklas |
803 |
} |
5984 |
24 Feb 12 |
nicklas |
804 |
catch (PermissionDeniedException ex) |
5984 |
24 Feb 12 |
nicklas |
805 |
{} |
6922 |
02 Jun 15 |
nicklas |
806 |
} |
6922 |
02 Jun 15 |
nicklas |
807 |
|
6922 |
02 Jun 15 |
nicklas |
808 |
// Values, units, etc. |
7605 |
26 Feb 19 |
nicklas |
809 |
Formatter<Object> formatter = FormatterFactory.getTypeFormatter(sc, at.getValueType()); |
6922 |
02 Jun 15 |
nicklas |
810 |
Unit unit = a.getActualUnit(dc); |
6922 |
02 Jun 15 |
nicklas |
811 |
UnitConverter converter = null; |
6922 |
02 Jun 15 |
nicklas |
812 |
if (unit != null) |
6922 |
02 Jun 15 |
nicklas |
813 |
{ |
6922 |
02 Jun 15 |
nicklas |
814 |
converter = unit.getUnitConverter(at.getDefaultUnit()); |
6922 |
02 Jun 15 |
nicklas |
815 |
formatter = unit.getFormatter(formatter); |
6922 |
02 Jun 15 |
nicklas |
816 |
} |
6922 |
02 Jun 15 |
nicklas |
817 |
List<?> values = a.getActualValues(converter, at.getValueType()); |
7334 |
11 Apr 17 |
nicklas |
818 |
List<?> defaultValues = null; |
7334 |
11 Apr 17 |
nicklas |
819 |
boolean projectSpecific = a.getProjectId() != 0; |
7334 |
11 Apr 17 |
nicklas |
820 |
if (projectSpecific) |
7334 |
11 Apr 17 |
nicklas |
821 |
{ |
7334 |
11 Apr 17 |
nicklas |
822 |
Annotation ann = a.getThisAnnotation(dc); |
7334 |
11 Apr 17 |
nicklas |
823 |
if (ann.isOverridingDefault()) |
7334 |
11 Apr 17 |
nicklas |
824 |
{ |
7334 |
11 Apr 17 |
nicklas |
825 |
Annotation defAnn = ann.getDefaultAnnotation(); |
7334 |
11 Apr 17 |
nicklas |
826 |
Annotation defFrom = defAnn.getInheritedFrom(); |
7334 |
11 Apr 17 |
nicklas |
827 |
defaultValues = defAnn.getSource() == Annotation.Source.CLONED ? defAnn.getValues() : defFrom.getValues(); |
7334 |
11 Apr 17 |
nicklas |
828 |
} |
7334 |
11 Apr 17 |
nicklas |
829 |
} |
6922 |
02 Jun 15 |
nicklas |
830 |
%> |
5935 |
26 Jan 12 |
nicklas |
831 |
<tbl:row> |
6922 |
02 Jun 15 |
nicklas |
832 |
<tbl:cell column="annotation"><%=Base.getLinkedName(ID, at, at == null, true)%></tbl:cell> |
8083 |
20 Oct 22 |
nicklas |
833 |
<tbl:cell column="values" clazz="<%=projectSpecific ? "cell ps-annotation" : "cell" %>" disableOverflowCheck="true"> |
5935 |
26 Jan 12 |
nicklas |
834 |
<%=values == null || values.size() == 0 ? |
5935 |
26 Jan 12 |
nicklas |
835 |
"<i>- no values -</i>" : Values.getString(values, ", ", true, formatter)%> |
6962 |
01 Oct 15 |
nicklas |
836 |
<base:icon image="<%=isUpToDate ? "edit.png" : "edit-outofsync.png"%>" |
6962 |
01 Oct 15 |
nicklas |
837 |
subclass="edit-annotation auto-init link" |
6939 |
21 Aug 15 |
nicklas |
838 |
data-auto-init="edit-annotation" |
6939 |
21 Aug 15 |
nicklas |
839 |
data-annotation="<%= a.getThisAnnotationId()%>" |
6939 |
21 Aug 15 |
nicklas |
840 |
data-annotation-type="<%=at.getId()%>" |
6939 |
21 Aug 15 |
nicklas |
841 |
data-item-type="<%=itemType.name()%>" |
6939 |
21 Aug 15 |
nicklas |
842 |
data-item-id="<%=itemId %>" |
6939 |
21 Aug 15 |
nicklas |
843 |
tooltip="Modify the values of this annotation" |
7206 |
19 Oct 16 |
nicklas |
844 |
visible="<%=annotatePermission %>" |
6939 |
21 Aug 15 |
nicklas |
845 |
/> |
5935 |
26 Jan 12 |
nicklas |
846 |
</tbl:cell> |
6939 |
21 Aug 15 |
nicklas |
847 |
<tbl:cell column="item"><%=from == null ? "<i>- missing -</i>" : Base.getLinkedName(ID, fromItem, fromItem == null, true)%><%=fromItem != null ? " <span class=\"itemsubtype\">("+fromType+")</span>" : ""%></tbl:cell> |
7334 |
11 Apr 17 |
nicklas |
848 |
<tbl:cell column="note"> |
7334 |
11 Apr 17 |
nicklas |
849 |
<%=a.getSource() == Annotation.Source.CLONED ? "Cloned" + (isUpToDate ? "; up-to-date" : "; modified") : "" %> |
7334 |
11 Apr 17 |
nicklas |
850 |
<% |
7334 |
11 Apr 17 |
nicklas |
851 |
if (projectSpecific && at.getProjectAnnotations()) |
7334 |
11 Apr 17 |
nicklas |
852 |
{ |
7334 |
11 Apr 17 |
nicklas |
853 |
%> |
7334 |
11 Apr 17 |
nicklas |
854 |
<%=defaultValues == null || defaultValues.size() == 0 ? "No default value" : "Default value: " + Values.getString(defaultValues, ", ", true, formatter)%> |
7334 |
11 Apr 17 |
nicklas |
855 |
<% |
7334 |
11 Apr 17 |
nicklas |
856 |
} |
7334 |
11 Apr 17 |
nicklas |
857 |
%> |
7334 |
11 Apr 17 |
nicklas |
858 |
</tbl:cell> |
6922 |
02 Jun 15 |
nicklas |
859 |
<tbl:cell column="lastModified" value="<%=lastModified %>"></tbl:cell> |
5935 |
26 Jan 12 |
nicklas |
860 |
<tbl:cell column="description"><%=description%></tbl:cell> |
5935 |
26 Jan 12 |
nicklas |
861 |
</tbl:row> |
5935 |
26 Jan 12 |
nicklas |
862 |
<% |
5935 |
26 Jan 12 |
nicklas |
863 |
} |
5935 |
26 Jan 12 |
nicklas |
864 |
%> |
5935 |
26 Jan 12 |
nicklas |
865 |
</tbl:rows> |
5935 |
26 Jan 12 |
nicklas |
866 |
</tbl:data> |
5935 |
26 Jan 12 |
nicklas |
867 |
</tbl:table> |
2166 |
19 Apr 06 |
nicklas |
868 |
<% |
2166 |
19 Apr 06 |
nicklas |
869 |
} |
2166 |
19 Apr 06 |
nicklas |
870 |
%> |
5935 |
26 Jan 12 |
nicklas |
871 |
</base:section> |
6922 |
02 Jun 15 |
nicklas |
872 |
|
5935 |
26 Jan 12 |
nicklas |
873 |
<% |
5935 |
26 Jan 12 |
nicklas |
874 |
} |
5935 |
26 Jan 12 |
nicklas |
875 |
%> |
1855 |
27 Jan 06 |
nicklas |
876 |
</base:body> |
1855 |
27 Jan 06 |
nicklas |
877 |
</base:page> |
1855 |
27 Jan 06 |
nicklas |
878 |
<% |
1855 |
27 Jan 06 |
nicklas |
879 |
} |
1855 |
27 Jan 06 |
nicklas |
880 |
finally |
1855 |
27 Jan 06 |
nicklas |
881 |
{ |
1855 |
27 Jan 06 |
nicklas |
882 |
if (dc != null) dc.close(); |
1855 |
27 Jan 06 |
nicklas |
883 |
} |
1855 |
27 Jan 06 |
nicklas |
884 |
|
1855 |
27 Jan 06 |
nicklas |
885 |
%> |