1
|
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.1.1</returndoctype>"
|
21
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
|
22
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
|
23
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
|
24
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
|
25
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
|
26
|
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
|
27
|
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
|
28
|
+"<returndoctype>metadata</returndoctype>"
|
29
|
+"<returnfield>originator/individualName/surName</returnfield>"
|
30
|
+"<returnfield>originator/individualName/givenName</returnfield>"
|
31
|
+"<returnfield>creator/individualName/surName</returnfield>"
|
32
|
+"<returnfield>creator/individualName/givenName</returnfield>"
|
33
|
+"<returnfield>originator/organizationName</returnfield>"
|
34
|
+"<returnfield>creator/organizationName</returnfield>"
|
35
|
+"<returnfield>dataset/title</returnfield>"
|
36
|
+"<returnfield>keyword</returnfield>"
|
37
|
//fgdc fields
|
38
|
+"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
|
39
|
+"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
|
40
|
+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
|
41
|
+"<querygroup operator=\"INTERSECT\">"
|
42
|
+"<querygroup operator=\"UNION\">"
|
43
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
44
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
45
|
+"<pathexpr>organizationName</pathexpr>"
|
46
|
+"</queryterm>"
|
47
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
48
|
//+"<value>%</value>"
|
49
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
50
|
+"<pathexpr>placekey</pathexpr>"
|
51
|
+"</queryterm>"
|
52
|
+"</querygroup>"
|
53
|
+"<querygroup operator=\"UNION\">"
|
54
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
55
|
+"<value>" + searchString + "</value>"
|
56
|
+"<pathexpr>surName</pathexpr>"
|
57
|
+"</queryterm>"
|
58
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
59
|
+"<value>" + searchString + "</value>"
|
60
|
+"<pathexpr>givenName</pathexpr>"
|
61
|
+"</queryterm>"
|
62
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
63
|
+"<value>" + searchString + "</value>"
|
64
|
+"<pathexpr>keyword</pathexpr>"
|
65
|
+"</queryterm>"
|
66
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
67
|
+"<value>" + searchString + "</value>"
|
68
|
+"<pathexpr>para</pathexpr>"
|
69
|
+"</queryterm>"
|
70
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
71
|
+"<value>" + searchString + "</value>"
|
72
|
+"<pathexpr>geographicDescription</pathexpr>"
|
73
|
+"</queryterm>"
|
74
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
75
|
+"<value>" + searchString + "</value>"
|
76
|
+"<pathexpr>literalLayout</pathexpr>"
|
77
|
+"</queryterm>"
|
78
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
79
|
+"<value>" + searchString + "</value>"
|
80
|
+"<pathexpr>title</pathexpr>"
|
81
|
+"</queryterm>"
|
82
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
83
|
+"<value>" + searchString + "</value>"
|
84
|
+"<pathexpr>@packageId</pathexpr>"
|
85
|
+"</queryterm>"
|
86
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
87
|
+"<value>" + searchString + "</value>"
|
88
|
+"<pathexpr>abstract/para</pathexpr>"
|
89
|
+"</queryterm>"
|
90
|
|
91
|
//FGDC fields
|
92
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
93
|
+"<value>" + searchString + "</value>"
|
94
|
+"<pathexpr>abstract</pathexpr>"
|
95
|
+"</queryterm>"
|
96
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
97
|
+"<value>" + searchString + "</value>"
|
98
|
+"<pathexpr>idinfo/citation/citeinfo/title</pathexpr>"
|
99
|
+"</queryterm>"
|
100
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
101
|
+"<value>" + searchString + "</value>"
|
102
|
+"<pathexpr>idinfo/citation/citeinfo/origin</pathexpr>"
|
103
|
+"</queryterm>"
|
104
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
105
|
+"<value>" + searchString + "</value>"
|
106
|
+"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>"
|
107
|
+"</queryterm>"
|
108
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
109
|
+"<value>" + searchString + "</value>"
|
110
|
+"<pathexpr>placekey</pathexpr>"
|
111
|
+"</queryterm>"
|
112
|
+"</querygroup>"
|
113
|
+"</querygroup>"
|
114
|
+"</pathquery>";
|
115
|
|
116
|
} else {
|
117
|
queryTermString = "";
|
118
|
if (searchString != "%"){
|
119
|
queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
120
|
+"<value>" + searchString + "</value>"
|
121
|
+"</queryterm>";
|
122
|
}
|
123
|
submitFormObj.query.value = "<pathquery version=\"1.2\">"
|
124
|
+"<querytitle>Web-Search</querytitle>"
|
125
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.1.1</returndoctype>"
|
126
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
|
127
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
|
128
|
+"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
|
129
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
|
130
|
+"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
|
131
|
+"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
|
132
|
+"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
|
133
|
+"<returndoctype>metadata</returndoctype>"
|
134
|
+"<returnfield>originator/individualName/surName</returnfield>"
|
135
|
+"<returnfield>originator/individualName/givenName</returnfield>"
|
136
|
+"<returnfield>creator/individualName/surName</returnfield>"
|
137
|
+"<returnfield>creator/individualName/givenName</returnfield>"
|
138
|
+"<returnfield>originator/organizationName</returnfield>"
|
139
|
+"<returnfield>creator/organizationName</returnfield>"
|
140
|
+"<returnfield>dataset/title</returnfield>"
|
141
|
+"<returnfield>keyword</returnfield>"
|
142
|
//fgdc fields
|
143
|
+"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
|
144
|
+"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
|
145
|
+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
|
146
|
+"<querygroup operator=\"INTERSECT\">"
|
147
|
+"<querygroup operator=\"UNION\">"
|
148
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
149
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
150
|
+"<pathexpr>organizationName</pathexpr>"
|
151
|
+"</queryterm>"
|
152
|
+"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
|
153
|
//+"<value>%</value>"
|
154
|
+"<value>National Center for Ecological Analysis and Synthesis</value>"
|
155
|
+"<pathexpr>placekey</pathexpr>"
|
156
|
+"</queryterm>"
|
157
|
+"</querygroup>"
|
158
|
+ queryTermString
|
159
|
+"</querygroup>"
|
160
|
+"</pathquery>";
|
161
|
|
162
|
}
|
163
|
return true;
|
164
|
}
|
165
|
|
166
|
function browseAll(searchFormId) {
|
167
|
var searchForm = document.getElementById(searchFormId);
|
168
|
var searchString = searchForm.searchstring;
|
169
|
var checkBox = document.getElementById("searchAll");
|
170
|
searchString.value="";
|
171
|
checkBox.checked = true;
|
172
|
if (checkSearch(searchForm)) {
|
173
|
searchForm.submit();
|
174
|
}
|
175
|
|
176
|
}
|
177
|
|
178
|
function searchAll(){
|
179
|
var checkBox = document.getElementById("searchCheckBox");
|
180
|
if (checkBox.checked == true) {
|
181
|
alert("You have selected to search all possible existing fields. This search will take longer.");
|
182
|
}
|
183
|
}
|