Project

General

Profile

1
<%@ page language="java" %>
2
<%@ page import="java.util.Set,java.util.Map,java.util.Vector,edu.ucsb.nceas.utilities.PropertiesMetaData" %>
3
<%@ page import="edu.ucsb.nceas.utilities.MetaDataGroup,edu.ucsb.nceas.utilities.MetaDataProperty" %>
4
<% 
5
/**
6
 *  '$RCSfile$'
7
 *    Copyright: 2008 Regents of the University of California and the
8
 *               National Center for Ecological Analysis and Synthesis
9
 *  For Details: http://www.nceas.ucsb.edu/
10
 *
11
 *   '$Author: walker $'
12
 *     '$Date: 2013-09-18 15:37:06 -0700 (Wed, 18 Sep 2013) $'
13
 * '$Revision: 8240 $'
14
 * 
15
 * This program is free software; you can redistribute it and/or modify
16
 * it under the terms of the GNU General Public License as published by
17
 * the Free Software Foundation; either version 2 of the License, or
18
 * (at your option) any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * You should have received a copy of the GNU General Public License
26
 * along with this program; if not, write to the Free Software
27
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
 */
29
%>
30

    
31
<html>
32
<head>
33

    
34
<title>Metacat Properties Configuration</title>
35
<%@ include file="./head-section.jsp"%>
36
</head>
37
<body>
38
<%@ include file="./header-section.jsp"%> 
39

    
40
<div class="document">
41
	<h2>Metacat Properties Configuration</h2>
42
	
43
	<p>Enter Metacat System properties here.  All Fields must be filled in before saving.
44
	</p>
45
	<br clear="right"/>
46
	
47
	<%@ include file="page-message-section.jsp"%>
48
	
49
	<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
50
	                                        onsubmit="return submitForm(this);">
51
	<% 
52
		// metadata holds all group and properties metadata
53
	    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
54
		if (metadata != null) {
55
			// each group describes a section of properties
56
			Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
57
			Set<Integer> groupIdSet = groupMap.keySet();
58
	
59
			
60
			for (Integer groupId : groupIdSet) {
61
				// for this group, display the header (group name)
62
				MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
63
				if (groupId == 0) {
64
					// get all the properties in this group
65
					Map<Integer, MetaDataProperty> propertyMap = 
66
						metadata.getPropertiesInGroup(metaDataGroup.getIndex());
67
					Set<Integer> propertyIndexes = propertyMap.keySet();
68
					// iterate through each property and display appropriately
69
					for (Integer propertyIndex : propertyIndexes) {
70
						MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
71
		    			String fieldType = metaDataProperty.getFieldType(); 
72
		    			if (fieldType.equals("hidden")) {
73
	%>
74
							<input type="hidden"
75
	                               name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
76
		           		    	   value="<%= request.getAttribute(metaDataProperty.getKey()) %>"/>
77
	<%
78
		    			}
79
					}
80
				} else {		
81
	%>
82
			<h3><%= metaDataGroup.getName()  %></h3>
83
	<%
84
				// get all the properties in this group
85
				Map<Integer, MetaDataProperty> propertyMap = 
86
					metadata.getPropertiesInGroup(metaDataGroup.getIndex());
87
				Set<Integer> propertyIndexes = propertyMap.keySet();
88
				// iterate through each property and display appropriately
89
				for (Integer propertyIndex : propertyIndexes) {
90
					MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
91
	    			String fieldType = metaDataProperty.getFieldType(); 
92
	    			if (fieldType.equals("select")) {
93
	%> 
94
					<div class="form-row">
95
	   				<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>
96
						<select class="textinput" name="<%= metaDataProperty.getKey() %>">
97
	<%
98
						Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
99
						Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
100
						for (int i = 0; i < fieldOptionNames.size(); i++) {
101
	%>
102
						<option value="<%= fieldOptionValues.elementAt(i) %>"
103
	<%
104
							if (fieldOptionValues.elementAt(i).equals(request.getAttribute(metaDataProperty.getKey()))) {
105
	%>
106
								selected="yes"
107
	<%
108
							}
109
	%>
110
						> <%= fieldOptionNames.elementAt(i) %>
111
	<%
112
					}
113
	%>
114
						</select>
115
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
116
					</div>
117
	<%		
118
					} else if (fieldType.equals("password")) {
119
	%>
120
					<div class="form-row">
121
						<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" ><%= metaDataProperty.getLabel() %></label></div>
122
						<input class="textinput" id="<%= metaDataProperty.getKey() %>" 
123
								name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
124
		           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
125
		           		    	type="<%= fieldType %>"/> 
126
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
127
					</div>
128
	<%
129
					} else if (fieldType.equals("hidden")) {
130
						%>
131
							<input id="<%= metaDataProperty.getKey() %>" 
132
									name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
133
			           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
134
			           		    	type="<%= fieldType %>"/> 
135
		<%
136
					} else {
137
	%>
138
					<div class="form-row">
139
						<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %> "><%= metaDataProperty.getLabel() %></label>	</div>					
140
						<input class="textinput" id="<%= metaDataProperty.getKey() %>" 
141
								name="<%= metaDataProperty.getKey() %>" 
142
		    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
143
		           		    	type="<%= fieldType %> "/>	
144
						<i class="icon-question-sign" onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"></i>
145
					</div>          		    
146
	<%   			
147
					}
148
	    			
149
	    			if (metaDataProperty.getDescription() != null && metaDataProperty.getDescription().trim().length() > 0 ) {
150
	%>
151
	
152
						<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
153
	<%
154
	    			}
155
				}
156
				}
157
			}
158
				
159
		}
160
	%>
161
	
162
				<input type="hidden" name="configureType" value="properties"/>
163
				<input type="hidden" name="processForm" value="true"/>
164
				<input class=button type="submit" value="Save"/>
165
				<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
166
	
167
	</form>
168
	
169
</div>
170
<%@ include file="./footer-section.jsp"%>
171

    
172
</body>
173
</html>
(16-16/20)