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-07-11 10:00:44 -0700 (Fri, 11 Jul 2008) $'
14
 * '$Revision: 4100 $'
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
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/help/help.js"></script>
45

    
46

    
47
</head>
48
<body>
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
	<table class="config-section">
75
		<tr>
76
			<td class="config-checkbox">
77
				<input type="checkbox" name="<%= skinName %>.cb" id="<%= skinName %>.cb"onClick="toggleHiddenTable(this, 'hiding-section-<%= skinName %>')"/>
78
			</td>
79
			<td class="config-checkbox-label">	
80
				<label for="<%= skinName %>.cb %>"><%= skinName %></label>
81
<%
82
		if (skinName.equals(defaultStyle)) {
83
%>		
84
				<div style="display: inline;" id="hiding-default-<%= skinName %>"> (default)<div>	
85
<%
86
		} else {
87
%>		
88
				<div style="display: none;" id="hiding-default-<%= skinName %>"> (default)<div>	
89
<%
90
		} 
91
%>
92
			</td> 
93
			<td class="config-question-mark">
94
				<img src="style/images/question-mark.gif"
95
						alt="blah"
96
						title="blah"/>
97
			</td>
98
		</tr>
99
	</table>
100
	<table class="config-section-hiding" id="hiding-section-<%= skinName %>">
101
<%
102
		HashMap<String, String> skinProperties = allSkinProperties.get(skinName);
103
		PropertiesMetaData metaData = (PropertiesMetaData)allMetaData.get(skinName);
104
		Map<Integer, MetaDataGroup> metaDataGroups = metaData.getGroups();
105
		Set<Integer> groupKeys = metaDataGroups.keySet();
106
		for (Integer groupkey : groupKeys) {
107
			SortedMap<Integer, MetaDataProperty> propertyMap = metaData.getPropertiesInGroup(groupkey);
108
			Set<Integer> propertyKeys = propertyMap.keySet();
109
%>
110
			<tr>
111
				<td class="config-property-label" >
112
					<label for="<%= skinName %>-radio"> Make <%= skinName %> default </label>
113
				</td>
114
				<td class="config-property-input" >
115
					<input type="radio" name="default-flag" id="<%= skinName %>-radio" value="<%= skinName %>" onChange="toggleHiddenDefaultText('default-flag', '<%= skinName %>')"/>
116
				</td>
117
				<td class="config-question-mark">
118
					<img src="style/images/question-mark.gif" 
119
							alt="boffo" 
120
							title="biffo"/><br>
121
				</td>
122
			</tr>
123
<%
124
			for (Integer propertyKey : propertyKeys) {
125
%>		
126
			<tr>	
127
<%		
128
				MetaDataProperty metaDataProperty = propertyMap.get(propertyKey);							
129
				String fieldType = metaDataProperty.getFieldType(); 
130
				if (fieldType.equals("select")) {
131
%> 
132
				<td class="config-property-label">
133
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>  
134
				</td>
135
				<td class="config-property-input"> 			
136
					<select name="<%= skinName %>.<%= metaDataProperty.getKey() %>">
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
				</td>
148
				<td class="config-question-mark"> 
149
					<img src="style/images/question-mark.gif" 
150
							alt="<%= metaDataProperty.getDescription() %>" 
151
							title="<%= metaDataProperty.getDescription() %>"/><br/>
152
				</td>
153

    
154
<%		
155
				} else if (fieldType.equals("password")) {
156
%>
157
				<td class="config-property-label">
158
					<label  for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
159
				</td>
160
				<td class="config-property-input"> 
161
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
162
							type="<%= fieldType %>"
163
							alt="<%= metaDataProperty.getDescription() %>"/> 
164
				</td>
165
				<td class="config-question-mark"> 
166
					<img src="style/images/question-mark.gif" 
167
							alt="<%= metaDataProperty.getDescription() %>" 
168
							title="<%= metaDataProperty.getDescription() %>"/><br/>
169
				</td>
170
<%		
171
				} else {
172
%>
173
				<td class="config-property-label">
174
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
175
				</td>
176
				<td class="config-property-input"> 
177
					<input id="<%= skinName %>.<%= metaDataProperty.getKey() %>" name="<%= skinName %>.<%= metaDataProperty.getKey() %>" 
178
							value="<%= skinProperties.get(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
179
							type="<%= fieldType %>	"           			
180
							alt="<%= metaDataProperty.getDescription() %>"/>	           		    
181
				</td>
182
				<td class="config-question-mark"> 
183
					<img src="style/images/question-mark.gif" onClick="helpWindow('ldap_url_help.html')"/><br/>
184
				</td>
185
<%   			
186
				}					
187
			}	
188
%>
189
			</tr>
190
<%
191
		}
192

    
193
%>
194

    
195
	</table>
196
<%
197
	}
198
%>
199
	<input type="hidden" name="configureType" value="skins"/>
200
	<input type="hidden" name="processForm" value="true"/>
201
	<br>
202
	<input class="left-button" type="submit" value="Save"/>
203
	<input class="button" type="button" value="Cancel" onClick="forward('./admin')"> 
204

    
205
</form>
206

    
207
</body>
208
</html>
(11-11/11)