Deleting old junk files
This commit is contained in:
parent
4e05a51f15
commit
94b73f3c73
5 changed files with 0 additions and 2296 deletions
|
|
@ -1,404 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Form = new function() {
|
||||
|
||||
var sliders;
|
||||
var dSliders;
|
||||
var texts;
|
||||
var buttons;
|
||||
var cals;
|
||||
var files;
|
||||
|
||||
var multipleChoice = {'Multiple Choice':1,'Gender':1,'Yes/No':1,'True/False':1,'Agree/Disagree':1,'Oppose/Support':1,'Importance':1,
|
||||
'Likelihood':1,'Certainty':1,'Satisfaction':1,'Confidence':1,'Effectiveness':1,'Concern':1,'Risk':1,'Threat':1,'Security':1,'Ideology':1,
|
||||
'Race':1,'Party':1,'Education':1};
|
||||
var text = {'Text':1, 'Email':1, 'Phone Number':1, 'Text Date':1, 'Currency':1};
|
||||
var slider = {'Slider':1, 'Dual Slider - Range':1, 'Multi Slider - Allocate':1};
|
||||
var dateType = {'Date':1,'Date Range':1};
|
||||
var fileUpload = {'File Upload':1};
|
||||
var hidden = {'Hidden':1};
|
||||
|
||||
this.displayQuestions = function(params){
|
||||
sliders = new Array();
|
||||
dSliders = new Array();
|
||||
texts = new Array();
|
||||
buttons = new Array();
|
||||
cals = new Array();
|
||||
files = new Array();
|
||||
|
||||
var section = params.section;
|
||||
var questions = params.questions;
|
||||
document.getElementById('headertitle').innerHTML = "Section: "+section.sequenceNumber+" "+section.sectionName + "<hr>";
|
||||
|
||||
if(section.questionsOnSectionPage){
|
||||
document.getElementById('headertext').innerHTML = section.sectionText;
|
||||
}
|
||||
|
||||
var qs = params.questions;
|
||||
var s = params.survey;
|
||||
var html = "";
|
||||
|
||||
// html = '<form id=surveyForm>';
|
||||
document.getElementById('survey').innerHTML = html;html = '';
|
||||
for(var i = 0; i < qs.length; i++){
|
||||
var q = qs[i];
|
||||
var verts = '';
|
||||
var verte = '';
|
||||
for(var x in q.answers){
|
||||
for(var y in q.answers[x]){
|
||||
if(q.answers[x][y] == undefined){q.answers[x][y] = '';}
|
||||
}
|
||||
}
|
||||
|
||||
if(q.verticalDisplay != 0){
|
||||
verts = "<p>";
|
||||
verte = "</p>";
|
||||
}
|
||||
|
||||
html += "<hr>";
|
||||
html += "<div class='question'>Q"+q.sequenceNumber+": "+q.questionText+"</div>";
|
||||
|
||||
if(multipleChoice[q.questionType]){
|
||||
if(q.maxAnswers > 1){
|
||||
html += "<div class='"+q.Survey_questionId+"qmessage'>Selections left: <span id='"+q.Survey_questionId+"max'>"+q.maxAnswers+"</span></div>";
|
||||
}
|
||||
var butts = new Array();
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer id="+a.Survey_answerId+"container></span>"+verte;
|
||||
// html += verts+"<input type=checkbox id="+a.Survey_answerId+" name="+a.Survey_answerId+" value=1></input>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
var b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.Survey_answerId, name: a.Survey_answerId, value: a.Survey_answerId,
|
||||
container: a.Survey_answerId+"container", checked: false });
|
||||
b.on("click", this.buttonChanged,[b,a.Survey_questionId,q.maxAnswers,butts]);
|
||||
butts.push(b);
|
||||
buttons.push(b);
|
||||
}
|
||||
}
|
||||
else if(text[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer>";
|
||||
|
||||
if(q.questionType == 'Text'){
|
||||
html += "<textarea name="+a.Survey_answerId+"></textarea>";
|
||||
}else if(q.questionType == 'Email'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Phone Number'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Text Date'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Currency'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
}
|
||||
}
|
||||
else if(dateType[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
var calid = a.Survey_answerId+'container';
|
||||
html += verts+"<span class=dateanswer>";
|
||||
html += "<table><tr><td/><td>"+a.answerText+"</td><td/></tr>";
|
||||
html += "<div id='"+calid+"'></div>";
|
||||
html += "<input name='"+a.Survey_answerId+"' id='"+a.Survey_answerId+"' type=text></input>";
|
||||
html += "<span id='"+a.Survey_answerId+"button'></span>";
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
var c = new YAHOO.widget.Calendar(calid,{title:'Choose a date:', close:true});
|
||||
c.selectEvent.subscribe(this.selectCalendar,[c,a.Survey_answerId],true);
|
||||
c.render();
|
||||
c.hide();
|
||||
var b = new YAHOO.widget.Button({ label:"Select Date", id:"pushbutton"+a.Survey_answerId, container:a.Survey_answerId+'button' });
|
||||
b.on("click", this.showCalendar,[c]);
|
||||
}
|
||||
}
|
||||
else if(fileUpload[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<input type='file' name='"+a.Survey_answerId+"' id='"+a.Survey_answerId+"' size='50'>";
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
files.push(a.Survey_answerId);
|
||||
}
|
||||
}
|
||||
else if(slider[q.questionType]){
|
||||
//First run through and put up the span placeholders and find the max value for an answer, to know how big the allocation points will be.
|
||||
var max = 0;
|
||||
if(q.questionType == 'Dual Slider - Range'){
|
||||
var a1 = q.answers[0];
|
||||
var a2 = q.answers[1];
|
||||
html += "<input type=hidden id='"+a1.Survey_answerId+"' name='"+a1.Survey_answerId+"' value=0>";
|
||||
html += "<input type=hidden id='"+a2.Survey_answerId+"' name='"+a2.Survey_answerId+"' value="+a1.max+">";
|
||||
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<p><table><tr><td>";
|
||||
html += "<span id='"+a1.Survey_answerId+"show'>0</span>";
|
||||
html += "</td><td></td><td>";
|
||||
html += "<span id='"+a2.Survey_answerId+"show'>"+a2.max+"</span>";
|
||||
html += "</td></tr>";
|
||||
html += "<tr><td>0 </td><td>";
|
||||
html += "<div id='"+q.Survey_questionId+"slider-bg' tabindex='-1' title='Slider' class=slider-bg>";
|
||||
html += "<div id='"+a1.Survey_answerId+"slider-min-thumb' class=slider-min-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'></div>\
|
||||
<div id='"+a2.Survey_answerId+"slider-max-thumb' class=slider-max-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'></div>";
|
||||
|
||||
html += " </div>\
|
||||
</div>";
|
||||
html += "<td>"+a1.max+"</td><td>";
|
||||
html += "</table>";
|
||||
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
new this.dualSliders(q);
|
||||
}else{
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<p><table><tr><td></td><td>";
|
||||
html += a.answerText+" ";
|
||||
html += "<span id='"+a.Survey_answerId+"show'>0</span>";
|
||||
html += "<input type=hidden id='"+a.Survey_answerId+"' name='"+a.Survey_answerId+"'>";
|
||||
html += "</td><td></td></tr>";
|
||||
html += "<tr><td>0 </td><td>";
|
||||
html += "<div id='"+a.Survey_answerId+"slider-bg' tabindex='-1' title='Slider' class=slider-bg>";
|
||||
if(q.questionType == 'Dual Slider - Range'){
|
||||
html += "<div id='"+a.Survey_answerId+"slider-min-thumb' class=slider-min-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>\
|
||||
<div id='"+a.Survey_answerId+"slider-max-thumb' class=slider-max-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>";
|
||||
|
||||
}else{
|
||||
html += "<div id='"+a.Survey_answerId+"slider-thumb' class=slider-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>";
|
||||
}
|
||||
html += " </div>\
|
||||
</div>";
|
||||
html += "<td>"+a.max+"</td><td>";
|
||||
html += "</table>";
|
||||
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
if(a.max - a.min > max){max = a.max - a.min;}
|
||||
}
|
||||
}
|
||||
if(q.questionType == 'Multi Slider - Allocate'){
|
||||
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
|
||||
new this.sliderManager(q,max);
|
||||
}
|
||||
else if(q.questionType == 'Slider'){
|
||||
new this.sliders(q);
|
||||
}
|
||||
}
|
||||
else if(hidden[q.questionType]){
|
||||
}
|
||||
}
|
||||
html += "<hr><input type=button id=submit value=submit></input>";
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
document.getElementById('footer').innerHTML = "<hr>You are |---| close to being done.";
|
||||
// var submit = function() {alert(YAHOO.util.Connect.setForm('surveyForm'));}
|
||||
YAHOO.util.Event.addListener("submit", "click", this.submit);
|
||||
}
|
||||
this.submit = function(){
|
||||
var butts = new Array();
|
||||
for(var i in buttons){
|
||||
if(buttons[i].get('checked')){
|
||||
butts.push([buttons[i].get('id'),buttons[i].get('value')]);
|
||||
}
|
||||
}
|
||||
for(var i in files){
|
||||
console.log(files[i]);
|
||||
console.log(document.getElementById(files[i]).value);
|
||||
}
|
||||
Survey.Comm.callServer(s,'submitQuestions');
|
||||
}
|
||||
this.dualSliders = function(q){
|
||||
var total = 200;
|
||||
var sliders = new Array();
|
||||
var a1 = q.answers[0];
|
||||
var a2 = q.answers[1];
|
||||
var scale = 200/a1.max;
|
||||
console.log(scale);
|
||||
|
||||
var id = q.Survey_questionId;
|
||||
var a1id = a1.Survey_answerId;
|
||||
var a2id = a2.Survey_answerId;
|
||||
|
||||
var a1h = document.getElementById(a1id);
|
||||
var a2h = document.getElementById(a2id);
|
||||
var a1s = document.getElementById(a1id+'show');
|
||||
var a2s = document.getElementById(a2id+'show');
|
||||
var s = YAHOO.widget.Slider.getHorizDualSlider(id+'slider-bg',
|
||||
a1id+"slider-min-thumb", a2id+"slider-max-thumb",
|
||||
200, 1*scale, [1,200]);
|
||||
|
||||
s.minRange = 4;
|
||||
var updateUI = function () {
|
||||
var min = Math.round(s.minVal/scale),
|
||||
max = Math.round(s.maxVal/scale);
|
||||
a1h.value = min;
|
||||
a1s.innerHTML = min;
|
||||
a2h.value = max;
|
||||
a2s.innerHTML = max;
|
||||
};
|
||||
|
||||
// Subscribe to the dual thumb slider's change and ready events to
|
||||
// report the state.
|
||||
// s.subscribe('ready', updateUI);
|
||||
s.subscribe('change', updateUI);
|
||||
}
|
||||
this.sliders = function(q){
|
||||
var total = 200;
|
||||
var sliders = new Array();
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
var step = q.answers[i].step;
|
||||
var scale = 200/q.answers[i].max;
|
||||
var Event = YAHOO.util.Event;
|
||||
var lang = YAHOO.lang;
|
||||
var id = a.Survey_answerId+'slider-bg';
|
||||
var s = YAHOO.widget.Slider.getHorizSlider(id, a.Survey_answerId+'slider-thumb',
|
||||
0, 200, (scale*step));
|
||||
s.max = a.max*scale;
|
||||
s.input = a.Survey_answerId;
|
||||
s.scale = scale;
|
||||
var check = function() {
|
||||
var t = document.getElementById(this.input);
|
||||
var tshow = document.getElementById(this.input+'show');
|
||||
t.value = this.getRealValue();
|
||||
tshow.innerHTML = this.getRealValue();
|
||||
};
|
||||
s.getRealValue = function() {
|
||||
return this.getValue() / this.scale;
|
||||
}
|
||||
s.subscribe("slideEnd", check);
|
||||
s.subscribe("change", check);
|
||||
sliders.push(s);
|
||||
}
|
||||
}
|
||||
//an object which creates sliders for allocation type questions and then manages their events and keeps them from overallocating
|
||||
this.sliderManager = function(q,t){
|
||||
var total = 200;
|
||||
var step = q.answers[0].step;
|
||||
var scale = 200/q.answers[0].max;
|
||||
var sliders = new Array();
|
||||
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
var Event = YAHOO.util.Event;
|
||||
var lang = YAHOO.lang;
|
||||
var id = a.Survey_answerId+'slider-bg';
|
||||
var s = YAHOO.widget.Slider.getHorizSlider(id, a.Survey_answerId+'slider-thumb',
|
||||
0, 200, scale*step);
|
||||
s.input = a.Survey_answerId;
|
||||
s.lastValue = 0;
|
||||
//console.log(s);
|
||||
var check = function() {
|
||||
var t = 0;
|
||||
for(var x in sliders){
|
||||
t+= sliders[x].getValue();
|
||||
}
|
||||
if(t > total){
|
||||
this.setValue(this.lastValue);
|
||||
}else{
|
||||
this.lastValue = this.getValue();
|
||||
// alert("Setting "+this.input+" to "+this.getRealValue());
|
||||
document.getElementById(this.input).value = this.getRealValue();
|
||||
}
|
||||
};
|
||||
s.subscribe("slideEnd", check);
|
||||
s.subscribe("change", check);
|
||||
var manualEntry = function(e){
|
||||
// set the value when the 'return' key is detected
|
||||
if (Event.getCharCode(e) === 13 || e.type == 'blur') {
|
||||
var v = parseFloat(this.value, 10);
|
||||
v = (lang.isNumber(v)) ? v : 0;
|
||||
v *= scale;
|
||||
|
||||
// convert the real value into a pixel offset
|
||||
for(var sl in sliders){
|
||||
if(sliders[sl].input == this.id){
|
||||
sliders[sl].setValue(Math.round(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Event.on(document.getElementById(s.input), "keydown", manualEntry);
|
||||
Event.on(document.getElementById(s.input), "blur", manualEntry);
|
||||
|
||||
s.getRealValue = function() {
|
||||
return Math.round(this.getValue() / scale);
|
||||
}
|
||||
sliders.push(s);
|
||||
document.getElementById(s.input).value = s.getRealValue();
|
||||
}
|
||||
}
|
||||
|
||||
this.selectCalendar = function(event,args,obj){
|
||||
var id = obj[1];
|
||||
var selected = args[0];
|
||||
var date = selected[0];
|
||||
var year = date[0], month = date[1], day = date[2];
|
||||
var input = document.getElementById(id);
|
||||
input.value = month + "/" + day + "/" + year;
|
||||
obj[0].hide();
|
||||
}
|
||||
|
||||
|
||||
this.showCalendar = function(event,objs){
|
||||
//console.log('showing '+objs[0].id);
|
||||
objs[0].show();
|
||||
}
|
||||
this.buttonChanged = function(event,objs){
|
||||
var b = objs[0];
|
||||
var qid = objs[1];
|
||||
var maxA = objs[2];
|
||||
var butts = objs[3];
|
||||
max = parseInt(max);
|
||||
if(maxA == 1){
|
||||
for(var i in butts){
|
||||
butts[i].set('checked',false);
|
||||
}
|
||||
b.set('checked',true);
|
||||
}
|
||||
else if(b.get('checked')){
|
||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
||||
if(max == 0){
|
||||
b.set('checked',false);
|
||||
//warn that options used up
|
||||
}
|
||||
else{
|
||||
document.getElementById(qid+'max').innerHTML = parseInt(max-1);
|
||||
}
|
||||
}else{
|
||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
||||
document.getElementById(qid+'max').innerHTML = parseInt(max+1);
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize survey
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
Survey.OnLoad = new function() {
|
||||
var e = YAHOO.util.Event;
|
||||
this.init = function() {
|
||||
e.onDOMReady(this.initHandler);
|
||||
}
|
||||
this.initHandler = function(){
|
||||
Survey.Comm.setUrl('/'+document.getElementById('assetPath').value);
|
||||
Survey.Comm.callServer('','loadQuestions');
|
||||
}
|
||||
}();
|
||||
|
||||
Survey.OnLoad.init();
|
||||
|
|
@ -1,408 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Form = new function() {
|
||||
|
||||
var sliders;
|
||||
var dSliders;
|
||||
var texts;
|
||||
var buttons;
|
||||
var cals;
|
||||
var files;
|
||||
|
||||
var multipleChoice = {'Multiple Choice':1,'Gender':1,'Yes/No':1,'True/False':1,'Agree/Disagree':1,'Oppose/Support':1,'Importance':1,
|
||||
'Likelihood':1,'Certainty':1,'Satisfaction':1,'Confidence':1,'Effectiveness':1,'Concern':1,'Risk':1,'Threat':1,'Security':1,'Ideology':1,
|
||||
'Race':1,'Party':1,'Education':1};
|
||||
var text = {'Text':1, 'Email':1, 'Phone Number':1, 'Text Date':1, 'Currency':1};
|
||||
var slider = {'Slider':1, 'Dual Slider - Range':1, 'Multi Slider - Allocate':1};
|
||||
var dateType = {'Date':1,'Date Range':1};
|
||||
var fileUpload = {'File Upload':1};
|
||||
var hidden = {'Hidden':1};
|
||||
|
||||
this.displayQuestions = function(params){
|
||||
sliders = new Array();
|
||||
dSliders = new Array();
|
||||
texts = new Array();
|
||||
buttons = new Array();
|
||||
cals = new Array();
|
||||
files = new Array();
|
||||
|
||||
var section = params.section;
|
||||
var questions = params.questions;
|
||||
document.getElementById('headertitle').innerHTML = "Section: "+section.sequenceNumber+" "+section.sectionName + "<hr>";
|
||||
|
||||
if(section.questionsOnSectionPage){
|
||||
document.getElementById('headertext').innerHTML = section.sectionText;
|
||||
}
|
||||
|
||||
var qs = params.questions;
|
||||
var s = params.survey;
|
||||
var html = "";
|
||||
|
||||
// html = '<form id=surveyForm>';
|
||||
document.getElementById('survey').innerHTML = html;html = '';
|
||||
for(var i = 0; i < qs.length; i++){
|
||||
var q = qs[i];
|
||||
var verts = '';
|
||||
var verte = '';
|
||||
for(var x in q.answers){
|
||||
for(var y in q.answers[x]){
|
||||
if(q.answers[x][y] == undefined){q.answers[x][y] = '';}
|
||||
}
|
||||
}
|
||||
|
||||
if(q.verticalDisplay != 0){
|
||||
verts = "<p>";
|
||||
verte = "</p>";
|
||||
}
|
||||
|
||||
html += "<hr>";
|
||||
html += "<div class='question'>Q"+q.sequenceNumber+": "+q.questionText+"</div>";
|
||||
|
||||
if(multipleChoice[q.questionType]){
|
||||
if(q.maxAnswers > 1){
|
||||
html += "<div class='"+q.Survey_questionId+"qmessage'>Selections left: <span id='"+q.Survey_questionId+"max'>"+q.maxAnswers+"</span></div>";
|
||||
}
|
||||
var butts = new Array();
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer id="+a.Survey_answerId+"container></span>"+verte;
|
||||
// html += verts+"<input type=checkbox id="+a.Survey_answerId+" name="+a.Survey_answerId+" value=1></input>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
var b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.Survey_answerId, name: a.Survey_answerId, value: a.Survey_answerId,
|
||||
container: a.Survey_answerId+"container", checked: false });
|
||||
b.on("click", this.buttonChanged,[b,a.Survey_questionId,q.maxAnswers,butts]);
|
||||
butts.push(b);
|
||||
buttons.push(b);
|
||||
}
|
||||
}
|
||||
else if(text[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer>";
|
||||
|
||||
if(q.questionType == 'Text'){
|
||||
html += "<textarea name="+a.Survey_answerId+"></textarea>";
|
||||
}else if(q.questionType == 'Email'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Phone Number'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Text Date'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}else if(q.questionType == 'Currency'){
|
||||
html += "<input type=text name="+a.Survey_answerId+"></input>";
|
||||
}
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
}
|
||||
}
|
||||
else if(dateType[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
var calid = a.Survey_answerId+'container';
|
||||
html += verts+"<span class=dateanswer>";
|
||||
html += "<table><tr><td/><td>"+a.answerText+"</td><td/></tr>";
|
||||
html += "<div id='"+calid+"'></div>";
|
||||
html += "<input name='"+a.Survey_answerId+"' id='"+a.Survey_answerId+"' type=text></input>";
|
||||
html += "<span id='"+a.Survey_answerId+"button'></span>";
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
var c = new YAHOO.widget.Calendar(calid,{title:'Choose a date:', close:true});
|
||||
c.selectEvent.subscribe(this.selectCalendar,[c,a.Survey_answerId],true);
|
||||
c.render();
|
||||
c.hide();
|
||||
var b = new YAHOO.widget.Button({ label:"Select Date", id:"pushbutton"+a.Survey_answerId, container:a.Survey_answerId+'button' });
|
||||
b.on("click", this.showCalendar,[c]);
|
||||
}
|
||||
}
|
||||
else if(fileUpload[q.questionType]){
|
||||
for(var x = 0; x < q.answers.length; x++){
|
||||
var a = q.answers[x];
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<input type='file' name='"+a.Survey_answerId+"' id='"+a.Survey_answerId+"' size='50' />";
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
files.push(a.Survey_answerId);
|
||||
}
|
||||
}
|
||||
else if(slider[q.questionType]){
|
||||
//First run through and put up the span placeholders and find the max value for an answer, to know how big the allocation points will be.
|
||||
var max = 0;
|
||||
if(q.questionType == 'Dual Slider - Range'){
|
||||
var a1 = q.answers[0];
|
||||
var a2 = q.answers[1];
|
||||
html += "<input type=hidden id='"+a1.Survey_answerId+"' name='"+a1.Survey_answerId+"' value=0>";
|
||||
html += "<input type=hidden id='"+a2.Survey_answerId+"' name='"+a2.Survey_answerId+"' value="+a1.max+">";
|
||||
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<p><table><tr><td>";
|
||||
html += "<span id='"+a1.Survey_answerId+"show'>0</span>";
|
||||
html += "</td><td></td><td>";
|
||||
html += "<span id='"+a2.Survey_answerId+"show'>"+a2.max+"</span>";
|
||||
html += "</td></tr>";
|
||||
html += "<tr><td>0 </td><td>";
|
||||
html += "<div id='"+q.Survey_questionId+"slider-bg' tabindex='-1' title='Slider' class=slider-bg>";
|
||||
html += "<div id='"+a1.Survey_answerId+"slider-min-thumb' class=slider-min-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'></div>\
|
||||
<div id='"+a2.Survey_answerId+"slider-max-thumb' class=slider-max-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'></div>";
|
||||
|
||||
html += " </div>\
|
||||
</div>";
|
||||
html += "<td>"+a1.max+"</td><td>";
|
||||
html += "</table>";
|
||||
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
new this.dualSliders(q);
|
||||
}else{
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
html += verts+"<span class=answer>";
|
||||
html += "<p><table><tr><td></td><td>";
|
||||
html += a.answerText+" ";
|
||||
html += "<span id='"+a.Survey_answerId+"show'>0</span>";
|
||||
html += "<input type=hidden id='"+a.Survey_answerId+"' name='"+a.Survey_answerId+"'>";
|
||||
html += "</td><td></td></tr>";
|
||||
html += "<tr><td>0 </td><td>";
|
||||
html += "<div id='"+a.Survey_answerId+"slider-bg' tabindex='-1' title='Slider' class=slider-bg>";
|
||||
if(q.questionType == 'Dual Slider - Range'){
|
||||
html += "<div id='"+a.Survey_answerId+"slider-min-thumb' class=slider-min-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>\
|
||||
<div id='"+a.Survey_answerId+"slider-max-thumb' class=slider-max-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>";
|
||||
|
||||
}else{
|
||||
html += "<div id='"+a.Survey_answerId+"slider-thumb' class=slider-thumb>\
|
||||
<img src='/extras/wobject/Survey/thumb-n.gif'>";
|
||||
}
|
||||
html += " </div>\
|
||||
</div>";
|
||||
html += "<td>"+a.max+"</td><td>";
|
||||
html += "</table>";
|
||||
|
||||
html += "</span>"+verte;
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
if(a.max - a.min > max){max = a.max - a.min;}
|
||||
}
|
||||
}
|
||||
if(q.questionType == 'Multi Slider - Allocate'){
|
||||
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
|
||||
new this.sliderManager(q,max);
|
||||
}
|
||||
else if(q.questionType == 'Slider'){
|
||||
new this.sliders(q);
|
||||
}
|
||||
}
|
||||
else if(hidden[q.questionType]){
|
||||
}
|
||||
}
|
||||
html += "<hr><input type=button id=submit value=submit></input>";
|
||||
document.getElementById('survey').innerHTML += html;html = '';
|
||||
document.getElementById('footer').innerHTML = "<hr>You are |---| close to being done.";
|
||||
YAHOO.util.Event.addListener("submit", "click", this.submit);
|
||||
YAHOO.util.Event.addListener("testSubmit", "click", this.tsubmit);
|
||||
}
|
||||
|
||||
|
||||
this.tsubmit = function(){
|
||||
// console.log(YAHOO.util.Connect.setForm('surveyForm',1));
|
||||
var t = document.getElementById('surveyTest');
|
||||
// Survey.Comm.callServer('','submitQuestions',document.getElementById('surveyTest'));
|
||||
Survey.Comm.callServer('','submitQuestions','surveyTest');
|
||||
}
|
||||
|
||||
this.submit = function(){
|
||||
// console.log(YAHOO.util.Connect.setForm('surveyForm',1));
|
||||
Survey.Comm.callServer('','submitQuestions','surveyForm');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.dualSliders = function(q){
|
||||
var total = 200;
|
||||
var sliders = new Array();
|
||||
var a1 = q.answers[0];
|
||||
var a2 = q.answers[1];
|
||||
var scale = 200/a1.max;
|
||||
//console.log(scale);
|
||||
|
||||
var id = q.Survey_questionId;
|
||||
var a1id = a1.Survey_answerId;
|
||||
var a2id = a2.Survey_answerId;
|
||||
|
||||
var a1h = document.getElementById(a1id);
|
||||
var a2h = document.getElementById(a2id);
|
||||
var a1s = document.getElementById(a1id+'show');
|
||||
var a2s = document.getElementById(a2id+'show');
|
||||
var s = YAHOO.widget.Slider.getHorizDualSlider(id+'slider-bg',
|
||||
a1id+"slider-min-thumb", a2id+"slider-max-thumb",
|
||||
200, 1*scale, [1,200]);
|
||||
|
||||
s.minRange = 4;
|
||||
var updateUI = function () {
|
||||
var min = Math.round(s.minVal/scale),
|
||||
max = Math.round(s.maxVal/scale);
|
||||
a1h.value = min;
|
||||
a1s.innerHTML = min;
|
||||
a2h.value = max;
|
||||
a2s.innerHTML = max;
|
||||
};
|
||||
|
||||
// Subscribe to the dual thumb slider's change and ready events to
|
||||
// report the state.
|
||||
// s.subscribe('ready', updateUI);
|
||||
s.subscribe('change', updateUI);
|
||||
}
|
||||
this.sliders = function(q){
|
||||
var total = 200;
|
||||
var sliders = new Array();
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
var step = q.answers[i].step;
|
||||
var scale = 200/q.answers[i].max;
|
||||
var Event = YAHOO.util.Event;
|
||||
var lang = YAHOO.lang;
|
||||
var id = a.Survey_answerId+'slider-bg';
|
||||
var s = YAHOO.widget.Slider.getHorizSlider(id, a.Survey_answerId+'slider-thumb',
|
||||
0, 200, (scale*step));
|
||||
s.max = a.max*scale;
|
||||
s.input = a.Survey_answerId;
|
||||
s.scale = scale;
|
||||
var check = function() {
|
||||
var t = document.getElementById(this.input);
|
||||
var tshow = document.getElementById(this.input+'show');
|
||||
t.value = this.getRealValue();
|
||||
tshow.innerHTML = this.getRealValue();
|
||||
};
|
||||
s.getRealValue = function() {
|
||||
return this.getValue() / this.scale;
|
||||
}
|
||||
s.subscribe("slideEnd", check);
|
||||
s.subscribe("change", check);
|
||||
sliders.push(s);
|
||||
}
|
||||
}
|
||||
//an object which creates sliders for allocation type questions and then manages their events and keeps them from overallocating
|
||||
this.sliderManager = function(q,t){
|
||||
var total = 200;
|
||||
var step = q.answers[0].step;
|
||||
var scale = 200/q.answers[0].max;
|
||||
var sliders = new Array();
|
||||
|
||||
for(var i in q.answers){
|
||||
var a = q.answers[i];
|
||||
var Event = YAHOO.util.Event;
|
||||
var lang = YAHOO.lang;
|
||||
var id = a.Survey_answerId+'slider-bg';
|
||||
var s = YAHOO.widget.Slider.getHorizSlider(id, a.Survey_answerId+'slider-thumb',
|
||||
0, 200, scale*step);
|
||||
s.input = a.Survey_answerId;
|
||||
s.lastValue = 0;
|
||||
//console.log(s);
|
||||
var check = function() {
|
||||
var t = 0;
|
||||
for(var x in sliders){
|
||||
t+= sliders[x].getValue();
|
||||
}
|
||||
if(t > total){
|
||||
this.setValue(this.lastValue);
|
||||
}else{
|
||||
this.lastValue = this.getValue();
|
||||
// alert("Setting "+this.input+" to "+this.getRealValue());
|
||||
document.getElementById(this.input).value = this.getRealValue();
|
||||
}
|
||||
};
|
||||
s.subscribe("slideEnd", check);
|
||||
s.subscribe("change", check);
|
||||
var manualEntry = function(e){
|
||||
// set the value when the 'return' key is detected
|
||||
if (Event.getCharCode(e) === 13 || e.type == 'blur') {
|
||||
var v = parseFloat(this.value, 10);
|
||||
v = (lang.isNumber(v)) ? v : 0;
|
||||
v *= scale;
|
||||
|
||||
// convert the real value into a pixel offset
|
||||
for(var sl in sliders){
|
||||
if(sliders[sl].input == this.id){
|
||||
sliders[sl].setValue(Math.round(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Event.on(document.getElementById(s.input), "keydown", manualEntry);
|
||||
Event.on(document.getElementById(s.input), "blur", manualEntry);
|
||||
|
||||
s.getRealValue = function() {
|
||||
return Math.round(this.getValue() / scale);
|
||||
}
|
||||
sliders.push(s);
|
||||
document.getElementById(s.input).value = s.getRealValue();
|
||||
}
|
||||
}
|
||||
|
||||
this.selectCalendar = function(event,args,obj){
|
||||
var id = obj[1];
|
||||
var selected = args[0];
|
||||
var date = selected[0];
|
||||
var year = date[0], month = date[1], day = date[2];
|
||||
var input = document.getElementById(id);
|
||||
input.value = month + "/" + day + "/" + year;
|
||||
obj[0].hide();
|
||||
}
|
||||
|
||||
|
||||
this.showCalendar = function(event,objs){
|
||||
//console.log('showing '+objs[0].id);
|
||||
objs[0].show();
|
||||
}
|
||||
this.buttonChanged = function(event,objs){
|
||||
var b = objs[0];
|
||||
var qid = objs[1];
|
||||
var maxA = objs[2];
|
||||
var butts = objs[3];
|
||||
max = parseInt(max);
|
||||
if(maxA == 1){
|
||||
for(var i in butts){
|
||||
butts[i].set('checked',false);
|
||||
}
|
||||
b.set('checked',true);
|
||||
}
|
||||
else if(b.get('checked')){
|
||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
||||
if(max == 0){
|
||||
b.set('checked',false);
|
||||
//warn that options used up
|
||||
}
|
||||
else{
|
||||
document.getElementById(qid+'max').innerHTML = parseInt(max-1);
|
||||
}
|
||||
}else{
|
||||
var max = parseInt(document.getElementById(qid+'max').innerHTML);
|
||||
document.getElementById(qid+'max').innerHTML = parseInt(max+1);
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize survey
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
Survey.OnLoad = new function() {
|
||||
var e = YAHOO.util.Event;
|
||||
this.init = function() {
|
||||
e.onDOMReady(this.initHandler);
|
||||
}
|
||||
this.initHandler = function(){
|
||||
Survey.Comm.setUrl('/'+document.getElementById('assetPath').value);
|
||||
Survey.Comm.callServer('','loadQuestions');
|
||||
}
|
||||
}();
|
||||
|
||||
Survey.OnLoad.init();
|
||||
|
|
@ -1,988 +0,0 @@
|
|||
// vim:ft=javascript
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize namespace
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
|
||||
(function() {
|
||||
if (typeof WebGUI == "undefined") {
|
||||
var WebGUI = {};
|
||||
}
|
||||
var Survey = {};
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Global Params
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
var objects = new Array();
|
||||
objects[0] = undefined;
|
||||
var slength = 1;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// List Super Object
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
//function listObject(type){
|
||||
Survey.listObject = function(type){
|
||||
var loType = type;
|
||||
this.dom;
|
||||
this.toggleOn = function(){
|
||||
if(loType == 'section'){
|
||||
this.dom.className="sselected";
|
||||
}else if(loType == 'question'){
|
||||
this.dom.className="qselected";
|
||||
}
|
||||
}
|
||||
this.toggleOff = function(){
|
||||
this.dom.className=loType;
|
||||
}
|
||||
this.getType = function(){return loType;}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Section definition
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
//function section(text,s,randomize){
|
||||
Survey.Section = function(text,s,randomize){
|
||||
//inheritence
|
||||
this.inherit= Survey.listObject;
|
||||
this.inherit("section");
|
||||
|
||||
var sectionUL = document.getElementById('sections');
|
||||
|
||||
this.text = text;
|
||||
this.sId = "S"+(slength++);
|
||||
this.id = s.toString();
|
||||
this.randomize = randomize;
|
||||
this.questions = new Array();
|
||||
this.dd;
|
||||
this.ddt;
|
||||
this.addThyself = function(){
|
||||
if(this.dom != undefined){alert("dom already defined");return}
|
||||
this.dom = document.createElement('li');
|
||||
this.dom.id=this.id;//use slice to get just the number. Q used to protect namespace from A numbered objects
|
||||
this.updateHTML();
|
||||
// this.className = this.getType();
|
||||
|
||||
var holder = document.createElement('ul');
|
||||
holder.className = "questionList";
|
||||
holder.id = this.id + "QL";
|
||||
holder.innerHTML = "<li></li>";
|
||||
|
||||
|
||||
var pli = document.createElement('li');//parent li, containter to hold section li and question ul.
|
||||
pli.id = this.id+"div";
|
||||
pli.className = this.getType();
|
||||
sectionUL.appendChild(pli);
|
||||
pli.appendChild(this.dom);
|
||||
pli.appendChild(holder);
|
||||
|
||||
this.ddt = new YAHOO.util.DDTarget(this.id+"QL","questions");
|
||||
|
||||
this.dd = new WebGUI.DDList(this.id+"div","sections");
|
||||
this.dd.isTarget = false;
|
||||
this.dd.addToGroup("trashcan");
|
||||
this.dd.setHandleElId(this.id);
|
||||
|
||||
YAHOO.util.Event.addListener(this.id, "click", WebGUI.SectionHandler.clicked);
|
||||
}
|
||||
this.updateHTML = function(){
|
||||
this.dom.innerHTML="<b>["+this.sId+"]</b>"+ " " + this.text.substr(0,25) + " ...";
|
||||
}
|
||||
this.updateLoc = function(loc){
|
||||
this.sId = "S"+loc;
|
||||
this.updateHTML();
|
||||
}
|
||||
this.removeQuestion = function(id){
|
||||
for(var i = 0; i <= this.questions.length; i++){
|
||||
if(this.questions[i] == id){
|
||||
this.questions.splice(i,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.addThyself();
|
||||
|
||||
this.noDrag = function(){
|
||||
this.dd.lock();
|
||||
},
|
||||
|
||||
this.removeThyself = function(){
|
||||
if(this.dom == undefined){ alert("dom is not defined"); return; }
|
||||
YAHOO.util.Event.removeListener(this.id, "click");
|
||||
this.dd.setHandleElId(undefined);
|
||||
this.dd.unreg();
|
||||
this.dd = undefined;
|
||||
var p = this.dom.parentNode;
|
||||
p.removeChild(this.dom.nextSibling);
|
||||
p.removeChild(this.dom);
|
||||
p.parentNode.removeChild(p);
|
||||
this.dom = undefined;
|
||||
}
|
||||
|
||||
this.showThyself = function(){
|
||||
document.getElementById("sid").innerHTML = this.sId;
|
||||
document.getElementById("sectioninputtext").value = this.text;
|
||||
var menu = WebGUI.Menu.getsMenu();
|
||||
menu.getItem(0).cfg.setProperty("checked",this.randomize);
|
||||
}
|
||||
this.update = function(text,randomize){
|
||||
this.text = text;
|
||||
this.randomize = randomize;
|
||||
this.updateHTML();
|
||||
}
|
||||
this.DESTROY = function(){
|
||||
for(var q in this.questions){
|
||||
objects[this.questions[q]].DESTROY();
|
||||
}
|
||||
this.removeThyself();
|
||||
slength--;
|
||||
objects[this.id] = undefined;
|
||||
WebGUI.Menu.newS();
|
||||
}
|
||||
}
|
||||
//Notes, use previousSibling,nextSibling to get ids of siblings, and insertBefore or appendChild to add elements.
|
||||
WebGUI.SectionHandler = function(){
|
||||
return{
|
||||
clicked: function() {//new section event button, prompts the new section menu
|
||||
WebGUI.DM.showThis(this.id);
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Answer definition
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
Survey.Answer = function(id,qid){
|
||||
//inheritence
|
||||
this.inherit= Survey.listObject;
|
||||
this.inherit("answer");
|
||||
this.avalues = [{'atext':"",'ameta':""}]; //array of associative arrays. Array maps to answer types. associate arrays map to all possible responses
|
||||
this.qId = qid;
|
||||
this.id = id;
|
||||
this.aId = "A"+objects[this.qId].answers.length;
|
||||
var answerUL = document.getElementById("answers");
|
||||
objects[this.qId].answers[objects[this.qId].answers.length] = this.id;
|
||||
this.addThyself = function(){
|
||||
if(this.dom != undefined){alert("dom already defined");return}
|
||||
this.dom = document.createElement('li');
|
||||
this.dom.id=this.id;//use slice to get just the number. Q used to protect namespace from A numbered objects
|
||||
this.dom.className = this.getType();
|
||||
this.updateHTML();
|
||||
answerUL.appendChild(this.dom);
|
||||
this.dd = new WebGUI.DDList(this.id.toString(),"answers");
|
||||
this.dd.addToGroup("trashcan");
|
||||
YAHOO.util.Event.addListener(this.id.toString(), "click", WebGUI.AnswerHandler.clicked);
|
||||
}
|
||||
this.updateHTML = function(){
|
||||
this.dom.innerHTML="<b>["+this.aId+"]</b>";
|
||||
}
|
||||
this.showThyself = function(){
|
||||
document.getElementById('asid').innerHTML = objects[this.sId].sId;
|
||||
document.getElementById('aqid').innerHTML = objects[this.qId].qId;
|
||||
document.getElementById('aid').innerHTML = this.aId;
|
||||
}
|
||||
this.hide = function(){
|
||||
}
|
||||
this.show = function(){
|
||||
}
|
||||
this.DESTROY = function(){
|
||||
if(this.dom == undefined){ alert("dom is not defined"); return; }
|
||||
YAHOO.util.Event.removeListener(this.id, "click");
|
||||
this.dom.parentNode.removeChild(this.dom);
|
||||
this.dom = undefined;
|
||||
this.dd.unreg();
|
||||
objects[this.id] = undefined;
|
||||
}
|
||||
}
|
||||
WebGUI.AnswerHandler = function(){
|
||||
return{
|
||||
clicked: function() {//new section event button, prompts the new section menu
|
||||
alert('click');
|
||||
// WebGUI.DM.showThis(this.id);
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Question definition
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
//function question(qid,type,typeName,text,options,toptions,sid){
|
||||
Survey.Question = function(qid,type,typeName,text,options,toptions,sid){
|
||||
//inheritence
|
||||
this.inherit= Survey.listObject;
|
||||
this.inherit("question");
|
||||
this.type = type; //index to the qMenu YUI menu containing this question type
|
||||
this.typeName = typeName;
|
||||
this.text = text; //Question text
|
||||
this.id = qid;
|
||||
this.sId = sid; //Section parent node id attribute
|
||||
objects[sid].questions[objects[sid].questions.length] = qid;
|
||||
this.qId = "Q"+ objects[this.sId].questions.length //Nodes id attribute
|
||||
this.options = options; //indexes to the oMenu YUI menu
|
||||
this.textOptions = toptions; //strings indexed by the ids of the option input fields
|
||||
this.answers = new Array();
|
||||
this.answersRef = new Array(); //2D array of [qid][aid] which point at this qid. Used for updating answers when this question is reordered/deleted
|
||||
|
||||
var questionUL = document.getElementById(this.sId.toString()+"QL");
|
||||
|
||||
this.loc;
|
||||
|
||||
this.addThyself = function(){
|
||||
this.dom = document.createElement('li'); //reference to this questions dom object
|
||||
this.dom.className = this.getType();
|
||||
this.dom.id = this.id.toString();
|
||||
this.updateHTML();
|
||||
questionUL.appendChild(this.dom);
|
||||
this.dd = new WebGUI.DDList(this.id.toString(),"questions");
|
||||
this.dd.addToGroup("trashcan");
|
||||
YAHOO.util.Event.addListener(this.id.toString(), "click", WebGUI.QuestionHandler.clicked);
|
||||
}
|
||||
this.updateHTML = function(){
|
||||
this.dom.innerHTML="<b>["+this.qId+ " "+ this.typeName+"]</b> " + this.text.substr(0,25) + " ...";
|
||||
}
|
||||
this.addThyself();
|
||||
|
||||
this.index = function(){
|
||||
var t = this.qId.split("-");
|
||||
return (t[1].slice(1)-1);
|
||||
}
|
||||
|
||||
this.removeThyself = function(){
|
||||
if(this.dom == undefined){ alert("dom is not defined"); return; }
|
||||
YAHOO.util.Event.removeListener(this.id.toString(), "click");
|
||||
this.dom.parentNode.removeChild(this.dom);
|
||||
this.dom = undefined;
|
||||
this.dd.unreg();
|
||||
objects[this.sId].removeQuestion(this.id);
|
||||
}
|
||||
this.showThyself = function(){
|
||||
document.getElementById("qid").innerHTML = this.qId;
|
||||
document.getElementById("qsid").innerHTML = objects[this.sId].sId;
|
||||
document.getElementById("questioninputtext").value = this.text;
|
||||
WebGUI.Menu.clearMenus();
|
||||
var menu = WebGUI.Menu.getqMenu();
|
||||
menu.getItem(this.type).cfg.setProperty("checked",true);
|
||||
//WebGUI.Menu.qTypeClick(null,[null,qMenu.getItem(q['type'])],null);
|
||||
WebGUI.Menu.loadOMenu(this.type);
|
||||
var oMenu = WebGUI.Menu.getoMenu();
|
||||
for(var i in this.options){
|
||||
oMenu.getItem(this.options[i]).cfg.setProperty("checked",true);
|
||||
}
|
||||
try{
|
||||
document.getElementById('max').value = q['max'];
|
||||
}catch(e){}
|
||||
try{
|
||||
document.getElementById('min').value = q['min'];
|
||||
}catch(e){}
|
||||
try{
|
||||
document.getElementById('step').value = q['step'];
|
||||
}catch(e){}
|
||||
|
||||
}
|
||||
this.update = function(type, typeName,text,options,toptions){
|
||||
this.type=type;
|
||||
this.typeName = typeName;
|
||||
this.text = text;
|
||||
this.options = options;
|
||||
this.textOptions = toptions;
|
||||
this.updateHTML();
|
||||
}
|
||||
this.updateLoc = function(sid,loc){
|
||||
this.sId = sid;
|
||||
this.qId = "Q"+loc;
|
||||
this.updateHTML();
|
||||
}
|
||||
this.DESTROY = function(){
|
||||
//remove event handler, dom, answerRefs, question, and answers
|
||||
for(var i in this.answers){
|
||||
this.answers[i].DESTROY();
|
||||
}
|
||||
for(var i in this.answersRef){
|
||||
this.answersRef[i].unlink();
|
||||
}
|
||||
this.removeThyself();
|
||||
objects[this.id] = undefined;
|
||||
WebGUI.Menu.newQ();
|
||||
}
|
||||
}
|
||||
WebGUI.QuestionHandler = function(){
|
||||
return{
|
||||
clicked: function() {//new question event button, prompts the new question menu
|
||||
WebGUI.DM.showThis(this.id);
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Display Manager
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
WebGUI.DM = function(){
|
||||
var lastObject;//Current Question
|
||||
return{
|
||||
updateSectionDOMLists: function(){
|
||||
//Loop through sections ul then answer ul and make sure everything is in the right place.
|
||||
var q = document.getElementById('sections');
|
||||
var loc = 1;
|
||||
var tsections = new Array();
|
||||
var start = q.firstChild;//the li which contains the a ul which contains the current section li and
|
||||
while(start){
|
||||
var section = start.firstChild.id;
|
||||
start = start.nextSibling;
|
||||
objects[section].updateLoc(loc++);
|
||||
objects[section].questions = new Array();
|
||||
this.updateQuestionDOMList(section,section+"QL");
|
||||
}
|
||||
|
||||
},
|
||||
updateQuestionDOMList: function(sid, parent){
|
||||
var q = document.getElementById(parent);
|
||||
var start = q.firstChild;
|
||||
var loc = 1;
|
||||
while(start){
|
||||
var section = start.id;
|
||||
if(! start.id){
|
||||
start = start.nextSibling;
|
||||
continue;
|
||||
}
|
||||
start = start.nextSibling;
|
||||
objects[section].updateLoc(sid,loc++);
|
||||
objects[sid].questions[objects[sid].questions.length] = section;
|
||||
}
|
||||
},
|
||||
|
||||
updateAnswerDOMLists: function(){
|
||||
},
|
||||
showThis: function(Id) {
|
||||
this.clearLast();
|
||||
lastObject = Id;
|
||||
try{
|
||||
objects[lastObject].toggleOn();
|
||||
WebGUI.Menu.sselected(lastObject);
|
||||
WebGUI.Menu.showEditSection();
|
||||
}catch(e){}
|
||||
try{
|
||||
objects[objects[lastObject].sId].toggleOn();
|
||||
WebGUI.Menu.sselected(objects[objects[lastObject].sId].id);
|
||||
WebGUI.Menu.qselected(lastObject);
|
||||
WebGUI.Menu.showEditQuestion();
|
||||
}catch(e){}
|
||||
try{
|
||||
objects[objects[objects[lastObject].qId].sId].toggleOn();
|
||||
WebGUI.Menu.sselected(objects[objects[objects[lastObject].qId].sId].id);
|
||||
WebGUI.Menu.qselected(objects[objects[lastObject].qId].id);
|
||||
WebGUI.Menu.aselected(lastObject);
|
||||
WebGUI.Menu.showEditAnswer();
|
||||
}catch(e){}
|
||||
objects[lastObject].showThyself();
|
||||
},
|
||||
clearLast: function(){
|
||||
try{
|
||||
objects[lastObject].toggleOff();
|
||||
}catch(e){}
|
||||
try{
|
||||
objects[objects[lastObject].sId].toggleOff();
|
||||
}catch(e){}
|
||||
try{
|
||||
objects[objects[objects[lastObject].qId].sId].toggleOff();
|
||||
}catch(e){}
|
||||
lastObject = undefined;
|
||||
WebGUI.Menu.sselected(undefined);
|
||||
WebGUI.Menu.qselected(undefined);
|
||||
WebGUI.Menu.aselected(undefined);
|
||||
},
|
||||
getLastSection: function(){
|
||||
var q = document.getElementById('sections');
|
||||
try{
|
||||
return (parseInt(q.lastChild.firstChild.id))//the li which contains the a ul which contains the current section li and
|
||||
}catch(e){}
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Menu definition
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
WebGUI.Menu = function(){
|
||||
var qMenu = new YAHOO.widget.Menu("qmenu",{position: "static", hidedelay: 750, lazyload: true});
|
||||
var oMenu = new YAHOO.widget.Menu("omenu",{position: "static", hidedelay: 750, lazyload: true});
|
||||
var sMenu = new YAHOO.widget.Menu("smenu",{position: "static", hidedelay: 750, lazyload: true});
|
||||
var aMenu = new YAHOO.widget.Menu("amenu",{position: "static", hidedelay: 750, lazyload: true});
|
||||
|
||||
var last = -1;//Last qMenu option selected, keep track so we can unselect on next click
|
||||
var qselected = 0;//Currently selected qMenu item.
|
||||
var sselected = 'S1';
|
||||
|
||||
return{
|
||||
sselected: function(i){ sselected = i; },
|
||||
qselected: function(i){ qselected = i; },
|
||||
aselected: function(i){ aselected = i; },
|
||||
|
||||
init: function() {
|
||||
document.getElementById("questiontext").innerHTML="<textarea id=questioninputtext maxlength=2056 cols=30 rows=5></textarea>";
|
||||
WebGUI.Menu.clearMenus();
|
||||
qMenu.subscribe("click", this.qTypeClick);
|
||||
oMenu.subscribe("click", this.oTypeClick);
|
||||
|
||||
sMenu.addItems([ "Randomly Ordered" ] );
|
||||
sMenu.render("sectionmenu");
|
||||
sMenu.subscribe("click", this.sTypeClick);
|
||||
|
||||
document.getElementById("qsubmitbutton").style.display="none";
|
||||
WebGUI.Menu.showEditSection();
|
||||
new YAHOO.widget.Button({ type: "button", label: "Submit Question", container: "qsubmitbutton",
|
||||
onclick: {fn: WebGUI.Menu.addQ} });
|
||||
new YAHOO.widget.Button({ type: "button", label: "Submit Section", container: "ssubmitbutton",
|
||||
onclick: {fn: WebGUI.Menu.addS} });
|
||||
new YAHOO.widget.Button({ type: "button", label: "Submit Answer", container: "asubmitbutton",
|
||||
onclick: {fn: WebGUI.Menu.addA} });
|
||||
|
||||
},
|
||||
|
||||
getsMenu: function(){ return sMenu; },
|
||||
getqMenu: function(){ return qMenu; },
|
||||
getoMenu: function(){ return oMenu; },
|
||||
getaMenu: function(){ return aMenu; },
|
||||
|
||||
addQ: function() {
|
||||
// var id = document.getElementById("qid").innerHTML;
|
||||
var text = document.getElementById('questioninputtext').value;
|
||||
var options = new Array();
|
||||
|
||||
var qindex;
|
||||
var qtype;
|
||||
var temp = qMenu.getItems();
|
||||
for(var i in temp){
|
||||
if(temp[i].cfg.getProperty("checked")){
|
||||
qtype = temp[i].value;
|
||||
qindex = temp[i].index;
|
||||
}
|
||||
}
|
||||
temp = oMenu.getItems();
|
||||
for(var i in temp){
|
||||
if(temp[i].cfg.getProperty("checked")){
|
||||
options[options.length] = temp[i].index;
|
||||
}
|
||||
}
|
||||
var toptions = new Array();
|
||||
var sid = sselected;
|
||||
|
||||
try{toptions['max'] = document.getElementById('max').value;}catch(err){}
|
||||
try{toptions['min'] = document.getElementById('min').value;}catch(err){}
|
||||
try{toptions['step'] = document.getElementById('step').value;}catch(err){}
|
||||
|
||||
if(qselected != undefined){
|
||||
objects[qselected].update(qindex,qtype,text,options,toptions);
|
||||
}else{
|
||||
objects[objects.length] = new Survey.Question(objects.length,qindex,qtype,text,options,toptions,sselected);
|
||||
}
|
||||
WebGUI.Menu.newQ();
|
||||
},
|
||||
addS: function(){
|
||||
var id;
|
||||
if(sselected){
|
||||
id = sselected;
|
||||
}else{
|
||||
id = objects.length;
|
||||
}
|
||||
var text = document.getElementById('sectioninputtext').value;
|
||||
var checked = sMenu.getItem(0).cfg.getProperty("checked");
|
||||
if(objects[id] != undefined){//editing an existing section which knows how to update itself
|
||||
objects[id].update(text,checked);
|
||||
}else{
|
||||
objects[id] = new Survey.Section(text,id,checked);
|
||||
}
|
||||
WebGUI.Menu.newS();
|
||||
},
|
||||
addA: function(){
|
||||
var qtype = objects[qselected].type;
|
||||
var id;
|
||||
if(aselected){
|
||||
id = sselected;
|
||||
}else{
|
||||
id = objects.length;
|
||||
}
|
||||
if(objects[id] == undefined){//editing an existing answer which knows how to update itself
|
||||
objects[id] = new Survey.Answer(id,qselected)
|
||||
}
|
||||
for(var q in objects[id].avalues[qtype]){
|
||||
objects[id].avalues[qtype][q] = document.getElementById(q).value;
|
||||
}
|
||||
objects[id].addThyself();
|
||||
WebGUI.Menu.newA();
|
||||
},
|
||||
|
||||
newS: function() {//new section event button, prompts the new section menu
|
||||
sselected = undefined;
|
||||
qselected = undefined;
|
||||
aselected = undefined;
|
||||
WebGUI.DM.clearLast();
|
||||
WebGUI.Menu.showEditSection();
|
||||
document.getElementById('sectioninputtext').value = '';
|
||||
document.getElementById('sid').innerHTML = "S"+(slength);
|
||||
sMenu.getItem(0).cfg.setProperty("checked",false);
|
||||
},
|
||||
|
||||
newA: function() {
|
||||
aselected = undefined;
|
||||
if(!sselected){
|
||||
sselected = WebGUI.DM.getLastSection();
|
||||
}
|
||||
if(!qselected){
|
||||
qselected = objects[sselected].questions[objects[sselected].questions.length-1];
|
||||
}
|
||||
if(!qselected){
|
||||
alert("At least one question must be selected to add an answer.");
|
||||
return;
|
||||
}
|
||||
document.getElementById('asid').innerHTML = objects[sselected].sId;
|
||||
document.getElementById('aqid').innerHTML = objects[qselected].qId;
|
||||
document.getElementById('aid').innerHTML = "A"+(objects[qselected].answers.length + 1);
|
||||
WebGUI.DM.showThis(qselected);
|
||||
WebGUI.Menu.showEditAnswer();
|
||||
WebGUI.Menu.clearOMenus();
|
||||
var input = document.getElementById("answerinput");
|
||||
input.innerHTML="";
|
||||
var qtype = objects[qselected].type;
|
||||
if(qtype == 0){//multiple choice
|
||||
input.innerHTML = "Please enter the text: <input type='text' id='atext'><br>"+
|
||||
"Please enter the meta tag: <input type='text' id='ameta'>";
|
||||
}else if(qtype == 1){//Text
|
||||
alert("Answers can not be added to a text type");
|
||||
WebGUI.Menu.newQ();
|
||||
}else if(qtype == 2){//Slider
|
||||
}else if(qtype == 3){//Date
|
||||
}else if(qtype == 4){//True/False
|
||||
}
|
||||
},
|
||||
newQ: function() {
|
||||
qselected = undefined;
|
||||
aselected = undefined;
|
||||
if(!sselected){
|
||||
sselected = WebGUI.DM.getLastSection();
|
||||
}
|
||||
if(!sselected){
|
||||
alert("At least one section must be selected to add an answer.");
|
||||
return;
|
||||
}
|
||||
WebGUI.DM.showThis(sselected);
|
||||
WebGUI.Menu.showEditQuestion();
|
||||
WebGUI.Menu.clearMenus();
|
||||
document.getElementById('qsid').innerHTML = objects[sselected].sId;
|
||||
var nextQ = objects[sselected].questions.length;
|
||||
document.getElementById('qid').innerHTML = "Q"+ (nextQ + 1);
|
||||
document.getElementById("questioninputtext").value = "";
|
||||
WebGUI.Menu.loadOMenu(0);
|
||||
},
|
||||
clearOMenus: function(){
|
||||
aMenu.clearContent();
|
||||
},
|
||||
|
||||
clearMenus: function() {
|
||||
qMenu.clearContent();
|
||||
qMenu.addItems([
|
||||
{text: "Multiple Choice",value: "Multiple Choice"},
|
||||
{text: "Text",value: "Text"},
|
||||
{text: "Slider",value: "Slider"},
|
||||
{text: "Date",value: "Date"},
|
||||
{text: "True/False",value: "True/False"},
|
||||
] );
|
||||
qMenu.render("questionmenu");
|
||||
oMenu.clearContent();
|
||||
document.getElementById("qsubmitbutton").style.display="none";
|
||||
document.getElementById("qoptionmenu").style.display="none";
|
||||
},
|
||||
|
||||
|
||||
loadQ: function(e) {
|
||||
WebGUI.Menu.clearMenus();
|
||||
var q = questions[ this.id.slice(1) - 1 ];
|
||||
document.getElementById('qid').innerHTML = "Q"+q['id']+":";
|
||||
document.getElementById('questioninputtext').value = q['text'];
|
||||
qMenu.getItem(q['type']).cfg.setProperty("checked");
|
||||
//WebGUI.Menu.qTypeClick(null,[null,qMenu.getItem(q['type'])],null);
|
||||
WebGUI.Menu.loadOMenu(qMenu.getItem(q['type']).index);
|
||||
for(var i in q['moptions']){
|
||||
oMenu.getItem(q['moptions'][i]).cfg.setProperty("checked",true);
|
||||
}
|
||||
try{
|
||||
document.getElementById('max').value = q['max'];
|
||||
}catch(e){}
|
||||
try{
|
||||
document.getElementById('min').value = q['min'];
|
||||
}catch(e){}
|
||||
try{
|
||||
document.getElementById('step').value = q['step'];
|
||||
}catch(e){}
|
||||
},
|
||||
|
||||
showEditQuestion: function() {
|
||||
document.getElementById("editquestion").style.display="inline";
|
||||
document.getElementById("editanswer").style.display="none";
|
||||
document.getElementById("editsection").style.display="none";
|
||||
},
|
||||
showEditAnswer: function() {
|
||||
document.getElementById("editquestion").style.display="none";
|
||||
document.getElementById("editanswer").style.display="inline";
|
||||
document.getElementById("editsection").style.display="none";
|
||||
},
|
||||
showEditSection: function() {
|
||||
document.getElementById("editquestion").style.display="none";
|
||||
document.getElementById("editanswer").style.display="none";
|
||||
document.getElementById("editsection").style.display="inline";
|
||||
},
|
||||
|
||||
sTypeClick: function(p_sType, p_aArgs, p_oValue) {
|
||||
if(p_aArgs[1].cfg.getProperty("checked")){
|
||||
p_aArgs[1].cfg.setProperty("checked", false);
|
||||
}else{
|
||||
p_aArgs[1].cfg.setProperty("checked", true);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
oTypeClick: function(p_sType, p_aArgs, p_oValue) {
|
||||
var checked = p_aArgs[1].cfg.getProperty("checked");
|
||||
var index = p_aArgs[1].index;
|
||||
if(qselected == 1 && index >= 0 && index < 4){
|
||||
for(var i=0; i<=3; i++){
|
||||
oMenu.getItem(i).cfg.setProperty("checked",false);
|
||||
}
|
||||
p_aArgs[1].cfg.setProperty("checked",checked);
|
||||
}
|
||||
else if(qselected == 4 && index >= 0 && index <= 1){
|
||||
for(var i=0; i<=1; i++){
|
||||
oMenu.getItem(i).cfg.setProperty("checked",false);
|
||||
}
|
||||
p_aArgs[1].cfg.setProperty("checked",checked);
|
||||
}
|
||||
|
||||
if(p_aArgs[1].cfg.getProperty("checked")){
|
||||
p_aArgs[1].cfg.setProperty("checked", false);
|
||||
}else{
|
||||
p_aArgs[1].cfg.setProperty("checked", true);
|
||||
}
|
||||
if(qselected == 0 && index == 1 && p_aArgs[1].cfg.getProperty("checked") == false){
|
||||
document.getElementById('max').value = 1;
|
||||
}
|
||||
},
|
||||
|
||||
validateMultipleMax: function(){
|
||||
var v = this.value;
|
||||
if (v != parseInt(v) || v < 1){
|
||||
this.value = 1;
|
||||
}
|
||||
},
|
||||
|
||||
qTypeClick: function(p_sType, p_aArgs, p_oValue) {
|
||||
var index = p_aArgs[1].index;
|
||||
|
||||
WebGUI.Menu.showEditQuestion();
|
||||
|
||||
WebGUI.Menu.loadOMenu(index);
|
||||
},
|
||||
|
||||
loadOMenu: function(index) {
|
||||
|
||||
if(last > -1){
|
||||
qMenu.getItem(last).cfg.setProperty("checked",false);
|
||||
}
|
||||
qMenu.getItem(index).cfg.setProperty("checked",true);
|
||||
last = index;
|
||||
|
||||
oMenu.clearContent();
|
||||
|
||||
document.getElementById("qsubmitbutton").style.display="inline";
|
||||
document.getElementById("qoptionmenu").style.display="inline";
|
||||
document.getElementById("textoptions").innerHTML="";
|
||||
|
||||
var temp = document.createElement("div");
|
||||
|
||||
if(index == 0){//Multipe choice options
|
||||
try{
|
||||
YAHOO.util.Event.removeListener("max", "click");
|
||||
}catch(e){}
|
||||
YAHOO.util.Event.addListener("max", "blur", WebGUI.Menu.validateMultipleMax);
|
||||
temp.innerHTML = "Max Answers: <input id=max type=text value=1 size=2><br/>";
|
||||
oMenu.addItems([
|
||||
"Randomize",
|
||||
"Horizontal display",
|
||||
"Multiple Answers",
|
||||
"Comment Box",
|
||||
] );
|
||||
}
|
||||
else if(index == 1){//Text options
|
||||
temp.innerHTML = "Max length <input type=text value=50 size=4 id=max><br/>";
|
||||
oMenu.addItems([
|
||||
"Multi-Line",
|
||||
"Numerical",
|
||||
"Phone Number",
|
||||
"Currency Amount",
|
||||
] );
|
||||
}
|
||||
else if(index == 2){//Slider options
|
||||
temp.innerHTML = "Start Value: <input type=text value=0 size=2 id=min><br/> End Value: <input id=max type=text value=10 size=2><br/> Step Value: <input id=step type=text value=2 size=2><br/>";
|
||||
}
|
||||
else if(index == 3){//Date options
|
||||
oMenu.addItems([
|
||||
"Range",
|
||||
] );
|
||||
}
|
||||
else if(index == 4){//True/False options
|
||||
oMenu.addItems([
|
||||
"Yes/No",
|
||||
"Male/Female",
|
||||
] );
|
||||
}
|
||||
document.getElementById("textoptions").appendChild(temp);
|
||||
oMenu.addItems(["Optional"]);
|
||||
oMenu.render("qoptionmenu");
|
||||
},
|
||||
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize survey
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
WebGUI.OnLoad = function() {
|
||||
var e = YAHOO.util.Event;
|
||||
return {
|
||||
init: function() {
|
||||
//e.onDOMReady(this.initHandler, "The onDOMReady event fired. The DOM is now safe to modify via script.");
|
||||
e.onDOMReady(this.initHandler);
|
||||
},
|
||||
initHandler: function(){
|
||||
new YAHOO.widget.Button({ type: "button", label: "New Question", container: "addqbutton",
|
||||
onclick: {fn: WebGUI.Menu.newQ} });
|
||||
new YAHOO.widget.Button({ type: "button", label: "New Answer", container: "addabutton",
|
||||
onclick: {fn: WebGUI.Menu.newA} });
|
||||
new YAHOO.widget.Button({ type: "button", label: "New Section", container: "addsbutton",
|
||||
onclick: {fn: WebGUI.Menu.newS} });
|
||||
|
||||
WebGUI.Menu.init();
|
||||
|
||||
document.getElementById("editanswer").style.display="none";
|
||||
objects[objects.length] = new Survey.Section("First Section",objects.length,false);
|
||||
WebGUI.DM.showThis(objects.length-1);
|
||||
WebGUI.Menu.newQ();
|
||||
},
|
||||
}
|
||||
}();
|
||||
|
||||
WebGUI.OnLoad.init();
|
||||
|
||||
|
||||
|
||||
var Dom = YAHOO.util.Dom;
|
||||
var Event = YAHOO.util.Event;
|
||||
var DDM = YAHOO.util.DragDropMgr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// example app
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//YAHOO.example.DDApp = {
|
||||
WebGUI.DD = {
|
||||
init: function() {
|
||||
|
||||
new YAHOO.util.DDTarget("sections","sections");
|
||||
new YAHOO.util.DDTarget("answers","answers");
|
||||
new YAHOO.util.DDTarget("trashcan","trashcan");
|
||||
|
||||
Event.on("showButton", "click", this.showOrder);
|
||||
Event.on("switchButton", "click", this.switchStyles);
|
||||
},
|
||||
|
||||
showOrder: function() {
|
||||
var parseList = function(ul, title) {
|
||||
var items = ul.getElementsByTagName("li");
|
||||
var out = title + ": ";
|
||||
for (i=0;i<items.length;i=i+1) {
|
||||
out += items[i].id + " ";
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
var ul1=Dom.get("ul1"), ul2=Dom.get("ul2");
|
||||
alert(parseList(ul1, "List 1") + "\n" + parseList(ul2, "List 2"));
|
||||
|
||||
},
|
||||
|
||||
switchStyles: function() {
|
||||
Dom.get("ul1").className = "draglist_alt";
|
||||
Dom.get("ul2").className = "draglist_alt";
|
||||
}
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// custom drag and drop implementation
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
WebGUI.DDList = function(id, sGroup, config) {
|
||||
WebGUI.DDList.superclass.constructor.call(this, id, sGroup, config);
|
||||
|
||||
this.logger = this.logger || YAHOO;
|
||||
var el = this.getDragEl();
|
||||
Dom.setStyle(el, "opacity", 0.3); // The proxy is slightly transparent
|
||||
|
||||
this.goingUp = false;
|
||||
this.lastY = 0;
|
||||
};
|
||||
|
||||
YAHOO.extend(WebGUI.DDList, YAHOO.util.DDProxy, {
|
||||
|
||||
startDrag: function(x, y) {
|
||||
this.logger.log(this.id + " startDrag");
|
||||
|
||||
// make the proxy look like the source element
|
||||
var dragEl = this.getDragEl();
|
||||
var clickEl = this.getEl();
|
||||
Dom.setStyle(clickEl, "visibility", "hidden");
|
||||
|
||||
dragEl.innerHTML = clickEl.innerHTML;
|
||||
|
||||
Dom.setStyle(dragEl, "color", Dom.getStyle(clickEl, "color"));
|
||||
Dom.setStyle(dragEl, "backgroundColor", Dom.getStyle(clickEl, "backgroundColor"));
|
||||
Dom.setStyle(dragEl, "border", "2px solid gray");
|
||||
},
|
||||
|
||||
endDrag: function(e) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var proxy = this.getDragEl();
|
||||
|
||||
// Show the proxy element and animate it to the src element's location
|
||||
Dom.setStyle(proxy, "visibility", "");
|
||||
var a = new YAHOO.util.Motion(
|
||||
proxy, {
|
||||
points: {
|
||||
to: Dom.getXY(srcEl)
|
||||
}
|
||||
},
|
||||
0.2,
|
||||
YAHOO.util.Easing.easeOut
|
||||
)
|
||||
var proxyid = proxy.id;
|
||||
var thisid = this.id;
|
||||
|
||||
// Hide the proxy and show the source element when finished with the animation
|
||||
a.onComplete.subscribe(function() {
|
||||
Dom.setStyle(proxyid, "visibility", "hidden");
|
||||
Dom.setStyle(thisid, "visibility", "");
|
||||
});
|
||||
a.animate();
|
||||
|
||||
//call appropriate update function depending on the element type moved.
|
||||
var t = this.getEl().id;
|
||||
t = t.replace(/[a-zA-Z]/g,"");
|
||||
if(document.getElementById(this.id).parentNode.id == 'trashcan' || document.getElementById(this.id).parentNode.parentNode.id == 'trashcan'){
|
||||
WebGUI.DM.updateAnswerDOMLists();
|
||||
WebGUI.DM.updateSectionDOMLists();
|
||||
objects[t].DESTROY();
|
||||
return;
|
||||
}
|
||||
if(objects[t].constructor == Survey.Answer){
|
||||
WebGUI.DM.updateAnswerDOMLists();
|
||||
}else{
|
||||
WebGUI.DM.updateSectionDOMLists();
|
||||
}
|
||||
},
|
||||
|
||||
onDragDrop: function(e, id) {
|
||||
|
||||
// If there is one drop interaction, the li was dropped either on the list,
|
||||
// or it was dropped on the current location of the source element.
|
||||
if (DDM.interactionInfo.drop.length === 1) {
|
||||
|
||||
// The position of the cursor at the time of the drop (YAHOO.util.Point)
|
||||
var pt = DDM.interactionInfo.point;
|
||||
|
||||
// The region occupied by the source element at the time of the drop
|
||||
var region = DDM.interactionInfo.sourceRegion;
|
||||
|
||||
// Check to see if we are over the source element's location. We will
|
||||
// append to the bottom of the list once we are sure it was a drop in
|
||||
// the negative space (the area of the list without any list items)
|
||||
if (!region.intersect(pt)) {
|
||||
var destEl = Dom.get(id);
|
||||
var destDD = DDM.getDDById(id);
|
||||
destEl.appendChild(this.getEl());
|
||||
destDD.isEmpty = false;
|
||||
DDM.refreshCache();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onDrag: function(e) {
|
||||
|
||||
// Keep track of the direction of the drag for use during onDragOver
|
||||
var y = Event.getPageY(e);
|
||||
|
||||
if (y < this.lastY) {
|
||||
this.goingUp = true;
|
||||
} else if (y > this.lastY) {
|
||||
this.goingUp = false;
|
||||
}
|
||||
|
||||
this.lastY = y;
|
||||
},
|
||||
|
||||
onDragOver: function(e, id) {
|
||||
|
||||
var srcEl = this.getEl();
|
||||
var destEl = Dom.get(id);
|
||||
|
||||
// We are only concerned with list items, we ignore the dragover
|
||||
// notifications for the list.
|
||||
document.getElementById('log1').innerHTML = srcEl.className;
|
||||
document.getElementById('log2').innerHTML = destEl.className;
|
||||
document.getElementById('log').innerHTML = destEl.nodeName;
|
||||
|
||||
if ( destEl.nodeName.toLowerCase() == "li" )
|
||||
{
|
||||
//destEl.className == "questionList" || destEl.className == "question" || destEl.className == "qselected")
|
||||
var orig_p = srcEl.parentNode;
|
||||
var p = destEl.parentNode;
|
||||
|
||||
if (this.goingUp) {
|
||||
p.insertBefore(srcEl, destEl); // insert above
|
||||
} else {
|
||||
p.insertBefore(srcEl, destEl.nextSibling); // insert below
|
||||
}
|
||||
|
||||
DDM.refreshCache();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Event.onDOMReady(YAHOO.example.DDApp.init, YAHOO.example.DDApp, true);
|
||||
Event.onDOMReady(WebGUI.DD.init, WebGUI.DD, true);
|
||||
|
||||
})();
|
||||
|
||||
|
|
@ -1,337 +0,0 @@
|
|||
if (typeof Survey == "undefined") {
|
||||
var Survey = {};
|
||||
}
|
||||
|
||||
Survey.Data = new function(){
|
||||
var lastDataSet = {};
|
||||
var focus;
|
||||
|
||||
this.dragDrop = function(did){
|
||||
var type;
|
||||
|
||||
if(did.className.match("section")){type = 'section';}
|
||||
else if(did.className.match("question")){type = 'question';}
|
||||
else{ type = 'answer';}
|
||||
|
||||
var first = {id:did.id,type:type};
|
||||
var before = document.getElementById(did.id).previousSibling;
|
||||
|
||||
while(1){
|
||||
if( before == undefined || (before.id != undefined && before.id != '') ){
|
||||
break;
|
||||
}
|
||||
var before = before.previousSibling;
|
||||
}
|
||||
|
||||
var data = {id:'',type:''};
|
||||
|
||||
if(before != undefined && before.id != undefined && before.id != ''){
|
||||
if(before.className.match("section")){type = 'section';}
|
||||
else if(before.className.match("question")){type = 'question';}
|
||||
else{ type = 'answer';}
|
||||
data = {id:before.id,type:type};
|
||||
}
|
||||
|
||||
Survey.Comm.dragDrop(first,data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.clicked = function(){
|
||||
Survey.Comm.loadSurvey(this.id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.loadData = function(d){
|
||||
focus = d.focus;//What is the current highlighted item.
|
||||
var lastType = '';//What was the last type created.
|
||||
var lastId = {'section': '', 'question': '', 'answer': ''};//what is the last id of each type placed, so we know a child's parent.
|
||||
var buttons = {'question':0,'answer':0,'section':0}; //array of bools on if buttons put down
|
||||
document.getElementById('sections').innerHTML='';
|
||||
|
||||
for(var x in d.data){
|
||||
//Now check to see if this is where an add button goes.
|
||||
//Add addAnswer when we go from answer to question or section or end
|
||||
//Add addQuestion when we go from question to section or end
|
||||
|
||||
if(lastType == 'answer' && (d.data[x].type == 'question' || d.data[x].type == 'section')){
|
||||
this.addAnswerButton(lastId['question']);
|
||||
buttons['answer'] = 1;
|
||||
}
|
||||
else if(lastType == 'question' && d.data[x].type == 'section'){
|
||||
this.addQuestionButton(lastId['section']);
|
||||
buttons['question'] = 1;
|
||||
}
|
||||
else if(d.data[x].type == 'section' && lastType == 'section' && lastId['section'] == focus){
|
||||
this.addQuestionButton(lastId['section']);
|
||||
buttons['question'] = 1;
|
||||
}
|
||||
|
||||
var node = document.createElement('li');
|
||||
|
||||
if(d.data[x].id == focus){
|
||||
node.className = "s"+d.data[x].type;
|
||||
}else{
|
||||
node.className = d.data[x].type;
|
||||
}
|
||||
|
||||
node.innerHTML = d.data[x].text;
|
||||
node.id = d.data[x].id;
|
||||
new Survey.DDList(node.id,"sections");
|
||||
document.getElementById('sections').appendChild(node);
|
||||
YAHOO.util.Event.addListener(d.data[x].id, "click", this.clicked);
|
||||
|
||||
lastType = d.data[x].type;
|
||||
lastId[d.data[x].type] = d.data[x].id;
|
||||
}
|
||||
if(lastType == 'answer' && ! buttons['answer']){
|
||||
this.addAnswerButton(lastId['question']);
|
||||
this.addQuestionButton(lastId['section']);
|
||||
}else if(lastType == 'question' || lastType == 'section' && ! buttons['question']){
|
||||
this.addQuestionButton(lastId['section']);
|
||||
}
|
||||
|
||||
this.addSectionButton();
|
||||
|
||||
this.loadObjectEdit(d.edit);
|
||||
lastDataSet = d;
|
||||
}
|
||||
|
||||
|
||||
this.addSection = function(){
|
||||
Survey.Comm.newSection();
|
||||
}
|
||||
|
||||
|
||||
this.addQuestion = function(e,sid){
|
||||
Survey.Comm.newQuestion(sid);
|
||||
}
|
||||
|
||||
|
||||
this.addSectionButton = function(){
|
||||
var node = document.createElement('li');
|
||||
node.innerHTML = "<span id='newSection'></span>";
|
||||
document.getElementById('sections').appendChild(node);
|
||||
var button = new YAHOO.widget.Button({ label:"Add Section", id:"addsection", container:"newSection" });
|
||||
button.on("click", this.addSection);
|
||||
}
|
||||
|
||||
|
||||
this.addQuestionButton = function(qid){
|
||||
var node = document.createElement('li');
|
||||
node.className = 'newQuestion';
|
||||
node.innerHTML = "<span id='newQuestion'></span>";
|
||||
document.getElementById('sections').appendChild(node);
|
||||
var button = new YAHOO.widget.Button({ label:"Add Question", id:'addquestion', container:"newQuestion"});//, onclick:{fn:this.addQuestion} });
|
||||
button.on("click", this.addQuestion,qid);
|
||||
}
|
||||
|
||||
|
||||
this.addAnswerButton = function(aid){
|
||||
var node = document.createElement('li');
|
||||
node.id = 'newAnswer';
|
||||
node.className = 'newAnswer';
|
||||
document.getElementById('sections').appendChild(node);
|
||||
var button = new YAHOO.widget.Button({ label:"Add Answer", id:aid, container:"newAnswer" });
|
||||
button.on("click", this.addAnswer);
|
||||
}
|
||||
|
||||
|
||||
this.loadObjectEdit = function(edit){
|
||||
if(edit){
|
||||
console.log('was an edit'+edit.type);
|
||||
if(edit.type == "loadSection"){
|
||||
console.log('loadsection');
|
||||
Survey.SectionTemplate.loadSection(edit.params);
|
||||
}
|
||||
else if(edit.type == "loadQuestion"){
|
||||
console.log('loadquestion');
|
||||
Survey.QuestionTemplate.loadQuestion(edit.params);
|
||||
}
|
||||
else if(edit.type == "loadAnswer"){
|
||||
Survey.AnswerTemplate.loadAnswer(edit.params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.loadLast = function(){
|
||||
this.loadData(lastDataSet);
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
|
||||
|
||||
/*Survey.SectionTemplate = new function(){
|
||||
this.qpp;
|
||||
this.randomizeQuestions;
|
||||
this.questionsOnSectionPage;
|
||||
|
||||
this.returnData = function(){
|
||||
var data = {};
|
||||
data['type'] = "section";
|
||||
data["sectionText"] = document.getElementById('text').value;
|
||||
data['sectionName'] = document.getElementById('sectionName').value;
|
||||
data['questionsPerPage'] = this.qpp.get('label');
|
||||
data['randomizeQuestions'] = this.randomizeQuestions.get('checkedButton').get('value');
|
||||
data['questionsOnSectionPage'] = this.questionsOnSectionPage.get('checkedButton').get('value');
|
||||
data['Survey_sectionId'] = document.getElementById('Survey_sectionId').value;
|
||||
Survey.Comm.submitEdit(data);
|
||||
return data;
|
||||
}
|
||||
this.qppClick = function(p_sType, p_aArgs, p_oItem) {
|
||||
Survey.SectionTemplate.qpp.set("label", p_oItem.cfg.getProperty("text"));
|
||||
}
|
||||
this.loadSection = function(params){
|
||||
document.getElementById('edit').innerHTML = "\
|
||||
<p>Section Number: "+params.sequenceNumber + "\
|
||||
<input type='hidden' id='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
|
||||
<p>Section Name: <input id='sectionName' value='"+params.sectionName + "' type=text>\
|
||||
<hr>\
|
||||
<p>Randomize Questions: <span id='randomQuestions'></span>\
|
||||
<p>Question per Page: <span id='questionsPerPage'></span>\
|
||||
<p>Questions on Section Page: <span id='questionsOnSectionPage'></span>\
|
||||
<hr>\
|
||||
<p>Section Text:</p> <textarea id=text maxlength=2056 cols=30 rows=5>"+ params.sectionText +"</textarea>\
|
||||
<p><input type='button' onclick='Survey.SectionTemplate.returnData()' value='Save Section'>\
|
||||
";
|
||||
|
||||
this.randomizeQuestions = new YAHOO.widget.ButtonGroup({
|
||||
id: "randomizeQuestions",
|
||||
name: "randomizeQuestions",
|
||||
container: "randomQuestions" });
|
||||
|
||||
this.randomizeQuestions.addButtons([
|
||||
{ label: "Yes", value: "1" },
|
||||
{ label: "No", value: "0" }
|
||||
]);
|
||||
|
||||
if(params['randomizeQuestions'] == 1){this.randomizeQuestions.check(0);}
|
||||
else{this.randomizeQuestions.check(1);}
|
||||
|
||||
var qppList = [];
|
||||
|
||||
for(var i = 1; i <= 10; i++){
|
||||
qppList.push({ text: i.toString(), onclick: { fn: Survey.SectionTemplate.qppClick } });
|
||||
}
|
||||
|
||||
this.qpp = new YAHOO.widget.Button({
|
||||
type: "menu",
|
||||
label: "1",
|
||||
name: "mymenubutton",
|
||||
menu: qppList,
|
||||
container: "questionsPerPage" });
|
||||
this.qpp.set("label", params['questionsPerPage']);
|
||||
|
||||
|
||||
this.questionsOnSectionPage = new YAHOO.widget.ButtonGroup({
|
||||
id: "questionsOnSectionPage",
|
||||
name: "questionsOnSectionpage",
|
||||
container: "questionsOnSectionPage" });
|
||||
this.questionsOnSectionPage.addButtons([
|
||||
{ label: "Yes", value: "1" },
|
||||
{ label: "No", value: "0" }
|
||||
]);
|
||||
if(params['questionsOnSectionPage'] == 1){this.questionsOnSectionPage.check(0);}
|
||||
else{this.questionsOnSectionPage.check(1);}
|
||||
}
|
||||
}();
|
||||
*/
|
||||
/*Survey.QuestionTemplate = new function(){
|
||||
this.loadQuestion = function(params){
|
||||
for(var i in params){
|
||||
console.log(i+' '+params[i]);
|
||||
}
|
||||
document.getElementById('edit').innerHTML = "\
|
||||
<p>Question Number: "+params.sequenceNumber + "\
|
||||
<input type='hidden' id='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
|
||||
<input type='hidden' id='Survey_questionId' value='"+params.Survey_questionId+"'>\
|
||||
|
||||
<p>Randomize Questions: <span id='randomAnswers'></span>\
|
||||
<p>Question per Page: <span id='questionsPerPage'></span>\
|
||||
<p>Questions on Section Page: <span id='questionsOnSectionPage'></span>\
|
||||
<hr>\
|
||||
<p>Section Text:</p> <textarea id=text maxlength=2056 cols=30 rows=5>"+ params.sectionText +"</textarea>\
|
||||
<p><input type='button' onclick='Survey.SectionTemplate.returnData()' value='Save Section'>\
|
||||
";
|
||||
}
|
||||
}();
|
||||
*/
|
||||
Survey.AnswerTemplate = new function(){
|
||||
this.loadAnswer = function(){
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
|
||||
Survey.Comm = new function(){
|
||||
|
||||
//p is a string that contains the id of the Survey that is of interest. To get Section 2 Question 3 Answer 4 pass '2-3-4'.
|
||||
var request = function(sUrl,callback,postData){
|
||||
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
|
||||
}
|
||||
var callback = {
|
||||
success:function(o){
|
||||
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
|
||||
},
|
||||
failure: function(o){
|
||||
alert("Last request failed");
|
||||
Survey.Data.loadLast();
|
||||
},
|
||||
argument:["what","is","this","for"],
|
||||
timeout: 1000
|
||||
};
|
||||
this.loadSurvey = function(p){
|
||||
var postData = "data="+p;
|
||||
var sUrl = "?func=loadSurvey";
|
||||
request(sUrl,callback,postData);
|
||||
}
|
||||
this.dragDrop = function(target,before){
|
||||
var p = {};
|
||||
p['target'] = target;
|
||||
p['before'] = before;
|
||||
var postData = "data="+YAHOO.lang.JSON.stringify(p);
|
||||
var sUrl = "?func=dragDrop";
|
||||
request(sUrl,callback,postData);
|
||||
}
|
||||
this.submitEdit = function(p){
|
||||
var postData = "data="+YAHOO.lang.JSON.stringify(p);
|
||||
var sUrl = "?func=submitEdit";
|
||||
request(sUrl,callback,postData);
|
||||
}
|
||||
this.newSection = function(){
|
||||
var sUrl = "?func=newSection";
|
||||
request(sUrl,callback);
|
||||
}
|
||||
this.newQuestion = function(sid){
|
||||
var postData = "data="+sid;
|
||||
var sUrl = "?func=newQuestion";
|
||||
request(sUrl,callback,postData);
|
||||
}
|
||||
}();
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//
|
||||
// Initialize survey
|
||||
//
|
||||
//----------------------------------------------------------------
|
||||
Survey.OnLoad = function() {
|
||||
var e = YAHOO.util.Event;
|
||||
return {
|
||||
init: function() {
|
||||
//e.onDOMReady(this.initHandler, "The onDOMReady event fired. The DOM is now safe to modify via script.");
|
||||
e.onDOMReady(this.initHandler);
|
||||
},
|
||||
initHandler: function(){
|
||||
new YAHOO.util.DDTarget("sections","sections");
|
||||
Survey.Comm.loadSurvey();
|
||||
},
|
||||
}
|
||||
}();
|
||||
|
||||
Survey.OnLoad.init();
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
<title>WebGUI Survey Alpha I ROCK A LOT!!!</title>
|
||||
|
||||
|
||||
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body { margin:0; padding:0; }
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="extras/yui/build/menu/assets/skins/sam/menu.css" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="extras/yui/build/fonts/fonts-min.css" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="extras/yui/build/button/assets/skins/sam/button.css" />
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="extras/yui/build/utilities/utilities.js"></script>
|
||||
|
||||
<script type="text/javascript" src="extras/yui/build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
|
||||
<script type="text/javascript" src="extras/yui/build/container/container_core.js"></script>
|
||||
|
||||
<script type="text/javascript" src="extras/yui/build/button/button.js"></script>
|
||||
|
||||
<script type="text/javascript" src="extras/yui/build/menu/menu.js"></script>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript" src="extras/wobject/Survey/editsurvey.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="extras/wobject/Survey/survey.css" />
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<div class="workarea">
|
||||
|
||||
<h3>Questions</h3>
|
||||
|
||||
<div id=addqbutton></div>
|
||||
|
||||
<div id = "addsbutton"></div>
|
||||
|
||||
<br/>
|
||||
|
||||
<ul id="sections" class="draglist"></ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="workarea">
|
||||
|
||||
<h3>Answers</h3>
|
||||
|
||||
<div id=addabutton></div>
|
||||
|
||||
<br/>
|
||||
|
||||
<ul id="answers" class="draglist">
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="editarea">
|
||||
|
||||
<div class="trashcan" id="trashcan">TrashCan.img</div>
|
||||
|
||||
<div id="editsection">
|
||||
|
||||
<h2>Edit Section</h3>
|
||||
|
||||
<h3 id=sid></h3>
|
||||
|
||||
<h4>Displayed Text:</h4>
|
||||
|
||||
<textarea id=sectioninputtext maxlength=2056 cols=30 rows=5></textarea>
|
||||
|
||||
<div id="sectionmenu"></div>
|
||||
|
||||
<div id="soptionmenu"></div>
|
||||
|
||||
<div id="ssubmitbutton"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="editquestion">
|
||||
|
||||
<h2>Edit Question</h3>
|
||||
|
||||
<h3 id=qsid></h3>
|
||||
|
||||
<h3 id=qid></h3>
|
||||
|
||||
<h4>Question Text: </h4>
|
||||
|
||||
<div class=entry id="questiontext"></div>
|
||||
|
||||
<h4>Question Type:</h4>
|
||||
|
||||
<div id="questionmenu"></div>
|
||||
|
||||
<div id="qoptionmenu">
|
||||
|
||||
<h4>Options:</h4><div id="textoptions"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="qsubmitbutton"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="editanswer">
|
||||
|
||||
<h2>Edit Answer</h3>
|
||||
|
||||
<h3 id=asid></h3>
|
||||
|
||||
<h3 id=aqid></h3>
|
||||
|
||||
<h3 id=aid></h3>
|
||||
|
||||
<div id="answermenu"></div>
|
||||
|
||||
<div id="answerinput"></div>
|
||||
|
||||
<div id="asubmitbutton"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class"area">
|
||||
|
||||
<div id=log></div>
|
||||
|
||||
<div id=log1></div>
|
||||
|
||||
<div id=log2></div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
Loading…
Add table
Add a link
Reference in a new issue