Project

General

Profile

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