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: daigle $'
12
 *     '$Date: 2008-07-29 10:31:02 -0700 (Tue, 29 Jul 2008) $'
13
 * '$Revision: 4176 $'
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
<link rel="stylesheet" type="text/css" 
36
        href="<%= request.getContextPath() %>/admin/admin.css"></link>
37
<script language="JavaScript" type="text/JavaScript" src="<%= request.getContextPath() %>/admin/admin.js"></script>
38

    
39
</head>
40
<body>
41
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
42
<h2>MetaCat Properties Configuration</h2>
43

    
44
<p>Enter MetaCat System properties here.  All Fields must be filled in before saving.
45
</p>
46
<br clear="right"/>
47

    
48
<%@ include file="page-message-section.jsp"%>
49

    
50
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
51
                                        onsubmit="return submitForm(this);">
52
<% 
53
	// metadata holds all group and properties metadata
54
    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
55
	if (metadata != null) {
56
		// each group describes a section of properties
57
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
58
		Set<Integer> groupIdSet = groupMap.keySet();
59
		for (Integer groupId : groupIdSet) {
60
			// for this group, display the header (group name)
61
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
62
%>
63
		<h3><%= metaDataGroup.getName()  %></h3>
64
		<hr class="config-line">
65
		<table class="config-section">
66
<%
67
			// get all the properties in this group
68
			Map<Integer, MetaDataProperty> propertyMap = 
69
				metadata.getPropertiesInGroup(metaDataGroup.getIndex());
70
			Set<Integer> propertyIndexes = propertyMap.keySet();
71
			// iterate through each property and display appropriately
72
			for (Integer propertyIndex : propertyIndexes) {
73
				MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
74
    			String fieldType = metaDataProperty.getFieldType(); 
75
    			if (fieldType.equals("select")) {
76
%> 
77
			<tr>
78
				<td class="config-property-label">
79
     				<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>   
80
     			</td>	
81
     			<td class="config-property-input" >		
82
					<select name="<%= metaDataProperty.getKey() %>">
83
<%
84
					Vector<String> fieldOptionValues = metaDataProperty.getFieldOptionValues();
85
					Vector<String> fieldOptionNames = metaDataProperty.getFieldOptionNames();
86
					for (int i = 0; i < fieldOptionNames.size(); i++) {
87
%>
88
					<option value="<%= fieldOptionValues.elementAt(i) %>"> <%= fieldOptionNames.elementAt(i) %>
89
<%
90
				}
91
%>
92
					</select>
93
				</td>
94
				<td class="config-question-mark">
95
					<img src="style/images/question-mark.gif" 
96
	           		       alt="<%= metaDataProperty.getDescription() %>" 
97
	           		       onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
98
				</td>
99
			</tr>
100

    
101
<%		
102
				} else if (fieldType.equals("password")) {
103
%>
104
			<tr>
105
				<td class="config-property-label">
106
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
107
     			</td>	
108
     			<td class="config-property-input" >	
109
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
110
	           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
111
	           		    	type="<%= fieldType %>"
112
	           		    	alt="<%= metaDataProperty.getDescription() %>"/> 
113
				</td>
114
				<td class="config-question-mark">
115
					<img src="style/images/question-mark.gif" 
116
	           		       alt="<%= metaDataProperty.getDescription() %>" 
117
	           		       onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
118
				</td>
119
			</tr>
120
<%		
121
				} else {
122
%>
123
			<tr>
124
				<td class="config-property-label">
125
					<label for="<%= metaDataProperty.getKey() %>" title="<%= metaDataProperty.getDescription() %>"><%= metaDataProperty.getLabel() %></label>
126
     			</td>	
127
     			<td class="config-property-input" >							
128
					<input id="<%= metaDataProperty.getKey() %>" name="<%= metaDataProperty.getKey() %>" 
129
	    			        value="<%= request.getAttribute(metaDataProperty.getKey()) %>"	             		    	    	           		    	             			
130
	           		    	type="<%= fieldType %>	"           			
131
	           		    	alt="<%= metaDataProperty.getDescription() %>"/>	
132
	           	</td>
133
				<td class="config-question-mark">           		    
134
					<img class=question-mark 
135
					     src="style/images/question-mark.gif" 
136
					     onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
137
				</td>
138
 			</tr>
139
<%   			
140
				}
141
    			
142
    			if (metaDataProperty.getDescription() != null) {
143
%>
144
			<tr>
145
    	        <td></td>
146
    	        <td class="config-property-description" colspan="2" >
147
					<%= metaDataProperty.getDescription() %>
148
    	        </td>
149
			</tr>
150
<%
151
    			}
152
			}
153
%>
154

    
155
			</table>
156
<%
157
		}
158
	}
159
%>
160

    
161
			<input type="hidden" name="configureType" value="properties"/>
162
			<input type="hidden" name="processForm" value="true"/>
163
			<input class=left-button type="submit" value="Save"/>
164
			<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
165

    
166
</form>
167

    
168
</body>
169
</html>
(11-11/12)