source: trunk/www/biomaterials/lists/view_list.jsp @ 6261

Last change on this file since 6261 was 6261, checked in by Nicklas Nordborg, 10 years ago

References #1729 and #1730. Fixed for all biomaterial view pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 10.7 KB
Line 
1<%-- $Id: view_list.jsp 6261 2013-03-27 12:25:00Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2008 Nicklas Nordborg
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 3
11  of the License, or (at your option) any later version.
12
13  BASE is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with BASE. If not, see <http://www.gnu.org/licenses/>.
20  ------------------------------------------------------------------
21
22  @author Nicklas
23  @version 2.10
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.SessionControl"
27  import="net.sf.basedb.core.DbControl"
28  import="net.sf.basedb.core.SystemItems"
29  import="net.sf.basedb.core.Group"
30  import="net.sf.basedb.core.Include"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.ItemQuery"
34  import="net.sf.basedb.core.ItemResultList"
35  import="net.sf.basedb.core.Permission"
36  import="net.sf.basedb.core.BioMaterialList"
37  import="net.sf.basedb.core.MultiPermissions"
38  import="net.sf.basedb.core.User"
39  import="net.sf.basedb.core.PermissionDeniedException"
40  import="net.sf.basedb.core.PluginDefinition"
41  import="net.sf.basedb.core.plugin.GuiContext"
42  import="net.sf.basedb.core.plugin.Plugin"
43  import="net.sf.basedb.core.Project"
44  import="net.sf.basedb.core.query.Orders"
45  import="net.sf.basedb.core.query.Hql"
46  import="net.sf.basedb.clients.web.Base"
47  import="net.sf.basedb.clients.web.PermissionUtil"
48  import="net.sf.basedb.clients.web.util.HTML"
49  import="net.sf.basedb.util.Values"
50  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
51  import="net.sf.basedb.clients.web.extensions.JspContext"
52  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
53  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
54  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
55  import="java.util.Collections"
56  import="java.util.Map"
57  import="java.util.Set"
58%>
59<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
60<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
61<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
62<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
63<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
64<%!
65  private static final Item itemType = Item.BIOMATERIALLIST;
66  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
67%>
68<%
69final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
70final String ID = sc.getId();
71final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
72final int itemId = cc.getId();
73final String tab = Values.getStringOrNull(request.getParameter("tab"));
74final float scale = Base.getScale(sc);
75final DbControl dc = sc.newDbControl();
76try
77{
78  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
79
80  String title = null;
81  BioMaterialList list = BioMaterialList.getById(dc, itemId);
82 
83  final boolean writePermission = list.hasPermission(Permission.WRITE);
84  final boolean deletePermission = list.hasPermission(Permission.DELETE);
85  final boolean sharePermission = list.hasPermission(Permission.SET_PERMISSION);
86  final boolean usePermission = list.hasPermission(Permission.USE);
87  final boolean setOwnerPermission = list.hasPermission(Permission.SET_OWNER);
88  final boolean isRemoved = list.isRemoved();
89  final boolean isUsed = isRemoved && list.isUsed();
90  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
91  final boolean isOwner = list.isOwner();
92  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, list);
93  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
94  %>
95  <base:page title="<%=title%>" id="view-page">
96  <base:head scripts="table.js,tabcontrol-2.js,~lists.js" styles="table.css,toolbar.css,headertabcontrol.css,path.css">
97    <ext:scripts context="<%=jspContext%>" />
98    <ext:stylesheets context="<%=jspContext%>" />
99  </base:head>
100  <base:body>
101    <p:path><p:pathelement 
102      title="Biomaterial lists" href="<%="index.jsp?ID="+ID%>" 
103      /><p:pathelement title="<%=HTML.encodeTags(list.getName())%>"
104      /></p:path>
105    <div id="page-data" data-item-id="<%=itemId%>"></div>
106   
107    <t:tabcontrol 
108      id="main" 
109      subclass="content mastertabcontrol"
110      active="<%=tab%>">
111    <t:tab id="properties" title="Properties">
112      <div>
113      <table class="fullform bottomborder">
114      <tr>
115        <th class="itemstatus">
116          <base:icon 
117            image="shared.png" 
118            visible="<%=list.isShared()%>"
119            tooltip="This item is shared to other users, groups and/or projects"
120          />
121          <base:icon 
122            id="btnDeletePermanently"
123            image="deleted.png"
124            tooltip="This item has been flagged for deletion. Click to delete it now."
125            enabled="<%=deletePermanentlyPermission %>"
126            visible="<%=isRemoved%>" 
127          />
128          <base:icon 
129            id="btnUsingItems"
130            image="used.png" 
131            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
132            visible="<%=isRemoved && isUsed%>" />
133        </th>
134        <td style="padding: 0px;">
135          <tbl:toolbar subclass="bottomborder">
136            <tbl:button 
137              id="btnEdit"
138              disabled="<%=!writePermission%>" 
139              image="edit.png" 
140              title="Edit&hellip;" 
141              tooltip="<%=writePermission ? "Edit this list" : "You do not have permission to edit this list"%>" 
142            />
143            <tbl:button 
144              id="btnDelete"
145              disabled="<%=!deletePermission%>" 
146              image="delete.png" 
147              title="Delete"
148              visible="<%=!list.isRemoved()%>"
149              tooltip="<%=deletePermission ? "Delete this list" : "You do not have permission to delete this list"%>" 
150            />
151            <tbl:button 
152              id="btnRestore"
153              disabled="<%=!writePermission%>" 
154              image="restore.png" 
155              title="Restore"
156              visible="<%=list.isRemoved()%>"
157              tooltip="<%=writePermission ? "Restore this list" : "You do not have permission to restore this list"%>" 
158            />
159            <tbl:button 
160              id="btnShare"
161              disabled="<%=!sharePermission%>"
162              image="share.png"
163              title="Share&hellip;" 
164              tooltip="<%=sharePermission ? "Share this list to other user, groups and projects" : "You do not have permission to share this list"%>"
165            />
166            <tbl:button 
167              id="btnSetOwner"
168              disabled="<%=!setOwnerPermission%>"
169              image="take_ownership.png"
170              title="Set owner&hellip;"
171              tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
172            />
173            <tbl:button 
174              id="btnPlaceOnPlate"
175              image="place_on_plate.png" 
176              title="Place on plate&hellip;" 
177              tooltip="Place the biomaterial in this list on a bioplate" 
178              visible="<%=list.getMemberType() != Item.BIOSOURCE%>"
179            />
180            <tbl:button
181              id="btnMergeUnion"
182              data-merge-type="union"
183              visible="<%=writePermission%>"
184              image="set_operations/union_small.png"
185              title="Union&hellip;"
186              tooltip="Add items from other lists to this list"
187            />
188            <tbl:button
189              id="btnMergeIntersection"
190              data-merge-type="intersection"
191              visible="<%=writePermission%>"
192              image="set_operations/intersection_small.png"
193              title="Intersection&hellip;"
194              tooltip="Keep only items that are present in other lists"
195            />
196            <tbl:button
197              id="btnMergeComplement"
198              data-merge-type="complement"
199              visible="<%=writePermission%>"
200              image="set_operations/complement_small.png"
201              title="Complement&hellip;"
202              tooltip="Remove items found in other lists from this list"
203            />
204            <tbl:button 
205              id="btnImport"
206              image="import.png" 
207              data-plugin-type="IMPORT" 
208              title="Import&hellip;" 
209              tooltip="Import data" 
210              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
211            />
212            <tbl:button 
213              id="btnExport"
214              image="export.png"
215              data-plugin-type="EXPORT" 
216              title="Export&hellip;" 
217              tooltip="Export data" 
218              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
219            />
220            <tbl:button 
221              id="btnRunPlugin"
222              image="runplugin.png" 
223              data-plugin-type="OTHER" 
224              title="Run plugin&hellip;" 
225              tooltip="Run a plugin" 
226              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
227            />
228            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
229              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
230            <tbl:button
231              image="help.png"
232              subclass="auto-init"
233              data-auto-init="help"
234              data-help-id="biomateriallist.view.properties"
235              title="Help&hellip;"
236              tooltip="Get help about this page"
237            /> 
238          </tbl:toolbar>
239        </td>
240      </tr>
241      <tr>
242        <th>Name</th>
243        <td><%=HTML.encodeTags(list.getName())%></td>
244      </tr>
245      <tr>
246        <th>Member type</th>
247        <td><%=list.getMemberType()%></td>
248      </tr>
249      <tr>
250        <th>Size</th>
251        <td><%=list.getSize()%></td>
252      </tr>
253      <tr>
254        <th>External ID</th>
255        <td><%=HTML.encodeTags(list.getExternalId())%></td>
256      </tr>
257      <tr>
258        <th>Owner</th>
259        <td><base:propertyvalue item="<%=list%>" property="owner"/></td>
260      </tr>
261      <tr>
262        <th>Permissions</th>
263        <td><%=PermissionUtil.getFullPermissionNames(list)%></td>
264      </tr>
265      <tr>
266        <th>Description</th>
267        <td><%=HTML.niceFormat(list.getDescription())%></td>
268      </tr>
269      </table>
270      </div>
271
272      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
273        <jsp:param name="ID" value="<%=ID%>" />
274        <jsp:param name="item_type" value="<%=itemType.name()%>" />
275        <jsp:param name="item_id" value="<%=itemId%>" />
276        <jsp:param name="title" value="Other items related to this list" />
277      </jsp:include>
278      <jsp:include page="../../common/share/list_share.jsp">
279        <jsp:param name="ID" value="<%=ID%>" />
280        <jsp:param name="item_type" value="<%=itemType.name()%>" />
281        <jsp:param name="item_id" value="<%=itemId%>" />
282        <jsp:param name="title" value="Shared to" />
283      </jsp:include>
284    </t:tab>
285    <t:tab id="members" title="Members" />
286    <t:tab id="overview" title="Overview" 
287      tooltip="Display a tree overview of related items">
288      <jsp:include page="../../common/overview/overview.jsp">
289        <jsp:param name="item_type" value="<%=itemType.name()%>" />
290        <jsp:param name="item_id" value="<%=itemId%>" />
291        <jsp:param name="ID" value="<%=ID%>" />
292      </jsp:include>
293    </t:tab>     
294    </t:tabcontrol>
295
296  </base:body>
297  </base:page>
298  <%
299}
300finally
301{
302  if (dc != null) dc.close();
303}
304
305%>
Note: See TracBrowser for help on using the repository browser.