Project

General

Profile

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