6694 |
26 Jan 15 |
nicklas |
1 |
<%-- $Id$ |
6694 |
26 Jan 15 |
nicklas |
2 |
------------------------------------------------------------------ |
6694 |
26 Jan 15 |
nicklas |
Copyright (C) 2015 Nicklas Nordborg |
6694 |
26 Jan 15 |
nicklas |
4 |
|
6694 |
26 Jan 15 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
6694 |
26 Jan 15 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
6694 |
26 Jan 15 |
nicklas |
7 |
|
6694 |
26 Jan 15 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
6694 |
26 Jan 15 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
6694 |
26 Jan 15 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
6694 |
26 Jan 15 |
nicklas |
11 |
of the License, or (at your option) any later version. |
6694 |
26 Jan 15 |
nicklas |
12 |
|
6694 |
26 Jan 15 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
6694 |
26 Jan 15 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
6694 |
26 Jan 15 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6694 |
26 Jan 15 |
nicklas |
16 |
GNU General Public License for more details. |
6694 |
26 Jan 15 |
nicklas |
17 |
|
6694 |
26 Jan 15 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
6694 |
26 Jan 15 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
6694 |
26 Jan 15 |
nicklas |
20 |
------------------------------------------------------------------ |
6694 |
26 Jan 15 |
nicklas |
21 |
--%> |
6694 |
26 Jan 15 |
nicklas |
22 |
<%@ page pageEncoding="UTF-8" session="false" |
6694 |
26 Jan 15 |
nicklas |
23 |
import="net.sf.basedb.core.DbControl" |
6694 |
26 Jan 15 |
nicklas |
24 |
import="net.sf.basedb.core.Item" |
6694 |
26 Jan 15 |
nicklas |
25 |
import="net.sf.basedb.core.ItemContext" |
6694 |
26 Jan 15 |
nicklas |
26 |
import="net.sf.basedb.core.Nameable" |
6696 |
28 Jan 15 |
nicklas |
27 |
import="net.sf.basedb.core.AnnotationType" |
6694 |
26 Jan 15 |
nicklas |
28 |
import="net.sf.basedb.core.AnnotatedItem" |
6694 |
26 Jan 15 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
6694 |
26 Jan 15 |
nicklas |
30 |
import="net.sf.basedb.clients.web.Base" |
6694 |
26 Jan 15 |
nicklas |
31 |
import="net.sf.basedb.clients.web.WebException" |
6694 |
26 Jan 15 |
nicklas |
32 |
import="net.sf.basedb.util.Values" |
6696 |
28 Jan 15 |
nicklas |
33 |
import="net.sf.basedb.clients.web.AnnotationUtil" |
6694 |
26 Jan 15 |
nicklas |
34 |
import="net.sf.basedb.clients.web.util.HTML" |
6696 |
28 Jan 15 |
nicklas |
35 |
import="org.json.simple.JSONObject" |
6696 |
28 Jan 15 |
nicklas |
36 |
import="org.json.simple.JSONArray" |
6694 |
26 Jan 15 |
nicklas |
37 |
import="java.util.Collections" |
6694 |
26 Jan 15 |
nicklas |
38 |
import="java.util.List" |
6694 |
26 Jan 15 |
nicklas |
39 |
import="java.util.Set" |
6694 |
26 Jan 15 |
nicklas |
40 |
%> |
6694 |
26 Jan 15 |
nicklas |
41 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
6694 |
26 Jan 15 |
nicklas |
42 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
6694 |
26 Jan 15 |
nicklas |
43 |
<% |
6694 |
26 Jan 15 |
nicklas |
44 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
6694 |
26 Jan 15 |
nicklas |
45 |
final String ID = sc.getId(); |
6694 |
26 Jan 15 |
nicklas |
46 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
6694 |
26 Jan 15 |
nicklas |
47 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
6694 |
26 Jan 15 |
nicklas |
48 |
final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
6694 |
26 Jan 15 |
nicklas |
49 |
|
7954 |
12 May 21 |
nicklas |
50 |
final DbControl dc = sc.newDbControl(":Batch inherit annotations"); |
6694 |
26 Jan 15 |
nicklas |
51 |
try |
6694 |
26 Jan 15 |
nicklas |
52 |
{ |
7605 |
26 Feb 19 |
nicklas |
53 |
Set<AnnotatedItem> items = cc.getObject("AnnotatedItems"); |
7605 |
26 Feb 19 |
nicklas |
54 |
Set<AnnotationType> annotationTypes = cc.getObject("AnnotationTypes"); |
6696 |
28 Jan 15 |
nicklas |
55 |
cc.removeObject("AnnotationTypes"); |
6696 |
28 Jan 15 |
nicklas |
56 |
JSONArray jsonAnnotationTypes = new JSONArray(); |
6696 |
28 Jan 15 |
nicklas |
57 |
if (annotationTypes != null) |
6696 |
28 Jan 15 |
nicklas |
58 |
{ |
6696 |
28 Jan 15 |
nicklas |
59 |
for (AnnotationType at : annotationTypes) |
6696 |
28 Jan 15 |
nicklas |
60 |
{ |
6696 |
28 Jan 15 |
nicklas |
61 |
JSONObject jsonAnnotationType = AnnotationUtil.loadJsonForBatchInherit(dc, AnnotationType.getById(dc, at.getId())); |
6696 |
28 Jan 15 |
nicklas |
62 |
jsonAnnotationTypes.add(jsonAnnotationType); |
6696 |
28 Jan 15 |
nicklas |
63 |
} |
6696 |
28 Jan 15 |
nicklas |
64 |
} |
6694 |
26 Jan 15 |
nicklas |
65 |
%> |
6694 |
26 Jan 15 |
nicklas |
66 |
<base:page type="popup" title="Batch inherit annotations"> |
6694 |
26 Jan 15 |
nicklas |
67 |
<base:head scripts="table.js,~batch_inherit.js" styles="table.css,toolbar.css"> |
6694 |
26 Jan 15 |
nicklas |
68 |
<style> |
6694 |
26 Jan 15 |
nicklas |
69 |
#selectedAnnotationTypes select |
6694 |
26 Jan 15 |
nicklas |
70 |
{ |
6694 |
26 Jan 15 |
nicklas |
71 |
width: calc(100% - 10px); |
6694 |
26 Jan 15 |
nicklas |
72 |
} |
6694 |
26 Jan 15 |
nicklas |
73 |
</style> |
6694 |
26 Jan 15 |
nicklas |
74 |
</base:head> |
6694 |
26 Jan 15 |
nicklas |
75 |
<base:body> |
6694 |
26 Jan 15 |
nicklas |
76 |
<h1>Batch inherit annotations to <%=items.size()%> items <base:help helpid="annotations.batch_inherit" /></h1> |
6694 |
26 Jan 15 |
nicklas |
77 |
|
6696 |
28 Jan 15 |
nicklas |
78 |
<div id="page-data" class="datacontainer" |
6696 |
28 Jan 15 |
nicklas |
79 |
data-annotation-types="<%=HTML.encodeTags(jsonAnnotationTypes.toJSONString())%>" |
6696 |
28 Jan 15 |
nicklas |
80 |
></div> |
6696 |
28 Jan 15 |
nicklas |
81 |
|
6694 |
26 Jan 15 |
nicklas |
82 |
<div class="content"> |
7943 |
04 May 21 |
nicklas |
83 |
<tbl:table id="annotations" subclass="fulltable" stickyheaders="<%=null%>" action="index.jsp"> |
6694 |
26 Jan 15 |
nicklas |
84 |
<tbl:hidden name="item_type" value="<%=itemType.name() %>"/> |
6694 |
26 Jan 15 |
nicklas |
85 |
<tbl:hidden name="subcontext" value="<%=subContext %>"/> |
6694 |
26 Jan 15 |
nicklas |
86 |
|
6694 |
26 Jan 15 |
nicklas |
87 |
<tbl:columndef id="annotationType" title="Annotation type" /> |
6926 |
03 Jun 15 |
nicklas |
88 |
<tbl:columndef id="action" title="Action" style="min-width: 10em;"/> |
6926 |
03 Jun 15 |
nicklas |
89 |
<tbl:columndef id="from" title="Parent item type" style="min-width: 10em;" /> |
6694 |
26 Jan 15 |
nicklas |
90 |
<tbl:columndef id="options" title="Options" /> |
6694 |
26 Jan 15 |
nicklas |
91 |
<div class="panelgroup bg-filled-50 bottomborder" style="height: 1.9em;"> |
6694 |
26 Jan 15 |
nicklas |
92 |
<tbl:toolbar style="height: 100%;"> |
6694 |
26 Jan 15 |
nicklas |
93 |
<tbl:button |
6694 |
26 Jan 15 |
nicklas |
94 |
id="btnSelectAnnotationTypes" |
6694 |
26 Jan 15 |
nicklas |
95 |
title="Select annotation types…" |
6694 |
26 Jan 15 |
nicklas |
96 |
image="add.png" |
6694 |
26 Jan 15 |
nicklas |
97 |
tooltip="Select annotations types that should be inherited" |
6694 |
26 Jan 15 |
nicklas |
98 |
/> |
6694 |
26 Jan 15 |
nicklas |
99 |
</tbl:toolbar> |
6694 |
26 Jan 15 |
nicklas |
100 |
</div> |
6694 |
26 Jan 15 |
nicklas |
101 |
<tbl:data style="top: 1.9em;"> |
6694 |
26 Jan 15 |
nicklas |
102 |
<tbl:headers> |
6694 |
26 Jan 15 |
nicklas |
103 |
<tbl:headerrow> |
6694 |
26 Jan 15 |
nicklas |
104 |
<tbl:columnheaders /> |
6694 |
26 Jan 15 |
nicklas |
105 |
</tbl:headerrow> |
6694 |
26 Jan 15 |
nicklas |
106 |
</tbl:headers> |
6694 |
26 Jan 15 |
nicklas |
107 |
<tbl:rows id="selectedAnnotationTypes"> |
6694 |
26 Jan 15 |
nicklas |
108 |
|
6694 |
26 Jan 15 |
nicklas |
109 |
<tbl:panel subclass="bg-filled-50" id="none-selected"> |
6694 |
26 Jan 15 |
nicklas |
110 |
<div class="messagecontainer note"> |
6694 |
26 Jan 15 |
nicklas |
111 |
No annotation types has been selected yet. |
6694 |
26 Jan 15 |
nicklas |
112 |
</div> |
6694 |
26 Jan 15 |
nicklas |
113 |
</tbl:panel> |
6694 |
26 Jan 15 |
nicklas |
114 |
</tbl:rows> |
6694 |
26 Jan 15 |
nicklas |
115 |
</tbl:data> |
6694 |
26 Jan 15 |
nicklas |
116 |
</tbl:table> |
6694 |
26 Jan 15 |
nicklas |
117 |
</div> |
6694 |
26 Jan 15 |
nicklas |
118 |
|
6694 |
26 Jan 15 |
nicklas |
119 |
<base:buttongroup subclass="dialogbuttons"> |
6694 |
26 Jan 15 |
nicklas |
120 |
<base:button id="btnSave" title="Ok" /> |
6694 |
26 Jan 15 |
nicklas |
121 |
<base:button id="close" title="Cancel" /> |
6694 |
26 Jan 15 |
nicklas |
122 |
</base:buttongroup> |
6694 |
26 Jan 15 |
nicklas |
123 |
</base:body> |
6694 |
26 Jan 15 |
nicklas |
124 |
</base:page> |
6694 |
26 Jan 15 |
nicklas |
125 |
<% |
6694 |
26 Jan 15 |
nicklas |
126 |
} |
6694 |
26 Jan 15 |
nicklas |
127 |
finally |
6694 |
26 Jan 15 |
nicklas |
128 |
{ |
6694 |
26 Jan 15 |
nicklas |
129 |
if (dc != null) dc.close(); |
6694 |
26 Jan 15 |
nicklas |
130 |
} |
6694 |
26 Jan 15 |
nicklas |
131 |
%> |