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.entity.value);
7
    var searchString = submitFormObj.entity.value;
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 (true) {
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
                 	// EML fields
43
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
44
                        +"<value>" + searchString + "</value>"
45
                        +"<pathexpr>keyword</pathexpr>"
46
                    +"</queryterm>"
47
                    
48
                    //FGDC fields
49
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
50
                        +"<value>" + searchString + "</value>"
51
                        +"<pathexpr>idinfo/keywords/theme/themekey</pathexpr>"
52
                    +"</queryterm>"
53
                    +"<queryterm searchmode=\"contains\" casesensitive=\"false\">"
54
                        +"<value>" + searchString + "</value>"
55
                        +"<pathexpr>placekey</pathexpr>"
56
                    +"</queryterm>"
57
                +"</querygroup>"
58
            +"</querygroup>"
59
            +"</pathquery>";
60
    }
61
    alert("query: " + submitFormObj.query.value);
62

    
63
    return true;
64
}
(12-12/19)