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 8240 walker
<%@ include file="./head-section.jsp"%>
42 4080 daigle
</head>
43
<body>
44 4557 daigle
<%@ include file="./header-section.jsp"%>
45
46 8222 walker
<div class="document">
47
	<h2>Skins Configuration</h2>
48
49
	<br class="skins-header">
50
51
	<%@ include file="./page-message-section.jsp"%>
52
53
	<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin"
54
	                                        onsubmit="return validate_form();">
55
56
57
	<h3>Skins Configuration</h3>
58
	<div class="heading-comment message-text">
59
		NOTE: Metacat v2.2.0 includes a new mechanism for customizing the look and feel of your
60
		Metacat deployment. MetacatUI themes can be deployed separately from the Metacat server
61
		allowing easier independent user interface customization. See the Metacat documentation
62
		for more information on using this feature.
63 4258 daigle
	</div>
64 8222 walker
	<br/>
65
	<div class="heading-comment">
66
		Choose and configure the skins that will be available in this instance of Metacat
67
	</div>
68
	<br/>
69
70
	<%
71
		HashMap<String, HashMap<String, String>> allSkinProperties =
72
			(HashMap<String, HashMap<String, String>>)request.getAttribute("skinProperties");
73
		HashMap<String, PropertiesMetaData> allMetaData =
74
			(HashMap<String, PropertiesMetaData>)request.getAttribute("metadataMap");
75
76
		for (String skinName : skinNames) {
77
	%>
78
		<div class="form-row">
79
			<input class="checkradio" type="checkbox"
80
	<%
81 4115 daigle
			if (skinName.equals(defaultStyle)) {
82 8222 walker
	%>
83
				checked="yes"
84
	<%
85 4115 daigle
			}
86 8222 walker
	%>
87
				name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
88
			<label class="checkradio-label" for="<%= skinName %>.cb %>"><%= skinName %></label>
89
	<%
90
			if (skinName.equals(defaultStyle)) {
91
	%>
92
				<div class="checkradio-label-inline" id="hiding-default-<%= skinName %>"> (default)</div>
93
	<%
94
			} else {
95
	%>
96
				<div class="checkradio-label-inline" style="display: none;" id="hiding-default-<%= skinName %>"> (default)</div>
97
	<%
98
			}
99
	%>
100
		</div>
101
		<div class="hiding-section"
102
	<%
103
			if (skinName.equals(defaultStyle)) {
104
	%>
105
					style="display: block;"
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
				if (groupkey == 0) {
117
					continue;
118
				}
119
				SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
120
				Set<Integer> propertyKeys = propertyMap.keySet();
121
	%>
122
						<input class="checkradio" type="radio"
123
	<%
124
				if (skinName.equals(defaultStyle)) {
125
	%>
126
						checked
127
	<%
128
				}
129
	%>
130
						name="application.default-style" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
131
						<label class="checkradio-label" for="<%= skinName %>-radio"> Make  &quot;<%= skinName %>&quot; default </label>
132
	<%
133
				for (Integer propertyKey : propertyKeys) {
134
	%>
135
	<%
136
					MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);
137
					String fieldType = metaDataProperty.getFieldType();
138
					if (fieldType.equals("select")) {
139
	%>
140
					<div class="form-row">
141
						<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
142
						<select class="textinput" name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
143
144
	<%
145
						Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
146
						Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
147
						for (int i = 0; i < fieldOptionNames.size(); i++) {
148
	%>
149
							<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
150
	<%
151
						}
152
	%>
153
						</select>
154
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')""></i>
155
					</div>
156
	<%
157
						if (metaDataProperty.getDescription() != null) {
158
	%>
159
							<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
160
	<%
161
						}
162
					} else if (fieldType.equals("password")) {
163
	%>
164
					<div class="form-row">
165
						<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label></div>
166
						<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
167
								type="<%= fieldType %>"/>
168
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
169
					</div>
170
	<%
171
						if (metaDataProperty.getDescription() != null) {
172
	%>
173
							<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
174
	<%
175
						}
176
					} else if (fieldType.equals("checkbox")) {
177
	%>
178
					<div class="form-row">
179
						<input class="checkradio" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
180
							   type="<%= fieldType %>"
181
	<%
182
						if (skinProperties.get(metaDataProperty.getKey()).equals("true")) {
183
	%>
184
								checked="yes"
185
	<%
186
						}
187
	%>
188
							   />
189
						<label class="checkradio-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
190
						<i class="icon-question-sign" alt="<%= metaDataProperty.getDescription() %>"
191
							 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
192
					</div>
193
	<%
194
						if (metaDataProperty.getDescription() != null) {
195
	%>
196
							<div class="checkradio-description">[<%= metaDataProperty.getDescription() %>]</div>
197
	<%
198
						}
199
					} else {
200
	%>
201
					<div class="form-row">
202
						<label class="textinput-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
203
						<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
204
								value="<%= skinProperties.get(metaDataProperty.getKey()) %>"
205
								type="<%= fieldType %>"/>
206
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
207
					</div>
208
	<%
209
						if (metaDataProperty.getDescription() != null) {
210
	%>
211
							<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
212
	<%
213
						}
214
					}
215
				}
216 4157 daigle
			}
217 8222 walker
218
	%>
219
		</div>
220
	<%
221 4080 daigle
		}
222 8222 walker
	%>
223
	<div class="buttons-wrapper">
224
		<input type="hidden" name="configureType" value="skins"/>
225
		<input type="hidden" name="processForm" value="true"/>
226
		<input class="button" type="submit" value="Save"/>
227
		<input class="button" type="button" value="Cancel" onClick="forward('./admin')">
228 4258 daigle
	</div>
229 8222 walker
	</form>
230
</div>
231 4080 daigle
232 4557 daigle
<%@ include file="./footer-section.jsp"%>
233
234 4080 daigle
</body>
235
</html>