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

Last change on this file since 2918 was 2918, checked in by Nicklas Nordborg, 17 years ago

References #348: Take ownership of items

Implemented on all pages in the "View" menu.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 8.7 KB
Line 
1<%-- $Id: view_reporterlist.jsp 2918 2006-11-15 11:21:13Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 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 modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  BASE is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA. 
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.SystemItems"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.Permission"
34  import="net.sf.basedb.core.ReporterList"
35  import="net.sf.basedb.core.User"
36  import="net.sf.basedb.core.RawDataType"
37  import="net.sf.basedb.core.PermissionDeniedException"
38  import="net.sf.basedb.core.PluginDefinition"
39  import="net.sf.basedb.core.plugin.GuiContext"
40  import="net.sf.basedb.core.plugin.Plugin"
41  import="net.sf.basedb.clients.web.Base"
42  import="net.sf.basedb.clients.web.PermissionUtil"
43  import="net.sf.basedb.clients.web.util.HTML"
44  import="net.sf.basedb.util.Values"
45  import="java.util.List"
46  import="java.util.Map"
47%>
48<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
49<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
50<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
51<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
52<%!
53  private static final Item itemType = Item.REPORTERLIST;
54  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
55%>
56<%
57final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
58final String ID = sc.getId();
59final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
60final int itemId = cc.getId();
61final float scale = Base.getScale(sc);
62final DbControl dc = sc.newDbControl();
63try
64{
65  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
66
67  String title = null;
68  final ReporterList reporterList = ReporterList.getById(dc, itemId);
69 
70  final boolean writePermission = reporterList.hasPermission(Permission.WRITE);
71  final boolean deletePermission = reporterList.hasPermission(Permission.DELETE);
72  final boolean sharePermission = reporterList.hasPermission(Permission.SET_PERMISSION);
73  final boolean setOwnerPermission = reporterList.hasPermission(Permission.SET_OWNER);
74  final boolean isOwner = reporterList.isOwner();
75  %>
76  <base:page title="<%=title%>">
77  <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css">
78    <script language="JavaScript">
79    function editItem()
80    {
81      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
82    }
83    function shareItem()
84    {
85      Main.openPopup('index.jsp?ID=<%=ID%>&cmd=ShareItem&item_id=<%=itemId%>', 'ShareReporterList', 500, 400);
86    }
87    function deleteItem()
88    {
89      location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
90    }
91    function restoreItem()
92    {
93      location.replace('index.jsp?ID=<%=ID%>&cmd=RestoreItem&item_id=<%=itemId%>');
94    }
95    function takeOwnership()
96    {
97      if (confirm('Are you sure that you want to take ownership of this item? It can\'t be undone.'))
98      {
99        location.replace('index.jsp?ID=<%=ID%>&cmd=TakeOwnershipOfItem&item_id=<%=itemId%>');
100      }
101    }
102    function runPlugin(cmd)
103    {
104      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
105    }
106    function viewReporters()
107    {
108      location.href = 'reporters/index.jsp?ID=<%=ID%>&cmd=List&reporterlist_id=<%=itemId%>';
109    }
110    function switchTab(tabControlId, tabId)
111    {
112      if (tabId == 'reporters')
113      {
114        viewReporters();
115      }
116      else
117      {
118        TabControl.setActiveTab(tabControlId, tabId);
119      }
120    }
121    </script>
122  </base:head>
123  <base:body>
124    <p>
125    <p:path>
126      <p:pathelement title="Reporter lists" href="<%="index.jsp?ID="+ID%>" />
127      <p:pathelement title="<%=HTML.encodeTags(reporterList.getName())%>" />
128    </p:path>
129   
130    <t:tabcontrol id="main" active="properties" switch="switchTab">
131    <t:tab id="properties" title="Properties">
132    <tbl:toolbar
133      >
134      <tbl:button 
135        disabled="<%=writePermission ? false : true%>" 
136        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
137        onclick="editItem()" 
138        title="Edit&hellip;" 
139        tooltip="<%=writePermission ? "Edit this reporter list" : "You do not have permission to edit this reporter list"%>" 
140      />
141      <tbl:button 
142        disabled="<%=deletePermission ? false : true%>" 
143        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
144        onclick="deleteItem()" 
145        title="Delete"
146        visible="<%=!reporterList.isRemoved()%>"
147        tooltip="<%=deletePermission ? "Delete this reporter list" : "You do not have permission to delete this reporter list"%>" 
148      />
149      <tbl:button 
150        disabled="<%=writePermission ? false : true%>" 
151        image="<%=writePermission ? "restore.gif" : "restore_disabled.gif"%>" 
152        onclick="restoreItem()" 
153        title="Restore"
154        visible="<%=reporterList.isRemoved()%>"
155        tooltip="<%=writePermission ? "Restore this reporter list" : "You do not have permission to restore this reporter list"%>" 
156      />
157      <tbl:button 
158        disabled="<%=sharePermission ? false : true%>"
159        image="<%=sharePermission ? "share.gif" : "share_disabled.gif"%>"
160        onclick="shareItem()" 
161        title="Share&hellip;" 
162        tooltip="<%=sharePermission ? "Share this reporter list to other user, groups and projects" : "You do not have permission to share this formula"%>"
163      />
164      <tbl:button 
165        disabled="<%=setOwnerPermission ? false : true%>"
166        image="<%=setOwnerPermission ? "take_ownership.png" : "take_ownership_disabled.png"%>"
167        onclick="takeOwnership()" 
168        title="Take ownership&hellip;"
169        visible="<%=!isOwner%>"
170        tooltip="<%=setOwnerPermission ? "Take ownership of this item" : "You do not have permission to take ownership of this item"%>"
171      />
172      <tbl:button 
173        image="import.gif" 
174        onclick="runPlugin('ImportItem')" 
175        title="Import&hellip;" 
176        tooltip="Import data" 
177        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
178      />
179      <tbl:button 
180        image="export.gif" 
181        onclick="runPlugin('ExportItem')" 
182        title="Export&hellip;" 
183        tooltip="Export data" 
184        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
185      />
186      <tbl:button 
187        image="runplugin.gif" 
188        onclick="runPlugin('RunPlugin')" 
189        title="Run plugin&hellip;" 
190        tooltip="Run a plugin" 
191        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
192      />
193      <tbl:button
194        image="help.gif"
195        onclick="<%="Main.openHelp('" + ID +"', 'reporterlist.view.properties')"%>"
196        title="Help&hellip;"
197        tooltip="Get help about this page"
198      />
199      </tbl:toolbar>
200    <div class="boxedbottom">
201      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(reporterList)%></i></div>
202      <%
203      if (reporterList.isRemoved() || reporterList.isShared())
204      {
205        %>
206        <div class="itemstatus">
207          <base:icon image="deleted.gif" 
208            visible="<%=reporterList.isRemoved()%>"> This item has been flagged for deletion<br></base:icon>
209          <base:icon image="shared.gif" 
210            visible="<%=reporterList.isShared()%>"> This item is shared to other user, groups and/or projects</base:icon>
211        </div>
212        <%
213      }
214      %>
215      <table class="form" cellspacing=0>
216      <tr>
217        <td class="prompt">Name</td>
218        <td><%=HTML.encodeTags(reporterList.getName())%></td>
219      </tr>
220      <tr>
221        <td class="prompt">External ID</td>
222        <td><%=HTML.encodeTags(reporterList.getExternalId())%></td>
223      </tr>
224      <tr>
225        <td class="prompt"># of reporters</td>
226        <td><%=reporterList.getReporterScores().count(dc)%></td>
227      </tr>
228      <tr>
229        <td class="prompt">Experiment</td>
230        <td><base:propertyvalue item="<%=reporterList%>" property="experiment" />
231      <tr>
232        <td class="prompt">Owner</td>
233        <td><base:propertyvalue item="<%=reporterList%>" property="owner" /></td>
234      </tr>
235      <tr>
236        <td class="prompt">Description</td>
237        <td><%=HTML.niceFormat(reporterList.getDescription())%></td>
238      </tr>
239      </table>
240
241    </div>
242    </t:tab>
243   
244    <t:tab id="reporters" title="Reporters" 
245      tooltip="List the reporters in this reporter list" />
246   
247    </t:tabcontrol>
248
249  </base:body>
250  </base:page>
251  <%
252}
253finally
254{
255  if (dc != null) dc.close();
256}
257
258%>
Note: See TracBrowser for help on using the repository browser.