7798 |
09 Apr 20 |
nicklas |
1 |
<%-- $Id $ |
7798 |
09 Apr 20 |
nicklas |
2 |
------------------------------------------------------------------ |
7798 |
09 Apr 20 |
nicklas |
Copyright (C) 2020 Nicklas Nordborg |
7798 |
09 Apr 20 |
nicklas |
4 |
|
7798 |
09 Apr 20 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
7798 |
09 Apr 20 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
7798 |
09 Apr 20 |
nicklas |
7 |
|
7798 |
09 Apr 20 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
7798 |
09 Apr 20 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
7798 |
09 Apr 20 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
7798 |
09 Apr 20 |
nicklas |
11 |
of the License, or (at your option) any later version. |
7798 |
09 Apr 20 |
nicklas |
12 |
|
7798 |
09 Apr 20 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
7798 |
09 Apr 20 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7798 |
09 Apr 20 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7798 |
09 Apr 20 |
nicklas |
16 |
GNU General Public License for more details. |
7798 |
09 Apr 20 |
nicklas |
17 |
|
7798 |
09 Apr 20 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
7798 |
09 Apr 20 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7798 |
09 Apr 20 |
nicklas |
20 |
------------------------------------------------------------------ |
7798 |
09 Apr 20 |
nicklas |
21 |
|
7798 |
09 Apr 20 |
nicklas |
22 |
@author Nicklas |
7798 |
09 Apr 20 |
nicklas |
23 |
--%> |
7798 |
09 Apr 20 |
nicklas |
24 |
<%@ page pageEncoding="UTF-8" session="false" |
7798 |
09 Apr 20 |
nicklas |
25 |
import="net.sf.basedb.core.SessionControl" |
7798 |
09 Apr 20 |
nicklas |
26 |
import="net.sf.basedb.core.DbControl" |
7798 |
09 Apr 20 |
nicklas |
27 |
import="net.sf.basedb.core.Item" |
7798 |
09 Apr 20 |
nicklas |
28 |
import="net.sf.basedb.core.ItemQuery" |
7798 |
09 Apr 20 |
nicklas |
29 |
import="net.sf.basedb.core.ItemContext" |
7798 |
09 Apr 20 |
nicklas |
30 |
import="net.sf.basedb.core.ItemResultList" |
7798 |
09 Apr 20 |
nicklas |
31 |
import="net.sf.basedb.core.ItemList" |
7798 |
09 Apr 20 |
nicklas |
32 |
import="net.sf.basedb.core.RawDataType" |
7798 |
09 Apr 20 |
nicklas |
33 |
import="net.sf.basedb.core.query.Orders" |
7798 |
09 Apr 20 |
nicklas |
34 |
import="net.sf.basedb.core.query.Hql" |
7798 |
09 Apr 20 |
nicklas |
35 |
import="net.sf.basedb.core.query.Expressions" |
7798 |
09 Apr 20 |
nicklas |
36 |
import="net.sf.basedb.core.query.Restrictions" |
7798 |
09 Apr 20 |
nicklas |
37 |
import="net.sf.basedb.core.plugin.GuiContext" |
7798 |
09 Apr 20 |
nicklas |
38 |
import="net.sf.basedb.util.Values" |
7798 |
09 Apr 20 |
nicklas |
39 |
import="net.sf.basedb.util.formatter.Formatter" |
7798 |
09 Apr 20 |
nicklas |
40 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
7798 |
09 Apr 20 |
nicklas |
41 |
import="net.sf.basedb.clients.web.Base" |
7798 |
09 Apr 20 |
nicklas |
42 |
import="net.sf.basedb.clients.web.util.HTML" |
7798 |
09 Apr 20 |
nicklas |
43 |
import="java.util.Date" |
7798 |
09 Apr 20 |
nicklas |
44 |
import="java.util.List" |
7798 |
09 Apr 20 |
nicklas |
45 |
%> |
7798 |
09 Apr 20 |
nicklas |
46 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
7798 |
09 Apr 20 |
nicklas |
47 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
7798 |
09 Apr 20 |
nicklas |
48 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
7798 |
09 Apr 20 |
nicklas |
49 |
<% |
7798 |
09 Apr 20 |
nicklas |
50 |
String root = request.getContextPath() + "/"; |
7798 |
09 Apr 20 |
nicklas |
51 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
7798 |
09 Apr 20 |
nicklas |
52 |
final String ID = sc.getId(); |
7798 |
09 Apr 20 |
nicklas |
53 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
7798 |
09 Apr 20 |
nicklas |
54 |
final int itemId = Values.getInt(request.getParameter("item_id")); |
7798 |
09 Apr 20 |
nicklas |
55 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
56 |
final DbControl dc = sc.newDbControl(":Item lists for item"); |
7798 |
09 Apr 20 |
nicklas |
57 |
final ItemContext cc = sc.getCurrentContext(itemType); |
7798 |
09 Apr 20 |
nicklas |
58 |
String title = Values.getString(request.getParameter("title"), "Related items"); |
7798 |
09 Apr 20 |
nicklas |
59 |
|
7798 |
09 Apr 20 |
nicklas |
60 |
try |
7798 |
09 Apr 20 |
nicklas |
61 |
{ |
7798 |
09 Apr 20 |
nicklas |
62 |
Formatter<Date> timeFormatter = FormatterFactory.getDateTimeFormatter(sc); |
7798 |
09 Apr 20 |
nicklas |
63 |
|
7798 |
09 Apr 20 |
nicklas |
64 |
final ItemQuery<ItemList> listQuery = ItemList.getQuery(); |
7798 |
09 Apr 20 |
nicklas |
65 |
listQuery.setIncludes(cc.getInclude()); |
7798 |
09 Apr 20 |
nicklas |
66 |
listQuery.join(Hql.innerJoin("members", "m")); |
7798 |
09 Apr 20 |
nicklas |
67 |
listQuery.restrict(Restrictions.eq(Hql.property("memberType"), Expressions.integer(itemType.getValue()))); |
7798 |
09 Apr 20 |
nicklas |
68 |
listQuery.restrict(Restrictions.eq(Hql.alias("m"), Expressions.integer(itemId))); |
7798 |
09 Apr 20 |
nicklas |
69 |
listQuery.order(Orders.asc(Hql.property("name"))); |
7798 |
09 Apr 20 |
nicklas |
70 |
|
7798 |
09 Apr 20 |
nicklas |
71 |
ItemResultList<ItemList> lists = listQuery.list(dc); |
7798 |
09 Apr 20 |
nicklas |
72 |
long count = lists.getTotalCount(); |
7798 |
09 Apr 20 |
nicklas |
73 |
%> |
7798 |
09 Apr 20 |
nicklas |
74 |
<base:page type="include"> |
7798 |
09 Apr 20 |
nicklas |
75 |
<base:body> |
7798 |
09 Apr 20 |
nicklas |
76 |
<base:section |
7798 |
09 Apr 20 |
nicklas |
77 |
id="itemlists" |
7798 |
09 Apr 20 |
nicklas |
78 |
title="<%=title + " (" + (count) +")"%>" |
7798 |
09 Apr 20 |
nicklas |
79 |
context="<%=cc%>" |
7798 |
09 Apr 20 |
nicklas |
80 |
> |
7798 |
09 Apr 20 |
nicklas |
81 |
<% |
7798 |
09 Apr 20 |
nicklas |
82 |
if (count == 0) |
7798 |
09 Apr 20 |
nicklas |
83 |
{ |
7798 |
09 Apr 20 |
nicklas |
84 |
%> |
7798 |
09 Apr 20 |
nicklas |
85 |
<div class="messagecontainer note"> |
7798 |
09 Apr 20 |
nicklas |
86 |
This <%=itemType.toString().toLowerCase() %> is not member in |
7798 |
09 Apr 20 |
nicklas |
87 |
any list (or, you don't have permission to view them). |
7798 |
09 Apr 20 |
nicklas |
88 |
</div> |
7798 |
09 Apr 20 |
nicklas |
89 |
<% |
7798 |
09 Apr 20 |
nicklas |
90 |
} |
7798 |
09 Apr 20 |
nicklas |
91 |
else |
7798 |
09 Apr 20 |
nicklas |
92 |
{ |
7798 |
09 Apr 20 |
nicklas |
93 |
%> |
7798 |
09 Apr 20 |
nicklas |
94 |
<tbl:table |
7798 |
09 Apr 20 |
nicklas |
95 |
id="links" |
7798 |
09 Apr 20 |
nicklas |
96 |
columns="all" |
7798 |
09 Apr 20 |
nicklas |
97 |
> |
7798 |
09 Apr 20 |
nicklas |
98 |
<tbl:columndef |
7798 |
09 Apr 20 |
nicklas |
99 |
id="name" |
7798 |
09 Apr 20 |
nicklas |
100 |
title="List" |
7798 |
09 Apr 20 |
nicklas |
101 |
/> |
7798 |
09 Apr 20 |
nicklas |
102 |
<tbl:columndef |
7798 |
09 Apr 20 |
nicklas |
103 |
id="memberType" |
7798 |
09 Apr 20 |
nicklas |
104 |
title="Member type" |
7798 |
09 Apr 20 |
nicklas |
105 |
/> |
7798 |
09 Apr 20 |
nicklas |
106 |
<tbl:columndef |
7808 |
19 May 20 |
nicklas |
107 |
id="owner" |
7808 |
19 May 20 |
nicklas |
108 |
title="Owner" |
7808 |
19 May 20 |
nicklas |
109 |
/> |
7808 |
19 May 20 |
nicklas |
110 |
<tbl:columndef |
7798 |
09 Apr 20 |
nicklas |
111 |
id="lastSync" |
7798 |
09 Apr 20 |
nicklas |
112 |
title="Last sync" |
7798 |
09 Apr 20 |
nicklas |
113 |
/> |
7798 |
09 Apr 20 |
nicklas |
114 |
<tbl:columndef |
7798 |
09 Apr 20 |
nicklas |
115 |
id="size" |
7798 |
09 Apr 20 |
nicklas |
116 |
title="Size" |
7798 |
09 Apr 20 |
nicklas |
117 |
/> |
7798 |
09 Apr 20 |
nicklas |
118 |
<tbl:columndef |
7798 |
09 Apr 20 |
nicklas |
119 |
id="description" |
7798 |
09 Apr 20 |
nicklas |
120 |
title="Description" |
7798 |
09 Apr 20 |
nicklas |
121 |
/> |
7798 |
09 Apr 20 |
nicklas |
122 |
<tbl:data> |
7798 |
09 Apr 20 |
nicklas |
123 |
<tbl:headers> |
7798 |
09 Apr 20 |
nicklas |
124 |
<tbl:headerrow> |
7798 |
09 Apr 20 |
nicklas |
125 |
<tbl:columnheaders /> |
7798 |
09 Apr 20 |
nicklas |
126 |
</tbl:headerrow> |
7913 |
22 Feb 21 |
nicklas |
127 |
<tbl:columnsubtitles /> |
7798 |
09 Apr 20 |
nicklas |
128 |
</tbl:headers> |
7798 |
09 Apr 20 |
nicklas |
129 |
<tbl:rows> |
7798 |
09 Apr 20 |
nicklas |
130 |
<% |
7798 |
09 Apr 20 |
nicklas |
131 |
for (ItemList list : lists) |
7798 |
09 Apr 20 |
nicklas |
132 |
{ |
7798 |
09 Apr 20 |
nicklas |
133 |
%> |
7798 |
09 Apr 20 |
nicklas |
134 |
<tbl:row> |
7798 |
09 Apr 20 |
nicklas |
135 |
<tbl:cell column="name"><base:icon |
7798 |
09 Apr 20 |
nicklas |
136 |
image="deleted.png" |
7798 |
09 Apr 20 |
nicklas |
137 |
tooltip="This item has been scheduled for deletion" |
7798 |
09 Apr 20 |
nicklas |
138 |
visible="<%=list.isRemoved()%>" |
7798 |
09 Apr 20 |
nicklas |
139 |
/><%=Base.getLinkedName(ID, list, false, true)%></tbl:cell> |
7798 |
09 Apr 20 |
nicklas |
140 |
<tbl:cell column="memberType"> |
7798 |
09 Apr 20 |
nicklas |
141 |
<% |
7798 |
09 Apr 20 |
nicklas |
142 |
if (itemType != Item.RAWBIOASSAY) |
7798 |
09 Apr 20 |
nicklas |
143 |
{ |
7798 |
09 Apr 20 |
nicklas |
144 |
%> |
7798 |
09 Apr 20 |
nicklas |
145 |
<base:propertyvalue item="<%=list%>" property="itemSubtype" nulltext="<i>any</i>"/> |
7798 |
09 Apr 20 |
nicklas |
146 |
<% |
7798 |
09 Apr 20 |
nicklas |
147 |
} |
7798 |
09 Apr 20 |
nicklas |
148 |
else |
7798 |
09 Apr 20 |
nicklas |
149 |
{ |
7798 |
09 Apr 20 |
nicklas |
150 |
RawDataType rdt = list.getRawDataType(); |
7798 |
09 Apr 20 |
nicklas |
151 |
%> |
7809 |
19 May 20 |
nicklas |
152 |
<%=rdt != null ? HTML.encodeTags(rdt.getName()) : "<i>any</i>"%> |
7798 |
09 Apr 20 |
nicklas |
153 |
<% |
7798 |
09 Apr 20 |
nicklas |
154 |
} |
7798 |
09 Apr 20 |
nicklas |
155 |
%> |
7798 |
09 Apr 20 |
nicklas |
156 |
</tbl:cell> |
7808 |
19 May 20 |
nicklas |
157 |
<tbl:cell column="owner"><base:propertyvalue item="<%=list%>" property="owner" /></tbl:cell> |
7798 |
09 Apr 20 |
nicklas |
158 |
<tbl:cell column="lastSync"> |
7808 |
19 May 20 |
nicklas |
159 |
<%=list.hasSyncFilters() ? (list.getSyncDate() == null ? "<i>never</i>" : timeFormatter.format(list.getSyncDate())) : "<i>n/a</i>" %> |
7798 |
09 Apr 20 |
nicklas |
160 |
</tbl:cell> |
7798 |
09 Apr 20 |
nicklas |
161 |
<tbl:cell column="size"><%=list.getSize() %></tbl:cell> |
7798 |
09 Apr 20 |
nicklas |
162 |
<tbl:cell column="description"><%=HTML.niceFormat(list.getDescription())%></tbl:cell> |
7798 |
09 Apr 20 |
nicklas |
163 |
</tbl:row> |
7798 |
09 Apr 20 |
nicklas |
164 |
<% |
7798 |
09 Apr 20 |
nicklas |
165 |
} |
7798 |
09 Apr 20 |
nicklas |
166 |
%> |
7798 |
09 Apr 20 |
nicklas |
167 |
</tbl:rows> |
7798 |
09 Apr 20 |
nicklas |
168 |
</tbl:data> |
7798 |
09 Apr 20 |
nicklas |
169 |
</tbl:table> |
7798 |
09 Apr 20 |
nicklas |
170 |
<% |
7798 |
09 Apr 20 |
nicklas |
171 |
} |
7798 |
09 Apr 20 |
nicklas |
172 |
%> |
7798 |
09 Apr 20 |
nicklas |
173 |
</base:section> |
7798 |
09 Apr 20 |
nicklas |
174 |
</base:body> |
7798 |
09 Apr 20 |
nicklas |
175 |
</base:page> |
7798 |
09 Apr 20 |
nicklas |
176 |
<% |
7798 |
09 Apr 20 |
nicklas |
177 |
} |
7798 |
09 Apr 20 |
nicklas |
178 |
finally |
7798 |
09 Apr 20 |
nicklas |
179 |
{ |
7798 |
09 Apr 20 |
nicklas |
180 |
if (dc != null) dc.close(); |
7798 |
09 Apr 20 |
nicklas |
181 |
} |
7798 |
09 Apr 20 |
nicklas |
182 |
|
7798 |
09 Apr 20 |
nicklas |
183 |
%> |