Changeset 237 for Dev/branches/jos-branch/js/sequencerScripts.js
- Timestamp:
- 01/17/12 18:17:51 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/jos-branch/js/sequencerScripts.js
r233 r237 123 123 } 124 124 125 function setSequencerSize() { 126 var seqContent = ge("seqContent"); 127 switch (sequencer.settings.content.orientation.toLowerCase()) { 128 case "vertical": 129 var availHeight = window.innerHeight; 130 var yOffset = getPos(seqContent).Y; 131 var bottomControlsHeight = 36; 132 var bottomMargin = 12; 133 sequencer.settings.content.height = (availHeight - yOffset - bottomControlsHeight - bottomMargin); 134 sequencer.settings.content.width = 665; 135 seqContent.style.height = sequencer.settings.content.height+"px"; 136 seqContent.style.width = sequencer.settings.content.width+"px"; 137 addClass(seqContent, "vertical"); 138 break; 139 case "horizontal": 140 sequencer.settings.content.width = 800; 141 sequencer.settings.content.height = 125; 142 seqContent.style.height = sequencer.settings.content.height+"px"; 143 seqContent.style.width = sequencer.settings.content.width+"px"; 144 addClass(seqContent, "horizontal"); 145 break; 146 default: 147 break; 148 } 149 } 150 125 151 function initSequencer() { 126 152 // Called from loadSequencer(). Sets sequencer.settings properties depending on content type and values passed by PHP in hidden fields (currently only one), then removes these fields. … … 129 155 // load settings fields first 130 156 var fContentType = ge("sContentTypeField"); 131 var content = ge("seqContent");132 //sequencer.settings.content.contentType = fContentType.value.toLowerCase();133 157 sequencer.settings.content.contentType = fContentType.value; 134 158 //Then select settings from a few presets 135 136 159 switch (sequencer.settings.content.contentType.toLowerCase()) { 137 160 case "session": 138 161 sequencer.settings.content.orientation = "horizontal"; 139 sequencer.settings.content.width = 800;140 sequencer.settings.content.height = 125;141 content.style.width = sequencer.settings.content.width+"px";142 content.style.height = sequencer.settings.content.height+"px";143 addClass(content, "horizontal");144 162 break; 145 163 case "survey": 146 164 sequencer.settings.content.orientation = "vertical"; 147 sequencer.settings.content.width = 650; //guesstimated148 var roomH = screen.availHeight;149 sequencer.settings.content.height = roomH - 200;150 content.style.width = sequencer.settings.content.width+"px";151 content.style.height = sequencer.settings.content.height+"px";152 addClass(content, "vertical");153 165 break; 154 166 default: … … 156 168 } 157 169 fContentType.parentNode.parentNode.removeChild(fContentType.parentNode); 170 171 window.addEventListener("load", setSequencerSize, true); 158 172 } 159 173 … … 230 244 requestString = "args="+JSON.stringify(args); 231 245 newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){ 232 console.log(result.responseText);246 //console.log(result.responseText); 233 247 insertNewObjects(result.responseText, needsUpdating); 234 248 }, true); … … 279 293 requestString = "args="+JSON.stringify(args); 280 294 newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){ 281 console.log(result.responseText);295 //console.log(result.responseText); 282 296 content.removeChild(loadingGif); 283 297 insertNewObjects(result.responseText, needsUpdating); … … 392 406 //console.log(responseText); 393 407 // Container function that calls different insertNewX() functions depending on content type. Called from updateSequencer(). 394 console.log(responseText);408 //console.log(responseText); 395 409 var response = JSON.parse(responseText); 396 410 // 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. … … 416 430 417 431 newAjaxRequest(c, u, function(result) { 418 console.log(result.responseText);432 //console.log(result.responseText); 419 433 sequencer.survey.questions.uids.push(removeNL(result.responseText)); 420 434 sequencer.survey.questions.upToDate.push(false); … … 434 448 */ 435 449 if (!response || !response.length > 0) return; 436 console.log(response);450 //console.log(response); 437 451 438 452 var content = ge("seqContentWrapper"); … … 524 538 525 539 function insertNewQuestions(response, needsUpdating) { 540 //TODO: QuestionDisplay ook classbased maken zoals de questionEditor? 541 526 542 //Code that inserts or replaces new object displays in the sequencer. Question version. 527 543 var content = ge("seqContentWrapper"); … … 571 587 removeButton.className = "smallButton"; 572 588 editButton.addEventListener("click", function(e){ 573 alert('Editing not yet supported!'); 589 var targ; 590 if (!e) e = window.event; 591 if (e.target) targ = e.target; 592 else if (e.srcElement) targ = e.srcElement; 593 594 do { 595 targ = targ.parentNode; 596 } while (!hasClass(targ, "question")); 597 598 questionEditor.editQuestion(targ.id); 599 e.stopPropagation(); 574 600 }, false); 575 601 removeButton.addEventListener("click", function(e){ 576 602 alert('Removing not yet supported!'); 603 e.stopPropagation(); 577 604 }, false); 578 605 controlsDiv.appendChild(editButton); … … 596 623 } 597 624 else { 598 content.replaceChild(frameDiv, content.childNodes[needsUpdating[j][0]*2]); 625 if (content.childNodes[needsUpdating[j][0]*2]) { 626 content.replaceChild(frameDiv, content.childNodes[needsUpdating[j][0]*2]); 627 } 628 else { 629 content.appendChild(frameDiv); 630 // HACK TIME! 631 for (var s = 0; s < content.childNodes.length; s++) { 632 if (hasClass(content.childNodes[s], "loading")) { 633 content.childNodes[s].parentNode.removeChild(content.childNodes[s]); 634 } 635 } 636 // Serieus, dit moet beter... 637 } 599 638 } 600 639 sequencer.survey.questions.upToDate[needsUpdating[j][0]] = true; … … 622 661 request.questions.uids = sequencer.survey.questions.uids; 623 662 requestString = "args="+JSON.stringify(request); 624 console.log(request);663 //console.log(request); 625 664 newAjaxRequest(requestString, url, function(result){ 626 665 console.log(result.responseText); … … 658 697 function selectStep(uid) { 659 698 // Called from clickStep(), manages CSS class assignment and updating of state variables. Also calls for info panel update. 660 699 debugger; 661 700 var element = ge(uid); 662 701 if (element) { … … 674 713 break; 675 714 } 676 (type != " survey") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/;715 (type != "Question") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/; 677 716 sequencer.state.selectedObject.uid = uid; 678 717 sequencer.state.selectedObject.index = null; //Don't know how to do this yet. … … 718 757 requestString += "&sessionUid="; 719 758 requestString += sequencer.session.uid; 720 console.log(requestString);759 //console.log(requestString); 721 760 newAjaxRequest(requestString, "savesession.php", function(result){ 722 console.log(result.responseText);723 }, true);761 //console.log(result.responseText); 762 }, true); 724 763 } 725 764
Note: See TracChangeset
for help on using the changeset viewer.