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