Project

General

Profile

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-11-12 10:33:25 -0800 (Wed, 12 Nov 2008) $'
14
 * '$Revision: 4557 $'
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
<%@ include file="./header-section.jsp"%>
48

    
49
<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
<hr class="config-line">
62
<div class="heading-comment">
63
	Choose and configure the skins that will be available in this instance of Metacat
64
</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
	<div>
75
		<input class="checkradio" type="checkbox" 
76
<%
77
		if (skinName.equals(defaultStyle)) {
78
%>
79
			checked="yes"
80
<%
81
		} 
82
%>
83
			name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
84
		<label class="checkradio-label" for="<%= skinName %>.cb %>"><%= skinName %></label>
85
<%
86
		if (skinName.equals(defaultStyle)) {
87
%>		
88
			<div class="checkradio-label-inline" id="hiding-default-<%= skinName %>"> (default)</div>	
89
<%
90
		} else {
91
%>		
92
			<div class="checkradio-label-inline" style="display: none;" id="hiding-default-<%= skinName %>"> (default)</div>	
93
<%
94
		} 
95
%>
96
	</div>
97
	<div class="hiding-section" 
98
<%
99
		if (skinName.equals(defaultStyle)) {
100
%>
101
				style="display: block;"
102
<%
103
		} 
104
%>	
105
	id="hiding-section-<%= skinName %>">
106
<%
107
		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
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
113
			Set<Integer> propertyKeys = propertyMap.keySet();
114
%>
115
					<input class="checkradio" type="radio" 
116
<%
117
			if (skinName.equals(defaultStyle)) {
118
%>
119
					checked
120
<%
121
			} 
122
%>
123
					name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
124
					<label class="checkradio-label" for="<%= skinName %>-radio"> Make  &quot;<%= skinName %>&quot; default </label>
125
<%
126
			for (Integer propertyKey : propertyKeys) {
127
%>		
128
<%		
129
				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);							
130
				String fieldType = metaDataProperty.getFieldType(); 
131
				if (fieldType.equals("select")) {
132
%>
133
				<div class="form-row"> 
134
					<img class="question-mark" src="style/images/question-mark.gif" 
135
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')""/>
136
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>  		
137
					<select class="textinput" name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
138

    
139
<%
140
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
141
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
142
					for (int i = 0; i < fieldOptionNames.size(); i++) {
143
%>
144
						<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
145
<%
146
					}
147
%>
148
					</select>
149
				</div>
150
<%
151
					if (metaDataProperty.getDescription() != null) {
152
%>
153
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
154
<%		
155
					}   	
156
				} else if (fieldType.equals("password")) {
157
%>	
158
				<div class="form-row">
159
					<img class="question-mark" src="style/images/question-mark.gif" 
160
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
161
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label></div>
162
					<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
163
							type="<%= fieldType %>"/> 
164
				</div>
165
<%
166
					if (metaDataProperty.getDescription() != null) {
167
%>
168
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
169
<%		
170
					}   		
171
				} else if (fieldType.equals("checkbox")) {
172
%>
173
				<div class="form-row">
174
					<img class="question-mark" src="style/images/question-mark.gif" 
175
						 alt="<%= metaDataProperty.getDescription() %>" 
176
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
177
					<input class="checkradio" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
178
						   type="<%= fieldType %>"
179
<%
180
					if (skinProperties.get(metaDataProperty.getKey()).equals("true")) {
181
%>
182
							checked="yes"
183
<%		
184
					}   
185
%>
186
						   /> 
187
					<label class="checkradio-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
188
				</div>
189
<%
190
					if (metaDataProperty.getDescription() != null) {
191
%>
192
						<div class="checkradio-description">[<%= metaDataProperty.getDescription() %>]</div>
193
<%		
194
					}
195
				} else {
196
%>
197
				<div class="form-row">
198
					<img class="question-mark" src="style/images/question-mark.gif" 
199
						 onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
200
					<label class="textinput-label" for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
201
					<input class="textinput" id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 
202
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
203
							type="<%= fieldType %>"/>	
204
				</div>  
205
<%
206
					if (metaDataProperty.getDescription() != null) {
207
%>
208
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
209
<%		
210
					}         		      			
211
				}									
212
			}
213
		}
214

    
215
%>
216
	</div>
217
<%
218
	}
219
%>
220
	<input type="hidden" name="configureType" value="skins"/>
221
	<input type="hidden" name="processForm" value="true"/>
222
	<br>
223
	<input class="left-button" type="submit" value="Save"/>
224
	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
225

    
226
</form>
227

    
228
<%@ include file="./footer-section.jsp"%>
229

    
230
</body>
231
</html>
(14-14/14)