Project

General

Profile

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

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

    
99
<table width="100%" border="0" cellspacing="0" cellpadding="0">
100
	<tr>
101
		<th>
102
			Cart
103
			<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm">
104
				<input name="qformat" value="first-assessment" type="hidden"> 
105
				<input name="action" value="squery" type="hidden"> 	
106
				
107
				<%
108
				String[] docids = 
109
					SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getDocids() ;
110
				for (int i = 0; i < docids.length; i++) {
111
				%>							
112
					<input name="@packageId" value="<%=docids[i] %>" type="hidden"> 
113
				<%} %>	
114
			</form>
115
		</th>
116
	</tr>
117
	<tr>
118
		<td>
119
			<p class="emphasis">Selected Metadata Fields: </p>
120
			<p>
121
				<table>
122
					<%
123
					String[] labels = 
124
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
125
					for (int i = 0; i < labels.length; i++) {
126
					%>							
127
						<tr>
128
							<td>
129
								&nbsp;
130
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
131
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
132
								</a>
133
							</td>
134
							<td><%=labels[i] %> </td>
135
						</tr>	
136
					<%} %>
137
				</table>
138
			</p>
139
		</td>
140
	</tr>
141
	<tr>
142
		<th>
143
			&nbsp;
144
		</th>
145
	</tr>		
146
	<tr>
147
		<td>
148
			<div id="ajaxCartResults" style="display:none;">
149
				Loading Cart...
150
			</div>
151
		</td>
152
	</tr>
153
</table>
154

    
155
<script language="JavaScript">          
156
    insertTemplateClosing("<%=CONTEXT_URL%>");
157
</script>
158
</body>
159
</html>