Changeset 351 in tmcsimulator for trunk/webapps/js/cmsLayer.js


Ignore:
Timestamp:
03/31/2019 10:20:47 AM (7 years ago)
Author:
jdalbey
Message:

updated ei notebook proof of concepts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/js/cmsLayer.js

    r335 r351  
    115115            document.getElementById('msgdisplay5').value = response5; 
    116116            document.getElementById('msgdisplay6').value = response6; 
    117             saveMessage(response1 + "|" + response2 + "|" + response3 + "|" + 
     117            saveCMSMessage(response1 + "|" + response2 + "|" + response3 + "|" + 
    118118                        response4 + "|" + response5 + "|" + response6); 
    119119        } 
     
    128128        document.getElementById('msgdisplay5').value = ""; 
    129129        document.getElementById('msgdisplay6').value = ""; 
    130         saveMessage("|||||"); 
     130        saveCMSMessage("|||||"); 
    131131    } 
    132132 
    133133    // Save an updated cms message to the file 
    134     function saveMessage(outMessage) 
     134    function saveCMSMessage(outMessage) 
    135135    { 
    136136        // Fetch cmsID from hidden field where it was put when dialog opened. 
     
    144144        messageDict[cmsID].cms.message.phase2.Line2 = msgParts[4]; 
    145145        messageDict[cmsID].cms.message.phase2.Line3 = msgParts[5]; 
     146        // Check if there was any messages to save and 
    146147        // Set icon to reflect message state 
    147148        if (outMessage == "|||||") 
     
    155156        cmsLayer.overrideStyle(cmsLayer.getFeatureById(cmsID), currentIcon) 
    156157        // break the json string into lines for readability 
    157         jsonstring = JSON.stringify(Object.values(messageDict)); //,null,4); 
     158        jsonstring = JSON.stringify(Object.values(messageDict)); //Can't use these in GET parameter  ,null,4); 
    158159        outString = "{\"data\":" + jsonstring + "}"; 
    159  
     160        console.log("outString = " + outString); 
    160161        var xhttp = new XMLHttpRequest(); 
    161162        xhttp.open("GET", "cgi-bin/saveCMSmessage.py?msg=" + outString, true); 
     
    163164        // Using POST might be a better idea ... haven't tried this yet 
    164165        //      var xhr = new XMLHttpRequest(); 
    165         //      xhr.open("POST", "/cgi-bin/saveMessage.py?", true); 
     166        //      xhr.open("POST", "/cgi-bin/saveCMSmessage.py?", true); 
    166167        //      xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); 
    167168        // send the collected data as JSON 
Note: See TracChangeset for help on using the changeset viewer.