source: trunk/www/views/reporterlists/view_reporterlist.jsp @ 5939

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

References #1655: GUI improvements

View pages for:

  • File server
  • Projects
  • Permission templates
  • Physical, derived and raw bioassays
  • Experiments, bioassay set
  • Formulas
  • Reporters
  • Reporter lists
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 12.0 KB
Line 
1<%-- $Id: view_reporterlist.jsp 5939 2012-01-30 14:42:18Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Nicklas Nordborg, Martin Svensson
4  Copyright (C) 2007 Martin Svensson
5 
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8 
9  BASE is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13 
14  BASE is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
22
23  @author Nicklas
24  @version 2.0
25--%>
26<%@ page pageEncoding="UTF-8" session="false"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.SystemItems"
30  import="net.sf.basedb.core.Group"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.ItemResultList"
34  import="net.sf.basedb.core.Permission"
35  import="net.sf.basedb.core.ReporterList"
36  import="net.sf.basedb.core.User"
37  import="net.sf.basedb.core.RawDataType"
38  import="net.sf.basedb.core.MultiPermissions"
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.clients.web.Base"
45  import="net.sf.basedb.clients.web.PermissionUtil"
46  import="net.sf.basedb.clients.web.util.HTML"
47  import="net.sf.basedb.util.Values"
48  import="net.sf.basedb.util.formatter.Formatter"
49  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
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.Date"
56  import="java.util.Collections"
57  import="java.util.List"
58  import="java.util.Map"
59  import="java.util.Set"
60%>
61<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
62<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
63<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
64<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
65<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
66<%!
67  private static final Item itemType = Item.REPORTERLIST;
68  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
69%>
70<%
71final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
72final String ID = sc.getId();
73final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
74final int itemId = cc.getId();
75final float scale = Base.getScale(sc);
76final DbControl dc = sc.newDbControl();
77try
78{
79  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
80  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
81
82  String title = null;
83  final ReporterList reporterList = ReporterList.getById(dc, itemId);
84 
85  final boolean writePermission = reporterList.hasPermission(Permission.WRITE);
86  final boolean deletePermission = reporterList.hasPermission(Permission.DELETE);
87  final boolean sharePermission = reporterList.hasPermission(Permission.SET_PERMISSION);
88  final boolean setOwnerPermission = reporterList.hasPermission(Permission.SET_OWNER);
89  final boolean isRemoved = reporterList.isRemoved();
90  final boolean isUsed = isRemoved && reporterList.isUsed();
91  final boolean deletePermanentlyPermission = deletePermission && !isUsed;
92  final boolean isOwner = reporterList.isOwner();
93  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, reporterList);
94  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
95  %>
96  <base:page title="<%=title%>">
97  <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css,table.css">
98    <ext:scripts context="<%=jspContext%>" />
99    <ext:stylesheets context="<%=jspContext%>" />
100    <script language="JavaScript">
101    function editItem()
102    {
103      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
104    }
105    function shareItem()
106    {
107      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareReporterList', 600, 400);
108    }
109    function deleteItem()
110    {
111      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
112    }
113    function restoreItem()
114    {
115      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
116    }
117    function deleteItemPermanently()
118    {
119      Main.deleteItemPermanently('<%=ID%>', true, '<%=itemType.name()%>', <%=itemId%>, '&callback=itemDeleted');
120    }
121    function itemDeleted()
122    {
123      Main.listItems('<%=ID%>', '<%=itemType.name()%>');
124    }
125    function showUsingItems()
126    {
127      Main.showUsingItems('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>);
128    }
129    function setOwner()
130    {
131      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=SetOwnerOfItem&item_id=<%=itemId%>', 'SetOwnerOfItem', 450, 300);
132    }
133    function runPlugin(cmd)
134    {
135      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);
136    }
137    function viewReporters()
138    {
139      location.href = 'reporters/index.jsp?ID=<%=ID%>&cmd=List&reporterlist_id=<%=itemId%>';
140    }
141    function switchTab(tabControlId, tabId)
142    {
143      if (tabId == 'reporters')
144      {
145        viewReporters();
146      }
147      else
148      {
149        TabControl.setActiveTab(tabControlId, tabId);
150      }
151    }
152    function merge(mergeType)
153    {
154      Main.openPopup('merge.jsp?ID=<%=ID%>&item_id=<%=itemId%>&mergeType='+mergeType, 'Union', 600, 400);
155    }
156    </script>
157  </base:head>
158  <base:body>
159    <p:path><p:pathelement
160      title="Reporter lists" href="<%="index.jsp?ID="+ID%>" 
161      /><p:pathelement title="<%=HTML.encodeTags(reporterList.getName())%>" 
162      /></p:path>
163   
164    <t:tabcontrol 
165      id="main" 
166      subclass="content mastertabcontrol" 
167      active="properties" switch="switchTab">
168    <t:tab id="properties" title="Properties">
169      <div>
170      <table class="fullform bottomborder">
171      <tr>
172        <th class="itemstatus">
173          <base:icon 
174            image="shared.gif" 
175            visible="<%=reporterList.isShared()%>"
176            tooltip="This item is shared to other users, groups and/or projects"
177          />
178          <base:icon 
179            image="deleted.gif"
180            onclick="deleteItemPermanently()"
181            tooltip="This item has been flagged for deletion. Click to delete it now."
182            enabled="<%=deletePermanentlyPermission %>"
183            visible="<%=isRemoved%>" 
184          />
185          <base:icon image="used.gif" 
186            onclick="showUsingItems()"
187            tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one"
188            visible="<%=isRemoved && isUsed%>" />
189        </th>
190        <td style="padding: 0px;">
191          <tbl:toolbar subclass="bottomborder">
192            <tbl:button 
193              disabled="<%=writePermission ? false : true%>" 
194              image="edit.gif" 
195              onclick="editItem()" 
196              title="Edit&hellip;" 
197              tooltip="<%=writePermission ? "Edit this reporter list" : "You do not have permission to edit this reporter list"%>" 
198            />
199            <tbl:button 
200              disabled="<%=deletePermission ? false : true%>" 
201              image="delete.gif" 
202              onclick="deleteItem()" 
203              title="Delete"
204              visible="<%=!reporterList.isRemoved()%>"
205              tooltip="<%=deletePermission ? "Delete this reporter list" : "You do not have permission to delete this reporter list"%>" 
206            />
207            <tbl:button 
208              disabled="<%=writePermission ? false : true%>" 
209              image="restore.gif" 
210              onclick="restoreItem()" 
211              title="Restore"
212              visible="<%=reporterList.isRemoved()%>"
213              tooltip="<%=writePermission ? "Restore this reporter list" : "You do not have permission to restore this reporter list"%>" 
214            />
215            <tbl:button 
216              disabled="<%=sharePermission ? false : true%>"
217              image="share.gif"
218              onclick="shareItem()" 
219              title="Share&hellip;" 
220              tooltip="<%=sharePermission ? "Share this reporter list to other user, groups and projects" : "You do not have permission to share this formula"%>"
221            />
222            <tbl:button 
223              disabled="<%=setOwnerPermission ? false : true%>"
224              image="take_ownership.png"
225              onclick="setOwner()" 
226              title="Set owner&hellip;"
227              tooltip="<%=setOwnerPermission ? "Change owner of this item" : "You do not have permission to change ownership of this item"%>"
228            />
229            <tbl:button
230              visible="<%=writePermission%>"
231              image="set_operations/union_small.png"
232              onclick="merge('union')"
233              title="Union&hellip;"
234              tooltip="Add reporters from other lists to this list"
235            />
236            <tbl:button
237              visible="<%=writePermission%>"
238              image="set_operations/intersection_small.png"
239              onclick="merge('intersection')"
240              title="Intersection&hellip;"
241              tooltip="Keep only reporters that are present in other lists"
242            />
243            <tbl:button
244              visible="<%=writePermission%>"
245              image="set_operations/complement_small.png"
246              onclick="merge('complement')"
247              title="Complement&hellip;"
248              tooltip="Remove reporters in other lists from this list"
249            />
250            <tbl:button 
251              image="import.gif" 
252              onclick="runPlugin('ImportItem')" 
253              title="Import&hellip;" 
254              tooltip="Import data" 
255              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
256            />
257            <tbl:button 
258              image="export.gif" 
259              onclick="runPlugin('ExportItem')" 
260              title="Export&hellip;" 
261              tooltip="Export data" 
262              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
263            />
264            <tbl:button 
265              image="runplugin.gif" 
266              onclick="runPlugin('RunPlugin')" 
267              title="Run plugin&hellip;" 
268              tooltip="Run a plugin" 
269              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
270            />
271            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
272              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
273            <tbl:button
274              image="help.png"
275              onclick="<%="Main.openHelp('" + ID +"', 'reporterlist.view.properties')"%>"
276              title="Help&hellip;"
277              tooltip="Get help about this page"
278            />
279          </tbl:toolbar>
280        </td>
281      </tr>
282      <tr>
283        <th>Name</th>
284        <td><%=HTML.encodeTags(reporterList.getName())%></td>
285      </tr>
286      <tr>
287        <th>Registered</th>
288        <td><%=dateFormatter.format(reporterList.getEntryDate())%></td>
289      </tr>
290      <tr>
291        <th>External ID</th>
292        <td><%=HTML.encodeTags(reporterList.getExternalId())%></td>
293      </tr>
294      <tr>
295        <th>Size</th>
296        <td><%=reporterList.getSize()%></td>
297      </tr>
298      <tr>
299        <th>Experiment</th>
300        <td><base:propertyvalue item="<%=reporterList%>" property="experiment" /></td>
301      </tr>
302      <tr>
303        <th>Owner</th>
304        <td><base:propertyvalue item="<%=reporterList%>" property="owner" /></td>
305      </tr>
306      <tr>
307        <th>Permissions</th>
308        <td><%=PermissionUtil.getFullPermissionNames(reporterList)%></td>
309      </tr>
310      <tr>
311        <th>Description</th>
312        <td><%=HTML.niceFormat(reporterList.getDescription())%></td>
313      </tr>
314      </table>
315      </div>
316      <jsp:include page="../../common/anytoany/list_anytoany.jsp">
317        <jsp:param name="ID" value="<%=ID%>" />
318        <jsp:param name="item_type" value="<%=itemType.name()%>" />
319        <jsp:param name="item_id" value="<%=itemId%>" />
320        <jsp:param name="title" value="Other items related to this reporter list" />
321      </jsp:include>
322      <jsp:include page="../../common/share/list_share.jsp">
323        <jsp:param name="ID" value="<%=ID%>" />
324        <jsp:param name="item_type" value="<%=itemType.name()%>" />
325        <jsp:param name="item_id" value="<%=itemId%>" />
326        <jsp:param name="title" value="Shared to" />
327      </jsp:include>
328    </t:tab>
329   
330    <t:tab id="reporters" title="Reporters" 
331      tooltip="List the reporters in this reporter list" />
332   
333    </t:tabcontrol>
334
335  </base:body>
336  </base:page>
337  <%
338}
339finally
340{
341  if (dc != null) dc.close();
342}
343
344%>
Note: See TracBrowser for help on using the repository browser.