4573 |
10 Oct 08 |
martin |
1 |
<%-- $Id$ |
4573 |
10 Oct 08 |
martin |
2 |
------------------------------------------------------------------ |
4573 |
10 Oct 08 |
martin |
Copyright (C) 2008 Martin Svensson |
4573 |
10 Oct 08 |
martin |
4 |
|
4573 |
10 Oct 08 |
martin |
5 |
This file is part of BASE - BioArray Software Environment. |
4573 |
10 Oct 08 |
martin |
6 |
Available at http://base.thep.lu.se/ |
4573 |
10 Oct 08 |
martin |
7 |
|
4573 |
10 Oct 08 |
martin |
8 |
BASE is free software; you can redistribute it and/or |
4573 |
10 Oct 08 |
martin |
9 |
modify it under the terms of the GNU General Public License |
4573 |
10 Oct 08 |
martin |
10 |
as published by the Free Software Foundation; either version 3 |
4573 |
10 Oct 08 |
martin |
11 |
of the License, or (at your option) any later version. |
4573 |
10 Oct 08 |
martin |
12 |
|
4573 |
10 Oct 08 |
martin |
13 |
BASE is distributed in the hope that it will be useful, |
4573 |
10 Oct 08 |
martin |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4573 |
10 Oct 08 |
martin |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4573 |
10 Oct 08 |
martin |
16 |
GNU General Public License for more details. |
4573 |
10 Oct 08 |
martin |
17 |
|
4573 |
10 Oct 08 |
martin |
18 |
You should have received a copy of the GNU General Public License |
4573 |
10 Oct 08 |
martin |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4573 |
10 Oct 08 |
martin |
20 |
------------------------------------------------------------------ |
4573 |
10 Oct 08 |
martin |
21 |
|
4573 |
10 Oct 08 |
martin |
22 |
Configure the order and visibility of columns in a table of items. |
4573 |
10 Oct 08 |
martin |
23 |
This page will use the TableColumn.getTableColumns(item) to retreive the |
4573 |
10 Oct 08 |
martin |
24 |
list of all available columns for that item type and |
4573 |
10 Oct 08 |
martin |
25 |
getSession().getSetting(item+".columns") to retreive a comma-separated |
4573 |
10 Oct 08 |
martin |
26 |
list of the current order of visible columns. |
4573 |
10 Oct 08 |
martin |
27 |
|
4573 |
10 Oct 08 |
martin |
28 |
@author Martin |
4573 |
10 Oct 08 |
martin |
29 |
@version 2.9 |
4573 |
10 Oct 08 |
martin |
30 |
--%> |
5426 |
24 Sep 10 |
nicklas |
31 |
<%@ page pageEncoding="UTF-8" session="false" |
4573 |
10 Oct 08 |
martin |
32 |
import="net.sf.basedb.core.DbControl" |
4573 |
10 Oct 08 |
martin |
33 |
import="net.sf.basedb.core.Item" |
4573 |
10 Oct 08 |
martin |
34 |
import="net.sf.basedb.core.ItemContext" |
4573 |
10 Oct 08 |
martin |
35 |
import="net.sf.basedb.core.Nameable" |
4587 |
15 Oct 08 |
martin |
36 |
import="net.sf.basedb.core.OwnedItem" |
4573 |
10 Oct 08 |
martin |
37 |
import="net.sf.basedb.core.SessionControl" |
4573 |
10 Oct 08 |
martin |
38 |
import="net.sf.basedb.core.User" |
4573 |
10 Oct 08 |
martin |
39 |
import="net.sf.basedb.clients.web.Base" |
4573 |
10 Oct 08 |
martin |
40 |
import="net.sf.basedb.clients.web.WebException" |
4573 |
10 Oct 08 |
martin |
41 |
import="net.sf.basedb.util.Values" |
4573 |
10 Oct 08 |
martin |
42 |
import="net.sf.basedb.clients.web.util.HTML" |
4573 |
10 Oct 08 |
martin |
43 |
import="java.util.Collections" |
4573 |
10 Oct 08 |
martin |
44 |
import="java.util.List" |
4573 |
10 Oct 08 |
martin |
45 |
import="java.util.Set" |
4573 |
10 Oct 08 |
martin |
46 |
%> |
4573 |
10 Oct 08 |
martin |
47 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4573 |
10 Oct 08 |
martin |
48 |
<% |
4573 |
10 Oct 08 |
martin |
49 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
4573 |
10 Oct 08 |
martin |
50 |
final String ID = sc.getId(); |
4573 |
10 Oct 08 |
martin |
51 |
final Item itemType = Item.valueOf(request.getParameter("item_type")); |
4573 |
10 Oct 08 |
martin |
52 |
final String subContext = Values.getString(request.getParameter("subcontext"), ""); |
4573 |
10 Oct 08 |
martin |
53 |
final ItemContext cc = sc.getCurrentContext(itemType, subContext); |
4573 |
10 Oct 08 |
martin |
54 |
|
7954 |
12 May 21 |
nicklas |
55 |
final DbControl dc = sc.newDbControl(":Change owner dialog"); |
4573 |
10 Oct 08 |
martin |
56 |
|
4573 |
10 Oct 08 |
martin |
57 |
try |
4573 |
10 Oct 08 |
martin |
58 |
{ |
7605 |
26 Feb 19 |
nicklas |
59 |
Set<OwnedItem> items = cc.getObject("OwnedItems"); |
4573 |
10 Oct 08 |
martin |
60 |
User defaultOwner = User.getById(dc, sc.getLoggedInUserId()); |
7605 |
26 Feb 19 |
nicklas |
61 |
List<User> recentUsers = cc.getRecent(dc, Item.USER); |
4573 |
10 Oct 08 |
martin |
62 |
|
4573 |
10 Oct 08 |
martin |
63 |
// Headline on the web page. |
4573 |
10 Oct 08 |
martin |
64 |
String headLine = null; |
4587 |
15 Oct 08 |
martin |
65 |
if (items.size() == 1) |
4573 |
10 Oct 08 |
martin |
66 |
{ |
4587 |
15 Oct 08 |
martin |
67 |
OwnedItem ownedItem = items.iterator().next(); |
4573 |
10 Oct 08 |
martin |
68 |
if (ownedItem instanceof Nameable) |
4573 |
10 Oct 08 |
martin |
69 |
{ |
4573 |
10 Oct 08 |
martin |
70 |
headLine = "Set owner of -- " + HTML.encodeTags(((Nameable)ownedItem).getName()); |
4573 |
10 Oct 08 |
martin |
71 |
} |
4573 |
10 Oct 08 |
martin |
72 |
else |
4573 |
10 Oct 08 |
martin |
73 |
{ |
4573 |
10 Oct 08 |
martin |
74 |
headLine = "Set owner of -- " + HTML.encodeTags(ownedItem.toString()); |
4573 |
10 Oct 08 |
martin |
75 |
} |
4573 |
10 Oct 08 |
martin |
76 |
} |
4573 |
10 Oct 08 |
martin |
77 |
else |
4573 |
10 Oct 08 |
martin |
78 |
{ |
4587 |
15 Oct 08 |
martin |
79 |
headLine = "Set owner of -- Multiple items ("+items.size()+")"; |
4573 |
10 Oct 08 |
martin |
80 |
} |
4573 |
10 Oct 08 |
martin |
81 |
|
4573 |
10 Oct 08 |
martin |
82 |
%> |
4573 |
10 Oct 08 |
martin |
83 |
<base:page type="popup" title="Set owner"> |
6181 |
22 Oct 12 |
nicklas |
84 |
<base:head scripts="~ownership.js" /> |
6181 |
22 Oct 12 |
nicklas |
85 |
<base:body> |
5907 |
13 Dec 11 |
nicklas |
86 |
<h1><%=headLine%> <base:help helpid="ownership.configure" /></h1> |
6162 |
10 Oct 12 |
nicklas |
87 |
<form name="ownership" action="submit_ownership.jsp"> |
4573 |
10 Oct 08 |
martin |
88 |
<input type="hidden" name="ID" value="<%=ID%>"> |
4573 |
10 Oct 08 |
martin |
89 |
<input type="hidden" name="cmd" value="Save"> |
4573 |
10 Oct 08 |
martin |
90 |
<input type="hidden" name="item_type" value="<%=itemType.name()%>"> |
4573 |
10 Oct 08 |
martin |
91 |
<input type="hidden" name="subcontext" value="<%=subContext%>"> |
5907 |
13 Dec 11 |
nicklas |
92 |
|
5907 |
13 Dec 11 |
nicklas |
93 |
<div class="content" > |
5907 |
13 Dec 11 |
nicklas |
94 |
<table class="fullform input100 bottomborder smaller"> |
4573 |
10 Oct 08 |
martin |
95 |
<tr> |
5907 |
13 Dec 11 |
nicklas |
96 |
<th>New owner</th> |
4573 |
10 Oct 08 |
martin |
97 |
<td> |
4573 |
10 Oct 08 |
martin |
98 |
<base:select |
4573 |
10 Oct 08 |
martin |
99 |
id="owner_id" |
4573 |
10 Oct 08 |
martin |
100 |
clazz="selectionlist" |
4573 |
10 Oct 08 |
martin |
101 |
required="true" |
4573 |
10 Oct 08 |
martin |
102 |
current="<%=defaultOwner%>" |
4573 |
10 Oct 08 |
martin |
103 |
recent="<%=recentUsers%>" |
4573 |
10 Oct 08 |
martin |
104 |
newitem="true" |
4573 |
10 Oct 08 |
martin |
105 |
/> |
4573 |
10 Oct 08 |
martin |
106 |
</td> |
4573 |
10 Oct 08 |
martin |
107 |
</tr> |
5907 |
13 Dec 11 |
nicklas |
108 |
<tr class="dynamic"> |
5907 |
13 Dec 11 |
nicklas |
109 |
<th></th> |
5907 |
13 Dec 11 |
nicklas |
110 |
<td></td> |
5907 |
13 Dec 11 |
nicklas |
111 |
</tr> |
4573 |
10 Oct 08 |
martin |
112 |
</table> |
4573 |
10 Oct 08 |
martin |
113 |
</div> |
4573 |
10 Oct 08 |
martin |
114 |
</form> |
5907 |
13 Dec 11 |
nicklas |
115 |
|
5907 |
13 Dec 11 |
nicklas |
116 |
<base:buttongroup subclass="dialogbuttons"> |
6181 |
22 Oct 12 |
nicklas |
117 |
<base:button id="btnSave" title="Ok" /> |
6181 |
22 Oct 12 |
nicklas |
118 |
<base:button id="close" title="Cancel" /> |
5907 |
13 Dec 11 |
nicklas |
119 |
</base:buttongroup> |
4573 |
10 Oct 08 |
martin |
120 |
</base:body> |
4573 |
10 Oct 08 |
martin |
121 |
</base:page> |
4573 |
10 Oct 08 |
martin |
122 |
<% |
4573 |
10 Oct 08 |
martin |
123 |
} |
4573 |
10 Oct 08 |
martin |
124 |
finally |
4573 |
10 Oct 08 |
martin |
125 |
{ |
4573 |
10 Oct 08 |
martin |
126 |
if (dc != null) dc.close(); |
4573 |
10 Oct 08 |
martin |
127 |
} |
4573 |
10 Oct 08 |
martin |
128 |
%> |