Project

General

Profile

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.0</returndoctype>"
21
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
22
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
23
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
24
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
25
            +"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
26
            +"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
27
            +"<returndoctype>metadata</returndoctype>"
28
            +"<returnfield>originator/individualName/surName</returnfield>"
29
            +"<returnfield>originator/individualName/givenName</returnfield>"
30
            +"<returnfield>creator/individualName/surName</returnfield>"
31
            +"<returnfield>creator/individualName/givenName</returnfield>"
32
            +"<returnfield>originator/organizationName</returnfield>"
33
            +"<returnfield>creator/organizationName</returnfield>"
34
            +"<returnfield>dataset/title</returnfield>"
35
            +"<returnfield>keyword</returnfield>"
36
            //fgdc fields
37
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
38
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
39
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
40
            +"<querygroup operator=\"INTERSECT\">"
41
            	+"<querygroup operator=\"UNION\">"
42
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
43
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"
44
	                    +"<pathexpr>organizationName</pathexpr>"
45
	                +"</queryterm>"
46
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
47
	                    //+"<value>%</value>"
48
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"	                    
49
	                    +"<pathexpr>placekey</pathexpr>"
50
	                +"</queryterm>"
51
                +"</querygroup>"
52
                +"<querygroup operator=\"UNION\">"
53
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
54
                        +"<value>" + searchString + "</value>"
55
                        +"<pathexpr>surName</pathexpr>"
56
                    +"</queryterm>"
57
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
58
                        +"<value>" + searchString + "</value>"
59
                        +"<pathexpr>givenName</pathexpr>"
60
                    +"</queryterm>"
61
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
62
                        +"<value>" + searchString + "</value>"
63
                        +"<pathexpr>keyword</pathexpr>"
64
                    +"</queryterm>"
65
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
66
                        +"<value>" + searchString + "</value>"
67
                        +"<pathexpr>para</pathexpr>"
68
                    +"</queryterm>"
69
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
70
                        +"<value>" + searchString + "</value>"
71
                        +"<pathexpr>geographicDescription</pathexpr>"
72
                    +"</queryterm>"
73
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
74
                        +"<value>" + searchString + "</value>"
75
                        +"<pathexpr>literalLayout</pathexpr>"
76
                    +"</queryterm>"
77
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
78
                        +"<value>" + searchString + "</value>"
79
                        +"<pathexpr>title</pathexpr>"
80
                    +"</queryterm>"
81
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
82
                        +"<value>" + searchString + "</value>"
83
                        +"<pathexpr>@packageId</pathexpr>"
84
                    +"</queryterm>"
85
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
86
                        +"<value>" + searchString + "</value>"
87
                        +"<pathexpr>abstract/para</pathexpr>"
88
                    +"</queryterm>"
89
                    
90
                    //FGDC fields
91
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
92
                        +"<value>" + searchString + "</value>"
93
                        +"<pathexpr>abstract</pathexpr>"
94
                    +"</queryterm>"
95
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
96
                        +"<value>" + searchString + "</value>"
97
                        +"<pathexpr>idinfo/citation/citeinfo/title</pathexpr>"
98
                    +"</queryterm>"
99
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
100
                        +"<value>" + searchString + "</value>"
101
                        +"<pathexpr>idinfo/citation/citeinfo/origin</pathexpr>"
102
                    +"</queryterm>"
103
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
104
                        +"<value>" + searchString + "</value>"
105
                        +"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>"
106
                    +"</queryterm>"
107
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
108
                        +"<value>" + searchString + "</value>"
109
                        +"<pathexpr>placekey</pathexpr>"
110
                    +"</queryterm>"
111
                +"</querygroup>"
112
            +"</querygroup>"
113
            +"</pathquery>";
114

    
115
    } else {
116
        queryTermString = "";
117
        if (searchString != "%"){
118
            queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
119
                                  +"<value>" + searchString + "</value>"
120
                              +"</queryterm>";
121
        }
122
        submitFormObj.query.value = "<pathquery version=\"1.2\">"
123
            +"<querytitle>Web-Search</querytitle>"
124
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
125
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
126
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
127
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta6//EN</returndoctype>"
128
            +"<returndoctype>-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN</returndoctype>"
129
            +"<returndoctype>-//NCEAS//resource//EN</returndoctype>"
130
            +"<returndoctype>-//NCEAS//eml-dataset//EN</returndoctype>"
131
            +"<returndoctype>metadata</returndoctype>"
132
            +"<returnfield>originator/individualName/surName</returnfield>"
133
            +"<returnfield>originator/individualName/givenName</returnfield>"
134
            +"<returnfield>creator/individualName/surName</returnfield>"
135
            +"<returnfield>creator/individualName/givenName</returnfield>"
136
            +"<returnfield>originator/organizationName</returnfield>"
137
            +"<returnfield>creator/organizationName</returnfield>"
138
            +"<returnfield>dataset/title</returnfield>"
139
            +"<returnfield>keyword</returnfield>"
140
            //fgdc fields
141
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
142
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
143
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
144
            +"<querygroup operator=\"INTERSECT\">"
145
                +"<querygroup operator=\"UNION\">"
146
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
147
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"
148
	                    +"<pathexpr>organizationName</pathexpr>"
149
	                +"</queryterm>"
150
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
151
	                    //+"<value>%</value>"
152
	                    +"<value>National Center for Ecological Analysis and Synthesis</value>"	                    
153
	                    +"<pathexpr>placekey</pathexpr>"
154
	                +"</queryterm>"
155
                +"</querygroup>"
156
                + queryTermString
157
            +"</querygroup>"
158
            +"</pathquery>";
159

    
160
    }
161
    return true;
162
}
163

    
164
function browseAll(searchFormId) {
165
	var searchForm = document.getElementById(searchFormId);
166
	var searchString = searchForm.searchstring;
167
    var checkBox = document.getElementById("searchAll");
168
    searchString.value="";
169
    checkBox.checked = true;
170
    if (checkSearch(searchForm)) {
171
		searchForm.submit();
172
	}
173

    
174
}
175

    
176
function searchAll(){
177
    var checkBox = document.getElementById("searchCheckBox");
178
    if (checkBox.checked == true) {
179
        alert("You have selected to search all possible existing fields. This search will take longer.");
180
    }
181
}
(16-16/17)