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 5119 leinfelder
		function checkBrowser() {
52
			Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 6;
53
			Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5)) == 7;
54
			Prototype.Browser.IE8 = Prototype.Browser.IE && !Prototype.Browser.IE6 && !Prototype.Browser.IE7;
55
56
			if (Prototype.Browser.IE6) {
57
				alert("NOTE: IE7, IE8, Firefox and Chrome are currently supported for data download.");
58
			}
59
		}
60 4381 leinfelder
		function listAssessments(){
61
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
62
63
			var docids = new Array();
64 4495 leinfelder
			var doc = getIframeDocument("iframeheaderclass");
65
			var objs = doc.getElementsByName("@packageId");
66 4397 leinfelder
			if (objs.length == 0) {
67
				return;
68
			}
69 4381 leinfelder
			for (var i=0; i< objs.length; i++) {
70
				docids[i] = objs[i].value;
71
			}
72
73
			//generate the query to list assessments
74
			var queryString =
75
				generateAssessmentListString(docids);
76
77 4388 leinfelder
			callAjax(metacatURL, queryString, "first-assessment", "ajaxCartResults");
78
79
			Effect.Appear('ajaxCartResults');
80
			//Effect.BlindDown('ajaxCartResults');
81 4381 leinfelder
		}
82 4388 leinfelder
83 4389 leinfelder
		function removeField(label) {
84
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
85
86
			var myRequest = new Ajax.Request(
87
			metacatURL,
88
			{	method: 'post',
89
				parameters: {
90
					action: 'editcart',
91
					operation: 'removefield',
92
					field: label,
93
					path: null},
94
				evalScripts: true,
95
				onSuccess: function(transport) {
96
					//in the cart, we should refresh the entire page
97
					window.location.reload();
98
				},
99
				onFailure: function(transport) {alert('failure saving field: ' + formElement.name);}
100
			 });
101
		}
102
103 4484 leinfelder
104
105 4381 leinfelder
   </script>
106
</head>
107 5119 leinfelder
<body onload="checkBrowser();listAssessments()">
108 4381 leinfelder
<script language="JavaScript">
109
          insertTemplateOpening("<%=CONTEXT_URL%>");
110
          insertSearchBox("<%=CONTEXT_URL%>");
111
      </script>
112
113 4484 leinfelder
<table width="100%" border="0" cellspacing="20" cellpadding="0">
114 4381 leinfelder
	<tr>
115 4536 leinfelder
		<th colspan="2">Data Cart</th>
116 4387 leinfelder
	</tr>
117 4491 leinfelder
	<tr valign="top">
118 4484 leinfelder
		<td colspan="1">
119 4491 leinfelder
			<p class="emphasis">Selected Metadata Fields:
120
				<a href="javascript:{}" onclick="Effect.Appear('fieldSelection')">Edit >></a>
121
			</p>
122 4389 leinfelder
			<p>
123
				<table>
124
					<%
125
					String[] labels =
126
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
127
					for (int i = 0; i < labels.length; i++) {
128
					%>
129
						<tr>
130
							<td>
131
								&nbsp;
132
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
133
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
134
								</a>
135
							</td>
136
							<td><%=labels[i] %> </td>
137
						</tr>
138
					<%} %>
139
				</table>
140
			</p>
141 4381 leinfelder
		</td>
142 4491 leinfelder
		<td>
143
			<div id="fieldSelection" style="display:none;">
144
				<p class="emphasis">
145
					<a href="javascript:{}" onclick="Effect.Fade('fieldSelection')"> << Done</a>
146
				</p>
147
				<form id="fieldForm" method="post" action="<%=CONTEXT_URL%>/metacat">
148
					<table>
149
						<tr>
150 4791 leinfelder
							<th>Assessment</th>
151 4491 leinfelder
							<th>Course</th>
152
						</tr>
153
						<tr>
154
							<td>
155 4636 leinfelder
								<input type="checkbox" name="title" value="//assessment/title" />
156 4491 leinfelder
									Title
157
								<br/>
158 4636 leinfelder
								<input type="checkbox" name="type" value="//assessment/type"/>
159 4491 leinfelder
									Type
160
								<br/>
161
								<input type="checkbox" name="duration" value="//assessment/duration"/>
162
									Duration
163
								<br/>
164
								<input type="checkbox" name="groupGrading" value="//assessment/grading/@group"/>
165
									Group Grading
166
								<br/>
167
								<input type="checkbox" name="groupSize" value="//assessment/grading/@size"/>
168
									Group Size
169
								<br/>
170
								<input type="checkbox" name="groupGradingApproach" value="//assessment/grading"/>
171
									Group Grading Approach
172
							</td>
173
							<td>
174
								<input type="checkbox" name="year" value="//course/year"/>
175
									Year
176
								<br/>
177
								<input type="checkbox" name="term" value="//course/term"/>
178
									Term
179
								<br/>
180
								<input type="checkbox" name="startDate" value="//course/coverage/rangeOfDates/beginDate/calendarDate"/>
181
									Start Date
182
								<br/>
183
								<input type="checkbox" name="endDate" value="//course/coverage/rangeOfDates/endDate/calendarDate"/>
184
									End Date
185
								<br/>
186
								<input type="checkbox" name="courseTitle" value="//course/lom/general/title/string"/>
187
									Title
188
								<br/>
189
								<input type="checkbox" name="courseId" value="//course/lom/general/identifier/entry"/>
190
									ID
191
								<br/>
192
								<input type="checkbox" name="courseDescription" value="//course/lom/general/description/string"/>
193
									Description
194
							</td>
195
						</tr>
196
						<tr>
197
							<th>Institution</th>
198
							<th>Instructor</th>
199
						</tr>
200
						<tr>
201
							<td>
202
								<input type="checkbox" name="institutionName" value="//institution/organizationName"/>
203
									Name
204
							</td>
205
							<td>
206
								<input type="checkbox" name="instructorName" value="//instructor/individualName/surName"/>
207
									Name
208
								<br/>
209
								<input type="checkbox" name="instructorOrganization" value="//instructor/organizationName"/>
210
									Organization
211
							</td>
212
						</tr>
213
						<tr>
214
							<td></td>
215
							<td>
216
								<input type="button" value="Save Field Selections" onclick="saveFields('fieldForm', '<%=CONTEXT_URL%>/metacat')"/>
217
							</td>
218
						</tr>
219
					</table>
220
				</form>
221
			</div>
222
		</td>
223 4381 leinfelder
	</tr>
224
	<tr>
225 4491 leinfelder
		<th colspan="2">
226 4389 leinfelder
			&nbsp;
227
		</th>
228 4397 leinfelder
	</tr>
229 4389 leinfelder
	<tr>
230 4491 leinfelder
		<td colspan="2">
231 4397 leinfelder
			<div id="ajaxCartResults" style="/*display:none;*/">
232 4536 leinfelder
				<p class="emphasis">Data Cart is Empty</p>
233 4389 leinfelder
			</div>
234 4381 leinfelder
		</td>
235
	</tr>
236
</table>
237
238
<script language="JavaScript">
239
    insertTemplateClosing("<%=CONTEXT_URL%>");
240
</script>
241
</body>
242
</html>