7407 |
05 Oct 17 |
nicklas |
1 |
<%-- $Id $ |
7407 |
05 Oct 17 |
nicklas |
2 |
------------------------------------------------------------------ |
7407 |
05 Oct 17 |
nicklas |
Copyright (C) 2017 Nicklas Nordborg |
7407 |
05 Oct 17 |
nicklas |
4 |
|
7407 |
05 Oct 17 |
nicklas |
5 |
This file is part of BASE - BioArray Software Environment. |
7407 |
05 Oct 17 |
nicklas |
6 |
Available at http://base.thep.lu.se/ |
7407 |
05 Oct 17 |
nicklas |
7 |
|
7407 |
05 Oct 17 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
7407 |
05 Oct 17 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
7407 |
05 Oct 17 |
nicklas |
10 |
as published by the Free Software Foundation; either version 3 |
7407 |
05 Oct 17 |
nicklas |
11 |
of the License, or (at your option) any later version. |
7407 |
05 Oct 17 |
nicklas |
12 |
|
7407 |
05 Oct 17 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
7407 |
05 Oct 17 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7407 |
05 Oct 17 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7407 |
05 Oct 17 |
nicklas |
16 |
GNU General Public License for more details. |
7407 |
05 Oct 17 |
nicklas |
17 |
|
7407 |
05 Oct 17 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
7407 |
05 Oct 17 |
nicklas |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7407 |
05 Oct 17 |
nicklas |
20 |
------------------------------------------------------------------ |
7407 |
05 Oct 17 |
nicklas |
21 |
|
7407 |
05 Oct 17 |
nicklas |
22 |
@author Nicklas |
7407 |
05 Oct 17 |
nicklas |
23 |
--%> |
7411 |
10 Oct 17 |
nicklas |
24 |
<%@page import="net.sf.basedb.util.HttpUtil"%> |
7407 |
05 Oct 17 |
nicklas |
25 |
<%@ page pageEncoding="UTF-8" session="false" |
7407 |
05 Oct 17 |
nicklas |
26 |
import="net.sf.basedb.core.SessionControl" |
7407 |
05 Oct 17 |
nicklas |
27 |
import="net.sf.basedb.core.DbControl" |
7407 |
05 Oct 17 |
nicklas |
28 |
import="net.sf.basedb.core.Item" |
7407 |
05 Oct 17 |
nicklas |
29 |
import="net.sf.basedb.core.Type" |
7407 |
05 Oct 17 |
nicklas |
30 |
import="net.sf.basedb.core.ItemContext" |
7407 |
05 Oct 17 |
nicklas |
31 |
import="net.sf.basedb.core.Permission" |
7407 |
05 Oct 17 |
nicklas |
32 |
import="net.sf.basedb.core.UserDevice" |
7407 |
05 Oct 17 |
nicklas |
33 |
import="net.sf.basedb.core.PermissionDeniedException" |
7407 |
05 Oct 17 |
nicklas |
34 |
import="net.sf.basedb.util.Values" |
7407 |
05 Oct 17 |
nicklas |
35 |
import="net.sf.basedb.clients.web.Base" |
7407 |
05 Oct 17 |
nicklas |
36 |
import="net.sf.basedb.clients.web.util.HTML" |
7407 |
05 Oct 17 |
nicklas |
37 |
import="net.sf.basedb.core.plugin.GuiContext" |
7407 |
05 Oct 17 |
nicklas |
38 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
7407 |
05 Oct 17 |
nicklas |
39 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
7407 |
05 Oct 17 |
nicklas |
40 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
41 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
7407 |
05 Oct 17 |
nicklas |
42 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
7407 |
05 Oct 17 |
nicklas |
43 |
import="java.util.List" |
7407 |
05 Oct 17 |
nicklas |
44 |
%> |
7407 |
05 Oct 17 |
nicklas |
45 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
7407 |
05 Oct 17 |
nicklas |
46 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
7407 |
05 Oct 17 |
nicklas |
47 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
7407 |
05 Oct 17 |
nicklas |
48 |
<% |
7407 |
05 Oct 17 |
nicklas |
49 |
final Item itemType = Item.USERDEVICE; |
7407 |
05 Oct 17 |
nicklas |
50 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
7407 |
05 Oct 17 |
nicklas |
51 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
7407 |
05 Oct 17 |
nicklas |
52 |
final int itemId = cc.getId(); |
7407 |
05 Oct 17 |
nicklas |
53 |
final String ID = sc.getId(); |
7407 |
05 Oct 17 |
nicklas |
54 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
55 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
7407 |
05 Oct 17 |
nicklas |
56 |
try |
7407 |
05 Oct 17 |
nicklas |
57 |
{ |
7407 |
05 Oct 17 |
nicklas |
58 |
if (itemId == 0) |
7407 |
05 Oct 17 |
nicklas |
59 |
{ |
7407 |
05 Oct 17 |
nicklas |
60 |
throw new PermissionDeniedException(Permission.CREATE, "device"); |
7407 |
05 Oct 17 |
nicklas |
61 |
} |
7411 |
10 Oct 17 |
nicklas |
62 |
UserDevice device = UserDevice.getById(dc, itemId); |
7411 |
10 Oct 17 |
nicklas |
63 |
device.checkPermission(Permission.WRITE); |
7411 |
10 Oct 17 |
nicklas |
64 |
cc.setObject("item", device); |
7411 |
10 Oct 17 |
nicklas |
65 |
String title = "Edit device -- " + HTML.encodeTags(device.getName()); |
7411 |
10 Oct 17 |
nicklas |
66 |
String summary = HTML.encodeTags(HttpUtil.getSummaryOfUserAgent(device.getUserAgent())); |
7407 |
05 Oct 17 |
nicklas |
67 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), device); |
7604 |
25 Feb 19 |
nicklas |
68 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
7407 |
05 Oct 17 |
nicklas |
69 |
%> |
7407 |
05 Oct 17 |
nicklas |
70 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
7407 |
05 Oct 17 |
nicklas |
71 |
<base:head scripts="tabcontrol-2.js,~devices.js" styles="tabcontrol.css"> |
7407 |
05 Oct 17 |
nicklas |
72 |
<ext:scripts context="<%=jspContext%>" /> |
7407 |
05 Oct 17 |
nicklas |
73 |
<ext:stylesheets context="<%=jspContext%>" /> |
7407 |
05 Oct 17 |
nicklas |
74 |
</base:head> |
7407 |
05 Oct 17 |
nicklas |
75 |
<base:body > |
7407 |
05 Oct 17 |
nicklas |
76 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
7407 |
05 Oct 17 |
nicklas |
77 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="device"> |
7407 |
05 Oct 17 |
nicklas |
78 |
<input type="hidden" name="cmd" value="UpdateItem"> |
7407 |
05 Oct 17 |
nicklas |
79 |
|
7407 |
05 Oct 17 |
nicklas |
80 |
<t:tabcontrol id="settings" |
7407 |
05 Oct 17 |
nicklas |
81 |
subclass="content dialogtabcontrol" |
7407 |
05 Oct 17 |
nicklas |
82 |
position="bottom" remember="<%=device != null%>" |
7407 |
05 Oct 17 |
nicklas |
83 |
extensions="<%=invoker%>"> |
7407 |
05 Oct 17 |
nicklas |
84 |
<t:tab id="info" title="Device" helpid="device.edit"> |
7407 |
05 Oct 17 |
nicklas |
85 |
<table class="fullform input100"> |
7407 |
05 Oct 17 |
nicklas |
86 |
<tr> |
7407 |
05 Oct 17 |
nicklas |
87 |
<th>Name</th> |
7407 |
05 Oct 17 |
nicklas |
88 |
<td><input class="text required auto-init" data-auto-init="focus" |
7407 |
05 Oct 17 |
nicklas |
89 |
type="text" name="name" |
7407 |
05 Oct 17 |
nicklas |
90 |
value="<%=HTML.encodeTags(device.getName())%>" |
7407 |
05 Oct 17 |
nicklas |
91 |
maxlength="<%=UserDevice.MAX_NAME_LENGTH%>"></td> |
7407 |
05 Oct 17 |
nicklas |
92 |
<td></td> |
7407 |
05 Oct 17 |
nicklas |
93 |
</tr> |
7411 |
10 Oct 17 |
nicklas |
94 |
<tr> |
7411 |
10 Oct 17 |
nicklas |
95 |
<th class="subprompt">User-agent</th> |
7411 |
10 Oct 17 |
nicklas |
96 |
<td> |
7411 |
10 Oct 17 |
nicklas |
97 |
<span title="<%=HTML.encodeTags(device.getUserAgent())%>"><%=summary %></span> |
7411 |
10 Oct 17 |
nicklas |
98 |
[<span id="use-user-agent" class="link" title="Use this as the name" data-summary="<%=summary%>">copy</span>] |
7411 |
10 Oct 17 |
nicklas |
99 |
</td> |
7411 |
10 Oct 17 |
nicklas |
100 |
<td></td> |
7411 |
10 Oct 17 |
nicklas |
101 |
</tr> |
7407 |
05 Oct 17 |
nicklas |
102 |
<tr class="dynamic"> |
7407 |
05 Oct 17 |
nicklas |
103 |
<th>Description</th> |
7407 |
05 Oct 17 |
nicklas |
104 |
<td> |
7407 |
05 Oct 17 |
nicklas |
105 |
<textarea class="text" rows="4" name="description" id="description" |
7407 |
05 Oct 17 |
nicklas |
106 |
><%=HTML.encodeTags(device.getDescription())%></textarea> |
7407 |
05 Oct 17 |
nicklas |
107 |
</td> |
7407 |
05 Oct 17 |
nicklas |
108 |
<td style="width: 20px;"> |
7407 |
05 Oct 17 |
nicklas |
109 |
<base:zoom textarea="description" title="Description" /> |
7407 |
05 Oct 17 |
nicklas |
110 |
</td> |
7407 |
05 Oct 17 |
nicklas |
111 |
</tr> |
7407 |
05 Oct 17 |
nicklas |
112 |
</table> |
7407 |
05 Oct 17 |
nicklas |
113 |
</t:tab> |
7407 |
05 Oct 17 |
nicklas |
114 |
</t:tabcontrol> |
7407 |
05 Oct 17 |
nicklas |
115 |
</form> |
7407 |
05 Oct 17 |
nicklas |
116 |
|
7407 |
05 Oct 17 |
nicklas |
117 |
<div class="legend"> |
7407 |
05 Oct 17 |
nicklas |
118 |
<base:icon image="required.png" />= required information |
7407 |
05 Oct 17 |
nicklas |
119 |
</div> |
7407 |
05 Oct 17 |
nicklas |
120 |
|
7407 |
05 Oct 17 |
nicklas |
121 |
<base:buttongroup subclass="dialogbuttons"> |
7407 |
05 Oct 17 |
nicklas |
122 |
<base:button id="btnSave" title="Save" /> |
7407 |
05 Oct 17 |
nicklas |
123 |
<base:button id="close" title="Cancel" /> |
7407 |
05 Oct 17 |
nicklas |
124 |
</base:buttongroup> |
7407 |
05 Oct 17 |
nicklas |
125 |
</base:body> |
7407 |
05 Oct 17 |
nicklas |
126 |
</base:page> |
7407 |
05 Oct 17 |
nicklas |
127 |
<% |
7407 |
05 Oct 17 |
nicklas |
128 |
} |
7407 |
05 Oct 17 |
nicklas |
129 |
finally |
7407 |
05 Oct 17 |
nicklas |
130 |
{ |
7407 |
05 Oct 17 |
nicklas |
131 |
if (dc != null) dc.close(); |
7407 |
05 Oct 17 |
nicklas |
132 |
} |
7407 |
05 Oct 17 |
nicklas |
133 |
%> |