Changeset 153 for Dev/trunk/js


Ignore:
Timestamp:
11/15/11 11:01:31 (13 years ago)
Author:
fpvanagthoven
Message:
 
Location:
Dev/trunk/js
Files:
1 added
1 edited

Legend:

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

    r152 r153  
    5151function selectStep(uid) {
    5252    document.getElementById(uid).addClass("selected");
    53     document.sequencer.controls.selectedStep.value = uid;
     53    var selectedInfo = document.getElementById("selectedStepField");
     54    if (selectedInfo == null) {     // This is the first time a step is selected after a reload of the page, therefore a hidden input field is not yet present.
     55        selectedInfo = document.createElement("input")
     56        selectedInfo.setAttribute("type","hidden");
     57        selectedInfo.setAttribute("id","selectedStepField");
     58        selectedInfo.setAttribute("value",uid);
     59        var hiddenInputFields = document.getElementById("hiddenInputs");
     60        hiddenInputFields.appendChild(selectedInfo);
     61    }
     62    else {      // There already exists a hidden input field with id selectedStepField, therefore we only change the value of this field.
     63        var hiddenInput = document.getElementById("selectedStepField");
     64        hiddenInput.value = uid;
     65    }
    5466}
    5567                                                                           
    5668                                                                           
    57 /*
    58  * ajaxStepRequest gets  the markup for displaying a step in the sequencer from returnStep.php
    59  * Using ajax principle allows for editing of pipeline without constantly refreshing the page.
    60  */
    61 
    62 function ajaxStepRequest(UID) {
    63     var c = "uid="+UID;
    64     var u = "returnStep.php";
    65     newAjaxRequest(c, u, function(result) {
    66         var newDiv = result.responseText;
    67         document.getElementById("seqContent").appendChild(newDiv);
    68     });
    69 }
    70 
    71 function ajaxInfoRequest(id, el) {
    72     var uid = id;
    73     var c = "uid="+uid;
    74     var u = "getInfo.php";
    75     newAjaxRequest(c, u, function(result) {
    76         el.innerHTML = result.responseText;
    77     });
    78 }
    79 
    8069/*
    8170 * This function allows for simple use of AJAX requests.
     
    133122    xml.send(contentString);
    134123}
     124
     125/*
     126 * ajaxStepRequest gets  the markup for displaying a step in the sequencer from returnStep.php
     127 * Using ajax principle allows for editing of pipeline without constantly refreshing the page.
     128 */
     129
     130function ajaxStepRequest(UID) {
     131    var c = "uid="+UID;
     132    var u = "returnStep.php";
     133    newAjaxRequest(c, u, function(result) {
     134        var newDiv = document.createElement("div");
     135        newDiv.innerHTML = result.responseText;
     136        document.getElementById("seqContent").appendChild(newDiv);
     137    });
     138}
     139
     140function ajaxInfoRequest(id, el) {
     141    var uid = id;
     142    var c = "uid="+uid;
     143    var u = "getInfo.php";
     144    newAjaxRequest(c, u, function(result) {
     145        el.innerHTML = result.responseText;
     146    });
     147}
    135148                           
    136149
     150
     151
     152
     153
     154
    137155function drawSteps() {
    138     var sequencer = document.getElementById("sequencer");
    139     var seqContent = document.getElementById("seqContent");
    140                
    141     // first delete all current children of seqContent (to reset the sequencer).
    142     while (seqContent.childNodes.length > 0) {
    143         var step = seqContent.childNodes[0];
    144         step.parentNode.removeChild(step);
    145     }
    146                
    147     // get pipeline contents from hidden form inputs.
    148     var pipeline = sequencer.controls.pipeline.value;
    149     var pipeline = pipeline.split(", ");
    150                
     156    var content = document.getElementById("seqContent");
     157    var pipeline = document.getElementById("pipelineStringField").value;
     158    var copy = pipeline;
     159    pipeline = copy.split(",");
     160   
    151161    // then do an xmlhttp request for each step to be added to the sequencer
    152162    var numberOfSteps = pipeline.length;
    153     for (var i = 0; i > numberOfSteps; i++) {
     163    for (var i = 0; i < numberOfSteps; i++) {
    154164        ajaxStepRequest(pipeline[i]);
     165        if (i < (numberOfSteps-1)) {
     166            ajaxStepRequest("divider");
     167        }
    155168    }
     169   
    156170               
    157171}
    158172
     173function updatePipelineHidden (pipelineString) {
     174   
     175}
     176
     177
Note: See TracChangeset for help on using the changeset viewer.