Changeset 153 for Dev/trunk/js/sequencerScripts.js
- Timestamp:
- 11/15/11 11:01:31 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/js/sequencerScripts.js
r152 r153 51 51 function selectStep(uid) { 52 52 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 } 54 66 } 55 67 56 68 57 /*58 * ajaxStepRequest gets the markup for displaying a step in the sequencer from returnStep.php59 * 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 80 69 /* 81 70 * This function allows for simple use of AJAX requests. … … 133 122 xml.send(contentString); 134 123 } 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 130 function 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 140 function 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 } 135 148 136 149 150 151 152 153 154 137 155 function 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 151 161 // then do an xmlhttp request for each step to be added to the sequencer 152 162 var numberOfSteps = pipeline.length; 153 for (var i = 0; i >numberOfSteps; i++) {163 for (var i = 0; i < numberOfSteps; i++) { 154 164 ajaxStepRequest(pipeline[i]); 165 if (i < (numberOfSteps-1)) { 166 ajaxStepRequest("divider"); 167 } 155 168 } 169 156 170 157 171 } 158 172 173 function updatePipelineHidden (pipelineString) { 174 175 } 176 177
Note: See TracChangeset
for help on using the changeset viewer.