source: trunk/www/admin/clients/help/view_help.jsp @ 5941

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

References #1655: GUI improvements

View pages for all items in the Adminstrate menu.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 7.3 KB
Line 
1<%-- $Id: view_help.jsp 5941 2012-02-01 13:26:23Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson
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.0
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.Item"
30  import="net.sf.basedb.core.ItemContext"
31  import="net.sf.basedb.core.Permission"
32  import="net.sf.basedb.core.Client"
33  import="net.sf.basedb.core.Help"
34  import="net.sf.basedb.core.PermissionDeniedException"
35  import="net.sf.basedb.core.PluginDefinition"
36  import="net.sf.basedb.core.data.RawData"
37  import="net.sf.basedb.core.plugin.GuiContext"
38  import="net.sf.basedb.core.plugin.Plugin"
39  import="net.sf.basedb.clients.web.Base"
40  import="net.sf.basedb.clients.web.PermissionUtil"
41  import="net.sf.basedb.clients.web.util.HTML"
42  import="net.sf.basedb.util.Values"
43  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
44  import="net.sf.basedb.clients.web.extensions.JspContext"
45  import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer"
46  import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil"
47  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
48  import="java.util.Date"
49  import="java.util.Map"
50  import="java.util.Set"
51%>
52<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
53<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
54<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %>
55<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
56<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %>
57<%!
58  private static final Item itemType = Item.HELP;
59  private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM);
60%>
61<%
62final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
63final String ID = sc.getId();
64final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
65final int itemId = cc.getId();
66final float scale = Base.getScale(sc);
67final DbControl dc = sc.newDbControl();
68try
69{
70  Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext);
71
72  String title = null;
73  final Help help = Help.getById(dc, itemId);
74  final Client client = help.getClient();
75  final int clientId = client.getId();
76
77  final boolean writePermission = help.hasPermission(Permission.WRITE);
78  final boolean deletePermission = help.hasPermission(Permission.DELETE);
79  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, help);
80  ExtensionsInvoker invoker = ToolbarUtil.useExtensions(jspContext);
81  %>
82  <base:page title="<%=title%>">
83  <base:head scripts="table.js,tabcontrol.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css">
84    <ext:scripts context="<%=jspContext%>" />
85    <ext:stylesheets context="<%=jspContext%>" />
86    <script language="JavaScript">
87    function editItem()
88    {
89      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, true);
90    }
91    function deleteItem()
92    {
93      if (confirm('This can\'t be undone. Continue?'))
94      {
95        location.replace('index.jsp?ID=<%=ID%>&cmd=DeleteItem&client_id=<%=clientId%>&item_id=<%=itemId%>');
96      }
97    }
98    function runPlugin(cmd)
99    {
100      Main.openPopup('index.jsp?ID=<%=ID%>&cmd='+cmd+'&client_id=<%=clientId%>&item_id=<%=itemId%>', 'RunPlugin'+cmd, 750, 500);
101    }
102    </script>
103  </base:head>
104  <base:body>
105    <p:path><p:pathelement 
106      title="Client applications" href="<%="../index.jsp?ID="+ID%>" 
107      /><p:pathelement 
108        title="<%=HTML.encodeTags(client.getName())%>" 
109        href="<%="index.jsp?ID="+ID+"&client_id="+clientId%>" 
110      /><p:pathelement title="<%=HTML.encodeTags(help.getName())%>" 
111      /></p:path>
112   
113    <t:tabcontrol 
114      id="main" 
115      subclass="content mastertabcontrol" 
116      active="properties">
117    <t:tab id="properties" title="Properties">
118      <div>
119      <table class="fullform bottomborder">
120      <tr>
121        <th class="itemstatus"></th>
122        <td style="padding: 0px;">
123          <tbl:toolbar subclass="bottomborder">
124            <tbl:button 
125              disabled="<%=writePermission ? false : true%>" 
126              image="edit.gif" 
127              onclick="editItem()" 
128              title="Edit&hellip;" 
129              tooltip="<%=writePermission ? "Edit this help text" : "You do not have permission to edit this help text"%>" 
130            />
131            <tbl:button 
132              disabled="<%=deletePermission ? false : true%>" 
133              image="delete.gif" 
134              onclick="deleteItem()" 
135              title="Delete"
136              tooltip="<%=deletePermission ? "Delete this help text" : "You do not have permission to event this help text"%>" 
137            />
138            <tbl:button 
139              image="import.gif" 
140              onclick="runPlugin('ImportItem')" 
141              title="Import&hellip;" 
142              tooltip="Import data" 
143              visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
144            />
145            <tbl:button 
146              image="export.gif" 
147              onclick="runPlugin('ExportItem')" 
148              title="Export&hellip;" 
149              tooltip="Export data" 
150              visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
151            />
152            <tbl:button 
153              image="runplugin.gif" 
154              onclick="runPlugin('RunPlugin')" 
155              title="Run plugin&hellip;" 
156              tooltip="Run a plugin" 
157              visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
158            />
159            <tbl:button
160              image="help.png"
161              onclick="<%="Main.openHelp('" + ID + "', '"+HTML.javaScriptEncode(help.getExternalId())+"')"%>"
162              title="Preview&hellip;"
163              tooltip="Check how this help will look like when viewed by the users"
164            />
165            <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
166              wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
167            <tbl:button
168              image="help.png"
169              onclick="<%="Main.openHelp('" + ID +"', 'help.view.properties')"%>"
170              title="Help&hellip;"
171              tooltip="Get help about this page"
172            />
173          </tbl:toolbar>
174        </td>
175      </tr>
176      <tr>
177        <th>Name</th>
178        <td><%=HTML.encodeTags(help.getName())%></td>
179      </tr>
180      <tr>
181        <th>External ID</th>
182        <td><%=help.getExternalId()%></td>
183      </tr>
184      <tr>
185        <th>Permissions</th>
186        <td><%=PermissionUtil.getFullPermissionNames(help)%></td>
187      </tr>
188      <tr class="big">
189        <th>Description</th>
190        <td><%=HTML.formatLineBreaks(HTML.encodeTags(help.getDescription()))%></td>
191      </tr>
192      </table>
193      </div>
194      <jsp:include page="../../../common/anytoany/list_anytoany.jsp">
195        <jsp:param name="ID" value="<%=ID%>" />
196        <jsp:param name="item_type" value="<%=itemType.name()%>" />
197        <jsp:param name="item_id" value="<%=itemId%>" />
198        <jsp:param name="title" value="Other items related to this help" />
199      </jsp:include>
200    </t:tab>
201    </t:tabcontrol>
202  </base:body>
203  </base:page>
204  <%
205}
206finally
207{
208  if (dc != null) dc.close();
209}
210
211%>
Note: See TracBrowser for help on using the repository browser.