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

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

References #1655: GUI improvements

  • Fixes rest of view pages in biomaterials menu.
  • Use SVG filter to make disabled button images grayscale.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 7.1 KB
Line 
1<%-- $Id: view_help.jsp 5937 2012-01-27 11:00:26Z 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>
106    <p:path>
107      <p:pathelement title="Client applications" href="<%="../index.jsp?ID="+ID%>" />
108      <p:pathelement 
109        title="<%=HTML.encodeTags(client.getName())%>" 
110        href="<%="index.jsp?ID="+ID+"&client_id="+clientId%>" />
111      <p:pathelement title="<%=HTML.encodeTags(help.getName())%>" />
112    </p:path>
113   
114    <t:tabcontrol id="main" active="properties">
115    <t:tab id="properties" title="Properties">
116
117    <tbl:toolbar
118      >
119      <tbl:button 
120        disabled="<%=writePermission ? false : true%>" 
121        image="edit.gif" 
122        onclick="editItem()" 
123        title="Edit&hellip;" 
124        tooltip="<%=writePermission ? "Edit this help text" : "You do not have permission to edit this help text"%>" 
125      />
126      <tbl:button 
127        disabled="<%=deletePermission ? false : true%>" 
128        image="delete.gif" 
129        onclick="deleteItem()" 
130        title="Delete"
131        tooltip="<%=deletePermission ? "Delete this help text" : "You do not have permission to event this help text"%>" 
132      />
133      <tbl:button 
134        image="import.gif" 
135        onclick="runPlugin('ImportItem')" 
136        title="Import&hellip;" 
137        tooltip="Import data" 
138        visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>"
139      />
140      <tbl:button 
141        image="export.gif" 
142        onclick="runPlugin('ExportItem')" 
143        title="Export&hellip;" 
144        tooltip="Export data" 
145        visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>"
146      />
147      <tbl:button 
148        image="runplugin.gif" 
149        onclick="runPlugin('RunPlugin')" 
150        title="Run plugin&hellip;" 
151        tooltip="Run a plugin" 
152        visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>"
153      />
154      <tbl:button
155        image="help.png"
156        onclick="<%="Main.openHelp('" + ID + "', '"+HTML.javaScriptEncode(help.getExternalId())+"')"%>"
157        title="Preview&hellip;"
158        tooltip="Check how this help will look like when viewed by the users"
159      />
160      <ext:render extensions="<%=invoker%>" context="<%=jspContext%>" 
161        wrapper="<%=new PrefixSuffixRenderer(jspContext, "<td>", "</td>") %>"/>
162      <tbl:button
163        image="help.png"
164        onclick="<%="Main.openHelp('" + ID +"', 'help.view.properties')"%>"
165        title="Help&hellip;"
166        tooltip="Get help about this page"
167      />
168      </tbl:toolbar>
169    <div class="boxedbottom">
170      <div class="itemstatus">Permissions on this item: <i><%=PermissionUtil.getFullPermissionNames(help)%></i></div>
171      <table class="form" cellspacing=0>
172      <tr>
173        <td class="prompt">Name</td>
174        <td><%=HTML.encodeTags(help.getName())%></td>
175      </tr>
176      <tr>
177        <td class="prompt">External ID</td>
178        <td><%=help.getExternalId()%></td>
179      </tr>
180      <tr >
181        <td class="prompt">Description</td>
182        <td><%=HTML.formatLineBreaks(HTML.encodeTags(help.getDescription()))%></td>
183      </tr>
184      </table>
185      <jsp:include page="../../../common/anytoany/list_anytoany.jsp">
186        <jsp:param name="ID" value="<%=ID%>" />
187        <jsp:param name="item_type" value="<%=itemType.name()%>" />
188        <jsp:param name="item_id" value="<%=itemId%>" />
189        <jsp:param name="title" value="Other items related to this help" />
190      </jsp:include>
191    </div>
192      </t:tab>
193      </t:tabcontrol>
194
195  </base:body>
196  </base:page>
197  <%
198}
199finally
200{
201  if (dc != null) dc.close();
202}
203
204%>
Note: See TracBrowser for help on using the repository browser.