Changeset 7531
- Timestamp:
- Nov 26, 2018, 1:06:20 PM (4 years ago)
- Location:
- trunk/www
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/include/menu.jsp
r7407 r7531 1194 1194 title="<%=menu.getString("switchuser.title") + "…"%>" 1195 1195 url="<%=root+"switch.jsp?ID="+ID%>" 1196 data-popup="Switch, 480, 320"1196 data-popup="Switch, 540, 360" 1197 1197 tooltip="<%=menu.getString("switchuser.tooltip")%>" 1198 1198 /> -
trunk/www/login.js
r7530 r7531 91 91 login.switchLoginForm = function(loginForm) 92 92 { 93 var url = 'main.jsp?ID='+App.getSessionId();93 var url = location.pathname+'?ID='+App.getSessionId(); 94 94 url += '&loginForm='+encodeURIComponent(loginForm); 95 95 location.replace(url); -
trunk/www/switch.jsp
r7500 r7531 33 33 import="net.sf.basedb.core.query.Hql" 34 34 import="net.sf.basedb.util.extensions.ExtensionsInvoker" 35 import="net.sf.basedb.util.extensions.ActionIterator" 35 36 import="net.sf.basedb.clients.web.Base" 36 37 import="net.sf.basedb.clients.web.util.HTML" … … 41 42 import="net.sf.basedb.clients.web.extensions.login.FieldInfo" 42 43 import="net.sf.basedb.util.Values" 44 import="java.util.Map" 45 import="java.util.TreeMap" 43 46 %> 44 47 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 53 56 <% 54 57 final String login = Values.getString(request.getParameter("login"), ""); 58 final String requestedLoginForm = Values.getString(request.getParameter("loginForm"), null); 55 59 56 60 final SessionControl sc = Base.getSessionControl(pageContext, true); … … 61 65 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext); 62 66 ExtensionsInvoker<LoginFormAction> invoker = (ExtensionsInvoker<LoginFormAction>)ExtensionsControl.useExtensions(jspContext, "net.sf.basedb.clients.web.login-form"); 67 63 68 LoginFormAction loginAction = null; 64 for (LoginFormAction action : invoker) 69 String selectedLoginForm = null; 70 Map<String, String> allForms = new TreeMap<String, String>(); 71 72 ActionIterator<LoginFormAction> it = invoker.iterate(); 73 while (it.hasNext()) 65 74 { 75 LoginFormAction action = it.next(); 66 76 if (action != null) 67 77 { 68 loginAction = action; 69 break; 78 String formId = action.getId(); 79 if (formId == null) formId = it.getExtension().getId(); 80 String displayName = action.getDisplayName(); 81 if (displayName == null) displayName = it.getExtension().getAbout().getName(); 82 allForms.put(formId, displayName); 83 84 if (loginAction == null || formId.equals(requestedLoginForm)) 85 { 86 loginAction = action; 87 selectedLoginForm = formId; 88 } 70 89 } 71 90 } … … 77 96 bean.setPasswordField(FieldInfo.DEFAULT_PASSWORD); 78 97 loginAction = bean; 98 selectedLoginForm = "password"; 79 99 } 80 100 FieldInfo loginField = loginAction.getLoginField(); … … 87 107 <ext:stylesheets context="<%=jspContext%>" /> 88 108 </base:head> 89 <base:body >109 <base:body data-login-form="<%=HTML.encodeTags(selectedLoginForm)%>" data-requested-form="<%=HTML.encodeTags(requestedLoginForm) %>"> 90 110 <h1>Switch user <base:help helpid="switchuser" /></h1> 91 111 <form name="login" action="login.jsp" method="post"> … … 98 118 <div class="content"> 99 119 <table class="fullform input100 bottomborder "> 120 <% 121 if (allForms.size() > 0) 122 { 123 %> 124 <tr> 125 <th>Login with</th> 126 <td> 127 <select name="loginForm" id="loginForm" style="min-width: 10em;"> 128 <% 129 for (Map.Entry<String, String> entry : allForms.entrySet()) 130 { 131 String formId = entry.getKey(); 132 %> 133 <option value="<%=formId%>" <%=formId.equals(selectedLoginForm) ? "selected" : ""%>><%=HTML.encodeTags(entry.getValue()) %> 134 <% 135 } 136 %> 137 </select> 138 </td> 139 </tr> 140 <% 141 } 142 %> 100 143 <tr <%=valueIfNotNull("class=\"", loginField.getClazz(), "\"")%> id="login-row"> 101 144 <th><%=loginField.getPrompt() %></th>
Note: See TracChangeset
for help on using the changeset viewer.