Ignore:
Timestamp:
2023-03-13T15:06:58+13:00 (14 months ago)
Author:
davidb
Message:

Changes to get Greenbug back up and running. Theis commit targets two areas: we now need to explicitly specify 'o=xml' in our calls to general action with 'sa' as things like 'XSLTGetTemplateListFromFile'; we now also need to set the AJAX calls explicitly so they return string-type as their response (even if fundamentally the message is XML for example), which is done with dataType: 'text' in the jquery-based AJAX call. We are now using jquery v3.x and it looks like the newer versions of the library auto-sense the return time, where as the older jquery we were using did not to this, hence the reason for the change. In the long run it would be better to keep the returned response in XML, and use browser API to access XML to get to the data we want, however the decision for now was to explicitly set things so it is handled as a string, thereby allowing all our currently written code to operate as it used to.

File:
1 edited

Legend:

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

    r37153 r37480  
    6868    if (gs.cgiParams.ck && gs.cgiParams.ck.length > 0) {
    6969    url += "&ck=" + gs.cgiParams.ck;
    70     }
    71    
    72    
    73    
    74     $.ajax(url)
     70    }       
     71   
     72    $.ajax(url, { dataType: "text" })
    7573    .done(function(response)
    7674    {
     
    109107    template += '<xsl:template match="/">';
    110108    template +=   '<sections>';
    111     template +=     '<xsl:for-each select="/page/pageResponse/document//documentNode[@nodeID = \'' + sectionID + '\']/documentNode">';
    112     template +=       '<xsl:call-template name="wrapDocumentNodes"/>';
    113     template +=     '</xsl:for-each>';
     109    template += '<xsl:for-each select="/page/pageResponse/document//documentNode[@nodeID = \'' + sectionID + '\']/documentNode">';
     110    template +=   '<xsl:call-template name="wrapDocumentNodes"/>';
     111    template += '</xsl:for-each>';
    114112    template +=   '</sections>';
    115113    template += '</xsl:template>';
    116114
    117     template = makeURLComponentSafe(template);
    118     var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ilt=" + template;
    119 
    120     if (gs.cgiParams.p_s && gs.cgiParams.p_s.length > 0) {
    121     url += "&p.s=" + gs.cgiParams.p_s;
    122     }
    123 
    124        if(gs.documentMetadata.docType == "paged")
     115    template = makeURLComponentSafe(template);
     116    var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + sectionID + "?ilt=" + template;
     117
     118    if (gs.cgiParams.p_s && gs.cgiParams.p_s.length > 0) {
     119        url += "&p.s=" + gs.cgiParams.p_s;
     120    }
     121
     122    if(gs.documentMetadata.docType == "paged")
    125123    {
    126124        url += "&dt=hierarchy";
    127125    }
    128126   
    129     $.ajax(url)
     127        $.ajax(url, { dataType: "text" })
    130128    .done(function(response)
    131129    {
     
    461459    }
    462460
    463     $.ajax(url)
     461    $.ajax(url, { dataType: "text" })
    464462    .done(function(response)
    465463    {
     
    537535    }
    538536    else { 
    539     $.ajax(url)
     537    $.ajax(url, { dataType: "text" })
    540538        .done(retrieveFullTableOfContentsSuccess)
    541539        .fail(function() {
     
    704702    }
    705703
    706     $.ajax(url)
     704    $.ajax(url, { dataType: "text" })
    707705    .done(function(response)
    708706    {
     
    968966        template +=   '</html>';
    969967        template += '</xsl:template>';
    970     template = makeURLComponentSafe(template);
     968        template = makeURLComponentSafe(template);
    971969        var url = href + "?noText=1&ilt=" + template;
    972970
    973         $.ajax(url)
     971    $.ajax(url, { dataType: "text" })
    974972        .done(function(text)
    975973             {
     
    13071305    template +=   ']</images>';
    13081306    template += '</xsl:template>';
    1309     template = makeURLComponentSafe(template);
     1307    template = makeURLComponentSafe(template);
    13101308    var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/document/" + gs.cgiParams.d + "?ed=1&ilt=" + template;
    13111309
    1312     $.ajax({
    1313         url:url
    1314     }).done(function(data) {
     1310    $.ajax(url, {dataType: "text"})
     1311    .done(function(data) {
    13151312        var startIndex = data.indexOf(">", data.indexOf(">") + 1) + 1;
    13161313        var endIndex = data.lastIndexOf("<");
Note: See TracChangeset for help on using the changeset viewer.