Project

General

Profile

Revision 4159

Added by daigle over 12 years ago

Add support for separate LDAP and organization level configurations

View differences:

ldap-configuration.jsp
27 27
 */
28 28
%>
29 29

  
30
<%
31
	PropertiesMetaData propMetadata =
32
		(PropertiesMetaData)request.getAttribute("metadata");
33
 	Vector<String> ldapOrganizations = 
34
 		(Vector<String>)request.getAttribute("orgList"); 
35
	Map<Integer, MetaDataGroup> groupMap = 
36
		(Map<Integer, MetaDataGroup>)request.getAttribute("groupMap"); 
37
%>
38

  
39 30
<html>
40 31
<head>
41 32

  
......
57 48

  
58 49
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
59 50
                                        onsubmit="return submitForm(this);">
60
<%
61
	Map<Integer, MetaDataProperty> globalPropertiesMap = propMetadata.getPropertiesInGroup(1);
62
	MetaDataGroup globalGroup = groupMap.get(new Integer(1));
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);
63 61
%>
64
  <h3><%=globalGroup.getName()%></h3> 
65
  <hr class="config-line">
62
		<h3><%= metaDataGroup.getName()  %></h3>
63
		<hr class="config-line">
64
		<table class="config-section">
66 65
<%
67
 	if (globalGroup.getComment() != null) {
68
%>
69
  <div class="heading-comment"><%=globalGroup.getComment()%></div><br>
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() %>">
70 82
<%
71
	}
83
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
84
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
85
					for (int i = 0; i < fieldOptionNames.size(); i++) {
72 86
%>
73
<br>
74
<table class="config-section">
87
					<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
75 88
<%
76
	Set<Integer> globalIdSet = globalPropertiesMap.keySet();
77
	for (Integer globalId : globalIdSet) {
78
		MetaDataProperty globalProperty = globalPropertiesMap.get(globalId);
89
				}
79 90
%>
80
	<tr>
81
		<td class="config-property-label">
82
			<label for="<%= globalProperty.getKey() %>" title="<%= globalProperty.getDescription() %>"><%=globalProperty.getLabel()%></label>
83
		</td>	
84
		<td class="config-property-input" >	
85
			<input id="<%= globalProperty.getKey() %>" name="<%= globalProperty.getKey() %>" 
86
				value="<%= request.getAttribute(globalProperty.getKey()) %>"             		    	    	           		    	             			
87
				type="text"           			
88
				alt="LDAP server URL"/>	   
89
		</td>
90
		<td class="config-question-mark">        		    
91
			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= globalProperty.getHelpFile() %>')"/><br/>
92
		</td>
93
	</tr>
94
<%
95
	}
96
    Map<Integer, MetaDataProperty> orgPropertyMap = propMetadata.getPropertiesInGroup(2);
97
    MetaDataGroup orgGroup = groupMap.get(new Integer(2));
98
    Set<Integer> orgIdSet = orgPropertyMap.keySet();
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")) {
99 102
%>
100
	</table>
101
	<h3><%=orgGroup.getName()%></h3> 
102
    <hr class="config-line">
103
<%
104
 	if (orgGroup.getComment() != null) {
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 {
105 121
%>
106
  <div class="heading-comment"><%= orgGroup.getComment() %></div>
107
<%
108
 	}
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) {
109 140
%>
110
<br>
141
			<tr>
142
    	        <td></td>
143
    	        <td class="config-property-description" colspan="2" >
144
					<%= metaDataProperty.getDescription() %>
145
    	        </td>
146
			</tr>
111 147
<%
112
	for (String orgName : ldapOrganizations) {
148
    			}
149
			}
113 150
%>
114
<table class="config-section">
115
	<tr>
116
		<td class="config-checkbox">
117
	  		<input class="org" type="checkbox" name="<%= orgName %>.cb" onClick="toggleHiddenTable(this, 'hiding-section-<%= orgName %>')"/>
118
	  	</td>
119
	  	<td class="config-checkbox-label">	
120
			<label for="<%= orgName %>.cb"><%=orgName%></label>
121
		</td> 
122
		<td class="config-question-mark">
123
			<img src="style/images/question-mark.gif"
124
					alt="blah"
125
					title="blah"/>
126
		</td>
127
	</tr>
128
</table>
129
<table class="config-section-hiding" id="hiding-section-<%= orgName %>">  
151

  
152
			</table>
130 153
<%
131
	  	for (Integer orgId : orgIdSet) {
132
	  	MetaDataProperty orgProperty = orgPropertyMap.get(orgId);
133
	  	String orgKeyName = orgProperty.getKey() + "." + orgName;
134
%>		
135
	<tr>
136
		<td class="config-property-label" >	
137
	    	<label for="<%= orgKeyName %>" title="<%= orgProperty.getDescription() %>"><%= orgProperty.getLabel() %></label>
138
     	</td>	
139
     	<td class="config-property-input" >
140
			<input name="<%= orgKeyName %>" 
141
				value="<%= request.getAttribute(orgKeyName) %>"	  
142
<% 
143
			if (orgProperty.getFieldType().equals("password")) { 
144
%>           		    	    	           		    	             			
145
	           	type="password"       
146
<%
147
	  		}
148
%>    			
149
	           alt="List of administrators for this installation in LDAP DN syntax (colon separated)"/>	           		    
150
		</td>
151
		<td class="config-question-mark">
152
			<img src="style/images/question-mark.gif" onClick="helpWindow('<%= request.getContextPath() %>', '<%= orgProperty.getHelpFile() %>')"/>
153
		</td>
154
	</tr>	  
155
<%
156
	  	}
157
%>
158
      </table>
159
<%
154
		}
160 155
	}
161 156
%>
162 157

  

Also available in: Unified diff