1
|
<%@ page language="java"%>
|
2
|
<%@ page import="java.util.Set,java.util.Map,java.util.Vector,edu.ucsb.nceas.utilities.*" %>
|
3
|
<%
|
4
|
/**
|
5
|
* '$RCSfile$'
|
6
|
* Copyright: 2008 Regents of the University of California and the
|
7
|
* National Center for Ecological Analysis and Synthesis
|
8
|
* For Details: http://www.nceas.ucsb.edu/
|
9
|
*
|
10
|
* '$Author: tao $'
|
11
|
* '$Date: 2014-01-22 11:46:34 -0800 (Wed, 22 Jan 2014) $'
|
12
|
* '$Revision: 8518 $'
|
13
|
*
|
14
|
* This program is free software; you can redistribute it and/or modify
|
15
|
* it under the terms of the GNU General Public License as published by
|
16
|
* the Free Software Foundation; either version 2 of the License, or
|
17
|
* (at your option) any later version.
|
18
|
*
|
19
|
* This program is distributed in the hope that it will be useful,
|
20
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22
|
* GNU General Public License for more details.
|
23
|
*
|
24
|
* You should have received a copy of the GNU General Public License
|
25
|
* along with this program; if not, write to the Free Software
|
26
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27
|
*/
|
28
|
%>
|
29
|
|
30
|
<html>
|
31
|
<head>
|
32
|
|
33
|
<title>Authentication Configuration</title>
|
34
|
<%@ include file="./head-section.jsp"%>
|
35
|
|
36
|
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
|
37
|
<!--
|
38
|
createExclusionList();
|
39
|
//-->
|
40
|
</SCRIPT>
|
41
|
|
42
|
|
43
|
</head>
|
44
|
<body>
|
45
|
<%@ include file="./header-section.jsp"%>
|
46
|
|
47
|
<div class="document">
|
48
|
<h2>Authentication Configuration</h2>
|
49
|
<p>Enter authentication service properties here.</p>
|
50
|
|
51
|
<br class="auth-header">
|
52
|
|
53
|
<%@ include file="./page-message-section.jsp"%>
|
54
|
|
55
|
|
56
|
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin"
|
57
|
onsubmit="return validateAndSubmitForm(this);">
|
58
|
<%
|
59
|
// metadata holds all group and properties metadata
|
60
|
PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
|
61
|
if (metadata != null) {
|
62
|
// each group describes a section of properties
|
63
|
Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
|
64
|
Set<Integer> groupIdSet = groupMap.keySet();
|
65
|
for (Integer groupId : groupIdSet) {
|
66
|
if (groupId == 0) {
|
67
|
continue;
|
68
|
}
|
69
|
// for this group, display the header (group name)
|
70
|
MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
|
71
|
%>
|
72
|
<h3><%= metaDataGroup.getName() %></h3>
|
73
|
<p><%= metaDataGroup.getDescription() %></p>
|
74
|
<%
|
75
|
// get all the properties in this group
|
76
|
Map<Integer, MetaDataProperty> propertyMap =
|
77
|
metadata.getPropertiesInGroup(metaDataGroup.getIndex());
|
78
|
Set<Integer> propertyIndexes = propertyMap.keySet();
|
79
|
// iterate through each property and display appropriately
|
80
|
for (Integer propertyIndex : propertyIndexes) {
|
81
|
MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
|
82
|
String fieldType = metaDataProperty.getFieldType();
|
83
|
if (metaDataProperty.getIsRequired()) {
|
84
|
%>
|
85
|
<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
|
86
|
<!--
|
87
|
addExclusion("<%= metaDataProperty.getKey() %>");
|
88
|
//-->
|
89
|
</SCRIPT>
|
90
|
<%
|
91
|
}
|
92
|
if (fieldType.equals("select")) {
|
93
|
%>
|
94
|
<div class="form-row">
|
95
|
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>
|
96
|
<select class="textinput" name="<%= metaDataProperty.getKey() %>">
|
97
|
<%
|
98
|
String storedValue = (String)request.getAttribute(metaDataProperty.getKey());
|
99
|
Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
|
100
|
Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
|
101
|
for (int i = 0; i < fieldOptionNames.size(); i++) {
|
102
|
boolean foundStoredValue = false;
|
103
|
if(storedValue != null && !storedValue.equals("") && storedValue.equals(fieldOptionNames.elementAt(i))) {
|
104
|
foundStoredValue = true;
|
105
|
}
|
106
|
if(foundStoredValue) {
|
107
|
%>
|
108
|
<option value="<%= fieldOptionValues.elementAt(i) %>" selected="selected"><%= fieldOptionNames.elementAt(i) %></option>
|
109
|
<%
|
110
|
} else {
|
111
|
%>
|
112
|
<option value="<%= fieldOptionValues.elementAt(i) %>"><%= fieldOptionNames.elementAt(i) %></option>
|
113
|
<%
|
114
|
}
|
115
|
}
|
116
|
%>
|
117
|
|
118
|
</select>
|
119
|
<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
|
120
|
|
121
|
</div>
|
122
|
<%
|
123
|
if (metaDataProperty.getDescription() != null) {
|
124
|
%>
|
125
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
126
|
<%
|
127
|
}
|
128
|
} else if (fieldType.equals("password")) {
|
129
|
%>
|
130
|
<div class="form-row">
|
131
|
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>
|
132
|
<input class="textinput" id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>"
|
133
|
value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
|
134
|
type="<%= fieldType %>"/>
|
135
|
<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
|
136
|
</div>
|
137
|
<%
|
138
|
if (metaDataProperty.getDescription() != null) {
|
139
|
%>
|
140
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
141
|
<%
|
142
|
}
|
143
|
} else {
|
144
|
%>
|
145
|
<div class="form-row">
|
146
|
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>
|
147
|
<input class="textinput" id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>"
|
148
|
value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
|
149
|
type="<%= fieldType %> "/>
|
150
|
<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
|
151
|
</div>
|
152
|
<%
|
153
|
if (metaDataProperty.getDescription() != null) {
|
154
|
%>
|
155
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
156
|
<%
|
157
|
}
|
158
|
}
|
159
|
}
|
160
|
}
|
161
|
}
|
162
|
%>
|
163
|
|
164
|
<div class="buttons-wrapper">
|
165
|
<input type="hidden" name="configureType" value="auth"/>
|
166
|
<input type="hidden" name="processForm" value="true"/>
|
167
|
<input class="button" type="submit" value="Save"/>
|
168
|
<input class="button" type="button" value="Cancel" onClick="forward('./admin')">
|
169
|
</div>
|
170
|
</form>
|
171
|
</div>
|
172
|
<%@ include file="./footer-section.jsp"%>
|
173
|
|
174
|
</body>
|
175
|
</html>
|