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-29 10:31:02 -0700 (Tue, 29 Jul 2008) $'
14
 * '$Revision: 4176 $'
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

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

    
50
<br class="skins-header">
51

    
52
<%@ include file="./page-message-section.jsp"%>
53

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

    
57

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

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

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

    
166
<%		
167
				} else if (fieldType.equals("password")) {
168
%>
169
				<td class="config-property-label">
170
					<label  for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
171
				</td>
172
				<td class="config-property-input"> 
173
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
174
							type="<%= fieldType %>"
175
							alt="<%= metaDataProperty.getDescription() %>"/> 
176
				</td>
177
				<td class="config-question-mark"> 
178
					<img src="style/images/question-mark.gif" 
179
						 alt="<%= metaDataProperty.getDescription() %>" 
180
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/><br/>
181
				</td>
182
<%		
183
				} else {
184
%>
185
				<td class="config-property-label">
186
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
187
				</td>
188
				<td class="config-property-input"> 
189
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 
190
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
191
							type="<%= fieldType %>	"           			
192
							alt="<%= metaDataProperty.getDescription() %>"/>	           		    
193
				</td>
194
				<td class="config-question-mark"> 
195
					<img src="style/images/question-mark.gif" 
196
						 alt="<%= metaDataProperty.getDescription() %>"
197
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/><br/>
198
				</td>
199
<%   			
200
				}									
201
%>
202
			</tr>
203
<%
204
				if (metaDataProperty.getDescription() != null) {
205
%>
206
				<tr>
207
	    	        <td></td>
208
	    	        <td class="config-property-description" colspan="2" >
209
						<%= metaDataProperty.getDescription() %>
210
	    	        </td>
211
				</tr>
212
<%
213
	    		}
214
			}
215
		}
216

    
217
%>
218

    
219
	</table>
220
<%
221
	}
222
%>
223
	<input type="hidden" name="configureType" value="skins"/>
224
	<input type="hidden" name="processForm" value="true"/>
225
	<br>
226
	<input class="left-button" type="submit" value="Save"/>
227
	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
228

    
229
</form>
230

    
231
</body>
232
</html>
(12-12/12)