Project

General

Profile

1 4267 leinfelder
function checkSearch(submitFormObj) {
2
	//alert("calling method");
3
4
    //var checkBox = document.getElementById("searchAll");
5
	var docId = submitFormObj.docid.value;
6
7 4273 leinfelder
	//alert("docId=" + docId);
8 4267 leinfelder
9
	var metadataAttributes = "";
10
	var index = 0;
11
	for (var i=0; i < submitFormObj.length; i++) {
12
		var formElement = submitFormObj.elements[i];
13 4273 leinfelder
		if (formElement.type == "checkbox" && formElement.checked) {
14 4267 leinfelder
15
			metadataAttributes += "<attribute index=\"";
16
			metadataAttributes += index;
17
			metadataAttributes += "\">";
18
19
			metadataAttributes += "<pathexpr label=\"";
20
			metadataAttributes += formElement.name;
21
			metadataAttributes += "\">";
22
			metadataAttributes += formElement.value;
23
			metadataAttributes += "</pathexpr>";
24
25
			metadataAttributes += "</attribute>";
26
27
			index++;
28
		}
29
	}
30
31
	metadataAttributes =
32
				"<datapackage id=\"" + docId + "\">"
33
					+ "<entity id=\"" + docId + "\">"
34
						+ metadataAttributes
35
					+ "</entity>"
36
				+ "</datapackage>";
37
38
        submitFormObj.dataquery.value =
39
        "<?xml version=\"1.0\"?>"
40
        + "<dataquery>"
41
		+ "<query>"
42
			+ "<selection>"
43
				+ "<datapackage id=\"" + docId + "\">"
44
					+ "<entity index=\"0\">"
45
						+ "<attribute index=\"0\"/>"
46
						+ "<attribute index=\"1\"/>"
47 4273 leinfelder
						//omit student id
48
						+ "<attribute index=\"3\"/>"
49
						+ "<attribute index=\"4\"/>"
50 4267 leinfelder
					+ "</entity>"
51
				+ "</datapackage>"
52
53
				+ metadataAttributes
54
55
			+ "</selection>"
56
			/*
57
			+ "<where>"
58
				+ "<condition type="condition">"
59
					+ "<left>"
60
						+ "<datapackage id="tao.1.1">"
61
							+ "<entity index="0">"
62
								+ "<attribute index="2"/>"
63
							+ "</entity>"
64
						+ "</datapackage>"
65
					+ "</left>"
66
					+ "<operator>>=</operator>"
67
					+ "<right>"
68
						+ "<value>15</value>"
69
					+ "</right>"
70
				+ "</condition>"
71
			+ "</where>"
72
			*/
73
		+ "</query>"
74
        + "</dataquery>";
75
76 4273 leinfelder
         //alert(submitFormObj.dataquery.value);
77 4267 leinfelder
78
    return true;
79
}