Revision 4484
Added by ben leinfelder over 15 years ago
first-assessment-resultset.xsl | ||
---|---|---|
61 | 61 |
<![CDATA[ |
62 | 62 |
downloadMergedResponseData = function(formId, fieldFormId) { |
63 | 63 |
|
64 |
if (!areItemsSelected('docid')) { |
|
65 |
alert("Please select at least one dataset"); |
|
66 |
return false; |
|
67 |
} |
|
64 |
//if (!areItemsSelected('docid')) {
|
|
65 |
// alert("Please select at least one dataset");
|
|
66 |
// return false;
|
|
67 |
//}
|
|
68 | 68 |
|
69 | 69 |
//transfer the assessmentItemId to this form |
70 | 70 |
//document.getElementById("questionId").value = document.getElementById("assessmentItemId").value; |
... | ... | |
83 | 83 |
|
84 | 84 |
submitFormObj.submit(); |
85 | 85 |
} |
86 |
editCart = function(formId, operation) { |
|
86 |
editCart = function(formId, operation, docid) {
|
|
87 | 87 |
|
88 | 88 |
var metacatURL = "]]><xsl:value-of select="$contextURL" /><![CDATA[/metacat"; |
89 |
if (!areItemsSelected('docid')) {
|
|
90 |
alert("Please select at least one dataset"); |
|
91 |
return false; |
|
92 |
} |
|
89 |
//if (!areItemsSelected('docid') && docid) {
|
|
90 |
// alert("Please select at least one dataset");
|
|
91 |
// return false;
|
|
92 |
//}
|
|
93 | 93 |
|
94 | 94 |
var submitFormObj = document.getElementById(formId); |
95 | 95 |
submitFormObj.qformat.value = 'first'; |
96 | 96 |
submitFormObj.action.value = 'editcart'; |
97 | 97 |
submitFormObj.operation.value = operation; |
98 |
if (docid) { |
|
99 |
submitFormObj.docid.value = docid; |
|
100 |
} |
|
98 | 101 |
|
99 | 102 |
var myUpdate = new Ajax.Request( |
100 | 103 |
metacatURL, |
... | ... | |
152 | 155 |
} |
153 | 156 |
setControlVisibility = function() { |
154 | 157 |
if (document.getElementById("ajaxCartResults")) { |
155 |
new Effect.Appear("removeCart"); |
|
156 |
//new Effect.Fade("addCart"); |
|
158 |
new Effect.Appear("download"); |
|
157 | 159 |
} |
158 |
else { |
|
159 |
new Effect.Appear("addCart"); |
|
160 |
//new Effect.Fade("removeCart"); |
|
160 |
} |
|
161 |
|
|
162 |
isInCart = function(docid) { |
|
163 |
|
|
164 |
var objs = window.document.getElementById("iframeheaderclass").contentDocument.getElementsByName("@packageId"); |
|
165 |
//var objs = document.getElementsByName("@packageId"); |
|
166 |
if (objs.length == 0) { |
|
167 |
return false; |
|
161 | 168 |
} |
169 |
for (var i=0; i< objs.length; i++) { |
|
170 |
if (docid == objs[i].value) { |
|
171 |
return true; |
|
172 |
} |
|
173 |
} |
|
174 |
return false; |
|
162 | 175 |
} |
163 | 176 |
|
164 | 177 |
hideDiv = function(divId) { |
... | ... | |
184 | 197 |
setControlVisibility(); |
185 | 198 |
]]> |
186 | 199 |
</script> |
187 |
<p> |
|
188 |
<a> |
|
189 |
<xsl:attribute name="href">javascript:{}</xsl:attribute> |
|
190 |
<xsl:attribute name="onclick">javascript:downloadMergedResponseData('assessmentForm', 'fieldForm')</xsl:attribute> |
|
191 |
<img border="none"> |
|
192 |
<xsl:attribute name="src"> |
|
193 |
<xsl:value-of select="$contextURL" /> |
|
194 |
<xsl:text>/style/images/page_white_put.png</xsl:text> |
|
195 |
</xsl:attribute> |
|
196 |
</img> |
|
197 |
<xsl:text> Download Selection (.csv)</xsl:text> |
|
198 |
</a> |
|
199 |
</p> |
|
200 |
<div id="addCart" style="display:none;"> |
|
201 |
<p/> |
|
200 |
<div id="download" style="display:none;"> |
|
202 | 201 |
<p> |
203 | 202 |
<a> |
204 | 203 |
<xsl:attribute name="href">javascript:{}</xsl:attribute> |
205 |
<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'add')</xsl:attribute>
|
|
204 |
<xsl:attribute name="onclick">javascript:downloadMergedResponseData('assessmentForm', 'fieldForm')</xsl:attribute>
|
|
206 | 205 |
<img border="none"> |
207 | 206 |
<xsl:attribute name="src"> |
208 | 207 |
<xsl:value-of select="$contextURL" /> |
209 |
<xsl:text>/style/images/fav.gif</xsl:text>
|
|
208 |
<xsl:text>/style/images/page_white_put.png</xsl:text>
|
|
210 | 209 |
</xsl:attribute> |
211 | 210 |
</img> |
212 |
<xsl:text> Add Selection to Cart</xsl:text>
|
|
211 |
<xsl:text> Download (.csv)</xsl:text>
|
|
213 | 212 |
</a> |
214 | 213 |
</p> |
215 | 214 |
</div> |
216 |
<div id="removeCart" style="display:none;"> |
|
217 |
<p/> |
|
218 |
<p> |
|
219 |
<a> |
|
220 |
<xsl:attribute name="href">javascript:{}</xsl:attribute> |
|
221 |
<xsl:attribute name="onclick">javascript:editCart('assessmentForm', 'remove')</xsl:attribute> |
|
222 |
<!-- <xsl:text>Remove </xsl:text> --> |
|
223 |
<img border="none"> |
|
224 |
<xsl:attribute name="src"> |
|
225 |
<xsl:value-of select="$contextURL" /> |
|
226 |
<xsl:text>/style/images/delete.gif</xsl:text> |
|
227 |
</xsl:attribute> |
|
228 |
</img> |
|
229 |
<xsl:text> Remove Selection from Cart</xsl:text> |
|
230 |
</a> |
|
231 |
</p> |
|
232 |
</div> |
|
233 | 215 |
|
234 | 216 |
<!-- for reading the assessment details --> |
235 | 217 |
<form action="{$contextURL}/metacat" method="POST" id="readForm" name="readForm" > |
... | ... | |
244 | 226 |
<input type="hidden" name="insertTemplate" value="1"/> |
245 | 227 |
</form> |
246 | 228 |
|
247 |
<!-- for managing the ajax actions --> |
|
229 |
<!-- for editing cart --> |
|
230 |
<form action="{$contextURL}/metacat" method="POST" id="cartForm" name="cartForm" > |
|
231 |
<input type="hidden" name="qformat" value="first" /> |
|
232 |
<input type="hidden" name="sessionid"> |
|
233 |
<xsl:attribute name="value"> |
|
234 |
<xsl:value-of select="$sessid" /> |
|
235 |
</xsl:attribute> |
|
236 |
</input> |
|
237 |
<input type="hidden" name="action" value="editcart" /> |
|
238 |
<input type="hidden" name="operation" /> |
|
239 |
<input type="hidden" name="docid" /> |
|
240 |
|
|
241 |
</form> |
|
242 |
|
|
243 |
<!-- for downloading data --> |
|
248 | 244 |
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" > |
249 | 245 |
<input type="hidden" name="qformat" value="first" /> |
250 | 246 |
<input type="hidden" name="sessionid"> |
... | ... | |
255 | 251 |
<input type="hidden" name="action" value="read" /> |
256 | 252 |
<input type="hidden" name="dataquery" /> |
257 | 253 |
<input type="hidden" name="operation" /> |
254 |
|
|
258 | 255 |
<xsl:element name="input"> |
259 | 256 |
<xsl:attribute name="type">hidden</xsl:attribute> |
260 | 257 |
<xsl:attribute name="id">questionId</xsl:attribute> |
... | ... | |
265 | 262 |
<table width="95%" align="left" border="0" cellpadding="0" |
266 | 263 |
cellspacing="0"> |
267 | 264 |
<tr> |
268 |
<th style="text-align: left"> |
|
269 |
<input type="checkbox"> |
|
270 |
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docid', this.checked)</xsl:attribute> |
|
271 |
</input> |
|
265 |
|
|
266 |
<th style="text-align: left" colspan="2"> |
|
267 |
Assessment |
|
272 | 268 |
</th> |
273 | 269 |
<th style="text-align: left"> |
274 |
Assessment Title |
|
275 |
</th> |
|
276 |
<th style="text-align: left"> |
|
277 | 270 |
Course Title |
278 | 271 |
</th> |
279 | 272 |
<th style="text-align: left"> |
... | ... | |
300 | 293 |
</xsl:choose> |
301 | 294 |
</xsl:attribute> |
302 | 295 |
|
303 |
<td class="text_plain"> |
|
304 |
<input type="checkbox" name="docid"> |
|
296 |
<td class="text_plain" nowrap="nowrap"> |
|
297 |
|
|
298 |
<script type="text/javascript" language="Javascript"> |
|
299 |
<![CDATA[ |
|
300 |
//what are our options? |
|
301 |
if (isInCart("]]><xsl:value-of select="./docid" /><![CDATA[")) { |
|
302 |
showDiv("]]><xsl:value-of select="$divId" /><![CDATA[remove"); |
|
303 |
hideDiv("]]><xsl:value-of select="$divId" /><![CDATA[add"); |
|
304 |
} |
|
305 |
else { |
|
306 |
showDiv("]]><xsl:value-of select="$divId" /><![CDATA[add"); |
|
307 |
hideDiv("]]><xsl:value-of select="$divId" /><![CDATA[remove"); |
|
308 |
} |
|
309 |
]]> |
|
310 |
</script> |
|
311 |
<div style="display:none;"> |
|
312 |
<xsl:attribute name="id"> |
|
313 |
<xsl:value-of select="$divId" /> |
|
314 |
<xsl:text>add</xsl:text> |
|
315 |
</xsl:attribute> |
|
316 |
<a> |
|
317 |
<xsl:attribute name="href">javascript:{}</xsl:attribute> |
|
318 |
<xsl:attribute name="onclick"><![CDATA[javascript:editCart('cartForm', 'add',"]]><xsl:value-of select="./docid" /><![CDATA[")]]></xsl:attribute> |
|
319 |
<img border="none"> |
|
320 |
<xsl:attribute name="src"> |
|
321 |
<xsl:value-of select="$contextURL" /> |
|
322 |
<xsl:text>/style/skins/first/images/add.png</xsl:text> |
|
323 |
</xsl:attribute> |
|
324 |
</img> |
|
325 |
</a> |
|
326 |
</div> |
|
327 |
<div style="display:none;"> |
|
328 |
<xsl:attribute name="id"> |
|
329 |
<xsl:value-of select="$divId" /> |
|
330 |
<xsl:text>remove</xsl:text> |
|
331 |
</xsl:attribute> |
|
332 |
<a> |
|
333 |
<xsl:attribute name="href">javascript:{}</xsl:attribute> |
|
334 |
<xsl:attribute name="onclick"><![CDATA[javascript:editCart('cartForm', 'remove',"]]><xsl:value-of select="./docid" /><![CDATA[")]]></xsl:attribute> |
|
335 |
<!-- <xsl:text>Remove </xsl:text> --> |
|
336 |
<img border="none"> |
|
337 |
<xsl:attribute name="src"> |
|
338 |
<xsl:value-of select="$contextURL" /> |
|
339 |
<xsl:text>/style/images/delete.gif</xsl:text> |
|
340 |
</xsl:attribute> |
|
341 |
</img> |
|
342 |
<xsl:text> Remove</xsl:text> |
|
343 |
</a> |
|
344 |
</div> |
|
345 |
|
|
346 |
<input type="hidden" name="docid"> |
|
305 | 347 |
<xsl:attribute name="value"> |
306 | 348 |
<xsl:value-of select="./docid" /> |
307 | 349 |
</xsl:attribute> |
308 | 350 |
</input> |
351 |
|
|
309 | 352 |
</td> |
310 | 353 |
<td> |
311 | 354 |
|
... | ... | |
373 | 416 |
</tr> |
374 | 417 |
|
375 | 418 |
<tr> |
376 |
<td width="30"> </td> |
|
377 |
<td colspan="5"> |
|
419 |
<td colspan="6"> |
|
378 | 420 |
Details |
379 | 421 |
<a> |
380 | 422 |
<xsl:attribute name="href">javascript:read('readForm', '<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute> |
... | ... | |
400 | 442 |
</tr> |
401 | 443 |
|
402 | 444 |
<tr> |
403 |
<td> </td> |
|
404 |
<td colspan="5"> |
|
445 |
<td colspan="6"> |
|
405 | 446 |
<div style="display:none;"> |
406 | 447 |
<xsl:attribute name="id"> |
407 | 448 |
<xsl:value-of select="$divId" /> |
Also available in: Unified diff
redesign the look and feel - save point.
-cart editing is done by clicking individual assessments rather than doing them in batches.
-cart status is shown in the search results (but still need a refresh for after adding cart items from search...)