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

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

    
119
    }
120
    return true;
121
}
122

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

    
133
}
134

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