Added IE7 compat in administersurvey.js for class changes.

This commit is contained in:
Kaleb Murphy 2008-05-08 14:21:03 +00:00
parent afd395ebb6
commit d6cfcd4381
3 changed files with 17 additions and 15 deletions

View file

@ -25,7 +25,6 @@ Survey.Form = new function() {
this.displayQuestions = function(params){ this.displayQuestions = function(params){
toValidate = new Array();//clear array toValidate = new Array();//clear array
var qs = params.questions; var qs = params.questions;
var s = params.section; var s = params.section;
@ -188,8 +187,8 @@ Survey.Form = new function() {
for(var z in toValidate[i]['answers']){ for(var z in toValidate[i]['answers']){
total += Math.round(document.getElementById(z).value); total += Math.round(document.getElementById(z).value);
} }
console.log(total+" and "+ toValidate[i]['total']);
if(total == toValidate[i]['total']){answered = 1;} if(total == toValidate[i]['total']){answered = 1;}
else{alert("Please enter amounts that sum to 100% to proceed.");}
}else{ }else{
for(var z in toValidate[i]['answers']){ for(var z in toValidate[i]['answers']){
var v = document.getElementById(z).value; var v = document.getElementById(z).value;
@ -197,9 +196,6 @@ console.log(total+" and "+ toValidate[i]['total']);
answered = 1; answered = 1;
break; break;
} }
else{
console.log(z+' was not answered');
}
} }
} }
if(answered == 0){ if(answered == 0){
@ -365,33 +361,33 @@ console.log(total+" and "+ toValidate[i]['total']);
var aid = objs[5]; var aid = objs[5];
max = parseInt(max); max = parseInt(max);
if(maxA == 1){ if(maxA == 1){
if(b.getAttribute('class') == 'mcbutton-selected'){ if(b.className == 'mcbutton-selected'){
document.getElementById(b.hid).value = 0; document.getElementById(b.hid).value = 0;
b.setAttribute('class','mcbutton'); b.className='mcbutton';
}else{ }else{
document.getElementById(b.hid).value = 1; document.getElementById(b.hid).value = 1;
b.setAttribute('class','mcbutton-selected'); b.className='mcbutton-selected';
} }
for(var i in butts){ for(var i in butts){
if(butts[i] != b){ if(butts[i] != b){
butts[i].setAttribute('class','mcbutton'); butts[i].className='mcbutton';
document.getElementById(butts[i].hid).value = ''; document.getElementById(butts[i].hid).value = '';
} }
} }
} }
else if(b.getAttribute('class') == 'mcbutton'){ else if(b.className == 'mcbutton'){
var max = parseInt(document.getElementById(qid+'max').innerHTML); var max = parseInt(document.getElementById(qid+'max').innerHTML);
if(max == 0){ if(max == 0){
b.setAttribute('class','mcbutton'); b.className='mcbutton';
//warn that options used up //warn that options used up
} }
else{ else{
b.setAttribute('class','mcbutton-selected'); b.className='mcbutton-selected';
document.getElementById(qid+'max').innerHTML = parseInt(max-1); document.getElementById(qid+'max').innerHTML = parseInt(max-1);
document.getElementById(b.hid).value = 1; document.getElementById(b.hid).value = 1;
} }
}else{ }else{
b.setAttribute('class','mcbutton'); b.className='mcbutton';
var max = parseInt(document.getElementById(qid+'max').innerHTML); var max = parseInt(document.getElementById(qid+'max').innerHTML);
document.getElementById(qid+'max').innerHTML = parseInt(max+1); document.getElementById(qid+'max').innerHTML = parseInt(max+1);
document.getElementById(b.hid).value = ''; document.getElementById(b.hid).value = '';

View file

@ -54,7 +54,7 @@ Survey.SectionTemplate = new function(){
} }
html = html + "\ html = html + "\
<hr>\ <hr>\
<p>Section Text:</p> <textarea name=sectionText maxlength=2056 cols=50 rows=10>"+ params.sectionText +"</textarea>\ <p>Section Text:</p> <textarea name=sectionText maxlength=2056 cols=65 rows=4>"+ params.sectionText +"</textarea>\
"; ";
html = html + "<p>Title on every page: " + this.makeRadio('everyPageTitle',[{text:'Yes',value:1},{text:'No',value:0}],params.everyPageTitle); html = html + "<p>Title on every page: " + this.makeRadio('everyPageTitle',[{text:'Yes',value:1},{text:'No',value:0}],params.everyPageTitle);
html = html + "<p>Text on every page: " + this.makeRadio('everyPageText',[{text:'Yes',value:1},{text:'No',value:0}],params.everyPageText); html = html + "<p>Text on every page: " + this.makeRadio('everyPageText',[{text:'Yes',value:1},{text:'No',value:0}],params.everyPageText);
@ -68,7 +68,7 @@ Survey.SectionTemplate = new function(){
} }
var form = new YAHOO.widget.Dialog("section", var form = new YAHOO.widget.Dialog("section",
{ width : "400px", { width : "500px",
fixedcenter : true, fixedcenter : true,
visible : false, visible : false,
constraintoviewport : true, constraintoviewport : true,

View file

@ -55,9 +55,15 @@ input.mcbutton:hover{
} }
input.mcbutton-selected{ input.mcbutton-selected{
background-color: #172D9D; background-color: #172D9D;
background-repeat: repeat-x;
color: #FFFFFF; color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px; font-size: 10px;
margin: 0.5em;
padding: .8em;
width: 60px;
text-align: center;
display: block;
font-weight: bold; font-weight: bold;
background-image: url(/extras/wobject/Survey/gradient-glossy.png); background-image: url(/extras/wobject/Survey/gradient-glossy.png);
background-position: 0px 0px; background-position: 0px 0px;