Project

General

Profile

Revision 3669

add support for selecting records for only one question from a set of one or more assessment response data files

View differences:

lib/style/skins/first/assessmentQuery.jsp
6 6
import="java.io.*"%><%
7 7

  
8 8
String[] docids = request.getParameterValues("docids");
9
String questionId = request.getParameter("questionId");
9 10
String qformat = request.getParameter("qformat");
10 11

  
11 12
if (docids != null && docids.length > 0) {
......
25 26
	fileName += ".csv";
26 27
	
27 28
	//AssessmentQuery.testEcogrid("edml.4.5");
28
	ResultSet rs = AssessmentQuery.selectResponseData(assessmentDocIds);
29
	ResultSet rs = AssessmentQuery.selectResponseData(assessmentDocIds, questionId, "=", new Integer(1));
29 30
	
30 31
	if (rs == null) {
31 32
		return;
......
40 41
		Writer writer = new OutputStreamWriter(response.getOutputStream());
41 42
		CSVWriter csv = new CSVWriter(writer, CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER);
42 43
		csv.writeAll(rs, true);
44
		csv.flush();
43 45
		
44 46
		response.flushBuffer();
45 47
		
lib/style/skins/first/first-assessment-resultset.xsl
63 63
				styleURL += "/assessmentQuery.jsp";
64 64
				return styleURL;
65 65
			}	
66
			getResponseData = function(docid, divId) {
66
			getResponseData = function(docid, divId, questionId) {
67 67
				var styleURL = getResponseDataURL();
68 68
																				
69 69
				//alert("calling ajax: " + styleURL);
70 70
				//alert("docid: " + docid);
71
				//alert("questionId: " + questionId);
71 72
				
72 73
				var myUpdate = new Ajax.Updater(
73 74
					divId,
74 75
					styleURL,
75 76
					{	method: 'post',
76
						parameters: { docids: docid},
77
						parameters: { docids: docid, questionId: questionId },
77 78
						//parameters: $('responseDataSearch').serialize(true),
78 79
						evalScripts: true, 
79 80
						//onSuccess: function(transport) {alert('success: ' + transport.status);},
......
93 94
				//alert("calling ajax: " + styleURL);
94 95
				//alert("docid: " + docid);
95 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
				
96 101
				var myUpdate = new Ajax.Updater(
97 102
					divId,
98 103
					styleURL,
......
116 121
				
117 122
				var styleURL = getResponseDataURL();
118 123
				
124
				//transfer the assessmentItemId to this form
125
				document.getElementById("questionId").value = document.getElementById("assessmentItemId").value;
126
				//alert("questionId: " + document.getElementById("questionId").value);
127
				
119 128
				var submitFormObj = document.getElementById(formId);
120 129
				submitFormObj.qformat.value = 'csv';
121 130
				submitFormObj.action = styleURL;
......
150 159

  
151 160
		<xsl:if test="count(resultset/document) &gt; 0">
152 161

  
153
			<form action="/knb/metacat" method="POST" id="assessmentForm" name="assessmentForm">
162
			<form action="/knb/metacat" method="POST" id="assessmentForm" name="assessmentForm" >
154 163
				<input type="hidden" name="qformat" value="first" />
155 164
				<input type="hidden" name="sessionid" />
156 165
				<input type="hidden" name="action" value="read" />
157 166
				<input type="hidden" name="docid" />
167
				<xsl:element name="input">
168
					<xsl:attribute name="type">hidden</xsl:attribute>
169
					<xsl:attribute name="id">questionId</xsl:attribute>
170
					<xsl:attribute name="name">questionId</xsl:attribute>
171
					<xsl:attribute name="value"></xsl:attribute>
172
				</xsl:element>
158 173
				
159 174
				<br/>
160 175
				Select:
......
245 260
							</input>
246 261
							<br/>
247 262
							<a>
248
								<xsl:attribute name="href">javascript:getResponseData('<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />')</xsl:attribute>
263
								<xsl:attribute name="href">javascript:getResponseData('<xsl:value-of select="./docid" />', '<xsl:value-of select="$divId" />', document.getElementById("assessmentItemId").value )</xsl:attribute>
249 264
								<xsl:text>View</xsl:text>
250 265
							</a>
251 266
							/

Also available in: Unified diff