Project

General

Profile

Revision 4389

show selected metadata fields in the cart view and allow them to be removed from said view

View differences:

cart.jsp
68 68
			//Effect.BlindDown('ajaxCartResults');
69 69
		}
70 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
		
71 91
   </script>
72 92
</head>
73 93
<body onload="listAssessments()">
......
96 116
	</tr>
97 117
	<tr>
98 118
		<td>
99
			Fields:
100
			<ul>
101
				<%
102
				String[] labels = 
103
					SessionService.getRegisteredSession(request.getSession().getId()).getDocumentCart().getLabels();
104
				for (int i = 0; i < labels.length; i++) {
105
				%>							
106
					<li><%=labels[i] %></li>
107
				<%} %>
108
			</ul>
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>
109 139
		</td>
110 140
	</tr>
111 141
	<tr>
142
		<th>
143
			&nbsp;
144
		</th>
145
	</tr>		
146
	<tr>
112 147
		<td>
113
			<div id="ajaxCartResults" style="display:none;">Loading Cart...</div>
148
			<div id="ajaxCartResults" style="display:none;">
149
				Loading Cart...
150
			</div>
114 151
		</td>
115 152
	</tr>
116 153
</table>

Also available in: Unified diff