Ignore:
Timestamp:
01/18/12 17:13:25 (13 years ago)
Author:
fpvanagthoven
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/jos-branch/js/questionEditorScripts.js

    r238 r240  
    2424    // Properties   
    2525    this.uid = null;    // The uid of the question contained in this editor
    26     this.saved = false; // Whether or not the question displayed in the editor has been saved already.
    2726    var me = this;      // Retarded self-reference because: Javascript
    2827    this.element = null;    // The parent div element containing the questionEditor
     
    7271        }
    7372    }
    74     this.init = function() {
     73    this.init = function(uid) {
    7574        // Outer div
    7675        this.saved = false;
     
    7877        me.element.className = "smallFrame questionEditor";
    7978        me.element.id = sequencer.state.selectedObject.uid;
    80         me.uid = sequencer.state.selectedObject.uid;
     79        me.uid = uid;
    8180        // Header
    8281        var titleDiv = ce("div");
     
    176175            "title": ge("qeTitleField").innerHTML,
    177176            "code": ge("qeCodeField").value,
    178             "description": ge("qeBodyTextField").value
     177            "description": ge("qeBodyTextField").value,
     178            "uid": me.uid
    179179        }
    180180       
     
    221221            // Then add the returned uid, if existing, to the sequencer.survey.questions array and set it for update
    222222            debugger;
     223            console.log(result.responseText);
    223224            var response = JSON.parse(result.responseText);
    224225            console.log(response);
     
    250251    }
    251252    this.discard = function() {
    252             debugger;
    253             me.element.parentNode.removeChild(me.element);
    254             me.init();
    255             sequencer.state.loaded = true;
    256             sequencer.state.editing = false;
    257             sequencer.survey.questions.upToDate[sequencer.survey.questions.uids.indexOf(me.uid)] = false;
    258             updateSequencer();
     253        debugger;
     254        me.element.parentNode.removeChild(me.element);
     255        sequencer.state.loaded = true;
     256        sequencer.state.editing = false;
     257        sequencer.survey.questions.upToDate[sequencer.survey.questions.uids.indexOf(me.uid)] = false;
     258        updateSequencer();
    259259       
    260260    }
     
    476476            uid: uid
    477477        });
    478         me.init();
     478        me.init(uid);
    479479        var oldElement = ge(uid);
    480480        if (oldElement) {
     
    494494        sequencer.state.editing = true;
    495495   
    496         me.reset();
     496        me.init(null);
    497497        var container = ge("seqContentWrapper");
    498498        container.appendChild(me.element);
Note: See TracChangeset for help on using the changeset viewer.