Project

General

Profile

« Previous | Next » 

Revision 4267

add dataquery construction via js.
used in the first XSL-housed style sheets

View differences:

lib/style/skins/first/search.js
1
function checkSearch(submitFormObj) {
2
	//alert("calling method");
3
	
4
    //var checkBox = document.getElementById("searchAll");
5
	var docId = submitFormObj.docid.value;
6
	
7
	alert("docId=" + docId);
8
	
9
	var metadataAttributes = "";
10
	var index = 0;
11
	for (var i=0; i < submitFormObj.length; i++) {
12
		var formElement = submitFormObj.elements[i];
13
		if (formElement.type == "checkbox") {
14
		
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
						+ "<attribute index=\"2\"/>"
48
					+ "</entity>"
49
				+ "</datapackage>"
50
				
51
				+ metadataAttributes
52
				
53
			+ "</selection>"
54
			/*
55
			+ "<where>"
56
				+ "<condition type="condition">"
57
					+ "<left>"
58
						+ "<datapackage id="tao.1.1">"
59
							+ "<entity index="0">"
60
								+ "<attribute index="2"/>"
61
							+ "</entity>"
62
						+ "</datapackage>"
63
					+ "</left>"
64
					+ "<operator>>=</operator>"				
65
					+ "<right>"
66
						+ "<value>15</value>"
67
					+ "</right>"
68
				+ "</condition>"
69
			+ "</where>"
70
			*/
71
		+ "</query>"
72
        + "</dataquery>";
73
         
74
         alert(submitFormObj.dataquery.value);
75
         
76
    return true;
77
}
0 78

  

Also available in: Unified diff