Project

General

Profile

« Previous | Next » 

Revision 4650

include demographic data if present in the datapackage
TODO: handle a mixture of datapackages when performing the union (i.e. cases when one package as demographic data and the other does not)
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=3519

View differences:

lib/style/skins/first/search.js
29 29
			if (submitFormObj.docid[i].value != "") {
30 30
				var documentObject = new Object();
31 31
				documentObject.docid = submitFormObj.docid[i].value;
32
				documentObject.demographicData = submitFormObj[documentObject.docid + "demographicData"].value;
32 33
				
33 34
				var questionIds = new Array();
34 35
				for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
......
46 47
		if (submitFormObj.docid.value != "") {
47 48
			var documentObject = new Object();
48 49
			documentObject.docid = submitFormObj.docid.value;
49
			
50
			documentObject.demographicData = submitFormObj[documentObject.docid + "demographicData"].value;
51
				
50 52
			var questionIds = new Array();
51 53
			for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
52 54
				questionIds[z] = submitFormObj[documentObject.docid][z].value;
......
233 235
	for (var i=0; i < docObjs.length; i++) {
234 236

  
235 237
		var docId = docObjs[i].docid;
236
		//alert("docId=" + docId);
238
		var containsDemographicData = docObjs[i].demographicData;
239
		//alert("containsDemographicData=" + containsDemographicData);
237 240
		
238 241
		//get the question ids for this question
239 242
		var questionIds = docObjs[i].questionIds;
......
257 260
		
258 261
			tempQuery +=
259 262
			"<query>"
263
			+ "<selection>";
264
			
260 265
			//select the data
261
			+ "<selection>"
262
				+ "<datapackage id=\"" + docId + "\">"
266
			tempQuery +=
267
				"<datapackage id=\"" + docId + "\">"
263 268
					+ "<entity index=\"0\">"
264 269
						+ "<attribute index=\"0\"/>"
265 270
						+ "<attribute index=\"1\"/>"
......
269 274
					+ "</entity>"
270 275
				+ "</datapackage>";
271 276
				
277
			//select the demographic data
278
			if (containsDemographicData) {
279
				tempQuery +=
280
					"<datapackage id=\"" + docId + "\">"
281
						+ "<entity index=\"1\">"
282
							//omit student id attribute
283
							+ "<attribute index=\"1\"/>"
284
							+ "<attribute index=\"2\"/>"
285
							+ "<attribute index=\"3\"/>"
286
						+ "</entity>"
287
					+ "</datapackage>";	
288
			}
289
				
272 290
			//select the metadata
273 291
			tempQuery += metadataAttributeSelection;
274 292
	
......
292 310
				
293 311
			tempQuery += "</selection>";
294 312
			
295
			//join to the quesion "table"
313
			//join to the question "table"
296 314
			if (questionId.length > 0) {
297 315
				tempQuery +=
298 316
					"<where>"
......
354 372
               +"<returnfield>assessment/duration</returnfield>"
355 373
               +"<returnfield>assessment/title</returnfield>"
356 374
               +"<returnfield>assessment/@id</returnfield>"
375
               +"<returnfield>dataset/dataTable/entityName</returnfield>"
357 376
               +"<returnfield>lom/general/title/string</returnfield>"
358 377
               +"<returnfield>lom/general/keyword/string</returnfield>"
359 378
               +"<returnfield>individualName/surName</returnfield>"
......
420 439
                      +"<returnfield>assessment/title</returnfield>"
421 440
                      +"<returnfield>assessment/@id</returnfield>"
422 441
                      +"<returnfield>assessment/duration</returnfield>"
442
                      +"<returnfield>dataset/dataTable/entityName</returnfield>"
423 443
                      +"<returnfield>lom/general/title/string</returnfield>"
424 444
                      +"<returnfield>lom/general/keyword/string</returnfield>"
425 445
                      +"<returnfield>individualName/surName</returnfield>"
......
459 479
                      +"<returnfield>assessment/title</returnfield>"
460 480
                      +"<returnfield>assessment/@id</returnfield>"
461 481
                      +"<returnfield>assessment/duration</returnfield>"
482
           			  +"<returnfield>dataset/dataTable/entityName</returnfield>"
462 483
                      +"<returnfield>lom/general/title/string</returnfield>"
463 484
                      +"<returnfield>lom/general/keyword/string</returnfield>"
464 485
                      +"<returnfield>individualName/surName</returnfield>"
lib/style/skins/first/first-assessment-resultset.xsl
310 310

  
311 311
						<td class="text_plain" nowrap="nowrap">
312 312
						
313
						<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) = 0" >
314
							No Data
315
						</xsl:if>	
316
						<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) >= 1" >
317
						
313 318
							<script type="text/javascript" language="Javascript">
314 319
								<![CDATA[
315 320
									//what are our options?
......
363 368
								</xsl:attribute>
364 369
							</input>
365 370
							
371
							</xsl:if>
372
							<xsl:if test="count(./param[@name='dataset/dataTable/entityName']) >= 2" >
373
								<!-- demographic data is present -->
374
								<img border="none">
375
									<xsl:attribute name="src">
376
										<xsl:value-of select="$contextURL" />
377
										<xsl:text>/style/skins/first/images/user.gif</xsl:text>
378
									</xsl:attribute>
379
								</img>
380
							</xsl:if>
381
							
366 382
						</td>
367 383
						<td>
368 384
							
......
387 403
								</input>
388 404
							</xsl:for-each>
389 405
							
406
							<!-- demographic data - present or not? -->
407
							<input type="hidden">
408
								<xsl:attribute name="name">
409
									<xsl:value-of select="./docid" />
410
									<xsl:text>demographicData</xsl:text>
411
								</xsl:attribute>
412
								<xsl:attribute name="value">
413
									<xsl:choose>	
414
										<xsl:when test="count(./param[@name='dataset/dataTable/entityName']) >= 2" >
415
											<xsl:text>true</xsl:text>
416
										</xsl:when>
417
										<xsl:otherwise>
418
											<xsl:text>false</xsl:text>
419
										</xsl:otherwise>
420
									</xsl:choose>
421
								</xsl:attribute>
422
							</input>
423
							
390 424
							<br/>
391 425
														
392 426
						</td>

Also available in: Unified diff