Project

General

Profile

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>Cart</th>
107
	</tr>
108
	<tr>
109
		<td colspan="1">
110
			<p class="emphasis">Selected Metadata Fields: </p>
111
			<p>
112
				<table>
113
					<%
114
					String[] labels = 
115
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
116
					for (int i = 0; i < labels.length; i++) {
117
					%>							
118
						<tr>
119
							<td>
120
								&nbsp;
121
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
122
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
123
								</a>
124
							</td>
125
							<td><%=labels[i] %> </td>
126
						</tr>	
127
					<%} %>
128
				</table>
129
			</p>
130
		</td>
131
	</tr>
132
	<tr>
133
		<th colspan="1">
134
			&nbsp;
135
		</th>
136
	</tr>
137
	<tr>
138
		<td colspan="1">
139
			<div id="ajaxCartResults" style="/*display:none;*/">
140
				<p class="emphasis">Cart is Empty</p>
141
			</div>
142
		</td>
143
	</tr>
144
</table>
145

    
146
<script language="JavaScript">          
147
    insertTemplateClosing("<%=CONTEXT_URL%>");
148
</script>
149
</body>
150
</html>
(3-3/19)