Editor is 98% finished. (still wrapping up final bits on drag and drop)
This commit is contained in:
parent
ac14d55b18
commit
c812705537
6 changed files with 400 additions and 261 deletions
|
|
@ -9,7 +9,7 @@ Survey.Data = new function(){
|
|||
|
||||
this.dragDrop = function(did){
|
||||
var type;
|
||||
|
||||
console.log('In drag drop');
|
||||
if(did.className.match("section")){type = 'section';}
|
||||
else if(did.className.match("question")){type = 'question';}
|
||||
else{ type = 'answer';}
|
||||
|
|
@ -32,7 +32,7 @@ Survey.Data = new function(){
|
|||
else{ type = 'answer';}
|
||||
data = {id:before.id,type:type};
|
||||
}
|
||||
|
||||
console.log(first.id+' '+data.id);
|
||||
Survey.Comm.dragDrop(first,data);
|
||||
}
|
||||
|
||||
|
|
@ -50,7 +50,9 @@ Survey.Data = new function(){
|
|||
|
||||
//add event handlers for if a tag is clicked
|
||||
for(var x in d.ids){
|
||||
console.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
|
||||
|
|
@ -64,7 +66,7 @@ Survey.Data = new function(){
|
|||
}
|
||||
if(d.buttons['answer']){
|
||||
var button = new YAHOO.widget.Button({ label:"Add Answer", id:"addanswer", container:"newAnswer" });
|
||||
button.on("click", this.addQuestion,d.buttons['answer']);
|
||||
button.on("click", this.addAnswer,d.buttons['answer']);
|
||||
}
|
||||
|
||||
this.loadObjectEdit(d.edithtml,d.type);
|
||||
|
|
@ -76,12 +78,12 @@ Survey.Data = new function(){
|
|||
}
|
||||
|
||||
|
||||
this.addQuestion = function(e,sid){
|
||||
Survey.Comm.newQuestion(sid);
|
||||
this.addQuestion = function(e,id){
|
||||
Survey.Comm.newQuestion(id);
|
||||
}
|
||||
|
||||
this.addAnswer = function(e,ids){
|
||||
Survey.Comm.newAnswer(ids[0],ids[1]);
|
||||
this.addAnswer = function(e,id){
|
||||
Survey.Comm.newAnswer(id);
|
||||
}
|
||||
|
||||
this.loadObjectEdit = function(edit,type){
|
||||
|
|
|
|||
|
|
@ -44,17 +44,17 @@ Survey.Comm = new function(){
|
|||
request(sUrl,this.callback,postData);
|
||||
}
|
||||
this.newSection = function(){
|
||||
var sUrl = "?func=newSection";
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback);
|
||||
}
|
||||
this.newQuestion = function(sid){
|
||||
var postData = "data="+sid;
|
||||
var sUrl = "?func=newQuestion";
|
||||
this.newQuestion = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback,postData);
|
||||
}
|
||||
this.newAnswer = function(sid,qid){
|
||||
var postData = "data="+YAHOO.lang.JSON.stringify([sid,qid]);
|
||||
var sUrl = "?func=newAnswer";
|
||||
this.newAnswer = function(id){
|
||||
var postData = "data="+id;
|
||||
var sUrl = "?func=newObject";
|
||||
request(sUrl,this.callback,postData);
|
||||
}
|
||||
this.deleteAnswer = function(id){
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ Survey.ObjectTemplate = new function(){
|
|||
];
|
||||
|
||||
var form = new YAHOO.widget.Dialog(type,
|
||||
{ width : "500px",
|
||||
{
|
||||
width : "500px",
|
||||
fixedcenter : true,
|
||||
visible : false,
|
||||
constraintoviewport : true,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ Survey.Data = new function(){
|
|||
else if(lastType == 'answer' && d.data[x].type == 'section'){
|
||||
this.addAnswerButton(lastId['section'],lastId['question']);
|
||||
buttons['answer'] = 1;
|
||||
this.addQuestionButton(lastId['section']);
|
||||
// this.addQuestionButton(lastId['section']);
|
||||
buttons['question'] = 1;
|
||||
acount = 1;
|
||||
qcount = 1;
|
||||
|
|
@ -135,16 +135,16 @@ Survey.Data = new function(){
|
|||
}
|
||||
if(lastType == 'answer' && ! buttons['answer']){
|
||||
this.addAnswerButton(lastId['section'],lastId['question']);
|
||||
this.addQuestionButton(lastId['section']);
|
||||
// this.addQuestionButton(lastId['section']);
|
||||
}
|
||||
if(lastType == 'question' && ! buttons['question']){
|
||||
this.addAnswerButton(lastId['section'],lastId['question']);
|
||||
}
|
||||
if(lastType == 'question' || lastType == 'section' && ! buttons['question']){
|
||||
this.addQuestionButton(lastId['section']);
|
||||
// this.addQuestionButton(lastId['section']);
|
||||
}
|
||||
|
||||
this.addSectionButton();
|
||||
// this.addSectionButton();
|
||||
|
||||
this.loadObjectEdit(d.edit);
|
||||
lastDataSet = d;
|
||||
|
|
@ -157,7 +157,7 @@ Survey.Data = new function(){
|
|||
|
||||
|
||||
this.addQuestion = function(e,sid){
|
||||
Survey.Comm.newQuestion(sid);
|
||||
// Survey.Comm.newQuestion(sid);
|
||||
}
|
||||
|
||||
this.addAnswer = function(e,ids){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue