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