- Timestamp:
- 11/15/11 16:25:01 (13 years ago)
- Location:
- Dev/trunk
- Files:
-
- 2 added
- 5 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/Toolbox.php
r144 r154 20 20 <div class="title">Toolbox</div> 21 21 <p>Add new: </p> 22 <div class="creationButton" onClick="document.toolbox.objectToCreate.value = ' Questionnaire'; SubmitToolbox();"><img src="images/icons/questionnaire.png" class="buttonIcon"/><p>Questionnaire</p></div>22 <div class="creationButton" onClick="document.toolbox.objectToCreate.value = 'Survey'; SubmitToolbox();"><img src="images/icons/survey.png" class="buttonIcon"/><p>Survey</p></div> 23 23 <div class="creationButton" onClick="document.toolbox.objectToCreate.value = 'Application'; SubmitToolbox();"><img src="images/icons/application.png" class="buttonIcon"/><p>Application</p></div> 24 24 <div class="creationButton" onClick="document.toolbox.objectToCreate.value = 'Dashboard'; SubmitToolbox();"><img src="images/icons/dashboard.png" class="buttonIcon"/><p>Dashboard</p></div> -
Dev/trunk/classes/pipelineSequencer.php
r153 r154 27 27 $stringPipeline = rtrim($stringPipeline, ","); 28 28 ?> 29 <br /><form name="sequencer " action="pipelineEditor.php" method="post">29 <br /><form name="sequencerForm" action="pipelineEditor.php" method="post"> 30 30 <fieldset id="sequencer"> 31 31 <div class="title">Name: <?php echo $this->loadedSession->title; ?> </div> 32 32 33 <div id="seqContent"> 34 35 </div> 33 <div id="seqContent"></div> 36 34 37 35 <div id="controls"> … … 43 41 <input type="checkbox" name="confirmClear" onChange="IsCheckEnabled(this, document.sequencer.clearPipeline);" />Really clear? 44 42 </div> 45 <div id="hidde Inputs">43 <div id="hiddenInputs"> 46 44 <input type="hidden" name="selectedStep" id="selectedStepField" value="" /> 47 <input type="hidden" name="pipelineString" id="pipelineStringField" value="123,456 ,123" />45 <input type="hidden" name="pipelineString" id="pipelineStringField" value="123,456" /> 48 46 </div> 49 47 </fieldset> … … 66 64 public function Javascript() { 67 65 $pipelineString = "ERROR"; 68 66 69 67 echo "<!--$pipelineString-->"; 70 71 68 ?> 72 69 <script type="text/javascript" src="js/sequencerScripts.js"></script> … … 90 87 if (count($sessionResults) > 0) { 91 88 $this->loadedSession = $sessionResults[0]; 92 } else { 89 } else { //No session with that UID found in database! 93 90 die("Invalid session!"); 94 91 } 95 92 } 96 93 94 public function HandlePostData() { 95 if (isset($_POST['editSelected'])) { 96 if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) { 97 redirect("editredirect.php"); 98 } 99 } 100 101 if (isset($_POST['moveSelectedLeft'])) { 102 if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) { 103 MoveStep($_POST['selectedStep'], -1); 104 } 105 } 106 107 if (isset($_POST['moveSelectedRight'])) { 108 if (isset($_POST['selectedStep']) && !empty($_POST['selectedStep'])) { 109 MoveStep($_POST['selectedStep'], 1); 110 } 111 } 112 113 if (isset($_POST['objectToCreate']) && !empty($_POST['objectToCreate'])) { 114 switch (strtolower($_POST['objectToCreate'])) { 115 case "survey": 116 redirect("createsurvey.php"); 117 break; 118 case "application": 119 redirect("createapplication.php"); 120 break; 121 case "dashboard": 122 redirect("createdashboard.php"); 123 break; 124 default: 125 // Er is iets fout gegaan, want er is geen valid type meegegeven! 126 break; 127 } 128 } 129 } 130 131 // Dit is een pure php versie. Deze slaat nog niet op in de Database, en reageert nog niet op 132 public function MoveStep($uid, $direction) { 133 $newSession = $this->loadedSession; 134 135 for ($i = 0; $i < count($newSession->pipeline); $i++) { 136 if ($newSession->pipeline[i]->uid == $uid) { 137 $temp = $newSession->pipeline[i]; 138 $newSession->pipeline[i] = $newSession->pipeline[i + $direction]; 139 $newSession->pipeline[i + $direction] = $newSession->pipeline[i]; 140 break; 141 } 142 } 143 144 $this->loadedSession = $newSession; 145 } 146 97 147 } 98 148 ?> -
Dev/trunk/css/awesome.css
r153 r154 668 668 669 669 .displayStep.selected { 670 background-color: rgba(255, 255, 255, 0.5); 670 -moz-box-shadow: 0 0 50px #FFF; 671 -webkit-box-shadow: 0 0 50px #FFF; 672 box-shadow: 0 0 50px #FFF; 673 671 674 } 672 675 -
Dev/trunk/js/sequencerScripts.js
r153 r154 32 32 33 33 function hasClass(ele,cls) { 34 return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); 34 if (ele.className) 35 return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); 35 36 } 36 37 … … 50 51 51 52 function selectStep(uid) { 52 document.getElementById(uid).addClass("selected"); 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); 53 var nodes = document.getElementById("seqContent").childNodes; 54 for (var i = 0; i < nodes.length; i++) { //loop through childNodes. Skip first node (whitespace) 55 //debugger; 56 if (hasClass(nodes[i], "displayStep")) { //check if current childNode is a displayStep, not divider or text. 57 if (nodes[i].id == uid) { 58 addClass(nodes[i], "selected"); 59 } 60 else { 61 removeClass(nodes[i], "selected"); 62 } 63 } 61 64 } 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 } 65 66 // Update selected step field with uid of currently selected step. 67 var selectedStepField = document.getElementById("selectedStepField"); 68 selectedStepField.value = uid; 69 66 70 } 67 71 … … 123 127 } 124 128 129 125 130 /* 126 131 * ajaxStepRequest gets the markup for displaying a step in the sequencer from returnStep.php … … 128 133 */ 129 134 130 function ajaxStepRequest(UID ) {131 var c = "uid ="+UID;135 function ajaxStepRequest(UIDS) { 136 var c = "uids="+UIDS; 132 137 var u = "returnStep.php"; 133 138 newAjaxRequest(c, u, function(result) { 134 var newDiv = document.createElement("div"); 135 newDiv.innerHTML = result.responseText; 136 document.getElementById("seqContent").appendChild(newDiv); 139 document.getElementById("seqContent").innerHTML = result.responseText; 137 140 }); 138 141 } … … 156 159 var content = document.getElementById("seqContent"); 157 160 var pipeline = document.getElementById("pipelineStringField").value; 158 var copy = pipeline; 159 pipeline = copy.split(","); 160 161 // then do an xmlhttp request for each step to be added to the sequencer 162 var numberOfSteps = pipeline.length; 163 for (var i = 0; i < numberOfSteps; i++) { 164 ajaxStepRequest(pipeline[i]); 165 if (i < (numberOfSteps-1)) { 166 ajaxStepRequest("divider"); 167 } 168 } 169 170 161 pipeline = pipeline.replace(/,/g , ",divider,"); //regex search for commas, global (repeat), to represent them with visual dividers. 162 ajaxStepRequest(pipeline); 171 163 } 172 164 … … 174 166 175 167 } 176 177 -
Dev/trunk/pipelineEditor.php
r153 r154 3 3 4 4 if (!isset($_SESSION['username'])) { 5 $_SESSION['message'] = "You were redirected here because your session timed out or you used an invalid link.";6 5 redirect('index.php'); 7 6 } 8 7 9 8 $sequencer = new PipelineSequencer(); 10 $sequencer->GetFromDB($_SESSION['currentSession']); 9 $sequencer->GetFromDB($_SESSION['currentSession']); //load session into php part of the sequencer 10 $sequencer->HandlePostData(); 11 11 ?> 12 12 -
Dev/trunk/returnStep.php
r153 r154 10 10 11 11 // Check if calling script actually passed a uid to use 12 if (isset($_POST['uid '])) {13 if (!empty($_POST['uid '])) {14 $uid = $_POST['uid'];12 if (isset($_POST['uids'])) { 13 if (!empty($_POST['uids'])) { 14 $uids = $_POST['uids']; 15 15 } else { 16 echo "Invalid UID passed!";16 echo "Invalid UIDs passed!"; 17 17 } 18 18 } else { … … 20 20 } 21 21 22 $sUids = explode(",", $uids); 23 $response = ""; 24 $dbi = new DatabaseInterface(); 25 foreach ($sUids as $uid) { 26 $response .= processUid($uid); 27 } 28 29 echo $response; 22 30 23 31 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. 32 /* 33 * ProcessUid needs to be changed once all the object classes are fixed. The '123', '456' test cases are not functional and are for testing puroses only. 34 * Additional onclick events for selecting objects would need to be added as well. 35 */ 41 36 42 37 43 $dbi = new DatabaseInterface(); 38 39 function processUid($uid) { 40 if ($uid == "123") { // test case for when steps aren't actually working 41 $imageURL = "images/icons/unknowntype.png"; 42 $responsePart = '<div class="displayStep" id="' . "123" . '" onClick="selectStep(this.id);"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . "123" . '</div>'; 43 return $responsePart; 44 } else if ($uid == '456') { 45 $imageURL = "images/icons/unknowntype.png"; 46 $responsePart = '<div class="displayStep" id="' . "456" . '" onClick="selectStep(this.id);"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . "456" . '</div>'; 47 return $responsePart; 48 } else { 49 50 51 if ($uid == "divider") { //a divider has been requested instead of a displaystep 52 $responsePart = '<div class="divider"></div>'; 53 return $responsePart; 54 } else { // an actual step has been requested. 55 44 56 //Check in order: survey, application, dashboard. 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 } 55 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"; 57 $result = null; 58 $resultType = null; 59 $surveys = $dbi->get("Survey", array("uid" => $uid)); 60 if (count($surveys) > 0) { 61 if ($surveys[0] != null) { 62 // A survey exists with the given UID! 63 $result = $surveys[0]; 64 $resultType = "Survey"; 63 65 } 64 66 } 65 }66 67 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"; 68 if (result != null) { 69 $applications = $dbi->get("Application", array("uid" => $uid)); 70 if (count($applications) > 0) { 71 if ($applications[0] != null) { 72 // An application exists with the given UID! 73 $result = $applications[0]; 74 $resultType = "Application"; 75 } 74 76 } 75 77 } 76 } 78 79 if (result != null) { 80 $dashboards = $dbi->get("Dashboard", array("uid" => $uid)); 81 if (count($dashboards) > 0) { 82 if ($dashboards[0] != null) { 83 // A dashboard exists with the given UID! 84 $result = $dashboards[0]; 85 $resultType = "Dashboard"; 86 } 87 } 88 } 77 89 78 90 // 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 {91 if ($result == null || $resultType == null) { 92 echo "Non-existing UID passed!"; 93 } else { 82 94 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 }95 // set relevant variables based on the type and properties of the step in question (currently stored in $result) 96 switch (strtolower($resultType)) { 97 case "survey": 98 $imageURL = "images/icons/survey.png"; 99 break; 100 case "dashboard": 101 $imageURL = "images/icons/dashboard.png"; 102 break; 103 case "application": 104 $imageURL = "images/icons/application.png"; 105 break; 106 default: 107 $imageURL = "images/icons/unknowntype.png"; 108 break; 109 } 98 110 99 111 //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; 112 $responsePart = '<div class="displayStep" id="' . $result->uid . '" onClick="selectStep(this.id);"><div class="displayStepIcon"><img src="' . $imageURL . '" /></div>' . $result->name . '</div>'; 113 return $responsePart; 114 } 102 115 } 103 116 } 104 117 } 118 105 119 ?>
Note: See TracChangeset
for help on using the changeset viewer.