Last checkin before major changes to buttons

This commit is contained in:
Kaleb Murphy 2008-04-30 14:13:49 +00:00
parent 93bbf128ca
commit bb891242a4
4 changed files with 32 additions and 11 deletions

View file

@ -105,12 +105,12 @@ YAHOO.util.Event.addListener("testB", "click", function(){Survey.Comm.callServer
container: a.Survey_answerId+"container", checked: false });
b.label=a.recordedAnswer;
}else{
// b = new YAHOO.widget.Button({ type: "checkbox", id: a.Survey_answerId+'button', name: a.Survey_answerId+'button',
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.Survey_answerId+'button', name: a.Survey_answerId+'button',
value: a.Survey_answerId,
container: a.Survey_answerId+"container", checked: false });
b.label=a.answerText;
}
b.setStyle('text-align','center');
//b.set('label',a.answerText);
b.on("click", this.buttonChanged,[b,a.Survey_questionId,q.maxAnswers,butts,qs.length,a.Survey_answerId]);
if(a.verbatim == 1){
verb = 1;
@ -342,11 +342,16 @@ YAHOO.util.Event.addListener("testB", "click", function(){Survey.Comm.callServer
max = parseInt(max);
if(maxA == 1){
for(var i in butts){
butts[i].set('checked',false);
document.getElementById(butts[i].hid).value = '';
if(butts[i] != b){
butts[i].set('checked',false);
document.getElementById(butts[i].hid).value = '';
}
}
if(b.get('checked') == true){
document.getElementById(b.hid).value = 1;
}else{
document.getElementById(b.hid).value = '';
}
b.set('checked',true);
document.getElementById(b.hid).value = 1;
}
else if(b.get('checked')){
var max = parseInt(document.getElementById(qid+'max').innerHTML);

View file

@ -7,7 +7,7 @@ Survey.Comm= new function(){
this.url = '';
this.setUrl = function(u){this.url = u;}
var callMade = 0;
var request = function(sUrl,callback,postData,form, hasFile){
if(form != undefined){
if(hasFile){
@ -19,15 +19,22 @@ Survey.Comm= new function(){
}
//console.log('setForm was true');
}
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
if(callMade == 1){
alert("Waiting on previous request");
}else{
callMade = 1;
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
}
}
this.callback = {
upload:function(o){
callMade = 0;
Survey.Comm.callServer('','loadQuestions');
},
success:function(o){
callMade = 0;
var response = '';
response = YAHOO.lang.JSON.parse(o.responseText);
if(response.type == 'displayquestions'){
@ -40,6 +47,7 @@ Survey.Comm= new function(){
}
},
failure: function(o){
callMade = 0;
if(o.status == -1){
alert("Last request timed out, please try again");
}else{

View file

@ -3,19 +3,27 @@ if (typeof Survey == "undefined") {
}
Survey.Comm = new function(){
var callMade = 0;
var request = function(sUrl,callback,postData){
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
if(callMade == 1){
alert("Waiting on previous call");
}else{
callMade = 1;
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
}
}
this.callback = {
success:function(o){
callMade = 0;
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
},
failure: function(o){
callMade = 0;
alert("Last request failed");
Survey.Data.loadLast();
},
timeout: 1000
timeout: 5000
};
this.loadSurvey = function(p){
var postData = "data="+p;

View file

@ -36,5 +36,5 @@ div.slider-max-thumb {
}
.yui-button button{
text-align: center;
min-width: 50px;
min-width: 100px;
}