source: trunk/www/views/reporters/view_reporter.jsp @ 4076

Last change on this file since 4076 was 4076, checked in by Martin Svensson, 14 years ago

Fixes #879 Add column holding the filename of last file used for updating reporter annotations. The documentation, reporter importer plugins and web client are now also updated to support this new column.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 7.8 KB
Line 
1<%-- $Id: view_reporter.jsp 4076 2008-01-11 15:16:30Z martin $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg
4  Copyright (C) 2006 Johan Enell, Jari Hakkinen, Nicklas Nordborg, Martin Svensson
5  Copyright (C) 2007 Nicklas Nordborg
6
7  This file is part of BASE - BioArray Software Environment.
8  Available at http://base.thep.lu.se/
9
10  BASE is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14
15  BASE is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU General Public License for more details.
19
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330,
23  Boston, MA  02111-1307, USA.
24  ------------------------------------------------------------------
25
26  @author Nicklas
27  @version 2.0
28--%>
29<%@ page session="false"
30  import="net.sf.basedb.core.SessionControl"
31  import="net.sf.basedb.core.DbControl"
32  import="net.sf.basedb.core.SystemItems"
33  import="net.sf.basedb.core.Item"
34  import="net.sf.basedb.core.ItemContext"
35  import="net.sf.basedb.core.Permission"
36  import="net.sf.basedb.core.ExtendedProperties"
37  import="net.sf.basedb.core.ExtendedProperty"
38  import="net.sf.basedb.core.Type"
39  import="net.sf.basedb.core.Reporter"
40  import="net.sf.basedb.core.ReporterType"
41  import="net.sf.basedb.core.data.ReporterData"
42  import="net.sf.basedb.core.ItemQuery"
43  import="net.sf.basedb.core.ItemResultIterator"
44  import="net.sf.basedb.core.PermissionDeniedException"
45  import="net.sf.basedb.core.PluginDefinition"
46  import="net.sf.basedb.core.plugin.GuiContext"
47  import="net.sf.basedb.core.plugin.Plugin"
48  import="net.sf.basedb.core.query.Orders"
49  import="net.sf.basedb.core.query.Hql"
50  import="net.sf.basedb.clients.web.Base"
51  import="net.sf.basedb.clients.web.util.HTML"
52  import="net.sf.basedb.util.Values"
53  import="net.sf.basedb.util.formatter.Formatter"
54  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
55  import="java.util.Date"
56  import="java.util.Map"
57  import="java.util.List"
58%>
59<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
60<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
61<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
62<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
63<%!
64  private static final Item itemType = Item.REPORTER;
65  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
66%>
67<%
68final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
69final String ID = sc.getId();
70final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
71final int itemId = cc.getId();
72final float scale = Base.getScale(sc);
73final DbControl dc = sc.newDbControl();
74try
75{
76  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
77
78  String title = null;
79  ReporterData reporter = Reporter.getById(dc, itemId);
80 
81  final boolean writePermission = sc.hasPermission(Permission.WRITE, itemType);
82  final boolean deletePermission = sc.hasPermission(Permission.DELETE, itemType);
83  Formatter<Date> dateFormatter = FormatterFactory.getDateTimeFormatter(sc);
84  %>
85
86  <base:page title="<%=title%>">
87  <base:head scripts="tabcontrol.js" styles="toolbar.css,headertabcontrol.css,path.css">
88    <script language="JavaScript">
89    function editItem()
90    {
91      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
92    }
93    function deleteItem()
94    {
95      if (confirm('This can\'t be undone. Continue?'))
96      {
97        location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&item_id=<%=itemId%>');
98      }
99    }
100    function runPlugin(cmd)
101    {
102      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&item_id=<%=itemId%>', 'RunPlugin'+cmd, 740, 540);
103    }
104    </script>
105  </base:head>
106  <base:body>
107    <p>
108    <p:path>
109      <p:pathelement title="Reporters" href="<%="index.jsp?ID="+ID%>" />
110      <p:pathelement title="<%=HTML.encodeTags(reporter.getName())%>" />
111    </p:path>
112   
113    <t:tabcontrol id="main" active="properties">
114    <t:tab id="properties" title="Properties">
115 
116    <tbl:toolbar
117      >
118      <tbl:button 
119        disabled="<%=writePermission ? false : true%>" 
120        image="<%=writePermission ? "edit.gif" : "edit_disabled.gif"%>" 
121        onclick="editItem()" 
122        title="Edit&hellip;" 
123        tooltip="<%=writePermission ? "Edit this reporter" : "You do not have permission to edit this reporter"%>" 
124      />
125      <tbl:button 
126        disabled="<%=deletePermission ? false : true%>" 
127        image="<%=deletePermission ? "delete.gif" : "delete_disabled.gif"%>" 
128        onclick="deleteItem()" 
129        title="Delete&hellip;" 
130        tooltip="<%=deletePermission ? "Delete this reporter" : "You do not have permission to delete this reporter"%>" 
131      />
132      <tbl:button 
133        image="import.gif" 
134        onclick="runPlugin('ImportItem')" 
135        title="Import&hellip;" 
136        tooltip="Import data" 
137        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
138      />
139      <tbl:button 
140        image="export.gif" 
141        onclick="runPlugin('ExportItem')" 
142        title="Export&hellip;" 
143        tooltip="Export data" 
144        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
145      />
146      <tbl:button 
147        image="runplugin.gif" 
148        onclick="runPlugin('RunPlugin')" 
149        title="Run plugin&hellip;" 
150        tooltip="Run a plugin" 
151        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
152      />
153      <tbl:button
154        image="help.gif"
155        onclick="<%="Main.openHelp('" + ID +"', 'reporter.view.properties')"%>"
156        title="Help&hellip;"
157        tooltip="Get help about this page"
158      />
159      </tbl:toolbar>
160    <div class="boxedbottom">
161      <div class="itemstatus">Permissions on this item:
162        <i>
163          <%=sc.hasPermission(Permission.READ, itemType) ? "Read" : ""%>
164          <%=sc.hasPermission(Permission.USE, itemType) ? ", Use" : ""%>
165          <%=sc.hasPermission(Permission.WRITE, itemType) ? ", Write" : ""%>
166          <%=sc.hasPermission(Permission.DELETE, itemType) ? ", Delete" : ""%>         
167        </i>       
168      <table class="form" cellspacing=0>
169      <tr>
170        <td class="prompt">Name</td>
171        <td><%=HTML.encodeTags(reporter.getName())%></td>
172      </tr>
173      <tr>
174        <td class="prompt">External ID</td>
175        <td><%=HTML.encodeTags(reporter.getExternalId())%></td>
176      </tr>
177      <tr>
178        <td class="prompt">Type</td>
179        <td><base:propertyvalue dbcontrol="<%=dc%>" item="<%=reporter%>" property="reporterType" /></td>
180      </tr>
181      <tr>
182        <td class="prompt">Gene symbol</td>
183        <td><%=HTML.encodeTags(reporter.getSymbol())%></td>
184      </tr>
185      <tr valign="top">
186        <td class="prompt">Description</td>
187        <td><%=HTML.niceFormat(reporter.getDescription())%></td>
188      </tr>
189      <tr>
190        <td class="prompt">Last update</td>
191        <td><%=dateFormatter.format(reporter.getLastUpdate())%></td>
192      </tr>
193      <tr>
194        <td class="prompt">Last source</td>
195        <td><%=HTML.niceFormat(reporter.getLastSource())%></td>
196      </tr>
197      </table>
198     
199      <h4>Extended properties</h4>
200      <table class="form" cellspacing=0>
201        <%
202        List<ExtendedProperty> reporterProperties = ExtendedProperties.getProperties("ReporterData");
203        if (reporterProperties != null)
204        {
205          boolean needsTr = true;
206          for (ExtendedProperty ep : reporterProperties)
207          {
208            String name = ep.getName();
209            Formatter f = FormatterFactory.getExtendedPropertyFormatter(sc, ep);
210            String value = f.format(reporter.getExtended(name));
211            %>
212              <%=needsTr ? "<tr valign=\"top\">" : "" %>
213              <td class="prompt"><%=HTML.encodeTags(ep.getTitle())%></td>
214              <td><%=value%></td>
215              <td>&nbsp;&nbsp;</td>
216              <%=needsTr ? "" : "</tr>"%>
217            <%
218            needsTr = !needsTr;
219          }
220          %>
221          <%=needsTr ? "" : "</tr>"%>
222          <%
223        }
224        %>
225      </table>
226    </div>
227   
228      </t:tab>
229      </t:tabcontrol>
230
231
232  </base:body>
233  </base:page>
234  <%
235}
236finally
237{
238  if (dc != null) dc.close();
239}
240
241%>
Note: See TracBrowser for help on using the repository browser.