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-08-26 15:31:59 -0700 (Tue, 26 Aug 2008) $'
|
14
|
* '$Revision: 4321 $'
|
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
|
<div>
|
73
|
<input class="checkradio" type="checkbox"
|
74
|
<%
|
75
|
if (skinName.equals(defaultStyle)) {
|
76
|
%>
|
77
|
checked="yes"
|
78
|
<%
|
79
|
}
|
80
|
%>
|
81
|
name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
|
82
|
<label class="checkradio-label" for="<%= skinName %>.cb %>"><%= skinName %></label>
|
83
|
<%
|
84
|
if (skinName.equals(defaultStyle)) {
|
85
|
%>
|
86
|
<div class="checkradio-label-inline" id="hiding-default-<%= skinName %>"> (default)</div>
|
87
|
<%
|
88
|
} else {
|
89
|
%>
|
90
|
<div class="checkradio-label-inline" style="display: none;" id="hiding-default-<%= skinName %>"> (default)</div>
|
91
|
<%
|
92
|
}
|
93
|
%>
|
94
|
</div>
|
95
|
<div class="hiding-section"
|
96
|
<%
|
97
|
if (skinName.equals(defaultStyle)) {
|
98
|
%>
|
99
|
style="display: block;"
|
100
|
<%
|
101
|
}
|
102
|
%>
|
103
|
id="hiding-section-<%= skinName %>">
|
104
|
<%
|
105
|
HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
|
106
|
PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
|
107
|
Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
|
108
|
Set<Integer> groupKeys = metaDataGroups.keySet();
|
109
|
for (Integer groupkey : groupKeys) {
|
110
|
SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
|
111
|
Set<Integer> propertyKeys = propertyMap.keySet();
|
112
|
%>
|
113
|
<input class="checkradio" type="radio"
|
114
|
<%
|
115
|
if (skinName.equals(defaultStyle)) {
|
116
|
%>
|
117
|
checked
|
118
|
<%
|
119
|
}
|
120
|
%>
|
121
|
name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
|
122
|
<label class="checkradio-label" for="<%= skinName %>-radio"> Make "<%= skinName %>" default </label>
|
123
|
<%
|
124
|
for (Integer propertyKey : propertyKeys) {
|
125
|
%>
|
126
|
<%
|
127
|
MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);
|
128
|
String fieldType = metaDataProperty.getFieldType();
|
129
|
if (fieldType.equals("select")) {
|
130
|
%>
|
131
|
<div class="form-row">
|
132
|
<img class="question-mark" src="style/images/question-mark.gif"
|
133
|
onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')""/>
|
134
|
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
|
135
|
<select class="textinput" name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
|
136
|
|
137
|
<%
|
138
|
Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
|
139
|
Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
|
140
|
for (int i = 0; i < fieldOptionNames.size(); i++) {
|
141
|
%>
|
142
|
<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
|
143
|
<%
|
144
|
}
|
145
|
%>
|
146
|
</select>
|
147
|
</div>
|
148
|
<%
|
149
|
if (metaDataProperty.getDescription() != null) {
|
150
|
%>
|
151
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
152
|
<%
|
153
|
}
|
154
|
} else if (fieldType.equals("password")) {
|
155
|
%>
|
156
|
<div class="form-row">
|
157
|
<img class="question-mark" src="style/images/question-mark.gif"
|
158
|
onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
|
159
|
<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label></div>
|
160
|
<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
|
161
|
type="<%= fieldType %>"/>
|
162
|
</div>
|
163
|
<%
|
164
|
if (metaDataProperty.getDescription() != null) {
|
165
|
%>
|
166
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
167
|
<%
|
168
|
}
|
169
|
} else if (fieldType.equals("checkbox")) {
|
170
|
%>
|
171
|
<div class="form-row">
|
172
|
<img class="question-mark" src="style/images/question-mark.gif"
|
173
|
alt="<%= metaDataProperty.getDescription() %>"
|
174
|
onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
|
175
|
<input class="checkradio" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
|
176
|
type="<%= fieldType %>"
|
177
|
<%
|
178
|
if (skinProperties.get(metaDataProperty.getKey()).equals("true")) {
|
179
|
%>
|
180
|
checked="yes"
|
181
|
<%
|
182
|
}
|
183
|
%>
|
184
|
/>
|
185
|
<label class="checkradio-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
|
186
|
</div>
|
187
|
<%
|
188
|
if (metaDataProperty.getDescription() != null) {
|
189
|
%>
|
190
|
<div class="checkradio-description">[<%= metaDataProperty.getDescription() %>]</div>
|
191
|
<%
|
192
|
}
|
193
|
} else {
|
194
|
%>
|
195
|
<div class="form-row">
|
196
|
<img class="question-mark" src="style/images/question-mark.gif"
|
197
|
onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
|
198
|
<label class="textinput-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
|
199
|
<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>"
|
200
|
value="<%= skinProperties.get(metaDataProperty.getKey()) %>"
|
201
|
type="<%= fieldType %>"/>
|
202
|
</div>
|
203
|
<%
|
204
|
if (metaDataProperty.getDescription() != null) {
|
205
|
%>
|
206
|
<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
|
207
|
<%
|
208
|
}
|
209
|
}
|
210
|
}
|
211
|
}
|
212
|
|
213
|
%>
|
214
|
</div>
|
215
|
<%
|
216
|
}
|
217
|
%>
|
218
|
<input type="hidden" name="configureType" value="skins"/>
|
219
|
<input type="hidden" name="processForm" value="true"/>
|
220
|
<br>
|
221
|
<input class="left-button" type="submit" value="Save"/>
|
222
|
<input class="button" type="button" value="Cancel" onClick="forward('./admin')">
|
223
|
|
224
|
</form>
|
225
|
|
226
|
</body>
|
227
|
</html>
|