1 | <%-- $Id: broadcast.jsp 5900 2011-12-07 13:43:15Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2008 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 |
---|
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 | --%> |
---|
24 | <%@ page pageEncoding="UTF-8" session="false" |
---|
25 | import="net.sf.basedb.core.SessionControl" |
---|
26 | import="net.sf.basedb.core.DbControl" |
---|
27 | import="net.sf.basedb.core.Client" |
---|
28 | import="net.sf.basedb.core.User" |
---|
29 | import="net.sf.basedb.core.ClientDefaultSetting" |
---|
30 | import="net.sf.basedb.core.Permission" |
---|
31 | import="net.sf.basedb.clients.web.util.HTML" |
---|
32 | import="net.sf.basedb.util.Values" |
---|
33 | import="net.sf.basedb.clients.web.Base" |
---|
34 | %> |
---|
35 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
36 | |
---|
37 | <% |
---|
38 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
39 | final String ID = sc.getId(); |
---|
40 | final float scale = Base.getScale(sc); |
---|
41 | final DbControl dc = sc.newDbControl(); |
---|
42 | |
---|
43 | try |
---|
44 | { |
---|
45 | final Client server = Client.getById(dc, sc.getClientId()); |
---|
46 | final boolean writePermission = server.hasPermission(Permission.WRITE); |
---|
47 | |
---|
48 | String title = (String)application.getAttribute("broadcast.title"); |
---|
49 | String message = (String)application.getAttribute("broadcast.message"); |
---|
50 | Boolean denyLogin = (Boolean)application.getAttribute("broadcast.deny-login"); |
---|
51 | %> |
---|
52 | <base:page type="popup" title="Broadcast message"> |
---|
53 | <base:head> |
---|
54 | <script language="JavaScript"> |
---|
55 | // Submit the form |
---|
56 | function saveSettings() |
---|
57 | { |
---|
58 | var frm = document.forms["broadcast"]; |
---|
59 | frm.submit(); |
---|
60 | } |
---|
61 | function clearMessage() |
---|
62 | { |
---|
63 | var frm = document.forms["broadcast"]; |
---|
64 | frm.denyLogin.checked = false; |
---|
65 | frm.title.value = ''; |
---|
66 | frm.message.value = ''; |
---|
67 | } |
---|
68 | function init() |
---|
69 | { |
---|
70 | var frm = document.forms["broadcast"]; |
---|
71 | frm.title.focus(); |
---|
72 | } |
---|
73 | </script> |
---|
74 | |
---|
75 | </base:head> |
---|
76 | <base:body onload="init()"> |
---|
77 | <form name="broadcast" action="submit_server.jsp" method="post" onsubmit="return false;"> |
---|
78 | <input type="hidden" name="ID" value="<%=ID%>"> |
---|
79 | <input type="hidden" name="cmd" value="SetBroadcastMessage"> |
---|
80 | |
---|
81 | <h3 class="docked">Broadcast message <base:help helpid="broadcast.message"/></h3> |
---|
82 | <div class="boxedbottom"> |
---|
83 | <% |
---|
84 | if (!writePermission) |
---|
85 | { |
---|
86 | %> |
---|
87 | <div class="error">You do not have permission to broadcast messages to users.</div> |
---|
88 | <% |
---|
89 | } |
---|
90 | else |
---|
91 | { |
---|
92 | %> |
---|
93 | <table class="form"> |
---|
94 | <tr> |
---|
95 | <td class="prompt">Title</td> |
---|
96 | <td> |
---|
97 | <input class="text" |
---|
98 | type="text" name="title" value="<%=HTML.encodeTags(title)%>" size="60" maxlength="255"> |
---|
99 | </td> |
---|
100 | </tr> |
---|
101 | <tr valign=top> |
---|
102 | <td class="prompt">Disable login</td> |
---|
103 | <td> |
---|
104 | <input type="checkbox" name="denyLogin" <%=Boolean.TRUE.equals(denyLogin) ? "checked": ""%> value="1"> |
---|
105 | </td> |
---|
106 | </tr> |
---|
107 | <tr valign=top> |
---|
108 | <td class="prompt">Message</td> |
---|
109 | <td> |
---|
110 | <textarea class="text" rows="15" cols="60" name="message" wrap="virtual"><%=HTML.encodeTags(message)%></textarea> |
---|
111 | <a href="javascript:Main.zoom('Message', 'broadcast', 'message')" title="Edit in larger window"><base:icon image="zoom.gif" /></a> |
---|
112 | </td> |
---|
113 | </tr> |
---|
114 | </table> |
---|
115 | <% |
---|
116 | } |
---|
117 | %> |
---|
118 | </div> |
---|
119 | |
---|
120 | </form> |
---|
121 | <base:buttongroup> |
---|
122 | <base:button onclick="clearMessage()" image="remove.png" title="Clear message" /> |
---|
123 | <base:button onclick="saveSettings();" title="Ok" visible="<%=writePermission%>"/> |
---|
124 | <base:button onclick="window.close();" title="Cancel" /> |
---|
125 | </base:buttongroup> |
---|
126 | </base:body> |
---|
127 | </base:page> |
---|
128 | <% |
---|
129 | } |
---|
130 | finally |
---|
131 | { |
---|
132 | if (dc != null) dc.close(); |
---|
133 | } |
---|
134 | %> |
---|
135 | |
---|