Ignore:
Timestamp:
2019-02-12T11:11:47+13:00 (5 years ago)
Author:
kjdon
Message:

tomcat 8 change - it didn't like unescaped chars in the inline templates. so we need to do more esacping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r32718 r32767  
    2424* EXPANSION SCRIPTS *
    2525********************/
     26
     27function makeURLSafe(url) {
     28
     29    url =  url.replace(/ /g, "%20").replace(/\//g, "%2F").replace(/\:/g, "%3A").replace(/=/g, "%3D").replace(/\[/g,"%5B").replace(/\]/g,"%5D");
     30    return url;
     31}
    2632
    2733function getTextForSection(sectionID, callback)
     
    4046    template +=   '</text>';
    4147    template += '</xsl:template>';
    42 
     48   
     49    template = makeURLSafe(template);
     50   
    4351    var hlCheckBox = document.getElementById("highlightOption");
    4452   
     
    5664    }
    5765   
    58     var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ed=1&hl=" + hl + "&ilt=" + template.replace(" ", "%20");
     66    var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ed=1&hl=" + hl + "&ilt=" + template;
    5967    if (gs.cgiParams.p_s && gs.cgiParams.p_s.length > 0) {
    6068    url += "&p.s=" + gs.cgiParams.p_s;
     
    109117    template += '</xsl:template>';
    110118
    111     var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ilt=" + template.replace(" ", "%20");
     119    template = makeURLSafe(template);
     120    var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ilt=" + template;
    112121
    113122       if(gs.documentMetadata.docType == "paged")
     
    677686    ilt += '</xsl:template>';
    678687   
    679     var url = gs.xsltParams.library_name + "?a=d&ec=1&c=" + gs.cgiParams.c + "&d=" + gs.cgiParams.d + "&ilt=" + ilt.replace(/ /g, "%20");
     688    ilt = makeURLSafe(ilt);
     689
     690
     691    var url = gs.xsltParams.library_name + "?a=d&ec=1&c=" + gs.cgiParams.c + "&d=" + gs.cgiParams.d + "&ilt=" + ilt;
    680692
    681693    $.ajax(url)
     
    939951        template +=   '</html>';
    940952        template += '</xsl:template>';
    941 
    942         var url = href + "?noText=1&ilt=" + template.replace(" ", "%20");
     953    template = makeURLSafe(template);
     954        var url = href + "?noText=1&ilt=" + template;
     955
    943956        $.ajax(url)
    944957        .success(function(text)
     
    13421355    template +=   ']</images>';
    13431356    template += '</xsl:template>';
    1344 
    1345     var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + gs.cgiParams.d + "?ed=1&ilt=" + template.replace(" ", "%20");
     1357    template = makeURLSafe(template);
     1358    var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + gs.cgiParams.d + "?ed=1&ilt=" + template;
    13461359
    13471360    $.ajax(
Note: See TracChangeset for help on using the changeset viewer.