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-08-18 11:05:02 -0700 (Mon, 18 Aug 2008) $'
12
 * '$Revision: 4258 $'
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
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
41
<h2>LDAP Configuration</h2>
42
Enter authentication service properties here. 
43
<br class="ldap-header">
44

    
45
<%@ include file="./page-message-section.jsp"%>
46

    
47

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

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

    
139
</form>
140

    
141
</body>
142
</html>
(7-7/13)