Project

General

Profile

1
<%@ page language="java" %>
2
<%@ page import="java.util.Set,java.util.HashMap,java.util.Map,java.util.SortedMap,java.util.Vector" %>
3
<%@ page import="edu.ucsb.nceas.utilities.PropertiesMetaData" %>
4
<%@ page import="edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
5
<% 
6
/**
7
 *  '$RCSfile$'
8
 *    Copyright: 2008 Regents of the University of California and the
9
 *               National Center for Ecological Analysis and Synthesis
10
 *  For Details: http://www.nceas.ucsb.edu/
11
 *
12
 *   '$Author: daigle $'
13
 *     '$Date: 2008-07-24 13:51:10 -0700 (Thu, 24 Jul 2008) $'
14
 * '$Revision: 4157 $'
15
 * 
16
 * This program is free software; you can redistribute it and/or modify
17
 * it under the terms of the GNU General Public License as published by
18
 * the Free Software Foundation; either version 2 of the License, or
19
 * (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29
 */
30
%>
31

    
32
<%
33
 	Vector<String> skinNames = (Vector<String>)request.getAttribute("skinNameList"); 
34
	String defaultStyle = (String)request.getAttribute("defaultStyle");
35
%>
36

    
37
<html>
38
<head>
39

    
40
<title>Skins Configuration</title>
41
<link rel="stylesheet" type="text/css" 
42
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
43
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
44
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
45

    
46

    
47
</head>
48
<body>
49
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
50
<h2>Skins Configuration</h2>
51

    
52
<br class="skins-header">
53

    
54
<%@ include file="./page-message-section.jsp"%>
55

    
56
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
57
                                        onsubmit="return validate_form();">
58

    
59

    
60
<h3>Skins Configuration</h3>
61
<hr class="config-line">
62
<div class="heading-comment">
63
	Choose and configure the skins that will be available in this instance of MetaCat
64
</div><br>
65

    
66
<%
67
	HashMap<String, HashMap<String, String>> allSkinProperties = 
68
		(HashMap<String, HashMap<String, String>>)request.getAttribute("skinProperties");
69
	HashMap<String, PropertiesMetaData> allMetaData = 
70
		(HashMap<String, PropertiesMetaData>)request.getAttribute("metadataMap");
71

    
72
	for (String skinName : skinNames) {
73
%>
74
	<table class="config-section">
75
		<tr>
76
			<td class="config-checkbox">
77
				<input type="checkbox" 
78
<%
79
		if (skinName.equals(defaultStyle)) {
80
%>
81
				checked="yes"
82
<%
83
		} 
84
%>
85
				name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
86
			</td>
87
			<td class="config-checkbox-label">	
88
				<label for="<%= skinName %>.cb %>"><%= skinName %></label>
89
<%
90
		if (skinName.equals(defaultStyle)) {
91
%>		
92
				<div style="display: inline;" id="hiding-default-<%= skinName %>"> (default)<div>	
93
<%
94
		} else {
95
%>		
96
				<div style="display: none;" id="hiding-default-<%= skinName %>"> (default)<div>	
97
<%
98
		} 
99
%>
100
			</td> 
101
			<td class="config-question-mark">
102
				<img src="style/images/question-mark.gif"
103
						alt="blah"
104
						title="blah"/>
105
			</td>
106
		</tr>
107
	</table>
108
	<table class="config-section-hiding" 
109
<%
110
		if (skinName.equals(defaultStyle)) {
111
%>
112
				style="display: table;"
113
<%
114
		} 
115
%>	
116
	id="hiding-section-<%= skinName %>">
117
<%
118
		HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
119
		PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
120
		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
121
		Set<Integer> groupKeys = metaDataGroups.keySet();
122
		for (Integer groupkey : groupKeys) {
123
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
124
			Set<Integer> propertyKeys = propertyMap.keySet();
125
%>
126
			<tr>
127
				<td class="config-property-label" >
128
					<label for="<%= skinName %>-radio"> Make  &quot;<%= skinName %>&quot; default </label>
129
				</td>
130
				<td class="config-property-input" >
131
					<input type="radio" 
132
<%
133
			if (skinName.equals(defaultStyle)) {
134
%>
135
					checked
136
<%
137
			} 
138
%>
139
					name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
140
				</td>
141
				<td class="config-question-mark">
142
					<img src="style/images/question-mark.gif" 
143
							alt="boffo" 
144
							title="biffo"/><br>
145
				</td>
146
			</tr>
147
<%
148
			for (Integer propertyKey : propertyKeys) {
149
%>		
150
			<tr>	
151
<%		
152
				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);							
153
				String fieldType = metaDataProperty.getFieldType(); 
154
				if (fieldType.equals("select")) {
155
%> 
156
				<td class="config-property-label">
157
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>  
158
				</td>
159
				<td class="config-property-input"> 			
160
					<select name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
161
<%
162
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
163
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
164
					for (int i = 0; i < fieldOptionNames.size(); i++) {
165
%>
166
						<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
167
<%
168
					}
169
%>
170
					</select>
171
				</td>
172
				<td class="config-question-mark"> 
173
					<img src="style/images/question-mark.gif" 
174
							alt="<%= metaDataProperty.getDescription() %>" 
175
							title="<%= metaDataProperty.getDescription() %>"/><br/>
176
				</td>
177

    
178
<%		
179
				} else if (fieldType.equals("password")) {
180
%>
181
				<td class="config-property-label">
182
					<label  for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
183
				</td>
184
				<td class="config-property-input"> 
185
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
186
							type="<%= fieldType %>"
187
							alt="<%= metaDataProperty.getDescription() %>"/> 
188
				</td>
189
				<td class="config-question-mark"> 
190
					<img src="style/images/question-mark.gif" 
191
							alt="<%= metaDataProperty.getDescription() %>" 
192
							title="<%= metaDataProperty.getDescription() %>"/><br/>
193
				</td>
194
<%		
195
				} else {
196
%>
197
				<td class="config-property-label">
198
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
199
				</td>
200
				<td class="config-property-input"> 
201
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 
202
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
203
							type="<%= fieldType %>	"           			
204
							alt="<%= metaDataProperty.getDescription() %>"/>	           		    
205
				</td>
206
				<td class="config-question-mark"> 
207
					<img src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/><br/>
208
				</td>
209
<%   			
210
				}									
211
%>
212
			</tr>
213
<%
214
				if (metaDataProperty.getDescription() != null) {
215
%>
216
				<tr>
217
	    	        <td></td>
218
	    	        <td class="config-property-description" colspan="2" >
219
						<%= metaDataProperty.getDescription() %>
220
	    	        </td>
221
				</tr>
222
<%
223
	    		}
224
			}
225
		}
226

    
227
%>
228

    
229
	</table>
230
<%
231
	}
232
%>
233
	<input type="hidden" name="configureType" value="skins"/>
234
	<input type="hidden" name="processForm" value="true"/>
235
	<br>
236
	<input class="left-button" type="submit" value="Save"/>
237
	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
238

    
239
</form>
240

    
241
</body>
242
</html>
(12-12/12)