Revision 4289
Added by ben leinfelder over 16 years ago
lib/style/skins/first/first-assessment-resultset.xsl | ||
---|---|---|
34 | 34 |
<xsl:param name="sessid"/> |
35 | 35 |
<xsl:param name="qformat">default</xsl:param> |
36 | 36 |
<xsl:param name="enableediting">false</xsl:param> |
37 |
<xsl:param name="contextURL"/> |
|
37 | 38 |
<xsl:template match="/"> |
38 | 39 |
<script language="JavaScript"> |
39 | 40 |
<![CDATA[ |
... | ... | |
57 | 58 |
</script> |
58 | 59 |
<script type="text/javascript" language="Javascript"> |
59 | 60 |
<![CDATA[ |
60 |
//reusable function to get the URL since I know this could change.... |
|
61 |
getResponseDataURL = function() { |
|
62 |
var styleURL = "/knb/style/skins/first"; |
|
63 |
styleURL += "/assessmentQuery.jsp"; |
|
64 |
return styleURL; |
|
65 |
} |
|
66 |
getResponseData = function(docid, divId, questionId) { |
|
67 |
var styleURL = getResponseDataURL(); |
|
68 |
|
|
69 |
//alert("calling ajax: " + styleURL); |
|
70 |
//alert("docid: " + docid); |
|
71 |
//alert("questionId: " + questionId); |
|
72 |
|
|
73 |
var myUpdate = new Ajax.Updater( |
|
74 |
divId, |
|
75 |
styleURL, |
|
76 |
{ method: 'post', |
|
77 |
parameters: { docids: docid, questionId: questionId }, |
|
78 |
//parameters: $('responseDataSearch').serialize(true), |
|
79 |
evalScripts: true, |
|
80 |
//onSuccess: function(transport) {alert('success: ' + transport.status);}, |
|
81 |
onFailure: function(transport) {alert('failure making ajax call');} |
|
82 |
}); |
|
83 |
|
|
84 |
Element.show(divId); |
|
85 |
//alert("done calling response ajax"); |
|
86 |
} |
|
87 |
getMergedResponseData = function(formId,divId) { |
|
88 |
if (!areItemsSelected('docids')) { |
|
89 |
alert("Please select at least one dataset to view"); |
|
90 |
return false; |
|
91 |
} |
|
92 |
var styleURL = getResponseDataURL(); |
|
93 |
|
|
94 |
//alert("calling ajax: " + styleURL); |
|
95 |
//alert("docid: " + docid); |
|
96 |
|
|
97 |
//transfer the assessmentItemId to this form |
|
98 |
document.getElementById("questionId").value = document.getElementById("assessmentItemId").value; |
|
99 |
//alert("questionId: " + document.getElementById("questionId").value); |
|
100 |
|
|
101 |
var myUpdate = new Ajax.Updater( |
|
102 |
divId, |
|
103 |
styleURL, |
|
104 |
{ method: 'post', |
|
105 |
//parameters: { docid: docid}, |
|
106 |
parameters: $(formId).serialize(true), |
|
107 |
evalScripts: true, |
|
108 |
//onSuccess: function(transport) {alert('success: ' + transport.status);}, |
|
109 |
onFailure: function(transport) {alert('failure making ajax call');} |
|
110 |
}); |
|
111 |
|
|
112 |
Element.show(divId); |
|
113 |
//alert("done calling response ajax"); |
|
114 |
} |
|
115 | 61 |
downloadMergedResponseData = function(formId) { |
116 | 62 |
|
117 | 63 |
if (!areItemsSelected('docids')) { |
118 |
alert("Please select at least one dataset to download");
|
|
64 |
alert("Please select at least one dataset for download");
|
|
119 | 65 |
return false; |
120 | 66 |
} |
121 |
|
|
122 |
var styleURL = getResponseDataURL(); |
|
123 |
|
|
67 |
|
|
124 | 68 |
//transfer the assessmentItemId to this form |
125 | 69 |
document.getElementById("questionId").value = document.getElementById("assessmentItemId").value; |
126 | 70 |
//alert("questionId: " + document.getElementById("questionId").value); |
127 | 71 |
|
128 | 72 |
var submitFormObj = document.getElementById(formId); |
129 | 73 |
submitFormObj.qformat.value = 'csv'; |
130 |
submitFormObj.action = styleURL; |
|
131 |
|
|
132 |
//alert("downloading response data from: " + submitFormObj.action); |
|
133 |
//alert("format=" + submitFormObj.qformat.value); |
|
74 |
submitFormObj.action.value = 'dataquery'; |
|
134 | 75 |
|
76 |
multipleAssessmentSearch(submitFormObj); |
|
77 |
|
|
135 | 78 |
submitFormObj.submit(); |
136 | 79 |
} |
137 | 80 |
areItemsSelected = function(checkBoxName) { |
... | ... | |
159 | 102 |
|
160 | 103 |
<xsl:if test="count(resultset/document) > 0"> |
161 | 104 |
|
162 |
<form action="/knb/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
|
105 |
<form action="{$contextURL}/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
|
|
163 | 106 |
<input type="hidden" name="qformat" value="first" /> |
164 |
<input type="hidden" name="sessionid" /> |
|
107 |
<input type="hidden" name="sessionid"> |
|
108 |
<xsl:attribute name="value"> |
|
109 |
<xsl:value-of select="$sessid" /> |
|
110 |
</xsl:attribute> |
|
111 |
</input> |
|
165 | 112 |
<input type="hidden" name="action" value="read" /> |
113 |
<input type="hidden" name="dataquery" /> |
|
166 | 114 |
<input type="hidden" name="docid" /> |
167 | 115 |
<xsl:element name="input"> |
168 | 116 |
<xsl:attribute name="type">hidden</xsl:attribute> |
... | ... | |
172 | 120 |
</xsl:element> |
173 | 121 |
|
174 | 122 |
<br/> |
175 |
Select: |
|
176 |
<a> |
|
177 |
<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', true)</xsl:attribute> |
|
178 |
<xsl:text>All</xsl:text> |
|
179 |
</a> |
|
180 |
/ |
|
181 |
<a> |
|
182 |
<xsl:attribute name="href">javascript:setSelect(document.assessmentForm, 'docids', false)</xsl:attribute> |
|
183 |
<xsl:text>None</xsl:text> |
|
184 |
</a> |
|
185 |
<br/> |
|
186 |
View: |
|
187 |
<a> |
|
188 |
<xsl:attribute name="href">#</xsl:attribute> |
|
189 |
<xsl:attribute name="onClick">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute> |
|
190 |
<xsl:text>Selected</xsl:text> |
|
191 |
</a> |
|
192 |
/ |
|
193 |
<a> |
|
194 |
<xsl:attribute name="href">javascript:hideDiv('mergedResponseData')</xsl:attribute> |
|
195 |
<xsl:text>Hide</xsl:text> |
|
196 |
</a> |
|
197 |
<br/> |
|
198 | 123 |
Download Selected as: |
199 | 124 |
<a> |
200 | 125 |
<xsl:attribute name="href">#</xsl:attribute> |
201 | 126 |
<xsl:attribute name="onClick">javascript:downloadMergedResponseData('assessmentForm')</xsl:attribute> |
202 | 127 |
<xsl:text>Datafile (.csv)</xsl:text> |
203 | 128 |
</a> |
204 |
/ |
|
205 |
<a> |
|
206 |
<xsl:attribute name="href">#doNothing</xsl:attribute> |
|
207 |
<xsl:text>Metadata Package (.zip)</xsl:text> |
|
208 |
</a> |
|
209 | 129 |
<br/> |
210 | 130 |
<div id="mergedResponseData"/> |
211 | 131 |
<br/> |
... | ... | |
214 | 134 |
cellspacing="0"> |
215 | 135 |
<tr> |
216 | 136 |
<th style="text-align: left"> |
137 |
<input type="checkbox"> |
|
138 |
<xsl:attribute name="onclick">setSelect(document.assessmentForm, 'docids', this.checked)</xsl:attribute> |
|
139 |
</input> |
|
140 |
</th> |
|
141 |
<th style="text-align: left"> |
|
217 | 142 |
Assessment Title |
218 | 143 |
</th> |
219 | 144 |
<th style="text-align: left"> |
... | ... | |
244 | 169 |
</xsl:attribute> |
245 | 170 |
|
246 | 171 |
<td class="text_plain"> |
172 |
<input type="checkbox" name="docids"> |
|
173 |
<xsl:attribute name="value"> |
|
174 |
<xsl:value-of select="./docid" /> |
|
175 |
</xsl:attribute> |
|
176 |
</input> |
|
177 |
</td> |
|
178 |
<td> |
|
179 |
|
|
247 | 180 |
<a> |
248 | 181 |
<xsl:attribute name="href">javascript:submitform('read','<xsl:value-of select="./docid" />',document.assessmentForm)</xsl:attribute> |
249 | 182 |
<xsl:text>» </xsl:text> |
250 | 183 |
<xsl:value-of select="./param[@name='assessment/@title']" /> |
251 |
<!-- <xsl:value-of select="./param[@name='assessment/@id']" />) --> |
|
252 | 184 |
</a> |
253 | 185 |
(<xsl:value-of select="./docid" />) |
186 |
|
|
254 | 187 |
<br /> |
255 |
Response Data... |
|
256 |
<input type="checkbox" name="docids"> |
|
257 |
<xsl:attribute name="value"> |
|
258 |
<xsl:value-of select="./docid" /> |
|
259 |
</xsl:attribute> |
|
260 |
</input> |
|
188 |
|
|
189 |
<!--include question ids here --> |
|
190 |
<xsl:for-each select="./param[@name='assessmentItems/assessmentItem/assessmentItemId']" > |
|
191 |
<input type="hidden"> |
|
192 |
<xsl:attribute name="name"> |
|
193 |
<xsl:value-of select="../docid" /> |
|
194 |
</xsl:attribute> |
|
195 |
<xsl:attribute name="value"> |
|
196 |
<xsl:value-of select="." /> |
|
197 |
</xsl:attribute> |
|
198 |
</input> |
|
199 |
</xsl:for-each> |
|
200 |
|
|
261 | 201 |
<br/> |
262 |
<a> |
|
263 |
<xsl:attribute name="href">javascript:getResponseData('<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />', document.getElementById("assessmentItemId").value )</xsl:attribute> |
|
264 |
<xsl:text>View</xsl:text> |
|
265 |
</a> |
|
266 |
/ |
|
267 |
<a> |
|
268 |
<xsl:attribute name="href">javascript:hideDiv('<xsl:value-of select="$divId" />')</xsl:attribute> |
|
269 |
<xsl:text>Hide</xsl:text> |
|
270 |
</a> |
|
271 |
<!-- |
|
272 |
/ |
|
273 |
<a> |
|
274 |
<xsl:attribute name="href">javascript:getMergedResponseData('assessmentForm','mergedResponseData')</xsl:attribute> |
|
275 |
<xsl:text>Merge Selected</xsl:text> |
|
276 |
</a> |
|
277 |
--> |
|
202 |
|
|
278 | 203 |
<div> |
279 | 204 |
<xsl:attribute name="id"> |
280 | 205 |
<xsl:value-of select="$divId" /> |
... | ... | |
320 | 245 |
|
321 | 246 |
</tr> |
322 | 247 |
<tr class="searchresultsdivider"> |
323 |
<td colspan="5">
|
|
248 |
<td colspan="6">
|
|
324 | 249 |
<img |
325 |
src="/knb/style/skins/default/images/transparent1x1.gif"
|
|
250 |
src="{$contextURL}/style/skins/default/images/transparent1x1.gif"
|
|
326 | 251 |
width="1" height="1" /> |
327 | 252 |
</td> |
328 | 253 |
</tr> |
... | ... | |
332 | 257 |
</table> |
333 | 258 |
|
334 | 259 |
</form> |
335 |
|
|
336 | 260 |
|
337 | 261 |
</xsl:if> |
338 | 262 |
</xsl:template> |
Also available in: Unified diff
use the generalized (and now built-in) data query mechanism for downloading "merged" data.