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