source: trunk/www/switch.jsp @ 5907

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

References #1655: GUI improvements

New design on some more pages:

  • Impersonate
  • Switch user
  • Calendar
  • Close popup message
  • Configure columns
  • Manage lists contexts
  • View help
  • Set owner
  • Share items
  • About
  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.0 KB
Line 
1<%-- $Id: switch.jsp 5907 2011-12-13 08:36:28Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006, 2007 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  @version 2.0
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.Application"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.News"
30  import="net.sf.basedb.core.ItemQuery"
31  import="net.sf.basedb.core.ItemResultList"
32  import="net.sf.basedb.core.query.Orders"
33  import="net.sf.basedb.core.query.Hql"
34  import="net.sf.basedb.clients.web.Base"
35  import="net.sf.basedb.clients.web.util.HTML"
36  import="net.sf.basedb.util.Values"
37%>
38<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
39<%
40final String login = Values.getString(request.getParameter("login"), "");
41final String root = request.getContextPath()+"/";
42
43final SessionControl sc = Base.getSessionControl(pageContext, true);
44final String ID = sc.getId();
45final DbControl dc = sc.newDbControl();
46try
47{
48  %>
49  <base:page type="popup" title="Switch user">
50  <base:head styles="login.css">
51    <script language="JavaScript" type="text/javascript">
52    // Set foucs on the login form
53    function init()
54    {
55      setFocus();
56    }
57   
58    // Set the focus on either the login or password field.
59    function setFocus()
60    {
61      frm = document.forms['login'];
62      if (frm.login.value == '' && window.parent.lastLogin) frm.login.value = window.parent.lastLogin;
63      if (frm.encrypt && window.parent.encrypt != undefined) frm.encrypt.checked = window.parent.encrypt;
64      if (frm.login.value == '')
65      {
66        frm.login.focus();
67      }
68      else
69      {
70        frm.password.focus();
71        frm.password.select();
72      }
73    }
74    function saveLogin()
75    {
76      var frm = document.forms['login'];
77      window.opener.parent.lastLogin = frm.login.value;
78      return true;
79    }
80    function doLogin()
81    {
82      saveLogin();
83      var frm = document.forms['login'];
84      if (frm.remainOnPage.checked)
85      {
86        frm.redirect.value = '';
87      }
88      else
89      {
90        frm.redirect.value = '<%=root%>my_base/index.jsp?ID=<%=ID%>';
91      }
92      frm.submit();
93    }
94    </script>
95  </base:head>
96 
97  <base:body onload="init();">
98    <h1>Switch user <base:help helpid="switchuser" /></h1>
99    <form name="login" action="login.jsp" method="post" onsubmit="doLogin();">
100    <input type="hidden" name="ID" value="<%=ID%>">
101    <input type="hidden" name="again" value="1">
102    <input type="hidden" name="redirect" value="">
103 
104    <div class="content">
105      <table class="fullform input100 bottomborder smaller">
106      <tr>
107        <th>Login</th>
108        <td><input  type="text" name="login" value="<%=HTML.encodeTags(login)%>" 
109           maxlength="100"></td>
110      </tr>
111      <tr>
112        <th>Password</th>
113        <td>
114          <input type="password" name="password" maxlength="80"
115            onkeypress="return Forms.submitOnEnter(event, saveLogin)">
116        </td>
117      </tr>
118      <tr>
119        <th><label for="remainOnPage">Remain on this page</label></th>
120        <td>
121          <input type="checkbox" name="remainOnPage" id="remainOnPage" checked value="1">
122        </td>
123      </tr>
124      <tr class="dynamic">
125        <th></th>
126        <td></td>
127      </tr>
128      </table>
129    </div>
130    </form>
131   
132    <base:buttongroup subclass="dialogbuttons">
133      <base:button image="login.png" onclick="doLogin();" title="Login" />
134      <base:button onclick="window.close()" title="Cancel" />
135    </base:buttongroup>
136   
137
138  </base:body>
139  </base:page>
140  <%
141}
142finally
143{
144  if (dc != null) dc.close();
145}
146%>
147
Note: See TracBrowser for help on using the repository browser.