Project

General

Profile

1 4381 leinfelder
<%@ page    language="java" %>
2
<%
3
/**
4
 *
5
 * '$RCSfile$'
6
 * Copyright: 2008 Regents of the University of California and the
7
 *             National Center for Ecological Analysis and Synthesis
8
 *    '$Author: leinfelder $'
9
 *      '$Date: 2008-08-22 16:48:56 -0700 (Fri, 22 Aug 2008) $'
10
 * '$Revision: 4305 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26
%>
27
28
<%@ include file="../../common/common-settings.jsp"%>
29
<%@ include file="../../common/configure-check.jsp"%>
30
31
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
32
<%@page import="edu.ucsb.nceas.metacat.service.SessionService"%>
33
<html>
34
<head>
35
<title>FIRST Assessment Metadata Repository</title>
36
<link rel="stylesheet" type="text/css"
37
	href="<%=STYLE_SKINS_URL%>/first/first.css">
38
<script language="JavaScript" type="text/JavaScript"
39
	src="<%=STYLE_SKINS_URL%>/first/first.js"></script>
40
<script language="JavaScript" type="text/JavaScript"
41
	src="<%=STYLE_SKINS_URL%>/first/search.js"></script>
42
<script language="JavaScript" type="text/JavaScript"
43
	src="<%=STYLE_COMMON_URL%>/branding.js"></script>
44
<script language="Javascript" type="text/JavaScript"
45
	src="<%=STYLE_COMMON_URL%>/prototype-1.5.1.1/prototype.js">
46
</script>
47 4388 leinfelder
<script language="Javascript" type="text/JavaScript"
48
	src="<%=STYLE_COMMON_URL%>/effects.js">
49
</script>
50 4381 leinfelder
<script language="Javascript">
51
52
		function listAssessments(){
53
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
54
55
			var docids = new Array();
56 4495 leinfelder
			var doc = getIframeDocument("iframeheaderclass");
57
			var objs = doc.getElementsByName("@packageId");
58 4397 leinfelder
			if (objs.length == 0) {
59
				return;
60
			}
61 4381 leinfelder
			for (var i=0; i< objs.length; i++) {
62
				docids[i] = objs[i].value;
63
			}
64
65
			//generate the query to list assessments
66
			var queryString =
67
				generateAssessmentListString(docids);
68
69 4388 leinfelder
			callAjax(metacatURL, queryString, "first-assessment", "ajaxCartResults");
70
71
			Effect.Appear('ajaxCartResults');
72
			//Effect.BlindDown('ajaxCartResults');
73 4381 leinfelder
		}
74 4388 leinfelder
75 4389 leinfelder
		function removeField(label) {
76
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
77
78
			var myRequest = new Ajax.Request(
79
			metacatURL,
80
			{	method: 'post',
81
				parameters: {
82
					action: 'editcart',
83
					operation: 'removefield',
84
					field: label,
85
					path: null},
86
				evalScripts: true,
87
				onSuccess: function(transport) {
88
					//in the cart, we should refresh the entire page
89
					window.location.reload();
90
				},
91
				onFailure: function(transport) {alert('failure saving field: ' + formElement.name);}
92
			 });
93
		}
94
95 4484 leinfelder
96
97 4381 leinfelder
   </script>
98
</head>
99
<body onload="listAssessments()">
100
<script language="JavaScript">
101
          insertTemplateOpening("<%=CONTEXT_URL%>");
102
          insertSearchBox("<%=CONTEXT_URL%>");
103
      </script>
104
105 4484 leinfelder
<table width="100%" border="0" cellspacing="20" cellpadding="0">
106 4381 leinfelder
	<tr>
107 4491 leinfelder
		<th colspan="2">Cart</th>
108 4387 leinfelder
	</tr>
109 4491 leinfelder
	<tr valign="top">
110 4484 leinfelder
		<td colspan="1">
111 4491 leinfelder
			<p class="emphasis">Selected Metadata Fields:
112
				<a href="javascript:{}" onclick="Effect.Appear('fieldSelection')">Edit >></a>
113
			</p>
114 4389 leinfelder
			<p>
115
				<table>
116
					<%
117
					String[] labels =
118
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
119
					for (int i = 0; i < labels.length; i++) {
120
					%>
121
						<tr>
122
							<td>
123
								&nbsp;
124
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
125
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
126
								</a>
127
							</td>
128
							<td><%=labels[i] %> </td>
129
						</tr>
130
					<%} %>
131
				</table>
132
			</p>
133 4381 leinfelder
		</td>
134 4491 leinfelder
		<td>
135
			<div id="fieldSelection" style="display:none;">
136
				<p class="emphasis">
137
					<a href="javascript:{}" onclick="Effect.Fade('fieldSelection')"> << Done</a>
138
				</p>
139
				<form id="fieldForm" method="post" action="<%=CONTEXT_URL%>/metacat">
140
					<table>
141
						<tr>
142
							<th>Assement</th>
143
							<th>Course</th>
144
						</tr>
145
						<tr>
146
							<td>
147
								<input type="checkbox" name="title" value="//assessment/@title" />
148
									Title
149
								<br/>
150
								<input type="checkbox" name="type" value="//assessment/@type"/>
151
									Type
152
								<br/>
153
								<input type="checkbox" name="duration" value="//assessment/duration"/>
154
									Duration
155
								<br/>
156
								<input type="checkbox" name="groupGrading" value="//assessment/grading/@group"/>
157
									Group Grading
158
								<br/>
159
								<input type="checkbox" name="groupSize" value="//assessment/grading/@size"/>
160
									Group Size
161
								<br/>
162
								<input type="checkbox" name="groupGradingApproach" value="//assessment/grading"/>
163
									Group Grading Approach
164
							</td>
165
							<td>
166
								<input type="checkbox" name="year" value="//course/year"/>
167
									Year
168
								<br/>
169
								<input type="checkbox" name="term" value="//course/term"/>
170
									Term
171
								<br/>
172
								<input type="checkbox" name="startDate" value="//course/coverage/rangeOfDates/beginDate/calendarDate"/>
173
									Start Date
174
								<br/>
175
								<input type="checkbox" name="endDate" value="//course/coverage/rangeOfDates/endDate/calendarDate"/>
176
									End Date
177
								<br/>
178
								<input type="checkbox" name="courseTitle" value="//course/lom/general/title/string"/>
179
									Title
180
								<br/>
181
								<input type="checkbox" name="courseId" value="//course/lom/general/identifier/entry"/>
182
									ID
183
								<br/>
184
								<input type="checkbox" name="courseDescription" value="//course/lom/general/description/string"/>
185
									Description
186
							</td>
187
						</tr>
188
						<tr>
189
							<th>Institution</th>
190
							<th>Instructor</th>
191
						</tr>
192
						<tr>
193
							<td>
194
								<input type="checkbox" name="institutionName" value="//institution/organizationName"/>
195
									Name
196
							</td>
197
							<td>
198
								<input type="checkbox" name="instructorName" value="//instructor/individualName/surName"/>
199
									Name
200
								<br/>
201
								<input type="checkbox" name="instructorOrganization" value="//instructor/organizationName"/>
202
									Organization
203
							</td>
204
						</tr>
205
						<tr>
206
							<td></td>
207
							<td>
208
								<input type="button" value="Save Field Selections" onclick="saveFields('fieldForm', '<%=CONTEXT_URL%>/metacat')"/>
209
							</td>
210
						</tr>
211
					</table>
212
				</form>
213
			</div>
214
		</td>
215 4381 leinfelder
	</tr>
216
	<tr>
217 4491 leinfelder
		<th colspan="2">
218 4389 leinfelder
			&nbsp;
219
		</th>
220 4397 leinfelder
	</tr>
221 4389 leinfelder
	<tr>
222 4491 leinfelder
		<td colspan="2">
223 4397 leinfelder
			<div id="ajaxCartResults" style="/*display:none;*/">
224
				<p class="emphasis">Cart is Empty</p>
225 4389 leinfelder
			</div>
226 4381 leinfelder
		</td>
227
	</tr>
228
</table>
229
230
<script language="JavaScript">
231
    insertTemplateClosing("<%=CONTEXT_URL%>");
232
</script>
233
</body>
234
</html>