merged with HEAD and other interesting changes

This commit is contained in:
David Delikat 2009-03-19 04:12:03 +00:00
parent 66c6c0fae5
commit 856cc06d04
151 changed files with 7335 additions and 2602 deletions

View file

@ -8,49 +8,29 @@ if (typeof Survey === "undefined") {
var CLASS_INVALID = 'survey-invalid'; // For elements that fail input validation
var CLASS_INVALID_MARKER = 'survey-invalid-marker'; // For default '*' invalid field marker
var multipleChoice = {
'Multiple Choice': 1,
'Gender': 1,
'Yes/No': 1,
'True/False': 1,
'Ideology': 1,
'Race': 1,
'Party': 1,
'Education': 1,
'Scale': 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
};
var text = {
// All specially-handled question types are listed here
// (anything else is assumed to be a multi-choice bundle)
var TEXT_TYPES = {
'Text': 1,
'Email': 1,
'Phone Number': 1,
'Text Date': 1,
'Currency': 1
'Currency': 1,
'TextArea': 1
};
var slider = {
var SLIDER_TYPES = {
'Slider': 1,
'Dual Slider - Range': 1,
'Multi Slider - Allocate': 1
};
var dateType = {
var DATE_TYPES = {
'Date': 1,
'Date Range': 1
};
var fileUpload = {
var UPLOAD_TYPES = {
'File Upload': 1
};
var hidden = {
var HIDDEN_TYPES = {
'Hidden': 1
};
@ -65,8 +45,10 @@ if (typeof Survey === "undefined") {
function formsubmit(event){
var submit = 1;//boolean for if all was good or not
for (var i in toValidate) {
console.log(toValidate);
if (YAHOO.lang.hasOwnProperty(toValidate, i)) {
var answered = 0;
console.log(toValidate[i].type);
if (toValidate[i].type === 'Multi Slider - Allocate') {
var total = 0;
for (var z in toValidate[i].answers) {
@ -94,6 +76,7 @@ if (typeof Survey === "undefined") {
}
}
var node = document.getElementById(i + 'required');
var q_parent_node = YAHOO.util.Dom.getAncestorByClassName(node, 'question');
if (!answered) {
submit = 0;
@ -229,7 +212,7 @@ if (typeof Survey === "undefined") {
var step = Math.round(q.answers[i].step);
var min = Math.round(parseFloat(q.answers[i].min));
var distance = Math.round(parseFloat(q.answers[i].max) + (-1 * min));
var scale = Math.round(sliderWidth / distance);
var scale = Math.floor(sliderWidth / distance);
var id = a.id;
var s = YAHOO.widget.Slider.getHorizSlider(id + 'slider-bg', id + 'slider-thumb', 0, sliderWidth, (scale * step));
s.scale = scale;
@ -353,7 +336,6 @@ if (typeof Survey === "undefined") {
if (lastSection !== s.id || s.everyPageText === '1') {
document.getElementById('headertext').style.display = 'block';
}
if (lastSection !== s.id && s.questionsOnSectionPage !== '1') {
var span = document.createElement("div");
span.innerHTML = "<input type=button id='showQuestionsButton' value='Continue'>";
@ -385,11 +367,16 @@ if (typeof Survey === "undefined") {
Survey.Form.addWidgets(qs);
}
},
addWidgets: function(qs){
hasFile = false;
for (var i = 0; i < qs.length; i++) {
var q = qs[i];
if (!q || !q.answers) {
// gracefully handle q with no answers
continue;
}
var verts = '';
for (var x in q.answers) {
if (YAHOO.lang.hasOwnProperty(q.answers, x)) {
@ -403,106 +390,108 @@ if (typeof Survey === "undefined") {
}
}
//Check if this question should be validated
if (q.required) {
//Check if this question should be validated.
//Sliders can't really be not answered, so requiring them makes little sense.
if (q.required == true && q.questionType != 'Slider') {
toValidate[q.id] = [];
toValidate[q.id].type = q.questionType;
toValidate[q.id].answers = [];
}
if (multipleChoice[q.questionType]) {
var butts = [];
verb = 0;
for (var j = 0; j < q.answers.length; j++) {
var a = q.answers[j];
if (DATE_TYPES[q.questionType]) {
for (var k = 0; k < q.answers.length; k++) {
var ans = q.answers[k];
if (toValidate[q.id]) {
toValidate[q.id].answers[a.id] = 1;
toValidate[q.id].answers[ans.id] = 1;
}
var b = document.getElementById(a.id + 'button');
/*
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.id+'button', name: a.id+'button',
value: a.id,
container: a.id+"container", checked: false });
*/
// b.on("click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
// YAHOO.util.Event.addListener(a.id+'button', "click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
if (a.verbatim) {
verb = 1;
}
YAHOO.util.Event.addListener(a.id + 'button', "click", buttonChanged, [b, a.id, q.maxAnswers, butts, qs.length, a.id]);
b.hid = a.id;
butts.push(b);
var calid = ans.id + 'container';
var c = new YAHOO.widget.Calendar(calid, {
title: 'Choose a date:',
close: true
});
c.selectEvent.subscribe(selectCalendar, [c, ans.id], true);
c.render();
c.hide();
var btn = new YAHOO.widget.Button({
label: "Select Date",
id: "pushbutton" + ans.id,
container: ans.id + 'button'
});
btn.on("click", showCalendar, [c]);
}
continue;
}
else
if (dateType[q.questionType]) {
for (var k = 0; k < q.answers.length; k++) {
var ans = q.answers[k];
if (toValidate[q.id]) {
toValidate[q.id].answers[ans.id] = 1;
if (SLIDER_TYPES[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') {
handleDualSliders(q);
}
else {
for (var s in q.answers) {
if (YAHOO.lang.hasOwnProperty(q.answers, s)) {
var a1 = q.answers[s];
YAHOO.util.Event.addListener(a1.id, "blur", sliderTextSet);
if (a1.max - a1.min > max) {
max = a1.max - a1.min;
}
}
var calid = ans.id + 'container';
var c = new YAHOO.widget.Calendar(calid, {
title: 'Choose a date:',
close: true
});
c.selectEvent.subscribe(selectCalendar, [c, ans.id], true);
c.render();
c.hide();
var btn = new YAHOO.widget.Button({
label: "Select Date",
id: "pushbutton" + ans.id,
container: ans.id + 'button'
});
btn.on("click", showCalendar, [c]);
}
}
if (q.questionType === 'Multi Slider - Allocate') {
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
for (var x1 = 0; x1 < q.answers.length; x1++) {
if (toValidate[q.id]) {
toValidate[q.id].total = q.answers[x1].max;
toValidate[q.id].answers[q.answers[x1].id] = 1;
}
}
sliderManager(q, max);
}
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') {
handleDualSliders(q);
}
else {
for (var s in q.answers) {
if (YAHOO.lang.hasOwnProperty(q.answers, s)) {
var a1 = q.answers[s];
YAHOO.util.Event.addListener(a1.id, "blur", sliderTextSet);
if (a1.max - a1.min > max) {
max = a1.max - a1.min;
}
}
}
}
if (q.questionType === 'Multi Slider - Allocate') {
//sliderManagers[sliderManagers.length] = new this.sliderManager(q,max);
for (var x1 = 0; x1 < q.answers.length; x1++) {
if (toValidate[q.id]) {
toValidate[q.id].total = q.answers[x1].max;
toValidate[q.id].answers[q.answers[x1].id] = 1;
}
}
sliderManager(q, max);
}
else
if (q.questionType === 'Slider') {
handleSliders(q);
}
if (q.questionType === 'Slider') {
handleSliders(q);
}
else
if (fileUpload[q.questionType]) {
hasFile = true;
}
else
if (text[q.questionType]) {
if (toValidate[q.id]) {
toValidate[q.id].answers[q.answers[x].id] = 1;
}
}
continue;
}
if (UPLOAD_TYPES[q.questionType]) {
hasFile = true;
continue;
}
if (TEXT_TYPES[q.questionType]) {
if (toValidate[q.id]) {
toValidate[q.id].answers[q.answers[x].id] = 1;
}
continue;
}
// Must be a multi-choice bundle
var butts = [];
verb = 0;
for (var j = 0; j < q.answers.length; j++) {
var a = q.answers[j];
if (toValidate[q.id]) {
toValidate[q.id].answers[a.id] = 1;
}
var b = document.getElementById(a.id + 'button');
/*
b = new YAHOO.widget.Button({ type: "checkbox", label: a.answerText, id: a.id+'button', name: a.id+'button',
value: a.id,
container: a.id+"container", checked: false });
*/
// b.on("click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
// YAHOO.util.Event.addListener(a.id+'button', "click", buttonChanged,[b,a.id,q.maxAnswers,butts,qs.length,a.id]);
if (a.verbatim) {
verb = 1;
}
YAHOO.util.Event.addListener(a.id + 'button', "click", buttonChanged, [b, a.id, q.maxAnswers, butts, qs.length, a.id]);
b.hid = a.id;
butts.push(b);
}
}
YAHOO.util.Event.addListener("submitbutton", "click", formsubmit);
}
@ -514,4 +503,4 @@ if (typeof Survey === "undefined") {
YAHOO.util.Event.onDOMReady(function(){
// Survey.Comm.setUrl('/' + document.getElementById('assetPath').value);
Survey.Comm.callServer('', 'loadQuestions');
});
});

View file

@ -5,6 +5,8 @@ var Dom = YAHOO.util.Dom;
var Event = YAHOO.util.Event;
var DDM = YAHOO.util.DragDropMgr;
var currentDest;
Survey.DDList = function(id, sGroup, config) {
Survey.DDList.superclass.constructor.call(this, id, sGroup, config);
@ -61,30 +63,10 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
a.animate();
},
onInvalidDrop: function(e, id) {
Survey.Data.dragDrop(this.getEl());
},
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();
}
}
Survey.Data.dragDrop(this.getEl());
},
@ -110,6 +92,8 @@ YAHOO.extend(Survey.DDList, YAHOO.util.DDProxy, {
// We are only concerned with list items, we ignore the dragover
// notifications for the list.
if (destEl.nodeName.toLowerCase() == "li") {
currentDest = destEl;
console.log(destEl);
var orig_p = srcEl.parentNode;
var p = destEl.parentNode;

View file

@ -1,134 +1,154 @@
if (typeof Survey == "undefined") {
/*global Survey, YAHOO */
if (typeof Survey === "undefined") {
var Survey = {};
}
Survey.Data = new function(){
Survey.Data = (function(){
var lastDataSet = {};
var focus;
var lastId = -1;
// Keep references to widgets here so that we can destory any instances before
// creating new ones (to avoid memory leaks)
var autoComplete;
var sButton, qButton, aButton;
this.dragDrop = function(did){
var type;
YAHOO.log('In drag drop');
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};
}
YAHOO.log(first.id+' '+data.id);
Survey.Comm.dragDrop(first,data);
}
this.clicked = function(){
Survey.Comm.loadSurvey(this.id);
}
this.loadData = function(d){
focus = d.address;//What is the current highlighted item.
var showEdit = 1;
if(lastId.toString() == d.address.toString()){
showEdit = 0;
lastId = -1;
}else{
lastId = d.address;
}
document.getElementById('sections').innerHTML=d.ddhtml;
//add event handlers for if a tag is clicked
for(var x in d.ids){
YAHOO.log('adding handler for '+ d.ids[x]);
YAHOO.util.Event.addListener(d.ids[x], "click", this.clicked);
new Survey.DDList(d.ids[x],"sections");
}
//add the add object buttons
// if(d.buttons['section']){
document.getElementById('addSection').innerHTML = '';
document.getElementById('addQuestion').innerHTML = '';
document.getElementById('addAnswer').innerHTML = '';
var button = new YAHOO.widget.Button({ label:"Add Section", id:"addsection", container:"addSection" });
button.on("click", this.addSection);
// }
// if(d.buttons['question']){
var button = new YAHOO.widget.Button({ label:"Add Question", id:"addquestion", container:"addQuestion" });
button.on("click", this.addQuestion,d.buttons['question']);
// }
if(d.buttons['answer']){
var button = new YAHOO.widget.Button({ label:"Add Answer", id:"addanswer", container:"addAnswer" });
button.on("click", this.addAnswer,d.buttons['answer']);
}
if(showEdit == 1){
this.loadObjectEdit(d.edithtml,d.type);
}else{
document.getElementById('edit').innerHTML = "";
}
lastDataSet = d;
}
this.addSection = function(){
Survey.Comm.newSection();
}
this.addQuestion = function(e,id){
Survey.Comm.newQuestion(id);
}
this.addAnswer = function(e,id){
Survey.Comm.newAnswer(id);
}
this.loadObjectEdit = function(edit,type){
if(edit){
Survey.ObjectTemplate.loadObject(edit,type);
}
}
this.loadLast = function(){
this.loadData(lastDataSet);
}
}();
//----------------------------------------------------------------
//
// Initialize survey
//
//----------------------------------------------------------------
Survey.OnLoad = function() {
var e = YAHOO.util.Event;
return {
init: function() {
e.onDOMReady(this.initHandler);
},
initHandler: function(){
new YAHOO.util.DDTarget("sections","sections");
Survey.Comm.loadSurvey();
},
}
}();
dragDrop: function(did){
Survey.OnLoad.init();
YAHOO.log('In drag drop');
var type = did.className.match("section") ? 'section'
: did.className.match("question") ? 'question'
: 'answer';
var first = {
id: did.id, // pre-drag index of item
type: type
};
var before = YAHOO.util.Dom.getPreviousSiblingBy( document.getElementById(did.id), function(node){
return node.id; // true iff node has a non-empty id
});
var data = {
id: '',
type: ''
};
if (before) {
type = before.className.match("section") ? 'section'
: before.className.match("question") ? 'question'
: 'answer';
data = {
id: before.id,
type: type
};
}
YAHOO.log(first.id + ' ' + data.id);
Survey.Comm.dragDrop(first, data);
},
clicked: function(){
Survey.Comm.loadSurvey(this.id);
},
loadData: function(d){
focus = d.address;//What is the current highlighted item.
var showEdit = 1;
if (lastId.toString() === d.address.toString()) {
showEdit = 0;
lastId = -1;
}
else {
lastId = d.address;
}
// First purge any event handlers bound to sections node..
YAHOO.util.Event.purgeElement('sections', true);
// Now we can re-write its innerHTML without fear of memory leaks
document.getElementById('sections').innerHTML = d.ddhtml;
//add event handlers for if a tag is clicked
for (var x in d.ids) {
if (YAHOO.lang.hasOwnProperty(d.ids, x)) {
YAHOO.log('adding handler for ' + d.ids[x]);
YAHOO.util.Event.addListener(d.ids[x], "click", this.clicked);
var _s = new Survey.DDList(d.ids[x], "sections");
}
}
sButton && sButton.destroy();
sButton = new YAHOO.widget.Button({
label: "Add Section",
id: "addsection",
container: "addSection"
});
sButton.on("click", this.addSection);
qButton && qButton.destroy();
qButton = new YAHOO.widget.Button({
label: "Add Question",
id: "addquestion",
container: "addQuestion"
});
qButton.on("click", this.addQuestion, d.buttons.question);
if (d.buttons.answer) {
aButton && aButton.destroy();
aButton = new YAHOO.widget.Button({
label: "Add Answer",
id: "addanswer",
container: "addAnswer"
});
aButton.on("click", this.addAnswer, d.buttons.answer);
}
if (showEdit == 1) {
this.loadObjectEdit(d.edithtml, d.type);
// build the goto auto-complete widget
if (d.gotoTargets && document.getElementById('goto')) {
var ds = new YAHOO.util.LocalDataSource(d.gotoTargets);
autoComplete = new YAHOO.widget.AutoComplete('goto', 'goto-yui-ac-container', ds);
}
}
else {
Survey.ObjectTemplate.unloadObject();
if (autoComplete) {
autoComplete.destroy();
autoComplete = null;
}
}
lastDataSet = d;
},
addSection: function(){
Survey.Comm.newSection();
},
addQuestion: function(e, id){
Survey.Comm.newQuestion(id);
},
addAnswer: function(e, id){
Survey.Comm.newAnswer(id);
},
loadObjectEdit: function(edit, type){
if (edit) {
Survey.ObjectTemplate.loadObject(edit, type);
}
},
loadLast: function(){
this.loadData(lastDataSet);
}
};
})();
// Initialize survey
YAHOO.util.Event.onDOMReady(function(){
var ddTarget = new YAHOO.util.DDTarget("sections", "sections");
Survey.Comm.loadSurvey();
});

View file

@ -1,69 +0,0 @@
if (typeof Survey == "undefined") {
var Survey = {};
}
Survey.AnswerTemplate = new function(){
this.params;
this.loadAnswer = function(params){
for(var p in params){
if(params[p] == undefined){params[p] = '';}
}
var html = "\
<div id='answer'>\
<div class='hd'>Please enter answer information</div>\
<div class='bd'>\
\
<form name='form' method='POST' action='?func=submitAnswerEdit'>\
\
<p>Answer Number: "+params.sequenceNumber + "\
\
<input type='hidden' name='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
<input type='hidden' name='Survey_questionId' value='"+params.Survey_questionId+"'>\
<input type='hidden' name='Survey_answerId' value='"+params.Survey_answerId+"'>";
html = html + "<p>Answer Text:\n<textarea name='answerText'>"+params.answerText+"</textArea>\n";
html = html + "<p>Recorded Answer\n<textarea name='recordedAnswer'>"+params.recordedAnswer+"</textArea>\n";
html = html + "<p>Jump to:<input type=text value='"+params.gotoQuestion+"' name=gotoQuestion size=4>";
html = html + "<span id='textParams'><p>Text Answer Cols:<input type=text size=2 value='"+params.textCols+"' name=textCols> Rows: \
<input type=text size=2 value='"+params.textRows+"' name=textRows> </p></span>";
html = html + "<p>Is this the correct answer:\n" +
this.makeRadio('isCorrect',[{text:'Yes',value:1},{text:'No',value:0}],params.isCorrect);
html = html + "<p>Min:<input type=text value='"+params.min+"' name=min size=2>";
html = html + "<p>Max:<input type=text value='"+params.max+"' name=max size=2>";
html = html + "<p>Step:<input type=text value='"+params.step+"' name=step size=2>";
html = html + "<p>Verbatim:\n" +
this.makeRadio('verbatim',[{text:'Yes',value:1},{text:'No',value:0}],params.verbatim);
document.getElementById('edit').innerHTML = html;
var butts = [{ text:"Submit", handler:function(){this.submit();}, isDefault:true },{ text:"Cancel", handler:function(){this.cancel();}} ];
if(params.Survey_answerId != ''){
butts[2] = { text:"Delete", handler:function(){Survey.Comm.deleteAnswer(Survey.AnswerTemplate.params.Survey_answerId);}};
}
var form = new YAHOO.widget.Dialog("answer",
{ width : "500px",
fixedcenter : true,
visible : false,
constraintoviewport : true,
buttons : butts
});
form.callback = Survey.Comm.callback;
form.render();
form.show();
this.params = params;
};
this.makeRadio = function(name,values,checked){
var html = '';
for(var i in values){
if(checked == values[i]['value']){
html = html+ "<input type='radio' name='" + name + "' value='" + values[i]['value'] + "' checked>" + values[i]['text'];
}else{
html = html+ "<input type='radio' name='" + name + "' value='" + values[i]['value'] + "' >" + values[i]['text'];
}
}
html = html + "\n";
return html;
}
}();

View file

@ -6,6 +6,7 @@ Survey.Comm = new function(){
var callMade = 0;
var request = function(sUrl,callback,postData){
YAHOO.util.Dom.setStyle('mask-all','display','block');
if(callMade == 1){
alert("Waiting on previous request");
}else{
@ -15,10 +16,12 @@ Survey.Comm = new function(){
}
this.callback = {
success:function(o){
YAHOO.util.Dom.setStyle('mask-all','display','none');
callMade = 0;
Survey.Data.loadData(YAHOO.lang.JSON.parse(o.responseText));
},
failure: function(o){
YAHOO.util.Dom.setStyle('mask-all','display','none')
callMade = 0;
alert("Last request failed");
Survey.Data.loadLast();

View file

@ -1,33 +1,118 @@
if (typeof Survey == "undefined") {
/*global Survey, YAHOO */
if (typeof Survey === "undefined") {
var Survey = {};
}
Survey.ObjectTemplate = new function(){
Survey.ObjectTemplate = (function(){
this.loadObject = function(html,type){
// Keep references to widgets here so that we can destory any instances before
// creating new ones (to avoid memory leaks)
var dialog;
var editor;
document.getElementById('edit').innerHTML = html;
return {
unloadObject: function(){
// First destory the editor..
if (editor) {
editor.destroy();
editor = null;
}
// And then the Dialog that contains it.
if (dialog) {
dialog.destroy();
dialog = null;
}
},
var butts = [
{ text:"Submit", handler:function(){this.submit();}, isDefault:true },
{ text:"Copy", handler:function(){document.getElementById('copy').value = 1; this.submit();}},
{ text:"Cancel", handler:function(){this.cancel(); Survey.Comm.loadSurvey('-');}},
{ text:"Delete", handler:function(){document.getElementById('delete').value = 1; this.submit();}}
];
loadObject: function(html, type){
// Make sure we purge any event listeners before overwrite innerHTML..
YAHOO.util.Event.purgeElement('edit', true);
document.getElementById('edit').innerHTML = html;
var btns = [{
text: "Submit",
handler: function(){
editor.saveHTML();
this.submit();
},
isDefault: true
}, {
text: "Copy",
handler: function(){
document.getElementById('copy').value = 1;
this.submit();
}
}, {
text: "Cancel",
handler: function(){
this.cancel();
Survey.Comm.loadSurvey('-');
}
}, {
text: "Delete",
handler: function(){
document.getElementById('delete').value = 1;
this.submit();
}
}, {
text: "Preview",
handler: function(){
if (type === 'answer') {
alert('Sorry, preview is only supported for Sections and Questions, not Answers');
}
else {
var msg = 'This will delete any Survey responses you have made under this ' +
'user account and redirect you to the Take Survey page starting at the selected item. ' +
"\n\nAre you sure you want to continue?";
if (confirm(msg)) {
window.location.search = 'func=jumpTo;id=' + dialog.getData().id;
}
}
}
}];
dialog = new YAHOO.widget.Dialog(type, {
width: "600px",
context: [document.body, 'tr', 'tr'],
visible: false,
constraintoviewport: true,
buttons: btns
});
dialog.callback = Survey.Comm.callback;
dialog.render();
var form = new YAHOO.widget.Dialog(type,
{
width : "500px",
fixedcenter : true,
visible : false,
constraintoviewport : true,
buttons : butts
} );
var resizeGotoExpression = new YAHOO.util.Resize('resize_gotoExpression_formId');
resizeGotoExpression.on('resize', function(ev) {
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'width', (ev.width - 6) + "px");
YAHOO.util.Dom.setStyle('gotoExpression_formId', 'height', (ev.height - 6) + "px");
});
var textareaId = type + 'Text';
var textarea = YAHOO.util.Dom.get(textareaId);
var height = YAHOO.util.Dom.getStyle(textarea, 'height');
if (!height) {
height = '300px';
}
form.callback = Survey.Comm.callback;
form.render();
form.show();
initHoverHelp(type);
}
}();
// N.B. SimpleEditor has a memory leak so this eats memory on every instantiation
editor = new YAHOO.widget.SimpleEditor(textareaId, {
height: height,
width: '100%',
dompath: false //Turns on the bar at the bottom
});
if (editor.get('toolbar')) {
editor.get('toolbar').titlebar = false;
}
editor.render();
dialog.show();
initHoverHelp(type);
}
};
})();

View file

@ -1,40 +0,0 @@
<div id='question'>
<div class='hd'>Please enter question information</div>
<div class='bd'>
<form name='form' method='POST' action='?func=submitObjectEdit'>
<p>Question Number: <tmpl_var displayed_id>
<input type='hidden' name='id' value='<tmpl_var id>'>
<p>Question Text:\n";
<textarea name='questionText'><tmpl_var text></textArea>\n";
<p>Question variable name:<input maxlength=35 size=10 type=text value='<tmpl_var variable>' name=variable size=2></p>";
<p>Randomize answers:";
<input type='radio' name='randomizeAnswers' value=1 <tmpl_if randomizeAnswers>checked</tmpl_if>>Yes
<input type='radio' name='randomizeAnswers' value=0 <tmpl_unless randomizeAnswers>checked</tmpl_unless>>No
<p>Question type:
<select name='questionType'>
<tmpl_loop questionType>
<option value='<tmpl_var text>' <tmpl_if selected>selected</tmpl_if>><tmpl_var text></option>
</tmpl_loop>
</select>
<p>Randomized words:
<textarea name=randomizWords><tmpl_var randomWords></textArea>
<p>Vertical display:
<input type='radio' name='verticalDisplay' value=1 <tmpl_if verticalDisplay>checked</tmpl_if>>Yes
<input type='radio' name='verticalDisplay' value=0 <tmpl_unless verticalDisplay>checked</tmpl_unless>>No
<p>Show text in button:
<input type='radio' name='textInButton' value=1 <tmpl_if textInButton>checked</tmpl_if>>Yes
<input type='radio' name='textInButton' value=0 <tmpl_unless textInButton>checked</tmpl_unless>>No
<p>Allow comment:
<input type='radio' name='allowComment' value=1 <tmpl_if allowComment>checked</tmpl_if>>Yes
<input type='radio' name='allowComment' value=0 <tmpl_unless allowComment>checked</tmpl_unlexx>>No
<span id='commentParams'><p>&nbsp;&nbsp; Cols:<input type=text size=2 value='<tmpl_var commentCols>' name=commentCols> Rows:
<input type=text size=2 value='<tmpl_var commentRows>' name=commentRows> </p></span>
<p>Maximum number of answers:<input type=text value='<tmpl_var maxAnswers>' name=maxAnswers size=2>
<p>Required:
<input type='radio' name='required' value=1 <tmpl_if required>checked</tmpl_if>>Yes
<input type='radio' name='required' value=0 <tmpl_unless required>checked</tmpl_unless>>No
</form>
</div>
</div>

View file

@ -1,112 +0,0 @@
if (typeof Survey == "undefined") {
var Survey = {};
}
Survey.QuestionTemplate = new function(){
this.loadQuestion = function(params){
for(var p in params){
if(params[p] == undefined){params[p] = '';}
}
var html = "\
<div id='question'>\
<div class='hd'>Please enter question information</div>\
<div class='bd'>\
\
<form name='form' method='POST' action='?func=submitQuestionEdit'>\
<p>Question Number: "+params.sequenceNumber + "\
\
<input type='hidden' name='Survey_sectionId' value='"+params.Survey_sectionId+"'>\
<input type='hidden' name='Survey_questionId' value='"+params.Survey_questionId+"'>\
<p>Question Text:\n";
if(params.questionText == ''){
html = html + "<textarea name='questionText'>Enter Text Here</textArea>\n";
}
else{
html = html + "<textarea name='questionText'>"+params.questionText+"</textArea>\n";
}
html = html + "<p>Question variable name:<input maxlength=35 size=10 type=text value='"+ params.questionVariable +"' name=questionVariable size=2></p>";
html = html + "<p>Randomize answers:";
html = html+ this.makeRadio('randomizeAnswers',[{text:'Yes',value:1},{text:'No',value:0}],params.randomizeAnswers);
html = html + "<p>Question type:";
var questions = ['Agree/Disagree','Certainty','Concern','Confidence','Currency','Date','Date Range','Dual Slider - Range','Education','Effectiveness',
'Email','File Upload','Gender','Hidden','Ideology','Importance','Likelihood','Multi Slider - Allocate','Multiple Choice','Oppose/Support',
'Party','Phone Number','Race','Risk','Satisfaction','Scale','Security','Slider','Text','Text Date','Threat','True/False','Yes/No'];
// var questions = ['Multiple Choice','Gender','Yes/No','True/False','Agree/Disagree','Oppose/Support','Importance','Likelihood','Certainty','Satisfaction',
// 'Confidence','Effectiveness','Concern','Risk','Threat','Security','Ideology','Race','Party','Education',
// 'Text', 'Email', 'Phone Number', 'Text Date', 'Currency',
// 'Slider','Dual Slider - Range','Multi Slider - Allocate', 'Date','Date Range', 'File Upload','Hidden'];
html = html + this.makeMenu('questionType',questions,questions,params.questionType);
html = html + "\
<p>Randomized words:\
<textarea name=randomizedWords>"+params.randomizedWords+"</textArea>\
<p>Vertical display:";
html = html+ this.makeRadio('verticalDisplay',[{text:'Yes',value:1},{text:'No',value:0}],params.verticalDisplay);
html = html + "<p>Show text in button:";
html = html + this.makeRadio('textInButton',[{text:'Yes',value:1},{text:'No',value:0}],params.textInButton);
html = html + "<p>Allow comment:";
html = html + this.makeRadio('allowComment',[{text:'Yes',value:1},{text:'No',value:0}],params.allowComment);
html = html + "<span id='commentParams'><p>&nbsp;&nbsp; Cols:<input type=text size=2 value='"+params.commentCols+"' name=commentCols> Rows: \
<input type=text size=2 value='"+params.commentRows+"' name=commentRows> </p></span>";
html = html + "<p>Maximum number of answers:<input type=text value='"+params.maxAnswers+"' name=maxAnswers size=2>";
html = html + "<p>Required:";
html = html+ this.makeRadio('required',[{text:'Yes',value:1},{text:'No',value:0}],params.required);
html = html + "\
</form>\
</div>\
</div>\
";
document.getElementById('edit').innerHTML = html;
var butts = [ { text:"Submit", handler:function(){this.submit();}, isDefault:true }, { text:"Cancel", handler:function(){this.cancel();}} ];
if(params.Survey_questionId != ''){
butts[2] = {text:"Delete", handler:function(){Survey.Comm.deleteQuestion(params.Survey_questionId);}};
}
var form = new YAHOO.widget.Dialog("question",
{ width : "500px",
fixedcenter : true,
visible : false,
constraintoviewport : true,
buttons : butts
} );
form.callback = Survey.Comm.callback;
form.render();
form.show();
}
this.makeMenu = function(name,values,text,selected){
var html = "<select name='"+name+"'>\n";
for(var i in values){
if(values[i] == selected){
html = html + "<option value='"+values[i]+"' selected>"+text[i]+"</option>\n";
}else{
html = html + "<option value='"+values[i]+"' >"+text[i]+"</option>\n";
}
}
html = html + "</select>\n";
return html;
}
this.makeRadio = function(name,values,checked){
var html = '';
for(var i in values){
if(checked == values[i]['value']){
html = html+ "<input type='radio' id='"+name+"' name='" + name + "' value='" + values[i]['value'] + "' checked>" + values[i]['text'];
}else{
html = html+ "<input type='radio' id='"+name+"' name='" + name + "' value='" + values[i]['value'] + "' >" + values[i]['text'];
}
}
html = html + "\n";
return html;
}
}();

View file

@ -1,28 +0,0 @@
if (typeof Survey == "undefined") {
var Survey = {};
}
Survey.SectionTemplate = new function(){
this.loadSection = function(html){
document.getElementById('edit').innerHTML = html;
var butts = [ { text:"Submit", handler:function(){this.submit();}, isDefault:true }, { text:"Cancel", handler:function(){this.cancel();}},
{text:"Delete", handler:function(){document.getElementById('delete').setValue(1); this.submit();}}
];
var form = new YAHOO.widget.Dialog("section",
{ width : "500px",
fixedcenter : true,
visible : false,
constraintoviewport : true,
buttons : butts
} );
form.callback = Survey.Comm.callback;
form.render();
form.show();
}
}();

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -1,90 +0,0 @@
body {
margin: 0;
background-repeat: repeat-y;
background-position: 0px 0px;
}
.survey-header {
width: 80%;
height: 20px;
margin-left: 80px;
}
#survey {
margin-left: 80px;
width: 85%;
}
div.dateanswer {
min-height: 250px;
}
div.slider-bg {
position: relative;
background:url(/extras/wobject/Survey/bg-fader-500.gif) 5px 0 no-repeat;
height:68px;
width:529px;
}
div.slider-thumb {
cursor:default;
position: absolute;
top: 30px;
left: 4px;
}
div.slider-min-thumb {
cursor:default;
position: absolute;
top: 4px;
}
div.slider-max-thumb {
cursor:default;
position: absolute;
top: 4px;
}
#headertitle {
display: none;
}
#headertext {
display: none;
}
#questions {
display: none;
}
input.mcbutton{
font-size: 10px;
font-weight: bold;
text-decoration: none;
background-color: #CCCCCC;
background-repeat: repeat-x;
text-align: center;
display: block;
margin: 0.5em;
padding: .8em;
width: 60px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #000000;
background-image: url(/extras/wobject/Survey/gradient-glossy.png);
}
input.mcbutton:hover{
background-color: #B6D2F1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
}
input.mcbutton-selected{
background-color: #172D9D;
background-repeat: repeat-x;
color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
margin: 0.5em;
padding: .8em;
width: 60px;
text-align: center;
display: block;
font-weight: bold;
background-image: url(/extras/wobject/Survey/gradient-glossy.png);
background-position: 0px 0px;
}
/* By default the marker for invalid (required) fields is a red '*' */
.survey-invalid-marker {
color: #FF0000;
}

View file

@ -1,4 +1,38 @@
#loading-mask {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 20000;
background-color: white;
opacity:0.6;
filter:alpha(opacity=60);
}
#loading {
position: absolute;
left: 50%;
top: 50%;
padding: 2px;
z-index: 20001;
height: auto;
margin: -35px 0 0 -30px;
}
#loading .loading-indicator {
background: url(/extras/wobject/Survey/rel_interstitial_loading.gif) no-repeat;
color: #555;
font: bold 13px tahoma,arial,helvetica;
padding: 18px 80px;
margin: 0;
text-align: center;
height: auto;
z-index: 20002;
}
div.testarea {
width: 200px;
height: 100px;
@ -92,9 +126,11 @@ li.squestion {
min-height: 10px;
}
li.newQuestion {
# background-color: #D1E6EC;
# border:1px solid #7EA6B2;
# cursor: move;
/*
background-color: #D1E6EC;
border:1px solid #7EA6B2;
cursor: move;
*/
padding-left:25px;
}
@ -119,14 +155,19 @@ li.sanswer {
background-color: #CC6600;
border:1px solid #7EA6B2;
cursor: move;
padding-left:50px;
padding-left:50px;
width:60%;
min-height: 10px;
}
li.newAnswer {
# background-color: #D1E6EC;
# border:1px solid #7EA6B2;
padding-left:50px;
# cursor: move;
/*
background-color: #D1E6EC;
border:1px solid #7EA6B2;
cursor: move;
*/
padding-left:50px;
}
#goto-yui-ac {
width:15em;
margin-top:0.5em;
}