- Timestamp:
- 11/15/11 11:01:31 (13 years ago)
- Location:
- Dev/trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/pipelineSequencer.php
r152 r153 21 21 22 22 public function init() { 23 $stringPipeline = ""; 24 foreach ($this->loadedSession->pipeline as $object) { 25 $stringPipeline .= "$object->uid,"; 26 } 27 $stringPipeline = rtrim($stringPipeline, ","); 23 28 ?> 24 29 <br /><form name="sequencer" action="pipelineEditor.php" method="post"> … … 27 32 28 33 <div id="seqContent"> 29 <?php $this->DrawSteps(); ?> 34 30 35 </div> 31 36 … … 37 42 <input type="submit" name="clearPipeline" value="Clear pipeline" class="surveyButton dis" disabled="true"/> 38 43 <input type="checkbox" name="confirmClear" onChange="IsCheckEnabled(this, document.sequencer.clearPipeline);" />Really clear? 39 <input type="hidden" name="selectedStep" /> 40 <input type="hidden" name="numSteps" /> 41 <input type="hidden" name="pipeline" /> 44 </div> 45 <div id="hiddeInputs"> 46 <input type="hidden" name="selectedStep" id="selectedStepField" value="" /> 47 <input type="hidden" name="pipelineString" id="pipelineStringField" value="123,456,123" /> 42 48 </div> 43 49 </fieldset> … … 47 53 48 54 public function DrawSteps() { 49 55 // Use AJAX to draw visual representations of step objects in a pipeline 56 // <TODO> Implement parameters such as screen size in the drawing of objects </TODO> 57 ?> 58 <script type="text/javascript"> 59 drawSteps(); 60 </script> 61 62 63 <?php 50 64 } 51 65 52 private function Javascript() { 66 public function Javascript() { 67 $pipelineString = "ERROR"; 68 69 echo "<!--$pipelineString-->"; 70 53 71 ?> 54 72 <script type="text/javascript" src="js/sequencerScripts.js"></script> 55 73 <script type="text/javascript" src="js/jquery.js"></script> 74 <script type="text/javascript"> 75 $(document).ready(function() { 76 drawSteps(); 77 }); 78 </script> 56 79 <?php 57 80 } … … 63 86 redirect("selectSession.php"); 64 87 } 65 88 66 89 $sessionResults = $dbi->get("Session", array("uid" => $currentSession)); 67 90 if (count($sessionResults) > 0) { 68 91 $this->loadedSession = $sessionResults[0]; 69 } 70 else { 92 } else { 71 93 die("Invalid session!"); 72 94 } -
Dev/trunk/css/awesome.css
r150 r153 627 627 } 628 628 629 #sequencer .seqContent {629 #sequencer #seqContent { 630 630 height: 9em; 631 631 overflow-x: scroll; … … 687 687 } 688 688 689 .seqContent .divider {689 #seqContent .divider { 690 690 width: 10px; 691 691 height: 50px; -
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 -
Dev/trunk/pipelineEditor.php
r152 r153 21 21 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 22 22 <title></title> 23 <?php new StyleSheet("awesome"); ?>24 <script type="text/javascript" src="js/menu.js"></script>25 <script type="text/javascript" src="js/jquery.jps"></script>26 <script type="text/javascript" src="js/sequencerScripts.js"></script>23 <?php new StyleSheet("awesome"); 24 $sequencer->Javascript(); 25 ?> 26 27 27 </head> 28 28 <body> … … 36 36 <?php $toolbox = new Toolbox(); ?> 37 37 </div> 38 38 39 </body> 39 40 </html> -
Dev/trunk/returnStep.php
r151 r153 1 <!--2 To change this template, choose Tools | Templates3 and open the template in the editor.4 -->5 1 <?php 2 3 require 'classes/master.php'; //should be at top of every page 6 4 /* 7 5 * Return the HTML markup for visualisation of an object in a pipeline, to be used in the PipelineSequencer.php … … 23 21 24 22 25 $dbi = new DatabaseInterface(); 23 24 if ($uid == "123") { // test case for when steps aren't actually working 25 $imageURL = "images/icons/unknowntype.png"; 26 $response = '<div class="displayStep" id="' . "123" . '"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . "123" . '</div>'; 27 echo $response; 28 } 29 else if($uid == '456') { 30 $imageURL = "images/icons/unknowntype.png"; 31 $response = '<div class="displayStep" id="' . "456" . '"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . "456" . '</div>'; 32 echo $response; 33 } 34 else { 35 36 37 if ($uid == "divider") { //a divider has been requested instead of a displaystep 38 $response = '<div class="divider"></div>'; 39 echo $response; 40 } else { // an actual step has been requested. 41 42 43 $dbi = new DatabaseInterface(); 26 44 //Check in order: survey, application, dashboard. 27 $result = null;28 $resultType = null;29 $surveys = $dbi->get("Survey", array("uid" => $uid));30 if (count($surveys) > 0) {31 if ($surveys[0] != null) {32 // A survey exists with the given UID!33 $result = $surveys[0];34 $resultType = "Survey";35 }36 }45 $result = null; 46 $resultType = null; 47 $surveys = $dbi->get("Survey", array("uid" => $uid)); 48 if (count($surveys) > 0) { 49 if ($surveys[0] != null) { 50 // A survey exists with the given UID! 51 $result = $surveys[0]; 52 $resultType = "Survey"; 53 } 54 } 37 55 38 if (result != null) { 39 $applications = $dbi->get("Application", array("uid" => $uid)); 40 if (count($applications) > 0) { 41 if ($applications[0] != null) { 42 // An application exists with the given UID! 43 $result = $applications[0]; 44 $resultType = "Application"; 56 if (result != null) { 57 $applications = $dbi->get("Application", array("uid" => $uid)); 58 if (count($applications) > 0) { 59 if ($applications[0] != null) { 60 // An application exists with the given UID! 61 $result = $applications[0]; 62 $resultType = "Application"; 63 } 64 } 65 } 66 67 if (result != null) { 68 $dashboards = $dbi->get("Dashboard", array("uid" => $uid)); 69 if (count($dashboards) > 0) { 70 if ($dashboards[0] != null) { 71 // A dashboard exists with the given UID! 72 $result = $dashboards[0]; 73 $resultType = "Dashboard"; 74 } 75 } 76 } 77 78 // If result is still null at this point, the passed UID does not refer to an existing object! 79 if ($result == null || $resultType == null) { 80 echo "Non-existing UID passed!"; 81 } else { 82 83 // set relevant variables based on the type and properties of the step in question (currently stored in $result) 84 switch (strtolower($resultType)) { 85 case "questionnaire": 86 $imageURL = "images/icons/questionnaire.png"; 87 break; 88 case "dashboard": 89 $imageURL = "images/icons/dashboard.png"; 90 break; 91 case "application": 92 $imageURL = "images/icons/application.png"; 93 break; 94 default: 95 $imageURL = "images/icons/unknowntype.png"; 96 break; 97 } 98 99 //echo out the HTML markup 100 $response = '<div class="displayStep" id="' . $result->uid . '"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . $result->name . '</div>'; 101 echo $response; 45 102 } 46 103 } 47 104 } 48 49 if (result != null) {50 $dashboards = $dbi->get("Dashboard", array("uid" => $uid));51 if (count($dashboards) > 0) {52 if ($dashboards[0] != null) {53 // A dashboard exists with the given UID!54 $result = $dashboards[0];55 $resultType = "Dashboard";56 }57 }58 }59 60 // If result is still null at this point, the passed UID does not refer to an existing object!61 if ($result == null || $resultType == null) {62 echo "Non-existing UID passed!";63 } else {64 65 // set relevant variables based on the type and properties of the step in question (currently stored in $result)66 switch (strtolower($resultType)) {67 case "questionnaire":68 $imageURL = "images/icons/questionnaire.png";69 break;70 case "dashboard":71 $imageURL = "images/icons/dashboard.png";72 break;73 case "application":74 $imageURL = "images/icons/application.png";75 break;76 default:77 $imageURL = "images/icons/unknowntype.png";78 break;79 }80 81 //echo out the HTML markup82 $response = '<div class="displayStep" id="' . $result->uid . '"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . $result->name . '</div>';83 echo $response;84 }85 105 ?> -
Dev/trunk/selectSession.php
r152 r153 64 64 </head> 65 65 <body> 66 <form action="selectSession.php" method="POST"> 67 <fieldset name="selectionMenu"> 68 <!-- onchange van volgende select linkt deze aan de ajax-based info panel, script staat in sequencerScripts.js --> 69 <select name="sessionUID" style="float: left;" onChange="ajaxInfoRequest(this.value, document.getElementById('sessionDescription'));"> 70 <?php 71 foreach ($sessions as $session) { 72 echo '<option value="' . $session->uid . '">' . $session->title . '</option>' . "\n"; 73 } 74 ?> 75 </select> 76 <br /><br /> 77 <input type="text" name="newSessionName" value="Name..." style="float: left;" /><br /> 78 <input type="submit" name="createSession" value="Create new session" class="surveybutton" style="float: left;" /> 79 <input type="submit" name="editSession" value="Edit session" class="surveybutton" style="float: left;" /> 80 <input type="submit" name="deleteSession" value="Delete session" class="surveybutton" style="float: left;" /> 81 <br /><br /><br /> 82 <div id="errorDisplay"><?php 83 if (isset($errorMessage)) { 84 foreach ($errorMessage as $message) { 85 echo $message; 66 <div id="header"> 67 <?php new Logo(); ?> 68 </div> 69 70 <div id="wrapper"> 71 <div id="content"> 72 <form action="selectSession.php" method="POST"> 73 <fieldset name="selectionMenu"> 74 <!-- onchange van volgende select linkt deze aan de ajax-based info panel, script staat in sequencerScripts.js --> 75 <select name="sessionUID" style="float: left;" onChange="ajaxInfoRequest(this.value, document.getElementById('sessionDescription'));"> 76 <?php 77 foreach ($sessions as $session) { 78 echo '<option value="' . $session->uid . '">' . $session->title . '</option>' . "\n"; 86 79 } 87 } 88 ?></div> 89 </fieldset> 90 <fieldset id="sessionDescription"> 91 Info goes here: 92 </fieldset> 93 </form> 80 ?> 81 </select> 82 <br /><br /> 83 <input type="text" name="newSessionName" value="Name..." style="float: left;" /><br /> 84 <input type="submit" name="createSession" value="Create new session" class="surveybutton" style="float: left;" /> 85 <input type="submit" name="editSession" value="Edit session" class="surveybutton" style="float: left;" /> 86 <input type="submit" name="deleteSession" value="Delete session" class="surveybutton" style="float: left;" /> 87 <br /><br /><br /> 88 <div id="errorDisplay"><?php 89 if (isset($errorMessage)) { 90 foreach ($errorMessage as $message) { 91 echo $message; 92 } 93 } 94 ?></div> 95 </fieldset> 96 <fieldset id="sessionDescription"> 97 Info goes here: 98 </fieldset> 99 </form> 100 </div> 101 </div> 94 102 </body> 95 103 </html> -
Dev/trunk/surveycreation.php
r95 r153 5 5 redirect('index.php'); 6 6 7 $savedSurvey = null; 8 $timeStamp = null; 7 if (isset($_POST['submit'])) { 8 if (isset($_POST['surveyName'])) { 9 $survey = new Survey(null, $_POST['surveyName'], "Thijs", null); 10 $dbi = new DatabaseInterface(); 11 $dbi->set($survey); 12 } 13 } 9 14 10 15 16 17 18 /* 19 $savedSurvey = null; 20 $timeStamp = null; 21 */ 22 11 23 /* LOAD SURVEY */ 12 if (isset($_POST['UID'])) { 13 $surveyID = $_POST['UID']; 14 $surveyDBI = new SurveyCreationDatabaseInterface($surveyID); 15 $info = $surveyDBI->getSurveyInfo(); 24 /* 25 if (isset($_POST['UID'])) { 26 $surveyID = $_POST['UID']; 27 $surveyDBI = new SurveyCreationDatabaseInterface($surveyID); 28 $info = $surveyDBI->getSurveyInfo(); 16 29 17 $savedSurvey = Survey::getSurvey($info); 18 } 30 $savedSurvey = Survey::getSurvey($info); 31 } 32 */ 33 /* AUTOSAVE */ 19 34 20 /* AUTOSAVE */21 else if (isset($_POST['timeStamp'])) {22 35 /* 36 else if (isset($_POST['timeStamp'])) { 37 $timeStamp = $_POST['timeStamp']; 23 38 24 25 26 27 28 29 30 31 32 39 echo 'This is what gets sent:'; 40 var_dump($_POST); 41 echo '<br/><br/>'; 42 $surveyDBI = new SurveyCreationDatabaseInterface($_POST['surveyID']); 43 $surveyDBI->setSurveyInfo($_POST,$_SESSION); 44 $info = $surveyDBI->getSurveyInfo(); 45 echo '<br/><br/>'; 46 echo 'This is what I get back:'; 47 var_dump($info); 33 48 34 $savedSurvey = Survey::getSurvey($info); 35 } 49 $savedSurvey = Survey::getSurvey($info); 50 } 51 52 */ 36 53 ?> 37 54 … … 42 59 <head> 43 60 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 44 45 <?php new StyleSheet(); ?>61 <title>Survey Creation</title> 62 <?php new StyleSheet("awesome"); ?> 46 63 </head> 47 64 <body> … … 52 69 53 70 <div id="content"> 54 <?php 55 new SurveyCreationTool($savedSurvey, $timeStamp); 56 ?> 71 <form action="surveycreation.php" method="post"> 72 <fieldset> 73 Name: <input type="text" name="surveyName" /><br /> 74 Uid: <input type="text" name="surveyID" /><br /><br /> 75 <input type="submit" name="submit" value="Make fake survey!" /> 76 </fieldset> 77 </form> 57 78 </div> 58 79 </div>
Note: See TracChangeset
for help on using the changeset viewer.