Project

General

Profile

metacat / lib / style / skins / first / cart.jsp @ 4491

1
<%@ 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
<script language="Javascript" type="text/JavaScript"
48
	src="<%=STYLE_COMMON_URL%>/effects.js">
49
</script>
50
<script language="Javascript">
51
		
52
		function listAssessments(){
53
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
54
		
55
			var docids = new Array();
56
			var objs = window.document.getElementById("iframeheaderclass").contentDocument.getElementsByName("@packageId");
57
			if (objs.length == 0) {
58
				return;
59
			}
60
			for (var i=0; i< objs.length; i++) {
61
				docids[i] = objs[i].value;
62
			}
63
				
64
			//generate the query to list assessments
65
			var queryString = 
66
				generateAssessmentListString(docids);
67
					
68
			callAjax(metacatURL, queryString, "first-assessment", "ajaxCartResults");
69
			
70
			Effect.Appear('ajaxCartResults');
71
			//Effect.BlindDown('ajaxCartResults');
72
		}
73
		
74
		function removeField(label) {
75
			var metacatURL = "<%=CONTEXT_URL%>/metacat";
76
			
77
			var myRequest = new Ajax.Request(
78
			metacatURL,
79
			{	method: 'post',
80
				parameters: { 
81
					action: 'editcart', 
82
					operation: 'removefield', 
83
					field: label, 
84
					path: null},
85
				evalScripts: true, 
86
				onSuccess: function(transport) {
87
					//in the cart, we should refresh the entire page
88
					window.location.reload();
89
				},
90
				onFailure: function(transport) {alert('failure saving field: ' + formElement.name);}
91
			 });
92
		}
93
		
94
		
95
		
96
   </script>
97
</head>
98
<body onload="listAssessments()">
99
<script language="JavaScript">
100
          insertTemplateOpening("<%=CONTEXT_URL%>");
101
          insertSearchBox("<%=CONTEXT_URL%>");
102
      </script>
103

    
104
<table width="100%" border="0" cellspacing="20" cellpadding="0">
105
	<tr>
106
		<th colspan="2">Cart</th>
107
	</tr>
108
	<tr valign="top">
109
		<td colspan="1">
110
			<p class="emphasis">Selected Metadata Fields: 
111
				<a href="javascript:{}" onclick="Effect.Appear('fieldSelection')">Edit >></a>
112
			</p>
113
			<p>
114
				<table>
115
					<%
116
					String[] labels = 
117
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
118
					for (int i = 0; i < labels.length; i++) {
119
					%>							
120
						<tr>
121
							<td>
122
								&nbsp;
123
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
124
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
125
								</a>
126
							</td>
127
							<td><%=labels[i] %> </td>
128
						</tr>	
129
					<%} %>
130
				</table>
131
			</p>
132
		</td>
133
		<td>
134
			<div id="fieldSelection" style="display:none;">
135
				<p class="emphasis">
136
					<a href="javascript:{}" onclick="Effect.Fade('fieldSelection')"> << Done</a>
137
				</p>	
138
				<form id="fieldForm" method="post" action="<%=CONTEXT_URL%>/metacat">
139
					<table>
140
						<tr>
141
							<th>Assement</th>
142
							<th>Course</th>
143
						</tr>
144
						<tr>
145
							<td>
146
								<input type="checkbox" name="title" value="//assessment/@title" />
147
									Title
148
								<br/>	
149
								<input type="checkbox" name="type" value="//assessment/@type"/>
150
									Type
151
								<br/>	
152
								<input type="checkbox" name="duration" value="//assessment/duration"/>
153
									Duration
154
								<br/>	
155
								<input type="checkbox" name="groupGrading" value="//assessment/grading/@group"/>
156
									Group Grading
157
								<br/>	
158
								<input type="checkbox" name="groupSize" value="//assessment/grading/@size"/>
159
									Group Size
160
								<br/>	
161
								<input type="checkbox" name="groupGradingApproach" value="//assessment/grading"/>
162
									Group Grading Approach
163
							</td>	
164
							<td>
165
								<input type="checkbox" name="year" value="//course/year"/>
166
									Year
167
								<br/>	
168
								<input type="checkbox" name="term" value="//course/term"/>
169
									Term
170
								<br/>	
171
								<input type="checkbox" name="startDate" value="//course/coverage/rangeOfDates/beginDate/calendarDate"/>
172
									Start Date
173
								<br/>	
174
								<input type="checkbox" name="endDate" value="//course/coverage/rangeOfDates/endDate/calendarDate"/>						
175
									End Date
176
								<br/>	
177
								<input type="checkbox" name="courseTitle" value="//course/lom/general/title/string"/>
178
									Title
179
								<br/>	
180
								<input type="checkbox" name="courseId" value="//course/lom/general/identifier/entry"/>
181
									ID
182
								<br/>	
183
								<input type="checkbox" name="courseDescription" value="//course/lom/general/description/string"/>
184
									Description
185
							</td>
186
						</tr>
187
						<tr>
188
							<th>Institution</th>
189
							<th>Instructor</th>
190
						</tr>
191
						<tr>	
192
							<td>
193
								<input type="checkbox" name="institutionName" value="//institution/organizationName"/>
194
									Name
195
							</td>
196
							<td>
197
								<input type="checkbox" name="instructorName" value="//instructor/individualName/surName"/>
198
									Name
199
								<br/>	
200
								<input type="checkbox" name="instructorOrganization" value="//instructor/organizationName"/>
201
									Organization	
202
							</td>
203
						</tr>
204
						<tr>
205
							<td></td>
206
							<td>
207
								<input type="button" value="Save Field Selections" onclick="saveFields('fieldForm', '<%=CONTEXT_URL%>/metacat')"/>
208
							</td>	
209
						</tr>	
210
					</table>		
211
				</form>
212
			</div>
213
		</td>
214
	</tr>
215
	<tr>
216
		<th colspan="2">
217
			&nbsp;
218
		</th>
219
	</tr>
220
	<tr>
221
		<td colspan="2">
222
			<div id="ajaxCartResults" style="/*display:none;*/">
223
				<p class="emphasis">Cart is Empty</p>
224
			</div>
225
		</td>
226
	</tr>
227
</table>
228

    
229
<script language="JavaScript">          
230
    insertTemplateClosing("<%=CONTEXT_URL%>");
231
</script>
232
</body>
233
</html>