1 |
3469
|
walbridge
|
function trim(stringToTrim) {
|
2 |
|
|
return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,'');
|
3 |
|
|
}
|
4 |
|
|
|
5 |
|
|
function checkSearch(submitFormObj) {
|
6 |
|
|
var searchString = trim(submitFormObj.searchstring.value);
|
7 |
|
|
var checkBox = document.getElementById("searchAll");
|
8 |
|
|
|
9 |
|
|
if (searchString=="") {
|
10 |
|
|
if (confirm("Show *all* data in the KNB?")) {
|
11 |
|
|
searchString = "%";
|
12 |
|
|
} else {
|
13 |
|
|
return false;
|
14 |
|
|
}
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
if (!checkBox.checked && searchString!="%") {
|
18 |
|
|
submitFormObj.query.value = "<pathquery version=\"1.2\">"
|
19 |
|
|
+"<querytitle>Web-Search</querytitle>"
|
20 |
|
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
|
21 |
|
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
|
22 |
|
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
|
23 |
|
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
|
24 |
|
|
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
|
25 |
|
|
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
|
26 |
|
|
+"<returnfield>originator/individualName/surName</returnfield>"
|
27 |
|
|
+"<returnfield>originator/individualName/givenName</returnfield>"
|
28 |
|
|
+"<returnfield>creator/individualName/surName</returnfield>"
|
29 |
|
|
+"<returnfield>creator/individualName/givenName</returnfield>"
|
30 |
|
|
+"<returnfield>originator/organizationName</returnfield>"
|
31 |
|
|
+"<returnfield>creator/organizationName</returnfield>"
|
32 |
|
|
+"<returnfield>dataset/title</returnfield>"
|
33 |
|
|
+"<returnfield>keyword</returnfield>"
|
34 |
|
|
+"<querygroup operator=\"INTERSECT\">"
|
35 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
36 |
|
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
37 |
|
|
+"<pathexpr>organizationName</pathexpr>"
|
38 |
|
|
+"</queryterm>"
|
39 |
|
|
+"<querygroup operator=\"UNION\">"
|
40 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
41 |
|
|
+"<value>" + searchString + "</value>"
|
42 |
|
|
+"<pathexpr>surName</pathexpr>"
|
43 |
|
|
+"</queryterm>"
|
44 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
45 |
|
|
+"<value>" + searchString + "</value>"
|
46 |
|
|
+"<pathexpr>givenName</pathexpr>"
|
47 |
|
|
+"</queryterm>"
|
48 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
49 |
|
|
+"<value>" + searchString + "</value>"
|
50 |
|
|
+"<pathexpr>keyword</pathexpr>"
|
51 |
|
|
+"</queryterm>"
|
52 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
53 |
|
|
+"<value>" + searchString + "</value>"
|
54 |
|
|
+"<pathexpr>para</pathexpr>"
|
55 |
|
|
+"</queryterm>"
|
56 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
57 |
|
|
+"<value>" + searchString + "</value>"
|
58 |
|
|
+"<pathexpr>geographicDescription</pathexpr>"
|
59 |
|
|
+"</queryterm>"
|
60 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
61 |
|
|
+"<value>" + searchString + "</value>"
|
62 |
|
|
+"<pathexpr>literalLayout</pathexpr>"
|
63 |
|
|
+"</queryterm>"
|
64 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
65 |
|
|
+"<value>" + searchString + "</value>"
|
66 |
|
|
+"<pathexpr>title</pathexpr>"
|
67 |
|
|
+"</queryterm>"
|
68 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
69 |
|
|
+"<value>" + searchString + "</value>"
|
70 |
|
|
+"<pathexpr>@packageId</pathexpr>"
|
71 |
|
|
+"</queryterm>"
|
72 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
73 |
|
|
+"<value>" + searchString + "</value>"
|
74 |
|
|
+"<pathexpr>abstract/para</pathexpr>"
|
75 |
|
|
+"</queryterm>"
|
76 |
|
|
+"</querygroup>"
|
77 |
|
|
+"</querygroup>"
|
78 |
|
|
+"</pathquery>";
|
79 |
|
|
|
80 |
|
|
} else {
|
81 |
|
|
queryTermString = "";
|
82 |
|
|
if (searchString != "%"){
|
83 |
|
|
queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
84 |
|
|
+"<value>" + searchString + "</value>"
|
85 |
|
|
+"</queryterm>";
|
86 |
|
|
}
|
87 |
|
|
submitFormObj.query.value = "<pathquery version=\"1.2\">"
|
88 |
|
|
+"<querytitle>Web-Search</querytitle>"
|
89 |
|
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
|
90 |
|
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
|
91 |
|
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
|
92 |
|
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
|
93 |
|
|
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
|
94 |
|
|
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
|
95 |
|
|
+"<returnfield>originator/individualName/surName</returnfield>"
|
96 |
|
|
+"<returnfield>originator/individualName/givenName</returnfield>"
|
97 |
|
|
+"<returnfield>creator/individualName/surName</returnfield>"
|
98 |
|
|
+"<returnfield>creator/individualName/givenName</returnfield>"
|
99 |
|
|
+"<returnfield>originator/organizationName</returnfield>"
|
100 |
|
|
+"<returnfield>creator/organizationName</returnfield>"
|
101 |
|
|
+"<returnfield>dataset/title</returnfield>"
|
102 |
|
|
+"<returnfield>keyword</returnfield>"
|
103 |
|
|
+"<querygroup operator=\"INTERSECT\">"
|
104 |
|
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
105 |
|
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
106 |
|
|
+"<pathexpr>organizationName</pathexpr>"
|
107 |
|
|
+"</queryterm>"
|
108 |
|
|
+ queryTermString
|
109 |
|
|
+"</querygroup>"
|
110 |
|
|
+"</pathquery>";
|
111 |
|
|
|
112 |
|
|
}
|
113 |
|
|
return true;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
function searchAll(){
|
117 |
|
|
var checkBox = document.getElementById("searchCheckBox");
|
118 |
|
|
if (checkBox.checked == true) {
|
119 |
|
|
alert("You have selected to search all possible existing fields. This search will take longer.");
|
120 |
|
|
}
|
121 |
|
|
}
|