Revision 8533
Added by Jing Tao almost 11 years ago
auth-configuration.jsp | ||
---|---|---|
1 | 1 |
<%@ page language="java"%> |
2 |
<%@ page import="java.util.Set,java.util.Map,java.util.Vector,edu.ucsb.nceas.utilities.*, edu.ucsb.nceas.metacat.properties.PropertyService" %> |
|
2 |
<%@ page import="java.util.Set,java.util.Map,java.util.Vector,edu.ucsb.nceas.utilities.*, edu.ucsb.nceas.metacat.properties.PropertyService, edu.ucsb.nceas.metacat.admin.AuthAdmin" %>
|
|
3 | 3 |
<% |
4 | 4 |
/** |
5 | 5 |
* '$RCSfile$' |
... | ... | |
32 | 32 |
|
33 | 33 |
<title>Authentication Configuration</title> |
34 | 34 |
<%@ include file="./head-section.jsp"%> |
35 |
<script language="javascript" type="text/javascript" src="<%= request.getContextPath() %>/style/common/jquery/jquery.js"></script> |
|
35 | 36 |
|
36 | 37 |
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT"> |
37 | 38 |
<!-- |
... | ... | |
56 | 57 |
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" |
57 | 58 |
onsubmit="return validateAndSubmitForm(this);"> |
58 | 59 |
<% |
60 |
|
|
59 | 61 |
// metadata holds all group and properties metadata |
60 | 62 |
PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata"); |
61 | 63 |
if (metadata != null) { |
... | ... | |
69 | 71 |
// for this group, display the header (group name) |
70 | 72 |
MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId); |
71 | 73 |
%> |
74 |
<div id="<%= metaDataGroup.getName().replace(' ','_') %>"> |
|
72 | 75 |
<h3><%= metaDataGroup.getName() %></h3> |
73 | 76 |
<p><%= metaDataGroup.getDescription() %></p> |
74 | 77 |
<% |
... | ... | |
82 | 85 |
String fieldType = metaDataProperty.getFieldType(); |
83 | 86 |
if (metaDataProperty.getIsRequired()) { |
84 | 87 |
%> |
85 |
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT"> |
|
86 |
<!-- |
|
87 |
addExclusion("<%= metaDataProperty.getKey() %>"); |
|
88 |
//--> |
|
89 |
</SCRIPT> |
|
88 |
|
|
90 | 89 |
<% |
91 | 90 |
} |
92 | 91 |
if (fieldType.equals("select")) { |
93 | 92 |
%> |
94 | 93 |
<div class="form-row"> |
95 | 94 |
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div> |
96 |
<select class="textinput" name="<%= metaDataProperty.getKey() %>"> |
|
95 |
<select class="textinput" id="<%= metaDataProperty.getKey().replace('.', '_') %>" name="<%= metaDataProperty.getKey() %>">
|
|
97 | 96 |
<% |
98 | 97 |
String storedValue = (String)request.getAttribute(metaDataProperty.getKey()); |
99 | 98 |
Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues(); |
... | ... | |
113 | 112 |
<% |
114 | 113 |
} |
115 | 114 |
} |
115 |
|
|
116 | 116 |
%> |
117 | 117 |
|
118 | 118 |
</select> |
... | ... | |
182 | 182 |
} |
183 | 183 |
} |
184 | 184 |
} |
185 |
%> |
|
186 |
</div> |
|
187 |
<% |
|
185 | 188 |
} |
186 | 189 |
} |
187 | 190 |
%> |
188 | 191 |
|
192 |
<% |
|
193 |
String FILEGROUPNAME = "File-based_Authentication_Configuration"; |
|
194 |
String LDAPGROUPNAME = "LDAP_Authentication_Configuration"; |
|
195 |
String AUTHCLASSID = "auth_class"; |
|
196 |
%> |
|
197 |
<script language="javascript" type="text/javascript"> |
|
198 |
//this is for the first loading |
|
199 |
taggleLdapFileConfig(); |
|
200 |
|
|
201 |
//this is for the user to change to different authentication class. |
|
202 |
$('#<%=AUTHCLASSID%>').change(function(){ |
|
203 |
taggleLdapFileConfig(); |
|
204 |
}); |
|
205 |
|
|
206 |
function taggleLdapFileConfig() { |
|
207 |
if($("#<%=AUTHCLASSID%> option:selected" ).text() == '<%=AuthAdmin.LDAPCLASS%>') { |
|
208 |
$('#<%=FILEGROUPNAME%>').css('display', 'none'); |
|
209 |
$('#<%=LDAPGROUPNAME%>').css('display', 'block'); |
|
210 |
} else if($("#<%=AUTHCLASSID%> option:selected" ).text() == '<%=AuthAdmin.FILECLASS%>') { |
|
211 |
$('#<%=LDAPGROUPNAME%>').css('display', 'none'); |
|
212 |
$('#<%=FILEGROUPNAME%>').css('display', 'block'); |
|
213 |
} |
|
214 |
} |
|
215 |
</script> |
|
216 |
|
|
189 | 217 |
<div class="buttons-wrapper"> |
190 | 218 |
<input type="hidden" name="configureType" value="auth"/> |
191 | 219 |
<input type="hidden" name="processForm" value="true"/> |
Also available in: Unified diff
Add the code to hide/display the file/ldap section base on the selection of the auth class.