Changeset 188 for Dev/trunk/js
- Timestamp:
- 12/16/11 16:22:19 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/js/sequencerScripts.js
r185 r188 145 145 case "survey": 146 146 sequencer.settings.content.orientation = "vertical"; 147 sequencer.settings.content.width = 800; 148 sequencer.settings.content.height = "auto"; 147 sequencer.settings.content.width = 650; //guesstimated 148 var roomH = screen.availHeight; 149 sequencer.settings.content.height = roomH - 200; 149 150 content.style.width = sequencer.settings.content.width+"px"; 150 151 content.style.height = sequencer.settings.content.height+"px"; … … 179 180 break; 180 181 } 181 182 183 184 185 //console.log(sequencer);186 sequencer.state.updating = false; // Re-enable new actions187 182 } 188 183 … … 258 253 // THIS NEEDS SOME WORK! A LOT OF IT ACTUALLY! 259 254 function updateSequencer_Survey() { 260 //debugger;255 261 256 var content = ge("seqContentWrapper"); 262 257 var requestString, needsUpdating, args; … … 283 278 requestString = "args="+JSON.stringify(args); 284 279 newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){ 285 //debugger;286 280 content.removeChild(loadingGif); 287 281 insertNewObjects(result.responseText, needsUpdating); 282 sequencer.state.loaded = true; 288 283 }, true); 289 284 sequencer.state.loaded = false; … … 293 288 } 294 289 else { 290 295 291 // This means that one or more steps are being added, not an entire pipeline's worth of them 292 debugger; 296 293 needsUpdating = new Array(); 297 294 args = []; 298 295 // Add steps that need updating to the needsUpdating array (index, uid, type). 299 for (var i = 0; i < sequencer.s ession.pipeline.uids.length; i++) {300 if (sequencer.s ession.pipeline.upToDate[i] == true) continue;301 needsUpdating.push(new Array(i, sequencer.s ession.pipeline.uids[i], sequencer.session.pipeline.types[i]));296 for (var i = 0; i < sequencer.survey.questions.uids.length; i++) { 297 if (sequencer.survey.questions.upToDate[i] == true) continue; 298 needsUpdating.push(new Array(i, sequencer.survey.questions.uids[i], "Question")); 302 299 args.push({ 303 uid: sequencer.s ession.pipeline.uids[i],304 type: sequencer.session.pipeline.types[i]300 uid: sequencer.survey.questions.uids[i], 301 type: "Question" 305 302 }); 306 303 } … … 326 323 updateDividers(); 327 324 // End optional 328 } 325 326 } 327 329 328 } 330 329 … … 363 362 } 364 363 } 364 365 // Because updateDividers is always called last, we set updating to false here, so the user can again issue commands to the pipeline 366 sequencer.state.updating = false; // Re-enable new actions 365 367 } 366 368 … … 387 389 function insertNewObjects(responseText, needsUpdating) { 388 390 // Container function that calls different insertNewX() functions depending on content type. Called from updateSequencer(). 389 debugger;390 391 var response = JSON.parse(responseText); 391 392 // For now I assume that only one type of element can be displayed in the editor at one time. Therefore, the type of response[0] is the type of all elements of response. … … 394 395 insertNewSteps(response, needsUpdating); 395 396 break; 396 case " question":397 case "survey": 397 398 insertNewQuestions(response, needsUpdating); 398 399 break; … … 411 412 412 413 newAjaxRequest(c, u, function(result) { 413 debugger;414 414 sequencer.survey.questions.uids.push(removeNL(result.responseText)); 415 415 sequencer.survey.questions.upToDate.push(false); … … 517 517 function insertNewQuestions(response, needsUpdating) { 518 518 //Code that inserts or replaces new object displays in the sequencer. Question version. 519 520 519 var content = ge("seqContentWrapper"); 521 520 // Loop through returned question objects … … 566 565 controlsDiv.appendChild(editButton); 567 566 controlsDiv.appendChild(removeButton); 567 frameDiv.addEventListener("click", function(){ 568 clickStep(this.id); 569 }, false); 568 570 frameDiv.appendChild(controlsDiv); 569 571 570 572 // We now have a full question display DIV contained in the frameDiv variable. We should now add this to the sequencer content. 573 debugger; 571 574 for (var j = needsUpdating.length - 1; j >= 0; j--) { 572 575 if (needsUpdating[j][1] != response[i].uid) continue; 573 576 if (needsUpdating[j][0] > sequencer.state.numSteps-1) { 574 577 content.appendChild(frameDiv); 578 sequencer.state.numSteps++; 575 579 } 576 580 else { 577 581 content.replaceChild(frameDiv, content.childNodes[needsUpdating[j][0]*2]); 578 582 } 579 sequencer.state.numSteps++; 580 } 581 } 583 sequencer.survey.questions.upToDate[needsUpdating[j][0]] = true; 584 585 } 586 } 587 588 sequencer.state.updating = false; //re-enable user commands 582 589 } 583 590 … … 609 616 if (element) { 610 617 addClass(element, "selected"); 611 var type = sequencer.session.pipeline.types[sequencer.session.pipeline.uids.indexOf(uid)]; 612 ajaxInfoRequest(uid, ge("infoPanelContent"), type); 618 var type; 619 switch (sequencer.settings.content.contentType.toLowerCase()) { 620 case "session": 621 type = sequencer.session.pipeline.types[sequencer.session.pipeline.uids.indexOf(uid)]; 622 break; 623 case "survey": 624 type = "Question"; 625 break; 626 default: 627 //Dunno 628 break; 629 } 630 (type != "survey") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/; 613 631 sequencer.state.selectedObject.uid = uid; 614 632 sequencer.state.selectedObject.index = null; //Don't know how to do this yet.
Note: See TracChangeset
for help on using the changeset viewer.