r4890 - trunk/lib/style/skins/first

leinfelder at ecoinformatics.org leinfelder at ecoinformatics.org
Wed Apr 1 12:00:13 PDT 2009


Author: leinfelder
Date: 2009-04-01 12:00:12 -0700 (Wed, 01 Apr 2009)
New Revision: 4890

Modified:
   trunk/lib/style/skins/first/search.js
Log:
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?)

Modified: trunk/lib/style/skins/first/search.js
===================================================================
--- trunk/lib/style/skins/first/search.js	2009-04-01 17:21:48 UTC (rev 4889)
+++ trunk/lib/style/skins/first/search.js	2009-04-01 19:00:12 UTC (rev 4890)
@@ -209,8 +209,10 @@
 function generateQuery(docObjs, metadataObjs) {
 	//alert("calling method");
 	
-	//make parameter at some point
+	//make parameters at some point
 	var includeDemographicData = false;
+	var questionMetadataCount = 2;
+	var questionChoiceCount = 5;
 	
 	//construct the assessment metadata attribute selection snippet
 	var metadataAttributes = "";
@@ -323,29 +325,26 @@
 						+ "</attribute>"
 						+ "<attribute name=\"qPrompt\">"
 							+ "<pathexpr label=\"qPrompt\">(//assessment/section/item/presentation/flow/response_lid/render_choice/material/mattext)|(//assessment/section/item/presentation/flow/response_str/material/mattext)</pathexpr>"
+						+ "</attribute>";
+				//control multiple choices
+				for (var p = 1; p <= questionChoiceCount; p++) {
+					tempQuery +=
+						"<attribute name=\"qChoice_" + p + "\">"
+							+ "<pathexpr label=\"qChoice_" + p + "\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
+						+ "</attribute>";
+				}
+				//control multiple metadata fields
+				for (var q = 1; q <= questionMetadataCount; q++) {
+					tempQuery +=
+						"<attribute name=\"qMetadataVocabulary_" + q +"\">"
+							+ "<pathexpr label=\"qMetadataVocabulary_" + q +"\">//assessment/section/item/itemmetadata/qtimetadata/vocabulary</pathexpr>"
 						+ "</attribute>"
-						+ "<attribute name=\"qChoice\">"
-							+ "<pathexpr label=\"qChoice\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qChoice_1\">"
-							+ "<pathexpr label=\"qChoice_1\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qChoice_2\">"
-							+ "<pathexpr label=\"qChoice_2\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qChoice_3\">"
-							+ "<pathexpr label=\"qChoice_3\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qChoice_4\">"
-							+ "<pathexpr label=\"qChoice_4\">//assessment/section/item/presentation/flow/response_lid/render_choice/flow_label/response_label/material/mattext</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qMetadataVocabulary\">"
-							+ "<pathexpr label=\"qMetadataVocabulary\">//assessment/section/item/itemmetadata/qtimetadata/vocabulary</pathexpr>"
-						+ "</attribute>"
-						+ "<attribute name=\"qMetadataValue\">"
-							+ "<pathexpr label=\"qMetadataValue\">//assessment/section/item/itemmetadata/qtimetadata/qtimetadatafield/fieldentry</pathexpr>"
-						+ "</attribute>"
-					+ "</entity>"
+						+ "<attribute name=\"qMetadataValue_" + q +"\">"
+							+ "<pathexpr label=\"qMetadataValue_" + q +"\">//assessment/section/item/itemmetadata/qtimetadata/qtimetadatafield/fieldentry</pathexpr>"
+						+ "</attribute>";
+				}
+				tempQuery +=
+					"</entity>"
 				+ "</datapackage>";
 			}
 				



More information about the Metacat-cvs mailing list