Fixed #10520 - Survey responses get confused if survey structure modified

Survey responses are now revision-aware.
The survey structure gets revisioned automatically as necessary when changes
are made on the Edit Survey screen (as necessary ~~ a response exists
for the current revision)
This commit is contained in:
Patrick Donelan 2009-06-16 06:25:38 +00:00
parent 3e5d5804f6
commit d820d43760
6 changed files with 260 additions and 97 deletions

View file

@ -783,6 +783,5 @@ if (typeof Survey === "undefined") {
})();
YAHOO.util.Event.onDOMReady(function(){
// Survey.Comm.setUrl('/' + document.getElementById('assetPath').value);
Survey.Comm.callServer('', 'loadQuestions');
});

View file

@ -79,16 +79,39 @@ if (typeof Survey === "undefined") {
}
},
submitSummary: function(data,functionName){
var sUrl = "?func=loadQuestions&shownSummary=1";
var sUrl = "?func=loadQuestions;shownSummary=1";
var revision = Survey.Comm.getRevision();
if (revision) {
sUrl += ";revision=" + revision;
}
request(sUrl, this.callback, null, null, null);
},
getRevision: function() {
// Use the appropriate Survey response revision
var revision = parseInt(document.getElementById('surveyResponseRevision').value, 10);
if (!revision) {
YAHOO.log("Revision not found, bad template?");
}
return revision;
},
callServer: function(data, functionName, form, hasFile){
var postData;
if (!form) {
postData = "data=" + YAHOO.lang.JSON.stringify(data, data);
}
//var sUrl = this.url + "?func="+functionName;
var sUrl = "?func=" + functionName;
var revision = Survey.Comm.getRevision();
if (revision) {
sUrl += ";revision=" + revision;
}
request(sUrl, this.callback, postData, form, hasFile);
}
};