6743 |
18 Feb 15 |
nicklas |
1 |
<%-- $Id: index.jsp 6278 2013-05-24 10:41:55Z nicklas $ |
6743 |
18 Feb 15 |
nicklas |
2 |
------------------------------------------------------------------ |
6743 |
18 Feb 15 |
nicklas |
Copyright (C) 2008 Nicklas Nordborg |
6743 |
18 Feb 15 |
nicklas |
4 |
|
6743 |
18 Feb 15 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
6743 |
18 Feb 15 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
6743 |
18 Feb 15 |
nicklas |
7 |
|
6743 |
18 Feb 15 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
6743 |
18 Feb 15 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
6743 |
18 Feb 15 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
6743 |
18 Feb 15 |
nicklas |
11 |
of the License, or (at your option) any later version. |
6743 |
18 Feb 15 |
nicklas |
12 |
|
6743 |
18 Feb 15 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
6743 |
18 Feb 15 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
6743 |
18 Feb 15 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6743 |
18 Feb 15 |
nicklas |
16 |
GNU General Public License for more details. |
6743 |
18 Feb 15 |
nicklas |
17 |
|
6743 |
18 Feb 15 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
6743 |
18 Feb 15 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
6743 |
18 Feb 15 |
nicklas |
20 |
------------------------------------------------------------------ |
6743 |
18 Feb 15 |
nicklas |
21 |
|
6743 |
18 Feb 15 |
nicklas |
22 |
@author Nicklas |
6743 |
18 Feb 15 |
nicklas |
23 |
@version 2.10 |
6743 |
18 Feb 15 |
nicklas |
24 |
--%> |
6743 |
18 Feb 15 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
6743 |
18 Feb 15 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
6743 |
18 Feb 15 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
6743 |
18 Feb 15 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
6743 |
18 Feb 15 |
nicklas |
29 |
import="net.sf.basedb.core.ItemContext" |
6743 |
18 Feb 15 |
nicklas |
30 |
import="net.sf.basedb.core.Type" |
6743 |
18 Feb 15 |
nicklas |
31 |
import="net.sf.basedb.core.ItemQuery" |
6743 |
18 Feb 15 |
nicklas |
32 |
import="net.sf.basedb.core.ItemList" |
6743 |
18 Feb 15 |
nicklas |
33 |
import="net.sf.basedb.core.BasicItem" |
6744 |
18 Feb 15 |
nicklas |
34 |
import="net.sf.basedb.core.Listable" |
6745 |
18 Feb 15 |
nicklas |
35 |
import="net.sf.basedb.core.OwnedItem" |
6743 |
18 Feb 15 |
nicklas |
36 |
import="net.sf.basedb.core.query.Restrictions" |
6743 |
18 Feb 15 |
nicklas |
37 |
import="net.sf.basedb.core.query.Expressions" |
6743 |
18 Feb 15 |
nicklas |
38 |
import="net.sf.basedb.core.query.Hql" |
6743 |
18 Feb 15 |
nicklas |
39 |
import="net.sf.basedb.core.query.Orders" |
6743 |
18 Feb 15 |
nicklas |
40 |
import="net.sf.basedb.core.MultiPermissions" |
6743 |
18 Feb 15 |
nicklas |
41 |
import="net.sf.basedb.core.Permission" |
6743 |
18 Feb 15 |
nicklas |
42 |
import="net.sf.basedb.core.PermissionDeniedException" |
6743 |
18 Feb 15 |
nicklas |
43 |
import="net.sf.basedb.clients.web.Base" |
6743 |
18 Feb 15 |
nicklas |
44 |
import="net.sf.basedb.clients.web.WebException" |
6743 |
18 Feb 15 |
nicklas |
45 |
import="net.sf.basedb.util.ShareableUtil" |
6743 |
18 Feb 15 |
nicklas |
46 |
import="net.sf.basedb.util.RemovableUtil" |
6743 |
18 Feb 15 |
nicklas |
47 |
import="net.sf.basedb.util.Values" |
6743 |
18 Feb 15 |
nicklas |
48 |
import="net.sf.basedb.clients.web.util.HTML" |
6743 |
18 Feb 15 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.GuiContext" |
6743 |
18 Feb 15 |
nicklas |
50 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
6743 |
18 Feb 15 |
nicklas |
51 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
6743 |
18 Feb 15 |
nicklas |
52 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
6743 |
18 Feb 15 |
nicklas |
53 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnExportRenderer" |
7604 |
25 Feb 19 |
nicklas |
54 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnAction" |
6743 |
18 Feb 15 |
nicklas |
55 |
import="net.sf.basedb.clients.web.extensions.list.ListColumnUtil" |
6743 |
18 Feb 15 |
nicklas |
56 |
import="java.util.Arrays" |
6743 |
18 Feb 15 |
nicklas |
57 |
import="java.util.Collections" |
6743 |
18 Feb 15 |
nicklas |
58 |
import="java.util.Set" |
6743 |
18 Feb 15 |
nicklas |
59 |
import="java.util.HashSet" |
6743 |
18 Feb 15 |
nicklas |
60 |
%> |
6743 |
18 Feb 15 |
nicklas |
61 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
6743 |
18 Feb 15 |
nicklas |
62 |
<%! |
6743 |
18 Feb 15 |
nicklas |
63 |
private static final ItemContext defaultContext = Base.createDefaultContext("name", "name,itemSubtype,description"); |
6743 |
18 Feb 15 |
nicklas |
64 |
|
6743 |
18 Feb 15 |
nicklas |
65 |
private static void registerExportUtils(ItemContext cc) |
6743 |
18 Feb 15 |
nicklas |
66 |
{ |
6743 |
18 Feb 15 |
nicklas |
67 |
Item memberType = cc.getItemType(); |
6743 |
18 Feb 15 |
nicklas |
68 |
} |
6743 |
18 Feb 15 |
nicklas |
69 |
%> |
6743 |
18 Feb 15 |
nicklas |
70 |
<% |
6743 |
18 Feb 15 |
nicklas |
71 |
final int listId = Values.getInt(request.getParameter("list_id")); |
6743 |
18 Feb 15 |
nicklas |
72 |
final String subContext = "listmembers."+listId; |
6743 |
18 Feb 15 |
nicklas |
73 |
|
6743 |
18 Feb 15 |
nicklas |
74 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
6743 |
18 Feb 15 |
nicklas |
75 |
final String ID = sc.getId(); |
6743 |
18 Feb 15 |
nicklas |
76 |
final String cmd = request.getParameter("cmd"); |
6743 |
18 Feb 15 |
nicklas |
77 |
final String root = request.getContextPath()+"/"; |
6743 |
18 Feb 15 |
nicklas |
78 |
final String mode = request.getParameter("mode"); |
6743 |
18 Feb 15 |
nicklas |
79 |
final String callback = request.getParameter("callback"); |
6743 |
18 Feb 15 |
nicklas |
80 |
final String listPage = "list_members.jsp?ID="+ID |
6743 |
18 Feb 15 |
nicklas |
81 |
+"&list_id="+listId |
6743 |
18 Feb 15 |
nicklas |
82 |
+(mode == null ? "" : "&mode="+mode) |
6743 |
18 Feb 15 |
nicklas |
83 |
+(callback == null ? "" : "&callback="+callback); |
6743 |
18 Feb 15 |
nicklas |
84 |
|
6743 |
18 Feb 15 |
nicklas |
85 |
String forward = null; |
6743 |
18 Feb 15 |
nicklas |
86 |
String redirect = null; |
6743 |
18 Feb 15 |
nicklas |
87 |
String message = null; |
6743 |
18 Feb 15 |
nicklas |
88 |
DbControl dc = null; |
6743 |
18 Feb 15 |
nicklas |
89 |
try |
6743 |
18 Feb 15 |
nicklas |
90 |
{ |
7954 |
12 May 21 |
nicklas |
91 |
dc = sc.newDbControl(":Load item list"); |
7954 |
12 May 21 |
nicklas |
92 |
ItemList list = ItemList.getById(dc, listId); |
6743 |
18 Feb 15 |
nicklas |
93 |
final Item itemType = list.getMemberType(); |
7954 |
12 May 21 |
nicklas |
94 |
dc.close(); |
6743 |
18 Feb 15 |
nicklas |
95 |
|
6743 |
18 Feb 15 |
nicklas |
96 |
if (cmd == null || "List".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
97 |
{ |
6743 |
18 Feb 15 |
nicklas |
98 |
// Display the list page without updatinging the current context |
6743 |
18 Feb 15 |
nicklas |
99 |
Base.getAndSetCurrentContext(sc, itemType, subContext, (PageContext)null, defaultContext, true); |
6743 |
18 Feb 15 |
nicklas |
100 |
redirect = listPage; |
6743 |
18 Feb 15 |
nicklas |
101 |
} |
6743 |
18 Feb 15 |
nicklas |
102 |
else if ("UpdateContext".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
103 |
{ |
6743 |
18 Feb 15 |
nicklas |
104 |
// Display the list page after updating the current context from the request parameters |
6743 |
18 Feb 15 |
nicklas |
105 |
Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6743 |
18 Feb 15 |
nicklas |
106 |
redirect = listPage; |
6743 |
18 Feb 15 |
nicklas |
107 |
} |
6743 |
18 Feb 15 |
nicklas |
108 |
else if ("LoadContext".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
109 |
{ |
6743 |
18 Feb 15 |
nicklas |
110 |
// Display the list page after loading a saved context |
6743 |
18 Feb 15 |
nicklas |
111 |
int contextId = Values.getInt(request.getParameter("context")); |
6743 |
18 Feb 15 |
nicklas |
112 |
Base.loadContext(sc, contextId, defaultContext); |
6743 |
18 Feb 15 |
nicklas |
113 |
redirect = listPage; |
6743 |
18 Feb 15 |
nicklas |
114 |
} |
6745 |
18 Feb 15 |
nicklas |
115 |
else if ("DeleteItems".equals(cmd)) |
6745 |
18 Feb 15 |
nicklas |
116 |
{ |
6745 |
18 Feb 15 |
nicklas |
117 |
// Delete all selected items on the list page |
7954 |
12 May 21 |
nicklas |
118 |
dc = sc.newDbControl(":Delete "+itemType+" (in item list)"); |
6745 |
18 Feb 15 |
nicklas |
119 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6745 |
18 Feb 15 |
nicklas |
120 |
int numTotal = cc.getSelected().size(); |
6745 |
18 Feb 15 |
nicklas |
121 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), true); |
6745 |
18 Feb 15 |
nicklas |
122 |
dc.commit(); |
6745 |
18 Feb 15 |
nicklas |
123 |
if (numTotal != numRemoved) |
6745 |
18 Feb 15 |
nicklas |
124 |
{ |
6745 |
18 Feb 15 |
nicklas |
125 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be deleted, because you have no DELETE permission"; |
6745 |
18 Feb 15 |
nicklas |
126 |
} |
6745 |
18 Feb 15 |
nicklas |
127 |
redirect = listPage; |
6745 |
18 Feb 15 |
nicklas |
128 |
} |
6745 |
18 Feb 15 |
nicklas |
129 |
else if ("RestoreItems".equals(cmd)) |
6745 |
18 Feb 15 |
nicklas |
130 |
{ |
6745 |
18 Feb 15 |
nicklas |
131 |
// Restore all selected items on the list page |
7954 |
12 May 21 |
nicklas |
132 |
dc = sc.newDbControl(":Restore "+itemType+" (in item list)"); |
6745 |
18 Feb 15 |
nicklas |
133 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6745 |
18 Feb 15 |
nicklas |
134 |
int numTotal = cc.getSelected().size(); |
6745 |
18 Feb 15 |
nicklas |
135 |
int numRemoved = RemovableUtil.setRemoved(dc, itemType, cc.getSelected(), false); |
6745 |
18 Feb 15 |
nicklas |
136 |
dc.commit(); |
6745 |
18 Feb 15 |
nicklas |
137 |
if (numTotal != numRemoved) |
6745 |
18 Feb 15 |
nicklas |
138 |
{ |
6745 |
18 Feb 15 |
nicklas |
139 |
message = (numRemoved == 0 ? "No" : "Only "+numRemoved+" of "+numTotal) + " items could be restored, because you have no WRITE permission"; |
6745 |
18 Feb 15 |
nicklas |
140 |
} |
6745 |
18 Feb 15 |
nicklas |
141 |
redirect = listPage; |
6745 |
18 Feb 15 |
nicklas |
142 |
} |
6745 |
18 Feb 15 |
nicklas |
143 |
else if ("ShareItems".equals(cmd)) |
6745 |
18 Feb 15 |
nicklas |
144 |
{ |
6745 |
18 Feb 15 |
nicklas |
145 |
// Display a popup window for sharing all selected items on the list page |
7954 |
12 May 21 |
nicklas |
146 |
dc = sc.newDbControl(":Share "+itemType+" (in item list)"); |
6745 |
18 Feb 15 |
nicklas |
147 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6745 |
18 Feb 15 |
nicklas |
148 |
MultiPermissions permissions = ShareableUtil.getMultiPermissions(dc, itemType, cc.getSelected()); |
6745 |
18 Feb 15 |
nicklas |
149 |
dc.close(); |
6745 |
18 Feb 15 |
nicklas |
150 |
cc.setObject("MultiPermissions", permissions); |
6745 |
18 Feb 15 |
nicklas |
151 |
redirect = "../../../common/share/share.jsp?ID="+ID+"&item_type="+itemType.name()+"&subcontext="+subContext; |
6745 |
18 Feb 15 |
nicklas |
152 |
} |
6745 |
18 Feb 15 |
nicklas |
153 |
else if ("SetOwnerOfItems".equals(cmd)) |
6745 |
18 Feb 15 |
nicklas |
154 |
{ |
6745 |
18 Feb 15 |
nicklas |
155 |
// Change owner of items selected on a list page |
7954 |
12 May 21 |
nicklas |
156 |
dc = sc.newDbControl(":Set owner of "+itemType+" (in item list)"); |
6745 |
18 Feb 15 |
nicklas |
157 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6745 |
18 Feb 15 |
nicklas |
158 |
Set<OwnedItem> items = new HashSet<OwnedItem>(); |
6745 |
18 Feb 15 |
nicklas |
159 |
for (Integer id : cc.getSelected()) |
6745 |
18 Feb 15 |
nicklas |
160 |
{ |
6745 |
18 Feb 15 |
nicklas |
161 |
if (id != null) items.add((OwnedItem)itemType.getById(dc, id)); |
6745 |
18 Feb 15 |
nicklas |
162 |
} |
6745 |
18 Feb 15 |
nicklas |
163 |
dc.close(); |
6745 |
18 Feb 15 |
nicklas |
164 |
cc.setObject("OwnedItems", items); |
6745 |
18 Feb 15 |
nicklas |
165 |
redirect = "../../../common/ownership/ownership.jsp?ID="+ID+"&item_type="+itemType.name()+"&subcontext="+subContext; |
6745 |
18 Feb 15 |
nicklas |
166 |
} |
6743 |
18 Feb 15 |
nicklas |
167 |
else if ("ExportItems".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
168 |
{ |
6743 |
18 Feb 15 |
nicklas |
169 |
// Run an export plugin in a list context |
6743 |
18 Feb 15 |
nicklas |
170 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
6743 |
18 Feb 15 |
nicklas |
171 |
registerExportUtils(cc); |
7954 |
12 May 21 |
nicklas |
172 |
dc = sc.newDbControl(":Export "+itemType+" (in item list)"); |
7954 |
12 May 21 |
nicklas |
173 |
list = ItemList.getById(dc, listId); |
6743 |
18 Feb 15 |
nicklas |
174 |
final ItemQuery<? extends Listable> query = list.getMembers(); |
7914 |
23 Feb 21 |
nicklas |
175 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
176 |
cc.configureQuery(dc, query, jspContext, true); |
6743 |
18 Feb 15 |
nicklas |
177 |
cc.setQuery(query); |
7604 |
25 Feb 19 |
nicklas |
178 |
ExtensionsInvoker<ListColumnAction<Listable,?>> listInvoker = ListColumnUtil.useExtensions(jspContext); |
7604 |
25 Feb 19 |
nicklas |
179 |
listInvoker.render(new ListColumnExportRenderer<Listable>(cc)); |
6743 |
18 Feb 15 |
nicklas |
180 |
dc.close(); |
6743 |
18 Feb 15 |
nicklas |
181 |
redirect = "../../../common/export/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&subcontext="+subContext+"&title=Export+list+members"; |
6743 |
18 Feb 15 |
nicklas |
182 |
} |
6743 |
18 Feb 15 |
nicklas |
183 |
else if ("ImportItems".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
184 |
{ |
6743 |
18 Feb 15 |
nicklas |
185 |
// Run an import plugin in a list context |
6743 |
18 Feb 15 |
nicklas |
186 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
7954 |
12 May 21 |
nicklas |
187 |
dc = sc.newDbControl(":Import "+itemType+" (in item list)"); |
7954 |
12 May 21 |
nicklas |
188 |
list = ItemList.getById(dc, listId); |
6743 |
18 Feb 15 |
nicklas |
189 |
final ItemQuery<? extends Listable> query = list.getMembers(); |
7914 |
23 Feb 21 |
nicklas |
190 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
191 |
cc.configureQuery(dc, query, jspContext, true); |
6743 |
18 Feb 15 |
nicklas |
192 |
cc.setQuery(query); |
6743 |
18 Feb 15 |
nicklas |
193 |
dc.close(); |
6743 |
18 Feb 15 |
nicklas |
194 |
redirect = "../../../common/import/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&subcontext="+subContext+"&title=Import+list+members"; |
6743 |
18 Feb 15 |
nicklas |
195 |
} |
6743 |
18 Feb 15 |
nicklas |
196 |
else if ("RunListPlugin".equals(cmd)) |
6743 |
18 Feb 15 |
nicklas |
197 |
{ |
6743 |
18 Feb 15 |
nicklas |
198 |
// Run another plugin in a list context |
6743 |
18 Feb 15 |
nicklas |
199 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
7954 |
12 May 21 |
nicklas |
200 |
dc = sc.newDbControl(":Run plugin "+itemType+" (in item list)"); |
7954 |
12 May 21 |
nicklas |
201 |
list = ItemList.getById(dc, listId); |
6743 |
18 Feb 15 |
nicklas |
202 |
final ItemQuery<? extends BasicItem> query = list.getMembers(); |
7914 |
23 Feb 21 |
nicklas |
203 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.list(itemType), null); |
7914 |
23 Feb 21 |
nicklas |
204 |
cc.configureQuery(dc, query, jspContext, true); |
6743 |
18 Feb 15 |
nicklas |
205 |
cc.setQuery(query); |
6743 |
18 Feb 15 |
nicklas |
206 |
dc.close(); |
6743 |
18 Feb 15 |
nicklas |
207 |
redirect = "../../../common/plugin/index.jsp?ID="+ID+"&cmd=SelectPlugin&item_type="+itemType.name()+"&context_type=LIST&subcontext="+subContext+"&main_type=OTHER&title=Run+plugin"; |
6743 |
18 Feb 15 |
nicklas |
208 |
} |
6744 |
18 Feb 15 |
nicklas |
209 |
else if ("AddMembers".equals(cmd)) |
6744 |
18 Feb 15 |
nicklas |
210 |
{ |
7954 |
12 May 21 |
nicklas |
211 |
dc = sc.newDbControl(":Add members to item list"); |
7954 |
12 May 21 |
nicklas |
212 |
list = ItemList.getById(dc, listId); |
6744 |
18 Feb 15 |
nicklas |
213 |
ItemContext memberContext = sc.getCurrentContext(itemType); |
6744 |
18 Feb 15 |
nicklas |
214 |
final ItemQuery<? extends Listable> query = list.getAllItems(); |
6744 |
18 Feb 15 |
nicklas |
215 |
memberContext.configureQuery(dc, query, true); |
6744 |
18 Feb 15 |
nicklas |
216 |
String which = request.getParameter("which"); |
6744 |
18 Feb 15 |
nicklas |
217 |
if ("selected".equals(which)) |
6744 |
18 Feb 15 |
nicklas |
218 |
{ |
6744 |
18 Feb 15 |
nicklas |
219 |
query.setFirstResult(0); |
6744 |
18 Feb 15 |
nicklas |
220 |
query.setMaxResults(-1); |
6744 |
18 Feb 15 |
nicklas |
221 |
Integer[] itemIds = Values.getInt(request.getParameter("items").split(",")); |
6744 |
18 Feb 15 |
nicklas |
222 |
query.restrict( |
6744 |
18 Feb 15 |
nicklas |
223 |
Restrictions.in( |
6744 |
18 Feb 15 |
nicklas |
224 |
Hql.property("id"), |
6744 |
18 Feb 15 |
nicklas |
225 |
Expressions.parameter("selectedItems") |
6744 |
18 Feb 15 |
nicklas |
226 |
) |
6744 |
18 Feb 15 |
nicklas |
227 |
); |
6744 |
18 Feb 15 |
nicklas |
228 |
query.setParameter("selectedItems", Arrays.asList(itemIds), Type.INT); |
6744 |
18 Feb 15 |
nicklas |
229 |
} |
6744 |
18 Feb 15 |
nicklas |
230 |
else if ("all".equals(which)) |
6744 |
18 Feb 15 |
nicklas |
231 |
{ |
6744 |
18 Feb 15 |
nicklas |
232 |
query.setFirstResult(0); |
6744 |
18 Feb 15 |
nicklas |
233 |
query.setMaxResults(-1); |
6744 |
18 Feb 15 |
nicklas |
234 |
} |
7834 |
26 Jun 20 |
nicklas |
235 |
int count = list.add(query); |
6744 |
18 Feb 15 |
nicklas |
236 |
dc.commit(); |
6744 |
18 Feb 15 |
nicklas |
237 |
message = count + " members added to list"; |
6744 |
18 Feb 15 |
nicklas |
238 |
} |
6744 |
18 Feb 15 |
nicklas |
239 |
else if ("RemoveMembers".equals(cmd)) |
6744 |
18 Feb 15 |
nicklas |
240 |
{ |
6744 |
18 Feb 15 |
nicklas |
241 |
// Delete all selected items on the list page |
6744 |
18 Feb 15 |
nicklas |
242 |
ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, subContext, pageContext, defaultContext); |
7954 |
12 May 21 |
nicklas |
243 |
dc = sc.newDbControl(":Remove members from item list"); |
7954 |
12 May 21 |
nicklas |
244 |
list = ItemList.getById(dc, listId); |
7834 |
26 Jun 20 |
nicklas |
245 |
list.removeItems(cc.getSelected()); |
6744 |
18 Feb 15 |
nicklas |
246 |
dc.commit(); |
6744 |
18 Feb 15 |
nicklas |
247 |
redirect = listPage; |
6744 |
18 Feb 15 |
nicklas |
248 |
} |
6744 |
18 Feb 15 |
nicklas |
249 |
|
6743 |
18 Feb 15 |
nicklas |
250 |
else |
6743 |
18 Feb 15 |
nicklas |
251 |
{ |
6743 |
18 Feb 15 |
nicklas |
252 |
throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd); |
6743 |
18 Feb 15 |
nicklas |
253 |
} |
6743 |
18 Feb 15 |
nicklas |
254 |
} |
6743 |
18 Feb 15 |
nicklas |
255 |
finally |
6743 |
18 Feb 15 |
nicklas |
256 |
{ |
6743 |
18 Feb 15 |
nicklas |
257 |
if (dc != null) dc.close(); |
6743 |
18 Feb 15 |
nicklas |
258 |
} |
6743 |
18 Feb 15 |
nicklas |
259 |
|
6743 |
18 Feb 15 |
nicklas |
260 |
if (forward != null) |
6743 |
18 Feb 15 |
nicklas |
261 |
{ |
6743 |
18 Feb 15 |
nicklas |
262 |
sc.setSessionSetting("alert-message", message); |
6743 |
18 Feb 15 |
nicklas |
263 |
pageContext.forward(forward); |
6743 |
18 Feb 15 |
nicklas |
264 |
} |
6743 |
18 Feb 15 |
nicklas |
265 |
else if (redirect != null) |
6743 |
18 Feb 15 |
nicklas |
266 |
{ |
6743 |
18 Feb 15 |
nicklas |
267 |
sc.setSessionSetting("alert-message", message); |
6743 |
18 Feb 15 |
nicklas |
268 |
response.sendRedirect(redirect); |
6743 |
18 Feb 15 |
nicklas |
269 |
} |
6743 |
18 Feb 15 |
nicklas |
270 |
else if (message == null) |
6743 |
18 Feb 15 |
nicklas |
271 |
{ |
6743 |
18 Feb 15 |
nicklas |
272 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0"); |
6743 |
18 Feb 15 |
nicklas |
273 |
} |
6743 |
18 Feb 15 |
nicklas |
274 |
else |
6743 |
18 Feb 15 |
nicklas |
275 |
{ |
6743 |
18 Feb 15 |
nicklas |
276 |
response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message)); |
6743 |
18 Feb 15 |
nicklas |
277 |
} |
6743 |
18 Feb 15 |
nicklas |
278 |
%> |
6743 |
18 Feb 15 |
nicklas |
279 |
|