- Timestamp:
- 2019-04-17T20:26:03+12:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/facet-scripts.js
r32110 r33016 21 21 } 22 22 23 var countsString = "s1.facetQueries= &";23 var countsString = "s1.facetQueries="; 24 24 if(counts.length > 0) 25 25 { 26 countsString = "s1.facetQueries=["; 27 var countsStringBuffer = ""; 26 var countsStringBuffer = "["; 28 27 for(var i = 0; i < counts.length; i++) 29 28 { 30 29 // escape any apostrophes in facet query terms 31 30 // (ext/solr's Greenstone3SearchHandler does the other half of handling them) 32 countsStringBuffer += "\"" + encodeURI(counts[i]).replace(/'/g, "%2527") + "\""; 31 //countsStringBuffer += "\"" + encodeURI(counts[i]).replace(/'/g, "%2527") + "\""; 32 // calling makeURLSafe() here will ensure percent signs are escaped away too 33 // by the end of makeURLComponentSafe() call below 34 countsStringBuffer += "\"" + makeURLSafe(counts[i]).replace(/'/g, "%2527") + "\""; 33 35 if(i < counts.length - 1) 34 36 { … … 37 39 } 38 40 39 countsString += encodeURI(countsStringBuffer) + "]&"; 41 countsStringBuffer += "]"; 42 43 // We need to ensure that the *value* of s1.facetQueries (so everything after 44 // s1.facetQueries= and before the connecting &) are safe, which requires escaping, 45 // and are further also escaped to not be mistaken for their reserved meaning. 46 // : is a reserved character in URLs, [] are unsafe characters. All need escaping. 47 // So call makeURLComponentSafe(), not makeURLSafe() 48 countsString = countsString + makeURLComponentSafe(countsStringBuffer, 1); 40 49 } 41 50 42 console.log("STRING IS " + countsString) 51 countsString += "&"; 52 console.log("STRING IS " + countsString); 43 53 44 54 $.ajax(gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/search/" + gs.cgiParams.s + "?" + searchString + countsString + "excerptid=resultsArea")
Note:
See TracChangeset
for help on using the changeset viewer.