Project

General

Profile

1 4080 daigle
<%@ 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$'
13
 *     '$Date$'
14
 * '$Revision$'
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 4557 daigle
<%@ include file="./header-section.jsp"%>
48
49 4080 daigle
<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 4100 daigle
<hr class="config-line">
62 4080 daigle
<div class="heading-comment">
63 4557 daigle
	Choose and configure the skins that will be available in this instance of Metacat
64 4080 daigle
</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 4258 daigle
	<div>
75
		<input class="checkradio" type="checkbox"
76 4115 daigle
<%
77
		if (skinName.equals(defaultStyle)) {
78
%>
79 4258 daigle
			checked="yes"
80 4115 daigle
<%
81
		}
82
%>
83 4258 daigle
			name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
84
		<label class="checkradio-label" for="<%= skinName %>.cb %>"><%= skinName %></label>
85 4080 daigle
<%
86
		if (skinName.equals(defaultStyle)) {
87
%>
88 4258 daigle
			<div class="checkradio-label-inline" id="hiding-default-<%= skinName %>"> (default)</div>
89 4080 daigle
<%
90
		} else {
91
%>
92 4258 daigle
			<div class="checkradio-label-inline" style="display: none;" id="hiding-default-<%= skinName %>"> (default)</div>
93 4080 daigle
<%
94
		}
95
%>
96 4258 daigle
	</div>
97
	<div class="hiding-section"
98 4080 daigle
<%
99 4115 daigle
		if (skinName.equals(defaultStyle)) {
100
%>
101 4258 daigle
				style="display: block;"
102 4115 daigle
<%
103
		}
104
%>
105
	id="hiding-section-<%= skinName %>">
106
<%
107 4080 daigle
		HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
108
		PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
109
		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
110
		Set<Integer> groupKeys = metaDataGroups.keySet();
111
		for (Integer groupkey : groupKeys) {
112 5028 daigle
			if (groupkey == 0) {
113
				continue;
114
			}
115 4080 daigle
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
116
			Set<Integer> propertyKeys = propertyMap.keySet();
117
%>
118 4258 daigle
					<input class="checkradio" type="radio"
119 4115 daigle
<%
120
			if (skinName.equals(defaultStyle)) {
121
%>
122
					checked
123
<%
124
			}
125
%>
126 4608 daigle
					name="application.default-style" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
127 4258 daigle
					<label class="checkradio-label" for="<%= skinName %>-radio"> Make  &quot;<%= skinName %>&quot; default </label>
128 4080 daigle
<%
129
			for (Integer propertyKey : propertyKeys) {
130
%>
131
<%
132
				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);
133
				String fieldType = metaDataProperty.getFieldType();
134
				if (fieldType.equals("select")) {
135 4258 daigle
%>
136
				<div class="form-row">
137 7424 leinfelder
					<img class="question-mark" src="style/images/help.png"
138 4258 daigle
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')""/>
139 4279 daigle
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
140 4258 daigle
					<select class="textinput" name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
141
142 4080 daigle
<%
143 4100 daigle
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
144
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
145
					for (int i = 0; i < fieldOptionNames.size(); i++) {
146 4080 daigle
%>
147 4100 daigle
						<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
148 4080 daigle
<%
149
					}
150
%>
151
					</select>
152 4258 daigle
				</div>
153
<%
154
					if (metaDataProperty.getDescription() != null) {
155
%>
156
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
157 4080 daigle
<%
158 4258 daigle
					}
159 4080 daigle
				} else if (fieldType.equals("password")) {
160 4258 daigle
%>
161
				<div class="form-row">
162 7424 leinfelder
					<img class="question-mark" src="style/images/help.png"
163 4258 daigle
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
164 4292 daigle
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label></div>
165 4258 daigle
					<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
166 4321 daigle
							type="<%= fieldType %>"/>
167 4258 daigle
				</div>
168
<%
169
					if (metaDataProperty.getDescription() != null) {
170
%>
171
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
172
<%
173
					}
174
				} else if (fieldType.equals("checkbox")) {
175
%>
176
				<div class="form-row">
177 7424 leinfelder
					<img class="question-mark" src="style/images/help.png"
178 4176 daigle
						 alt="<%= metaDataProperty.getDescription() %>"
179 4258 daigle
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
180
					<input class="checkradio" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
181
						   type="<%= fieldType %>"
182 4321 daigle
<%
183
					if (skinProperties.get(metaDataProperty.getKey()).equals("true")) {
184
%>
185
							checked="yes"
186
<%
187
					}
188
%>
189
						   />
190 4258 daigle
					<label class="checkradio-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
191
				</div>
192
<%
193
					if (metaDataProperty.getDescription() != null) {
194
%>
195
						<div class="checkradio-description">[<%= metaDataProperty.getDescription() %>]</div>
196 4080 daigle
<%
197 4258 daigle
					}
198 4080 daigle
				} else {
199
%>
200 4258 daigle
				<div class="form-row">
201 7424 leinfelder
					<img class="question-mark" src="style/images/help.png"
202 4258 daigle
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
203
					<label class="textinput-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
204
					<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
205 4080 daigle
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"
206 4321 daigle
							type="<%= fieldType %>"/>
207 4258 daigle
				</div>
208 4080 daigle
<%
209 4258 daigle
					if (metaDataProperty.getDescription() != null) {
210 4157 daigle
%>
211 4258 daigle
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
212
<%
213
					}
214
				}
215 4157 daigle
			}
216 4080 daigle
		}
217
218
%>
219 4258 daigle
	</div>
220 4080 daigle
<%
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 4557 daigle
<%@ include file="./footer-section.jsp"%>
232
233 4080 daigle
</body>
234
</html>