Project

General

Profile

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: walker $'
11
 *     '$Date: 2013-09-18 15:37:06 -0700 (Wed, 18 Sep 2013) $'
12
 * '$Revision: 8240 $'
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
							Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
99
							Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
100
							for (int i = 0; i < fieldOptionNames.size(); i++) {
101
		%>
102
								<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
103
		<%
104
							}
105
		%>
106
							</select>
107
							<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
108
							
109
						</div> 
110
		<%
111
							if (metaDataProperty.getDescription() != null) {
112
		%>
113
								<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
114
		<%		
115
							}
116
						} else if (fieldType.equals("password")) {
117
		%>
118
						<div class="form-row">
119
							<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>	
120
							<input class="textinput" id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
121
			           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
122
			           		    	type="<%= fieldType %>"/> 
123
							<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
124
						</div> 
125
		<%
126
							if (metaDataProperty.getDescription() != null) {
127
		%>
128
								<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
129
		<%		
130
							}
131
						} else {
132
		%>
133
						<div class="form-row">
134
							<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>					
135
							<input class="textinput" id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
136
			    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
137
			           		    	type="<%= fieldType %>	"/>	
138
							<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
139
									</div>    		    
140
		<%
141
							if (metaDataProperty.getDescription() != null) {
142
		%>
143
								<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
144
		<%		
145
							}
146
						}
147
					}
148
				}
149
			}
150
		%>
151
		
152
		  <div class="buttons-wrapper">
153
		  	<input type="hidden" name="configureType" value="auth"/>
154
		  	<input type="hidden" name="processForm" value="true"/>
155
		  	<input class="button" type="submit" value="Save"/>
156
		  	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
157
		 </div>
158
		</form>
159
</div>
160
<%@ include file="./footer-section.jsp"%>
161

    
162
</body>
163
</html>
(4-4/19)