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

    
43
<img src="<%= request.getContextPath() %>/metacat-logo.png" width="100px" align="right"/> 
44
<h2>Metacat Properties Configuration</h2>
45

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

    
50
<%@ include file="page-message-section.jsp"%>
51

    
52
<form method="POST" name="configuration_form" action="<%= request.getContextPath() %>/admin" 
53
                                        onsubmit="return submitForm(this);">
54
<% 
55
	// metadata holds all group and properties metadata
56
    PropertiesMetaData metadata = (PropertiesMetaData)request.getAttribute("metadata");
57
	if (metadata != null) {
58
		// each group describes a section of properties
59
		Map<Integer, MetaDataGroup> groupMap = metadata.getGroups();
60
		Set<Integer> groupIdSet = groupMap.keySet();
61
		for (Integer groupId : groupIdSet) {
62
			// for this group, display the header (group name)
63
			MetaDataGroup metaDataGroup = (MetaDataGroup)groupMap.get(groupId);
64
%>
65
		<h3><%= metaDataGroup.getName()  %></h3>
66
		<hr class="config-line">
67
<%
68
			// get all the properties in this group
69
			Map<Integer, MetaDataProperty> propertyMap = 
70
				metadata.getPropertiesInGroup(metaDataGroup.getIndex());
71
			Set<Integer> propertyIndexes = propertyMap.keySet();
72
			// iterate through each property and display appropriately
73
			for (Integer propertyIndex : propertyIndexes) {
74
				MetaDataProperty metaDataProperty = propertyMap.get(propertyIndex);
75
    			String fieldType = metaDataProperty.getFieldType(); 
76
    			if (fieldType.equals("select")) {
77
%> 
78
				<div class="form-row">
79
					<img class="question-mark" src="style/images/question-mark.gif"  
80
							onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
81
     				<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>"><%= metaDataProperty.getLabel() %></label></div>
82
					<select class="textinput" 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) %>"
89
<%
90
						if (fieldOptionValues.elementAt(i).equals(request.getAttribute(metaDataProperty.getKey()))) {
91
%>
92
							selected="yes"
93
<%
94
						}
95
%>
96
					> <%= fieldOptionNames.elementAt(i) %>
97
<%
98
				}
99
%>
100
					</select>
101
				</div>
102
<%		
103
				} else if (fieldType.equals("password")) {
104
%>
105
				<div class="form-row">
106
					<img class="question-mark" src="style/images/question-mark.gif"  
107
	           		       onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
108
					<div class="textinput-label"><label for="<%= metaDataProperty.getKey() %>" ><%= metaDataProperty.getLabel() %></label></div>
109
					<input class="textinput" id="<%= metaDataProperty.getKey() %>" 
110
							name="<%= metaDataProperty.getKey() %>" 	             		    	    	           		    	             			
111
	           		    	value="<%= request.getAttribute(metaDataProperty.getKey()) %>"
112
	           		    	type="<%= fieldType %>"/> 
113
				</div>
114
<%
115
				} else {
116
%>
117
				<div class="form-row">
118
					<img class="question-mark" class=question-mark 
119
					     src="style/images/question-mark.gif" 
120
					     onClick="helpWindow('<%= request.getContextPath() %>','<%= metaDataProperty.getHelpFile() %>')"/>
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
				</div>          		    
127
<%   			
128
				}
129
    			
130
    			if (metaDataProperty.getDescription() != null) {
131
%>
132

    
133
					<div class="textinput-description">[<%= metaDataProperty.getDescription() %>]</div>
134
<%
135
    			}
136
			}
137
		}
138
	}
139
%>
140

    
141
			<input type="hidden" name="configureType" value="properties"/>
142
			<input type="hidden" name="processForm" value="true"/>
143
			<input class=left-button type="submit" value="Save"/>
144
			<input class=button type="button" value="Cancel" onClick="forward('./admin')"> 
145

    
146
</form>
147

    
148
<%@ include file="./footer-section.jsp"%>
149

    
150
</body>
151
</html>
(13-13/14)