Changeset 7529 for trunk/www/main.jsp
- Timestamp:
- Nov 26, 2018, 8:30:41 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/main.jsp
r7500 r7529 41 41 import="net.sf.basedb.core.query.Hql" 42 42 import="net.sf.basedb.util.extensions.ExtensionsInvoker" 43 import="net.sf.basedb.util.extensions.ActionIterator" 43 44 import="net.sf.basedb.clients.web.Base" 44 45 import="net.sf.basedb.clients.web.util.HTML" … … 53 54 import="net.sf.basedb.util.Values" 54 55 import="java.util.Date" 56 import="java.util.Map" 57 import="java.util.TreeMap" 55 58 %> 56 59 <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> … … 66 69 final String login = Values.getString(request.getParameter("login"), ""); 67 70 final String error = Values.getString(request.getParameter("error"), null); 71 final String requestedLoginForm = Values.getString(request.getParameter("loginForm"), null); 68 72 final String root = request.getContextPath()+"/"; 69 73 … … 83 87 84 88 LoginFormAction loginAction = null; 85 for (LoginFormAction action : invoker) 89 String selectedLoginForm = null; 90 Map<String, String> allForms = new TreeMap<String, String>(); 91 92 ActionIterator<LoginFormAction> it = invoker.iterate(); 93 while (it.hasNext()) 86 94 { 95 LoginFormAction action = it.next(); 87 96 if (action != null) 88 97 { 89 loginAction = action; 90 break; 98 String formId = action.getId(); 99 if (formId == null) formId = it.getExtension().getId(); 100 String displayName = action.getDisplayName(); 101 if (displayName == null) displayName = it.getExtension().getAbout().getName(); 102 allForms.put(formId, displayName); 103 104 if (loginAction == null || formId.equals(requestedLoginForm)) 105 { 106 loginAction = action; 107 selectedLoginForm = formId; 108 } 91 109 } 92 110 } … … 109 127 <ext:stylesheets context="<%=jspContext%>" /> 110 128 </base:head> 111 <base:body style="padding-top: 5em;" >129 <base:body style="padding-top: 5em;" data-login-form="<%=Values.getString(selectedLoginForm)%>"> 112 130 <form name="login" action="login.jsp" method="post"> 113 131 <input type="hidden" name="ID" value="<%=ID%>"> … … 122 140 { 123 141 %> 124 <div class="messagecontainer help" style=" font-style: italic;" id="login-help">142 <div class="messagecontainer help" style="margin-bottom: 1em; font-style: italic;" id="login-help"> 125 143 <%=loginAction.getHelp() %> 126 144 </div> … … 130 148 { 131 149 %> 132 <div class="messagecontainer error" style="margin-top: 1em;"><%=error%></div> 133 <% 134 } 135 %> 136 <table style="width: 100%; margin-top: 1em; border-collapse: separate;"> 150 <div class="messagecontainer error" style="margin-top: 1em; margin-bottom: 1em;"><%=error%></div> 151 <% 152 } 153 if (allForms.size() > 1) 154 { 155 %> 156 <div style="text-align: right; margin-bottom: 0.25em;"> 157 <b>Login with</b> 158 <select name="loginForm" id="loginForm" style="min-width: 10em;"> 159 <% 160 for (Map.Entry<String, String> entry : allForms.entrySet()) 161 { 162 String formId = entry.getKey(); 163 %> 164 <option value="<%=formId%>" <%=formId.equals(selectedLoginForm) ? "selected" : ""%>><%=HTML.encodeTags(entry.getValue()) %> 165 <% 166 } 167 %> 168 </select> 169 </div> 170 <% 171 } 172 else if (selectedLoginForm != null) 173 { 174 %> 175 <input type="hidden" name="loginForm" value="<%=selectedLoginForm%>"> 176 <% 177 } 178 %> 179 <table style="width: 100%; border-collapse: separate;"> 137 180 <tr> 138 181 <td class="base-logo"><img src="images/baselogo.png" alt="BASE logo"></td>
Note: See TracChangeset
for help on using the changeset viewer.