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 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
            +"<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>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
            +"<returnfield>keyword</returnfield>"
33
            //fgdc fields
34
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
35
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
36
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
37
            +"<querygroup operator=\"INTERSECT\">"
38
            	+"<querygroup operator=\"UNION\">"
39
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
40
	                    +"<value>Palmyra Atoll Research Consortium</value>"
41
	                    +"<pathexpr>/eml/dataset/creator/organizationName</pathexpr>"
42
	                +"</queryterm>"
43
                +"</querygroup>"
44
                +"<querygroup operator=\"UNION\">"
45
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
46
                        +"<value>" + searchString + "</value>"
47
                        +"<pathexpr>/eml/dataset/creator/individualName/surName</pathexpr>"
48
                    +"</queryterm>"
49
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
50
                        +"<value>" + searchString + "</value>"
51
                        +"<pathexpr>/eml/dataset/creator/individualName/givenName</pathexpr>"
52
                    +"</queryterm>"
53
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
54
                        +"<value>" + searchString + "</value>"
55
                        +"<pathexpr>/eml/dataset/keywordSet/keyword</pathexpr>"
56
                    +"</queryterm>"
57
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
58
                        +"<value>" + searchString + "</value>"
59
                        +"<pathexpr>para</pathexpr>"
60
                    +"</queryterm>"
61
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
62
                        +"<value>" + searchString + "</value>"
63
                        +"<pathexpr>/eml/dataset/coverage/geographicCoverage/geographicDescription</pathexpr>"
64
                    +"</queryterm>"
65
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
66
                        +"<value>" + searchString + "</value>"
67
                        +"<pathexpr>literalLayout</pathexpr>"
68
                    +"</queryterm>"
69
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
70
                        +"<value>" + searchString + "</value>"
71
                        +"<pathexpr>/eml/dataset/title</pathexpr>"
72
                    +"</queryterm>"
73
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
74
                        +"<value>" + searchString + "</value>"
75
                        +"<pathexpr>/eml/@packageId</pathexpr>"
76
                    +"</queryterm>"
77
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
78
                        +"<value>" + searchString + "</value>"
79
                        +"<pathexpr>/eml/dataset/abstract/para</pathexpr>"
80
                    +"</queryterm>"
81
                +"</querygroup>"
82
            +"</querygroup>"
83
            +"</pathquery>";
84

    
85
    } else {
86
        queryTermString = "";
87
        if (searchString != "%"){
88
            queryTermString = "<queryterm searchmode=\"contains\" casesensitive=\"false\">"
89
                                  +"<value>" + searchString + "</value>"
90
                              +"</queryterm>";
91
        }
92
        submitFormObj.query.value = "<pathquery version=\"1.2\">"
93
            +"<querytitle>Web-Search</querytitle>"
94
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.1</returndoctype>"
95
            +"<returndoctype>eml://ecoinformatics.org/eml-2.1.0</returndoctype>"
96
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.1</returndoctype>"
97
            +"<returndoctype>eml://ecoinformatics.org/eml-2.0.0</returndoctype>"
98
            +"<returndoctype>metadata</returndoctype>"
99
            +"<returnfield>originator/individualName/surName</returnfield>"
100
            +"<returnfield>originator/individualName/givenName</returnfield>"
101
            +"<returnfield>creator/individualName/surName</returnfield>"
102
            +"<returnfield>creator/individualName/givenName</returnfield>"
103
            +"<returnfield>originator/organizationName</returnfield>"
104
            +"<returnfield>creator/organizationName</returnfield>"
105
            +"<returnfield>dataset/title</returnfield>"
106
            +"<returnfield>keyword</returnfield>"
107
            //fgdc fields
108
            +"<returnfield>idinfo/citation/citeinfo/title</returnfield>"
109
            +"<returnfield>idinfo/citation/citeinfo/origin</returnfield>"
110
			+"<returnfield>idinfo/keywords/theme/themekey</returnfield>"
111
            +"<querygroup operator=\"INTERSECT\">"
112
                +"<querygroup operator=\"UNION\">"
113
	                +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
114
	                    +"<value>Palmyra Atoll Research Consortium</value>"
115
	                    +"<pathexpr>/eml/dataset/creator/organizationName</pathexpr>"
116
	                +"</queryterm>"
117
                +"</querygroup>"
118
                + queryTermString
119
            +"</querygroup>"
120
            +"</pathquery>";
121

    
122
    }
123
    return true;
124
}
125

    
126
function browseAll(searchFormId) {
127
	var searchForm = document.getElementById(searchFormId);
128
	var searchString = searchForm.searchstring;
129
    var checkBox = document.getElementById("searchAll");
130
    searchString.value="";
131
    checkBox.checked = true;
132
    if (checkSearch(searchForm)) {
133
		searchForm.submit();
134
	}
135

    
136
}
137

    
138
function searchAll(){
139
    var checkBox = document.getElementById("searchCheckBox");
140
    if (checkBox.checked == true) {
141
        alert("You have selected to search all possible existing fields. This search will take longer.");
142
    }
143
}
(13-13/14)