Project

General

Profile

metacat / lib / admin / ldap-configuration.jsp @ 4159

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-07-24 13:52:51 -0700 (Thu, 24 Jul 2008) $'
12
 * '$Revision: 4159 $'
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
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
38

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

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

    
48

    
49
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
50
                                        onsubmit="return submitForm(this);">
51
<% 
52
	// metadata holds all group and properties metadata
53
    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
54
	if (metadata != null) {
55
		// each group describes a section of properties
56
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
57
		Set<Integer> groupIdSet = groupMap.keySet();
58
		for (Integer groupId : groupIdSet) {
59
			// for this group, display the header (group name)
60
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
61
%>
62
		<h3><%= metaDataGroup.getName()  %></h3>
63
		<hr class="config-line">
64
		<table class="config-section">
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
			<tr>
77
				<td class="config-property-label">
78
     				<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>   
79
     			</td>	
80
     			<td class="config-property-input" >		
81
					<select name="<%= metaDataProperty.getKey() %>">
82
<%
83
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
84
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
85
					for (int i = 0; i < fieldOptionNames.size(); i++) {
86
%>
87
					<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
88
<%
89
				}
90
%>
91
					</select>
92
				</td>
93
				<td class="config-question-mark">
94
					<img src="style/images/question-mark.gif" 
95
	           		       alt="<%= metaDataProperty.getDescription() %>" 
96
	           		       title="<%= metaDataProperty.getDescription() %>"/>
97
				</td>
98
			</tr>
99

    
100
<%		
101
				} else if (fieldType.equals("password")) {
102
%>
103
			<tr>
104
				<td class="config-property-label">
105
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
106
     			</td>	
107
     			<td class="config-property-input" >	
108
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
109
	           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
110
	           		    	type="<%= fieldType %>"
111
	           		    	alt="<%= metaDataProperty.getDescription() %>"/> 
112
				</td>
113
				<td class="config-question-mark">
114
					<img src="style/images/question-mark.gif" 
115
	           		       alt="<%= metaDataProperty.getDescription() %>" 
116
	           		       title="<%= metaDataProperty.getDescription() %>"/>
117
				</td>
118
			</tr>
119
<%		
120
				} else {
121
%>
122
			<tr>
123
				<td class="config-property-label">
124
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
125
     			</td>	
126
     			<td class="config-property-input" >							
127
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
128
	    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
129
	           		    	type="<%= fieldType %>	"           			
130
	           		    	alt="<%= metaDataProperty.getDescription() %>"/>	
131
	           	</td>
132
				<td class="config-question-mark">           		    
133
					<img class=question-mark src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/>
134
				</td>
135
 			</tr>
136
<%   			
137
				}
138
    			
139
    			if (metaDataProperty.getDescription() != null) {
140
%>
141
			<tr>
142
    	        <td></td>
143
    	        <td class="config-property-description" colspan="2" >
144
					<%= metaDataProperty.getDescription() %>
145
    	        </td>
146
			</tr>
147
<%
148
    			}
149
			}
150
%>
151

    
152
			</table>
153
<%
154
		}
155
	}
156
%>
157

    
158
  <input type="hidden" name="configureType" value="ldap"/>
159
  <input type="hidden" name="processForm" value="true"/>
160
  <input class="left-button" type="submit" value="Save"/>
161
  <input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
162

    
163
</form>
164

    
165
</body>
166
</html>