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
			var objs = document.getElementsByName("@packageId");
57 4397 leinfelder
			if (objs.length == 0) {
58
				return;
59
			}
60 4381 leinfelder
			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 4388 leinfelder
			callAjax(metacatURL, queryString, "first-assessment", "ajaxCartResults");
69
70
			Effect.Appear('ajaxCartResults');
71
			//Effect.BlindDown('ajaxCartResults');
72 4381 leinfelder
		}
73 4388 leinfelder
74 4389 leinfelder
		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 4381 leinfelder
   </script>
95
</head>
96
<body onload="listAssessments()">
97
<script language="JavaScript">
98
          insertTemplateOpening("<%=CONTEXT_URL%>");
99
          insertSearchBox("<%=CONTEXT_URL%>");
100
      </script>
101
102 4387 leinfelder
<table width="100%" border="0" cellspacing="0" cellpadding="0">
103 4381 leinfelder
	<tr>
104 4397 leinfelder
		<th>Cart</th>
105
		<th>
106 4381 leinfelder
			<form method="POST" action="<%=SERVLET_URL%>" target="_top" id="searchForm">
107
				<input name="qformat" value="first-assessment" type="hidden">
108
				<input name="action" value="squery" type="hidden">
109
110
				<%
111
				String[] docids =
112
					SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getDocids() ;
113
				for (int i = 0; i < docids.length; i++) {
114
				%>
115
					<input name="@packageId" value="<%=docids[i] %>" type="hidden">
116
				<%} %>
117
			</form>
118 4387 leinfelder
		</th>
119 4397 leinfelder
		<th align="right" style="text-align:right;">
120
			<a href="<%=SERVLET_URL%>?action=logout&qformat=first">Logout</a>
121
		</th>
122 4387 leinfelder
	</tr>
123
	<tr>
124 4397 leinfelder
		<td colspan="3"">
125 4389 leinfelder
			<p class="emphasis">Selected Metadata Fields: </p>
126
			<p>
127
				<table>
128
					<%
129
					String[] labels =
130
						SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
131
					for (int i = 0; i < labels.length; i++) {
132
					%>
133
						<tr>
134
							<td>
135
								&nbsp;
136
								<a href="javascript:{}" onclick="removeField('<%=labels[i] %>')">
137
									<img src="<%=CONTEXT_URL%>/style/images/delete.gif" border="none"/>
138
								</a>
139
							</td>
140
							<td><%=labels[i] %> </td>
141
						</tr>
142
					<%} %>
143
				</table>
144
			</p>
145 4381 leinfelder
		</td>
146
	</tr>
147
	<tr>
148 4397 leinfelder
		<th colspan="3">
149 4389 leinfelder
			&nbsp;
150
		</th>
151 4397 leinfelder
	</tr>
152 4389 leinfelder
	<tr>
153 4397 leinfelder
		<td colspan="3">
154
			<div id="ajaxCartResults" style="/*display:none;*/">
155
				<p class="emphasis">Cart is Empty</p>
156 4389 leinfelder
			</div>
157 4381 leinfelder
		</td>
158
	</tr>
159
</table>
160
161
<script language="JavaScript">
162
    insertTemplateClosing("<%=CONTEXT_URL%>");
163
</script>
164
</body>
165
</html>