1 |
4288
|
leinfelder
|
/****************************************************************************
|
2 |
|
|
* Multiple Assessment download
|
3 |
|
|
* @param form containing the neceassary input items
|
4 |
|
|
* @return true/false for form submission
|
5 |
|
|
*****************************************************************************/
|
6 |
4387
|
leinfelder
|
function multipleAssessmentSearch(submitFormObj, fieldFormObj) {
|
7 |
4377
|
leinfelder
|
|
8 |
|
|
//alert("submitFormObj=" + submitFormObj);
|
9 |
4288
|
leinfelder
|
//harvest the metadata fields we want to include
|
10 |
|
|
var metadataObjs = new Array();
|
11 |
|
|
var index = 0;
|
12 |
4387
|
leinfelder
|
for (var i=0; i < fieldFormObj.length; i++) {
|
13 |
|
|
var formElement = fieldFormObj.elements[i];
|
14 |
|
|
var metadataObj = new Object();
|
15 |
|
|
metadataObj.name = formElement.name;
|
16 |
|
|
metadataObj.value = formElement.value;
|
17 |
|
|
metadataObjs[index] = metadataObj;
|
18 |
|
|
index++;
|
19 |
4288
|
leinfelder
|
}
|
20 |
4267
|
leinfelder
|
|
21 |
4288
|
leinfelder
|
//TODO option for all questions vs. just one
|
22 |
4555
|
leinfelder
|
//var questionId = submitFormObj.questionId.value;
|
23 |
4288
|
leinfelder
|
//alert("questionId=" + questionId);
|
24 |
|
|
|
25 |
|
|
var documentObjects = new Array();
|
26 |
4290
|
leinfelder
|
var index = 0;
|
27 |
4377
|
leinfelder
|
if (submitFormObj.docid.length > 1) {
|
28 |
|
|
for (var i=0; i < submitFormObj.docid.length; i++) {
|
29 |
4484
|
leinfelder
|
if (submitFormObj.docid[i].value != "") {
|
30 |
4290
|
leinfelder
|
var documentObject = new Object();
|
31 |
4377
|
leinfelder
|
documentObject.docid = submitFormObj.docid[i].value;
|
32 |
4650
|
leinfelder
|
documentObject.demographicData = submitFormObj[documentObject.docid + "demographicData"].value;
|
33 |
4290
|
leinfelder
|
|
34 |
4555
|
leinfelder
|
var questionIds = new Array();
|
35 |
4290
|
leinfelder
|
for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
|
36 |
|
|
questionIds[z] = submitFormObj[documentObject.docid][z].value;
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
documentObject.questionIds = questionIds;
|
40 |
|
|
documentObjects[index] = documentObject;
|
41 |
|
|
index++;
|
42 |
|
|
}
|
43 |
4288
|
leinfelder
|
}
|
44 |
|
|
}
|
45 |
|
|
else {
|
46 |
4377
|
leinfelder
|
//alert("submitFormObj.docid=" + submitFormObj.docid);
|
47 |
4484
|
leinfelder
|
if (submitFormObj.docid.value != "") {
|
48 |
4290
|
leinfelder
|
var documentObject = new Object();
|
49 |
4377
|
leinfelder
|
documentObject.docid = submitFormObj.docid.value;
|
50 |
4650
|
leinfelder
|
documentObject.demographicData = submitFormObj[documentObject.docid + "demographicData"].value;
|
51 |
|
|
|
52 |
4555
|
leinfelder
|
var questionIds = new Array();
|
53 |
4792
|
leinfelder
|
if (submitFormObj[documentObject.docid].length > 1) {
|
54 |
|
|
for (var z = 0; z < submitFormObj[documentObject.docid].length; z++) {
|
55 |
|
|
questionIds[z] = submitFormObj[documentObject.docid][z].value;
|
56 |
|
|
}
|
57 |
4290
|
leinfelder
|
}
|
58 |
4792
|
leinfelder
|
else {
|
59 |
|
|
questionIds[0] = submitFormObj[documentObject.docid].value;
|
60 |
|
|
}
|
61 |
4290
|
leinfelder
|
|
62 |
|
|
documentObject.questionIds = questionIds;
|
63 |
|
|
documentObjects[0] = documentObject;
|
64 |
4288
|
leinfelder
|
}
|
65 |
|
|
}
|
66 |
|
|
|
67 |
|
|
var query = generateQuery(documentObjects, metadataObjs);
|
68 |
|
|
|
69 |
|
|
submitFormObj.dataquery.value = query;
|
70 |
|
|
|
71 |
|
|
return true;
|
72 |
|
|
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
/****************************************************************************
|
76 |
|
|
* Single Assessment download
|
77 |
|
|
* @param form containing the neceassary input items
|
78 |
|
|
* @return true/false for form submission
|
79 |
|
|
*****************************************************************************/
|
80 |
|
|
function assessmentSearch(submitFormObj) {
|
81 |
|
|
|
82 |
|
|
//harvest the metadata fields we want to include
|
83 |
|
|
var metadataObjs = new Array();
|
84 |
|
|
var index = 0;
|
85 |
|
|
for (var i=0; i < submitFormObj.length; i++) {
|
86 |
|
|
var formElement = submitFormObj.elements[i];
|
87 |
|
|
if (formElement.type == "checkbox" && formElement.checked) {
|
88 |
|
|
//ignore certain other checkboxes, kind of a hack
|
89 |
|
|
if (formElement.name == "includeQuestions") {
|
90 |
|
|
continue;
|
91 |
|
|
}
|
92 |
|
|
var metadataObj = new Object();
|
93 |
|
|
metadataObj.name = formElement.name;
|
94 |
|
|
metadataObj.value = formElement.value;
|
95 |
|
|
metadataObjs[index] = metadataObj;
|
96 |
|
|
index++;
|
97 |
|
|
}
|
98 |
|
|
}
|
99 |
|
|
|
100 |
|
|
//var checkBox = document.getElementById("searchAll");
|
101 |
4267
|
leinfelder
|
var docId = submitFormObj.docid.value;
|
102 |
4273
|
leinfelder
|
//alert("docId=" + docId);
|
103 |
4267
|
leinfelder
|
|
104 |
4281
|
leinfelder
|
//do we want question metadata?
|
105 |
4282
|
leinfelder
|
var includeQuestions = submitFormObj.includeQuestions.checked;
|
106 |
4281
|
leinfelder
|
var questionIds = new Array();
|
107 |
|
|
questionIds[0] = "";
|
108 |
|
|
|
109 |
|
|
if (includeQuestions) {
|
110 |
|
|
if (submitFormObj.assessmentItemId.length > 1) {
|
111 |
|
|
for (var i=0; i < submitFormObj.assessmentItemId.length; i++) {
|
112 |
|
|
questionIds[i] = submitFormObj.assessmentItemId[i].value;
|
113 |
|
|
}
|
114 |
|
|
}
|
115 |
|
|
else {
|
116 |
|
|
questionIds[0] = submitFormObj.assessmentItemId.value;
|
117 |
|
|
}
|
118 |
|
|
}
|
119 |
|
|
|
120 |
4288
|
leinfelder
|
//set up the list of objects to pass to the query assembler, just one document
|
121 |
|
|
var documentObjects = new Array();
|
122 |
|
|
var documentObject = new Object();
|
123 |
|
|
documentObject.docid = docId;
|
124 |
|
|
documentObject.questionIds = questionIds;
|
125 |
|
|
documentObjects[0] = documentObject;
|
126 |
4281
|
leinfelder
|
|
127 |
4288
|
leinfelder
|
var query = generateQuery(documentObjects, metadataObjs);
|
128 |
|
|
|
129 |
|
|
submitFormObj.dataquery.value = query;
|
130 |
|
|
|
131 |
|
|
return true;
|
132 |
|
|
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
/****************************************************************************
|
136 |
4387
|
leinfelder
|
* Save fields for the attribute maping
|
137 |
|
|
* @param formId containing the neceassary input items
|
138 |
|
|
* @return true/false for form submission
|
139 |
|
|
*****************************************************************************/
|
140 |
|
|
function saveFields(formId, metacatURL) {
|
141 |
|
|
|
142 |
|
|
var submitFormObj = document.getElementById(formId);
|
143 |
|
|
|
144 |
|
|
//send the request to clear
|
145 |
|
|
var myRequest = new Ajax.Request(
|
146 |
|
|
metacatURL,
|
147 |
|
|
{ method: 'post',
|
148 |
|
|
parameters: {
|
149 |
|
|
action: 'editcart',
|
150 |
|
|
operation: 'clearfields'},
|
151 |
|
|
evalScripts: true,
|
152 |
|
|
//onSuccess: function(transport) {alert('success: ' + transport.status);},
|
153 |
|
|
onFailure: function(transport) {alert('failure clearing fields');}
|
154 |
|
|
});
|
155 |
|
|
|
156 |
|
|
//go through the check boxes and set the ones we want
|
157 |
|
|
var count = 0;
|
158 |
|
|
for (var i=0; i < submitFormObj.length; i++) {
|
159 |
|
|
var formElement = submitFormObj.elements[i];
|
160 |
|
|
if (formElement.type == "checkbox" && formElement.checked) {
|
161 |
4411
|
leinfelder
|
//ignore certain other checkboxes, kind of a hack, but it's javascript...
|
162 |
4387
|
leinfelder
|
if (formElement.name == "includeQuestions") {
|
163 |
|
|
continue;
|
164 |
|
|
}
|
165 |
4411
|
leinfelder
|
if (formElement.name == "docid") {
|
166 |
|
|
continue;
|
167 |
|
|
}
|
168 |
4387
|
leinfelder
|
|
169 |
|
|
//send the request
|
170 |
|
|
var myRequest = new Ajax.Request(
|
171 |
|
|
metacatURL,
|
172 |
|
|
{ method: 'post',
|
173 |
|
|
parameters: {
|
174 |
|
|
action: 'editcart',
|
175 |
|
|
operation: 'addfield',
|
176 |
|
|
field: formElement.name,
|
177 |
|
|
path: formElement.value},
|
178 |
|
|
evalScripts: true,
|
179 |
4411
|
leinfelder
|
onSuccess: function(transport) {
|
180 |
|
|
//alert('Selections saved: ' + operation);
|
181 |
|
|
//refresh after the save
|
182 |
|
|
if (document.getElementById("ajaxCartResults")) {
|
183 |
|
|
window.location.reload();
|
184 |
|
|
}
|
185 |
|
|
else {
|
186 |
|
|
window.document.getElementById("iframeheaderclass").src=window.document.getElementById("iframeheaderclass").src;
|
187 |
|
|
}
|
188 |
|
|
},
|
189 |
4387
|
leinfelder
|
onFailure: function(transport) {alert('failure saving field: ' + formElement.name);}
|
190 |
|
|
});
|
191 |
|
|
count++;
|
192 |
|
|
}
|
193 |
|
|
}
|
194 |
|
|
|
195 |
4411
|
leinfelder
|
//window.document.getElementById("iframeheaderclass").src = window.document.getElementById("iframeheaderclass").src;
|
196 |
4387
|
leinfelder
|
|
197 |
4388
|
leinfelder
|
//alert(count + ' Field selections saved.');
|
198 |
4387
|
leinfelder
|
|
199 |
|
|
return true;
|
200 |
|
|
|
201 |
|
|
}
|
202 |
|
|
|
203 |
|
|
/****************************************************************************
|
204 |
4288
|
leinfelder
|
* Query Generation function
|
205 |
|
|
* @param docObjs is an Array of Objects with "docid" (String) and "questionIds" (Array) properties
|
206 |
|
|
* @param metadataObjs is an Array of Objects with "name" and "value" properties (both String)
|
207 |
|
|
* @return generated query string
|
208 |
|
|
*****************************************************************************/
|
209 |
|
|
function generateQuery(docObjs, metadataObjs) {
|
210 |
|
|
//alert("calling method");
|
211 |
|
|
|
212 |
|
|
//construct the assessment metadata attribute selection snippet
|
213 |
4267
|
leinfelder
|
var metadataAttributes = "";
|
214 |
|
|
var index = 0;
|
215 |
4288
|
leinfelder
|
for (var j=0; j < metadataObjs.length; j++) {
|
216 |
|
|
var metadataObj = metadataObjs[j];
|
217 |
4267
|
leinfelder
|
|
218 |
4288
|
leinfelder
|
metadataAttributes += "<attribute index=\"";
|
219 |
|
|
metadataAttributes += index;
|
220 |
|
|
metadataAttributes += "\">";
|
221 |
|
|
|
222 |
|
|
metadataAttributes += "<pathexpr label=\"";
|
223 |
|
|
metadataAttributes += metadataObj.name;
|
224 |
|
|
metadataAttributes += "\">";
|
225 |
|
|
metadataAttributes += metadataObj.value;
|
226 |
|
|
metadataAttributes += "</pathexpr>";
|
227 |
|
|
|
228 |
|
|
metadataAttributes += "</attribute>";
|
229 |
|
|
|
230 |
|
|
index++;
|
231 |
|
|
}//metadataObjs loop
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
//construct the begining of the query
|
235 |
|
|
var tempQuery =
|
236 |
|
|
"<?xml version=\"1.0\"?>"
|
237 |
|
|
+ "<dataquery>"
|
238 |
|
|
+ "<union>";
|
239 |
4267
|
leinfelder
|
|
240 |
4288
|
leinfelder
|
for (var i=0; i < docObjs.length; i++) {
|
241 |
|
|
|
242 |
|
|
var docId = docObjs[i].docid;
|
243 |
4650
|
leinfelder
|
var containsDemographicData = docObjs[i].demographicData;
|
244 |
|
|
//alert("containsDemographicData=" + containsDemographicData);
|
245 |
4288
|
leinfelder
|
|
246 |
|
|
//get the question ids for this question
|
247 |
|
|
var questionIds = docObjs[i].questionIds;
|
248 |
4267
|
leinfelder
|
|
249 |
4377
|
leinfelder
|
//alert("questionIds=" + questionIds);
|
250 |
4288
|
leinfelder
|
|
251 |
|
|
//assemble the assessment metadata
|
252 |
|
|
var metadataAttributeSelection = "";
|
253 |
|
|
if (metadataAttributes.length > 0) {
|
254 |
|
|
metadataAttributeSelection =
|
255 |
4267
|
leinfelder
|
"<datapackage id=\"" + docId + "\">"
|
256 |
|
|
+ "<entity id=\"" + docId + "\">"
|
257 |
|
|
+ metadataAttributes
|
258 |
|
|
+ "</entity>"
|
259 |
|
|
+ "</datapackage>";
|
260 |
4288
|
leinfelder
|
}
|
261 |
|
|
|
262 |
|
|
//loop for each question item
|
263 |
|
|
for (var k=0; k < questionIds.length; k++) {
|
264 |
|
|
var questionId = questionIds[k];
|
265 |
|
|
|
266 |
|
|
tempQuery +=
|
267 |
|
|
"<query>"
|
268 |
4650
|
leinfelder
|
+ "<selection>";
|
269 |
|
|
|
270 |
4288
|
leinfelder
|
//select the data
|
271 |
4650
|
leinfelder
|
tempQuery +=
|
272 |
|
|
"<datapackage id=\"" + docId + "\">"
|
273 |
4288
|
leinfelder
|
+ "<entity index=\"0\">"
|
274 |
|
|
+ "<attribute index=\"0\"/>"
|
275 |
|
|
+ "<attribute index=\"1\"/>"
|
276 |
4859
|
leinfelder
|
//DO NOT omit student id attribute - used for transpose
|
277 |
|
|
+ "<attribute index=\"2\"/>"
|
278 |
4288
|
leinfelder
|
+ "<attribute index=\"3\"/>"
|
279 |
|
|
+ "<attribute index=\"4\"/>"
|
280 |
|
|
+ "</entity>"
|
281 |
|
|
+ "</datapackage>";
|
282 |
|
|
|
283 |
4650
|
leinfelder
|
//select the demographic data
|
284 |
|
|
if (containsDemographicData) {
|
285 |
|
|
tempQuery +=
|
286 |
|
|
"<datapackage id=\"" + docId + "\">"
|
287 |
|
|
+ "<entity index=\"1\">"
|
288 |
|
|
//omit student id attribute
|
289 |
|
|
+ "<attribute index=\"1\"/>"
|
290 |
|
|
+ "<attribute index=\"2\"/>"
|
291 |
|
|
+ "<attribute index=\"3\"/>"
|
292 |
|
|
+ "</entity>"
|
293 |
|
|
+ "</datapackage>";
|
294 |
|
|
}
|
295 |
4653
|
leinfelder
|
else {
|
296 |
|
|
tempQuery +=
|
297 |
|
|
"<staticItem name=\"demographic_1\" value=\"\" />"
|
298 |
|
|
+ "<staticItem name=\"demographic_2\" value=\"\" />"
|
299 |
|
|
+ "<staticItem name=\"demographic_3\" value=\"\" />";
|
300 |
|
|
}
|
301 |
4650
|
leinfelder
|
|
302 |
4288
|
leinfelder
|
//select the metadata
|
303 |
|
|
tempQuery += metadataAttributeSelection;
|
304 |
4267
|
leinfelder
|
|
305 |
4288
|
leinfelder
|
//select the question metadata
|
306 |
|
|
if (questionId.length > 0) {
|
307 |
|
|
tempQuery +=
|
308 |
|
|
"<datapackage id=\"" + questionId + "\">"
|
309 |
|
|
+ "<entity id=\"" + questionId + "\">"
|
310 |
|
|
+ "<attribute index=\"0\">"
|
311 |
|
|
+ "<pathexpr label=\"qId\">//assessment/section/item/@ident</pathexpr>"
|
312 |
|
|
+ "</attribute>"
|
313 |
|
|
+ "<attribute index=\"1\">"
|
314 |
|
|
+ "<pathexpr label=\"qTitle\">//assessment/section/item/@title</pathexpr>"
|
315 |
|
|
+ "</attribute>"
|
316 |
|
|
+ "<attribute index=\"2\">"
|
317 |
|
|
+ "<pathexpr label=\"qLabel\">//assessment/section/item/presentation/@label</pathexpr>"
|
318 |
|
|
+ "</attribute>"
|
319 |
|
|
+ "</entity>"
|
320 |
|
|
+ "</datapackage>";
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
tempQuery += "</selection>";
|
324 |
4281
|
leinfelder
|
|
325 |
4650
|
leinfelder
|
//join to the question "table"
|
326 |
4288
|
leinfelder
|
if (questionId.length > 0) {
|
327 |
4281
|
leinfelder
|
tempQuery +=
|
328 |
4288
|
leinfelder
|
"<where>"
|
329 |
|
|
+ "<condition type=\"join\">"
|
330 |
|
|
+ "<left>"
|
331 |
|
|
+ "<datapackage id=\"" + docId + "\">"
|
332 |
|
|
+ "<entity index=\"0\">"
|
333 |
|
|
+ "<attribute index=\"1\"/>"
|
334 |
|
|
+ "</entity>"
|
335 |
|
|
+ "</datapackage>"
|
336 |
|
|
+ "</left>"
|
337 |
|
|
+ "<operator>=</operator>"
|
338 |
|
|
+ "<right>"
|
339 |
|
|
+ "<datapackage id=\"" + questionId + "\">"
|
340 |
|
|
+ "<entity id=\"" + questionId + "\">"
|
341 |
|
|
+ "<attribute index=\"0\">"
|
342 |
|
|
+ "<pathexpr label=\"qId\">//assessment/section/item/@ident</pathexpr>"
|
343 |
|
|
+ "</attribute>"
|
344 |
|
|
+ "</entity>"
|
345 |
|
|
+ "</datapackage>"
|
346 |
|
|
+ "</right>"
|
347 |
|
|
+ "</condition>"
|
348 |
|
|
+ "</where>";
|
349 |
|
|
}
|
350 |
|
|
|
351 |
|
|
tempQuery += "</query>";
|
352 |
|
|
|
353 |
|
|
} // for questionId loop
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
} //for docObjs loop
|
357 |
4281
|
leinfelder
|
|
358 |
4288
|
leinfelder
|
tempQuery +=
|
359 |
|
|
"</union>"
|
360 |
|
|
+ "</dataquery>";
|
361 |
|
|
|
362 |
4377
|
leinfelder
|
//alert(tempQuery);
|
363 |
4288
|
leinfelder
|
|
364 |
|
|
return tempQuery;
|
365 |
4290
|
leinfelder
|
}
|
366 |
|
|
|
367 |
4364
|
leinfelder
|
/**
|
368 |
|
|
* @param searchTerms - and object (hashtable) with, pay attention now:
|
369 |
|
|
keys are search values
|
370 |
|
|
* values are pathexprs
|
371 |
|
|
**/
|
372 |
|
|
function generateSearchString(searchTerms, operator, searchAssessments, searchAssessmentItems) {
|
373 |
4290
|
leinfelder
|
var queryString =
|
374 |
|
|
"<pathquery version=\"1.2\">"
|
375 |
|
|
+"<querytitle>Web-Search</querytitle>";
|
376 |
|
|
|
377 |
|
|
/** assessments **/
|
378 |
|
|
if (searchAssessments) {
|
379 |
|
|
|
380 |
|
|
queryString +=
|
381 |
|
|
"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
|
382 |
|
|
|
383 |
|
|
//assessment fields
|
384 |
|
|
+"<returnfield>assessment/duration</returnfield>"
|
385 |
4636
|
leinfelder
|
+"<returnfield>assessment/title</returnfield>"
|
386 |
4290
|
leinfelder
|
+"<returnfield>assessment/@id</returnfield>"
|
387 |
4650
|
leinfelder
|
+"<returnfield>dataset/dataTable/entityName</returnfield>"
|
388 |
4290
|
leinfelder
|
+"<returnfield>lom/general/title/string</returnfield>"
|
389 |
|
|
+"<returnfield>lom/general/keyword/string</returnfield>"
|
390 |
|
|
+"<returnfield>individualName/surName</returnfield>"
|
391 |
|
|
+"<returnfield>organizationName</returnfield>"
|
392 |
|
|
|
393 |
|
|
+"<returnfield>assessmentItems/assessmentItem/assessmentItemId</returnfield>";
|
394 |
|
|
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
/** questions **/
|
398 |
|
|
if (searchAssessmentItems) {
|
399 |
|
|
queryString +=
|
400 |
|
|
"<returndoctype>http://www.imsglobal.org/xsd/ims_qtiasiv1p2</returndoctype>"
|
401 |
|
|
|
402 |
|
|
//question (qti) fields
|
403 |
|
|
+"<returnfield>item/@title</returnfield>"
|
404 |
|
|
+"<returnfield>item/@ident</returnfield>"
|
405 |
|
|
+"<returnfield>qtimetadata/qtimetadatafield/fieldlabel</returnfield>"
|
406 |
|
|
+"<returnfield>qtimetadata/qtimetadatafield/fieldentry</returnfield>"
|
407 |
|
|
//classification
|
408 |
|
|
+"<returnfield>fieldlabel</returnfield>"
|
409 |
|
|
+"<returnfield>fieldentry</returnfield>"
|
410 |
|
|
+"<returnfield>objectives/material/mattext</returnfield>"
|
411 |
|
|
//question content
|
412 |
4796
|
leinfelder
|
+"<returnfield>presentation/flow/response_lid/render_choice/material/mattext</returnfield>"
|
413 |
4290
|
leinfelder
|
+"<returnfield>response_label/@ident</returnfield>"
|
414 |
|
|
+"<returnfield>response_label/material/mattext</returnfield>";
|
415 |
|
|
}
|
416 |
4364
|
leinfelder
|
|
417 |
|
|
queryString +=
|
418 |
|
|
"<querygroup operator=\"" + operator + "\">";
|
419 |
|
|
|
420 |
|
|
for (var i in searchTerms) {
|
421 |
|
|
var key = i;
|
422 |
4562
|
leinfelder
|
var value = searchTerms[i];
|
423 |
|
|
//only if we have a value
|
424 |
|
|
if (value.length > 0) {
|
425 |
|
|
queryString +=
|
426 |
|
|
"<queryterm searchmode=\"contains\" casesensitive=\"false\">";
|
427 |
|
|
if (key != "anyValue") {
|
428 |
|
|
queryString += "<pathexpr>" + key + "</pathexpr>";
|
429 |
|
|
}
|
430 |
|
|
queryString += "<value>" + value + "</value>";
|
431 |
|
|
queryString +="</queryterm>";
|
432 |
|
|
}
|
433 |
4364
|
leinfelder
|
}
|
434 |
|
|
|
435 |
4290
|
leinfelder
|
queryString +=
|
436 |
4364
|
leinfelder
|
"</querygroup>"
|
437 |
4290
|
leinfelder
|
+"</pathquery>";
|
438 |
|
|
|
439 |
|
|
return queryString;
|
440 |
|
|
|
441 |
|
|
}
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
function generateAssessmentSearchString(assessmentItemId) {
|
445 |
|
|
var query =
|
446 |
|
|
"<pathquery version='1.2'>"
|
447 |
|
|
+"<querytitle>Containing-Assessment-Search</querytitle>"
|
448 |
|
|
|
449 |
|
|
+"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
|
450 |
|
|
|
451 |
4636
|
leinfelder
|
+"<returnfield>assessment/title</returnfield>"
|
452 |
4290
|
leinfelder
|
+"<returnfield>assessment/@id</returnfield>"
|
453 |
|
|
+"<returnfield>assessment/duration</returnfield>"
|
454 |
4650
|
leinfelder
|
+"<returnfield>dataset/dataTable/entityName</returnfield>"
|
455 |
4290
|
leinfelder
|
+"<returnfield>lom/general/title/string</returnfield>"
|
456 |
|
|
+"<returnfield>lom/general/keyword/string</returnfield>"
|
457 |
|
|
+"<returnfield>individualName/surName</returnfield>"
|
458 |
|
|
+"<returnfield>organizationName</returnfield>"
|
459 |
|
|
|
460 |
|
|
+"<returnfield>assessmentItems/assessmentItem/assessmentItemId</returnfield>";
|
461 |
|
|
|
462 |
|
|
if (assessmentItemId.length > 0) {
|
463 |
|
|
query += "<querygroup operator='UNION'>";
|
464 |
|
|
|
465 |
|
|
//add the assessmentId if included
|
466 |
|
|
query +=
|
467 |
|
|
"<queryterm searchmode='contains' casesensitive='false'>"
|
468 |
|
|
+"<value>"
|
469 |
|
|
+ assessmentItemId
|
470 |
|
|
+"</value>"
|
471 |
|
|
+"<pathexpr>assessmentItemId</pathexpr>"
|
472 |
|
|
+"</queryterm>";
|
473 |
|
|
|
474 |
|
|
//close the query group
|
475 |
|
|
query +=
|
476 |
|
|
"</querygroup>";
|
477 |
|
|
}
|
478 |
|
|
|
479 |
|
|
query += "</pathquery>";
|
480 |
|
|
|
481 |
|
|
return query;
|
482 |
|
|
}
|
483 |
|
|
|
484 |
4363
|
leinfelder
|
function generateAssessmentListString(assessmentIds) {
|
485 |
|
|
var query =
|
486 |
|
|
"<pathquery version='1.2'>"
|
487 |
|
|
+"<querytitle>Assessment-List</querytitle>"
|
488 |
|
|
|
489 |
|
|
+"<returndoctype>edml://ecoinformatics.org/edml</returndoctype>"
|
490 |
|
|
|
491 |
4636
|
leinfelder
|
+"<returnfield>assessment/title</returnfield>"
|
492 |
4363
|
leinfelder
|
+"<returnfield>assessment/@id</returnfield>"
|
493 |
|
|
+"<returnfield>assessment/duration</returnfield>"
|
494 |
4650
|
leinfelder
|
+"<returnfield>dataset/dataTable/entityName</returnfield>"
|
495 |
4363
|
leinfelder
|
+"<returnfield>lom/general/title/string</returnfield>"
|
496 |
|
|
+"<returnfield>lom/general/keyword/string</returnfield>"
|
497 |
|
|
+"<returnfield>individualName/surName</returnfield>"
|
498 |
|
|
+"<returnfield>organizationName</returnfield>"
|
499 |
|
|
|
500 |
|
|
+"<returnfield>assessmentItems/assessmentItem/assessmentItemId</returnfield>";
|
501 |
|
|
|
502 |
|
|
if (assessmentIds.length > 0) {
|
503 |
|
|
query += "<querygroup operator='UNION'>";
|
504 |
|
|
|
505 |
|
|
//add the assessmentId if included
|
506 |
|
|
for (var i=0; i < assessmentIds.length; i++) {
|
507 |
|
|
query +=
|
508 |
|
|
"<queryterm searchmode='equals' casesensitive='false'>"
|
509 |
|
|
+"<value>"
|
510 |
|
|
+ assessmentIds[i]
|
511 |
|
|
+"</value>"
|
512 |
|
|
+"<pathexpr>@packageId</pathexpr>"
|
513 |
|
|
+"</queryterm>";
|
514 |
|
|
}
|
515 |
|
|
//close the query group
|
516 |
|
|
query +=
|
517 |
|
|
"</querygroup>";
|
518 |
|
|
}
|
519 |
|
|
|
520 |
|
|
query += "</pathquery>";
|
521 |
|
|
|
522 |
|
|
return query;
|
523 |
|
|
}
|
524 |
|
|
|
525 |
4377
|
leinfelder
|
function callAjax(metacatURL, myQuery, qfmt, divId) {
|
526 |
4290
|
leinfelder
|
|
527 |
|
|
//alert("calling ajax: " + metacatURL);
|
528 |
|
|
//alert("myQuery: " + myQuery);
|
529 |
|
|
|
530 |
|
|
//var myRequest = new Ajax.Request(
|
531 |
|
|
var myUpdate = new Ajax.Updater(
|
532 |
4377
|
leinfelder
|
divId,
|
533 |
4290
|
leinfelder
|
metacatURL,
|
534 |
|
|
{ method: 'post',
|
535 |
|
|
parameters: { action: 'squery', qformat: qfmt, query: myQuery},
|
536 |
|
|
evalScripts: true,
|
537 |
|
|
//onSuccess: function(transport) {alert('success: ' + transport.status);},
|
538 |
|
|
onFailure: function(transport) {alert('failure making ajax call');}
|
539 |
|
|
});
|
540 |
|
|
|
541 |
|
|
//alert("done calling ajax");
|
542 |
4495
|
leinfelder
|
}
|
543 |
|
|
function getIframeDocument(iframeId) {
|
544 |
|
|
//look up the document
|
545 |
|
|
var iframe = window.document.getElementById(iframeId);
|
546 |
|
|
var doc = null;
|
547 |
|
|
if (iframe.contentDocument) {
|
548 |
|
|
doc = iframe.contentDocument;
|
549 |
|
|
}
|
550 |
|
|
else {
|
551 |
|
|
doc = iframe.contentWindow.document;
|
552 |
|
|
}
|
553 |
|
|
return doc;
|
554 |
|
|
}
|