Project

General

Profile

« Previous | Next » 

Revision 4890

question choices and metadata selection controlled by a counter - can easily increase the number returned...note: probably need to make this a parameter for user or be intelligent about figuring what the widest question is (ie: does it have 5,10,20! metadata entries?)

View differences:

lib/style/skins/first/search.js
209 209
function generateQuery(docObjs, metadataObjs) {
210 210
	//alert("calling method");
211 211
	
212
	//make parameter at some point
212
	//make parameters at some point
213 213
	var includeDemographicData = false;
214
	var questionMetadataCount = 2;
215
	var questionChoiceCount = 5;
214 216
	
215 217
	//construct the assessment metadata attribute selection snippet
216 218
	var metadataAttributes = "";
......
323 325
						+ "</attribute>"
324 326
						+ "<attribute name=\"qPrompt\">"
325 327
							+ "<pathexpr label=\"qPrompt\">(//assessment/section/item/presentation/flow/response_lid/render_choice/material/mattext)|(//assessment/section/item/presentation/flow/response_str/material/mattext)</pathexpr>"
328
						+ "</attribute>";
329
				//control multiple choices
330
				for (var p = 1; p <= questionChoiceCount; p++) {
331
					tempQuery +=
332
						"<attribute name=\"qChoice_" + p + "\">"
333
							+ "<pathexpr label=\"qChoice_" + p + "\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
334
						+ "</attribute>";
335
				}
336
				//control multiple metadata fields
337
				for (var q = 1; q <= questionMetadataCount; q++) {
338
					tempQuery +=
339
						"<attribute name=\"qMetadataVocabulary_" + q +"\">"
340
							+ "<pathexpr label=\"qMetadataVocabulary_" + q +"\">//assessment/section/item/itemmetadata/qtimetadata/vocabulary</pathexpr>"
326 341
						+ "</attribute>"
327
						+ "<attribute name=\"qChoice\">"
328
							+ "<pathexpr label=\"qChoice\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
329
						+ "</attribute>"
330
						+ "<attribute name=\"qChoice_1\">"
331
							+ "<pathexpr label=\"qChoice_1\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
332
						+ "</attribute>"
333
						+ "<attribute name=\"qChoice_2\">"
334
							+ "<pathexpr label=\"qChoice_2\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
335
						+ "</attribute>"
336
						+ "<attribute name=\"qChoice_3\">"
337
							+ "<pathexpr label=\"qChoice_3\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
338
						+ "</attribute>"
339
						+ "<attribute name=\"qChoice_4\">"
340
							+ "<pathexpr label=\"qChoice_4\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
341
						+ "</attribute>"
342
						+ "<attribute name=\"qMetadataVocabulary\">"
343
							+ "<pathexpr label=\"qMetadataVocabulary\">//assessment/section/item/itemmetadata/qtimetadata/vocabulary</pathexpr>"
344
						+ "</attribute>"
345
						+ "<attribute name=\"qMetadataValue\">"
346
							+ "<pathexpr label=\"qMetadataValue\">//assessment/section/item/itemmetadata/qtimetadata/qtimetadatafield/fieldentry</pathexpr>"
347
						+ "</attribute>"
348
					+ "</entity>"
342
						+ "<attribute name=\"qMetadataValue_" + q +"\">"
343
							+ "<pathexpr label=\"qMetadataValue_" + q +"\">//assessment/section/item/itemmetadata/qtimetadata/qtimetadatafield/fieldentry</pathexpr>"
344
						+ "</attribute>";
345
				}
346
				tempQuery +=
347
					"</entity>"
349 348
				+ "</datapackage>";
350 349
			}
351 350
				

Also available in: Unified diff