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: daigle $'
11
 *     '$Date: 2008-11-12 10:33:25 -0800 (Wed, 12 Nov 2008) $'
12
 * '$Revision: 4557 $'
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>LDAP Configuration</title>
34
<link rel="stylesheet" type="text/css" 
35
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
36
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
37

    
38
</head>
39
<body>
40
<%@ include file="./header-section.jsp"%>
41

    
42
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
43
<h2>LDAP Configuration</h2>
44
Enter authentication service properties here. 
45
<br class="ldap-header">
46

    
47
<%@ include file="./page-message-section.jsp"%>
48

    
49

    
50
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
51
                                        onsubmit="return validateAndSubmitForm(this);">
52
<% 
53
	// metadata holds all group and properties metadata
54
    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
55
	if (metadata != null) {
56
		// each group describes a section of properties
57
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
58
		Set<Integer> groupIdSet = groupMap.keySet();
59
		for (Integer groupId : groupIdSet) {
60
			// for this group, display the header (group name)
61
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
62
%>
63
		<h3><%= metaDataGroup.getName()  %></h3>
64
		<hr class="config-line">
65
<%
66
			// get all the properties in this group
67
			Map<Integer, MetaDataProperty> propertyMap = 
68
				metadata.getPropertiesInGroup(metaDataGroup.getIndex());
69
			Set<Integer> propertyIndexes = propertyMap.keySet();
70
			// iterate through each property and display appropriately
71
			for (Integer propertyIndex : propertyIndexes) {
72
				MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
73
    			String fieldType = metaDataProperty.getFieldType(); 
74
    			if (fieldType.equals("select")) {
75
%> 
76
				<div class="form-row">
77
					<img class="question-mark" src="style/images/question-mark.gif" 
78
	           		       onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
79
     				<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>	   	
80
					<select class="textinput" name="<%= metaDataProperty.getKey() %>">
81
<%
82
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
83
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
84
					for (int i = 0; i < fieldOptionNames.size(); i++) {
85
%>
86
						<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
87
<%
88
					}
89
%>
90
					</select>
91
				</div> 
92
<%
93
					if (metaDataProperty.getDescription() != null) {
94
%>
95
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
96
<%		
97
					}
98
				} else if (fieldType.equals("password")) {
99
%>
100
				<div class="form-row">
101
					<img class="question-mark" src="style/images/question-mark.gif"  
102
	           		     onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
103
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>	
104
					<input class="textinput" id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
105
	           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
106
	           		    	type="<%= fieldType %>"/> 
107
				</div> 
108
<%
109
					if (metaDataProperty.getDescription() != null) {
110
%>
111
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
112
<%		
113
					}
114
				} else {
115
%>
116
				<div class="form-row">
117
					<img class="question-mark" src="style/images/question-mark.gif"  
118
					     onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
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
				</div>    		    
124
<%
125
					if (metaDataProperty.getDescription() != null) {
126
%>
127
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
128
<%		
129
					}
130
				}
131
			}
132
		}
133
	}
134
%>
135

    
136
  <input type="hidden" name="configureType" value="ldap"/>
137
  <input type="hidden" name="processForm" value="true"/>
138
  <input class="left-button" type="submit" value="Save"/>
139
  <input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
140

    
141
</form>
142

    
143
<%@ include file="./footer-section.jsp"%>
144

    
145
</body>
146
</html>
(9-9/14)