Ignore:
Timestamp:
12/21/11 17:52:00 (13 years ago)
Author:
fpvanagthoven
Message:
  • Clean up van bestanden die niet meer gebruikt worden/niet nodig zijn/zijn gemerged met bestaande files.
  • Daarnaast question/survey editor nu grotendeels werkend (min save functie...)
  • Inloggen werkt nu op userUid ipv naam, werkt beter met het aanmaken van creators.
  • Bug in returnObjectDisplay gefixt, er stond nog een var_dump tussen de echoes. JSON houdt niet van HTML tags.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/js/sequencerScripts.js

    r188 r191  
    7373        // settings fields first
    7474        initSequencer();
    75        
     75        debugger;
    7676        switch (sequencer.settings.content.contentType.toLowerCase()) {
    7777            case "session":
     
    230230        requestString = "args="+JSON.stringify(args);
    231231        newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
     232            console.log(result.responseText);
    232233            insertNewObjects(result.responseText, needsUpdating);
    233234        }, true);
     
    290291
    291292        // This means that one or more steps are being added, not an entire pipeline's worth of them
    292         debugger;
    293293        needsUpdating = new Array();
    294294        args = [];
     
    305305        requestString = "args="+JSON.stringify(args);
    306306        newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
     307            //console.log(result.responseText);
    307308            insertNewObjects(result.responseText, needsUpdating);
    308309        }, true);
     
    388389
    389390function insertNewObjects(responseText, needsUpdating) {
     391    //console.log(responseText);
    390392    // Container function that calls different insertNewX() functions depending on content type. Called from updateSequencer().
    391393    var response = JSON.parse(responseText);
     
    520522    // Loop through returned question objects
    521523    for (var i = 0; i < response.length; i++) {
     524       
     525        /*
     526         * The following block of code defines the layout and composition of the question display
     527         */
     528       
    522529        // Define the outer frame
    523530        var frameDiv = ce("div");
     
    570577        frameDiv.appendChild(controlsDiv);
    571578       
     579        /*
     580         * This is where the layout code ends
     581         * We proceed to insertion of the created DIV into the document
     582         */
     583       
    572584        // We now have a full question display DIV contained in the frameDiv variable. We should now add this to the sequencer content.
    573         debugger;
    574585        for (var j = needsUpdating.length - 1; j >= 0; j--) {
    575586            if (needsUpdating[j][1] != response[i].uid) continue;
     
    587598   
    588599    sequencer.state.updating = false;   //re-enable user commands
     600}
     601
     602function saveSurvey(confirmSave) {
     603    // Sends an AJAX request to the PHP server that saves the current object.
     604    var answer = (confirmSave == true) ? confirm("Save changes?") : true;
     605    if (answer == false) return;
     606   
     607    // Check for object type being edited, adjust requestString and target URL to this information.
     608    var request = new Object(), url, requestString;
     609    switch (sequencer.settings.content.contentType.toLowerCase()) {
     610        case "survey":
     611            url = "saveSurvey.php";
     612            request.title = sequencer.survey.title;
     613            request.uid = sequencer.survey.uid;
     614            request.description = sequencer.survey.description;
     615            request.questions = new Object();
     616            request.questions.uids = sequencer.survey.questions.uids;
     617            requestString = "args="+JSON.stringify(request);
     618            console.log(request);
     619            newAjaxRequest(requestString, url, function(result){
     620                console.log(result.responseText);
     621            }, true);
     622            break;
     623        case "blaaaat":
     624            url = "savesession.php";
     625            request.pipeline.uids = sequencer.session.pipeline.uids;
     626            request.pipeline.types = sequencer.session.pipeline.types;
     627            break;
     628    }
    589629}
    590630
     
    648688}
    649689
    650 function ajaxInfoRequest(uid, el, type) {
    651     // Info panel update.
    652    
    653     var c = "uid="+uid;
    654     c += "&type="+type;
    655     var u = "getInfo.php";
    656     newAjaxRequest(c, u, function(result) {
    657         el.innerHTML = result.responseText;
    658     }, true);
    659 }
     690
    660691
    661692function savePipeline (confirmSave) {
     
    784815
    785816// Temp function that creates a dummy question to test the insertNewQuestions function.
     817// NOTE: CAN BE REMOVED!
    786818function debug_addQuestion() {
    787819    // Derp, natuurlijk werkt de addQuestion call niet twee keer. Hij creeert twee keer exact hetzelfde object. Bottom line: het werkt. Nu de editing code voor deze questions gaan schrijven!
     
    803835
    804836// Temp function that articially switches content type when the page is already loaded, to easily test layout changes and content flow.
     837// NOTE: CAN BE REMOVED!
    805838function debug_switchType() {
    806839    var content = ge("seqContent");
Note: See TracChangeset for help on using the changeset viewer.