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/debug_scripts.js

    r37468 r37480  
    130130    var partialPageReload = function(callback)
    131131    {
    132         $.ajax(document.URL)
     132        $.ajax(document.URL, { dataType: "text" })
    133133        .done(function(response)
    134134        {
     
    319319
    320320                var url = gs.xsltParams.library_name;
    321                 var parameters = {"a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1.locationName":_currentLocation, "s1.fileName":_currentFileName, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString};
     321                var parameters = {"o": "xml", "a":"g", "rt":"r", "s":"SaveXMLTemplateToFile", "s1.locationName":_currentLocation, "s1.fileName":_currentFileName, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.namespace":_currentNamespace, "s1.nodename":_currentNodename, "s1.xml":xmlString};
    322322
    323323                if(_currentName && _currentName.length > 0){parameters["s1.name"] = _currentName;}
     
    328328                $.blockUI({message:'<div class="ui-state-active">Saving, please wait...</div>'});
    329329
    330                 $.post(url, parameters)
     330                $.ajax(url, { method: "POST", dataType: "text" , data: parameters })
    331331                .done(function()
    332332                {
     
    495495
    496496        //Populate the file selector
    497         var url = gs.xsltParams.library_name + "?a=g&rt=r&o=xml&s=GetXSLTFilesForCollection&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
    498         $.ajax(url,
    499                    {
    500                        dataType: 'text'
    501                    }
    502                   )
     497        var url = gs.xsltParams.library_name + "?o=xml&a=g&rt=r&s=GetXSLTFilesForCollection&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
     498        $.ajax(url, { dataType: "text" })
    503499        .done(function(response)
    504500        {
     
    610606    this.populateTemplateSelectorFromFile = function(filename, location, callback)
    611607    {
    612         var getURL = gs.xsltParams.library_name + "?a=g&rt=r&s=GetTemplateListFromFile&s1.fileName=" + filename + "&s1.locationName=" + location + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
    613         $.ajax(getURL)
     608        var getURL = gs.xsltParams.library_name + "?o=xml&a=g&rt=r&s=GetTemplateListFromFile&s1.fileName=" + filename + "&s1.locationName=" + location + "&s1.interfaceName=" + gs.xsltParams.interface_name + "&s1.siteName=" + gs.xsltParams.site_name + "&s1.collectionName=" + gs.cgiParams.c;
     609        $.ajax(getURL, { dataType: "text" })
    614610        .done(function(templateResponse)
    615611        {
     
    618614           
    619615            if(templateListStart == "<templateList>".length - 1)
    620             {
    621                 return;
     616                {
     617                console.error("Error retrieving '" + filename + "' templates");
     618                return;
    622619            }
    623620           
     
    688685
    689686        var url = gs.xsltParams.library_name;
    690         var params = {"a":"g", "rt":"r", "s":"GetXMLTemplateFromFile", "s1.fileName":filename, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.locationName":location, "s1.namespace":namespace, "s1.nodename":nodename};
     687        var params = {"o": "xml", "a":"g", "rt":"r", "s":"GetXMLTemplateFromFile", "s1.fileName":filename, "s1.interfaceName":gs.xsltParams.interface_name, "s1.siteName":gs.xsltParams.site_name, "s1.collectionName":gs.cgiParams.c, "s1.locationName":location, "s1.namespace":namespace, "s1.nodename":nodename};
    691688
    692689        if(match && match.length > 0){params["s1.match"] = match; responseName = "requestedMatchTemplate";}
     
    694691        if(name && name.length > 0){params["s1.name"] = name;}
    695692
    696         $.post(url, params)
     693        $.ajax(url, { method: "POST", dataType: "text" , "data": params})
    697694        .done(function(response)
    698695        {
     
    705702            }
    706703            else
    707             {
    708                 return;
     704                {
     705                console.error("Failed to find '" + responseName + "' in POST response");
     706                return;
    709707            }
    710708
Note: See TracChangeset for help on using the changeset viewer.