Changeset 168
- Timestamp:
- 11/29/11 17:26:07 (13 years ago)
- Location:
- Dev/trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/Logo.php
r167 r168 17 17 echo '<div id="logo"><a href="index.php">Research Tool</a>'; 18 18 if (isset($_SESSION['username'])) { 19 echo '<a href="index.php" onClick="savePipeline(true);" style=" font-size: 12pt;">Log out</a>';19 echo '<a href="index.php" onClick="savePipeline(true);" style="display:block; font-size: 12px;">Log out</a>'; 20 20 } 21 21 echo '</div>'; -
Dev/trunk/classes/PipelineInfoPanel.php
r167 r168 21 21 Title 22 22 </div> 23 <div id="info Content">24 Info goes here23 <div id="infoPanelContent"> 24 25 25 </div> 26 26 </fieldset> -
Dev/trunk/classes/Toolbox.php
r167 r168 18 18 <form name="toolbox" action="pipelineEditor.php" method="POST"> 19 19 <fieldset id="toolbox"> 20 <div class="fieldsetTitle">Toolbox</div> <br /><br />20 <div class="fieldsetTitle">Toolbox</div> 21 21 <p>Add new: </p> 22 22 <div class="creationButton" onClick="SubmitToolbox('Survey');"><img src="images/icons/survey.png" class="buttonIcon"/><p>Survey</p></div> -
Dev/trunk/classes/pipelineSequencer.php
r167 r168 51 51 <input type="button" id="moveSelectedL" value="< Move" class="surveyButton" onClick="moveStep(-1);" /> 52 52 <input type="button" id="moveSelectedR" value="Move >" class="surveyButton" onClick="moveStep(1);" /> 53 <input type="button" id="editSelected" value="Edit step" class="surveyButton" />53 <input type="button" id="editSelected" value="Edit step" class="surveyButton" onClick="editStep();" /> 54 54 <input type="submit" id="deleteSelected" name="deleteSelected" value="Delete step" class="surveyButton" /> 55 55 <input type="submit" id ="clearPipeline" name="clearPipeline" value="Clear pipeline" class="surveyButton dis" disabled="true"/> 56 56 <input type="checkbox" id="confirmClear" name="confirmClear" onChange="IsCheckEnabled(this, document.getElementById('clearPipeline'));" />Really clear? 57 <input type="button" id="t_saveSession" name="t_saveSession" onClick="savePipeline(true);" value="t_Save_session!" /> 58 <input type="button" id="t_setOOD" name="t_setOOD" onClick="t_setOutOfDate();" value="t_Set_OOD" /> 59 <input type="button" id="t_updateSeq" name="t_updateSeq" onClick="updateSequencer();" value="t_Update_Seq" /> 57 <input type="button" value="debug_save" onClick="savePipeline(true);" /> 60 58 </div> 61 59 <div id="hiddenInputs"> … … 72 70 } 73 71 74 public function DrawSteps() { 75 // Use AJAX to draw visual representations of step objects in a pipeline 76 // <TODO> Implement parameters such as screen size in the drawing of objects </TODO> 77 ?> 78 <script type="text/javascript"> 79 drawSteps(); 80 </script> 81 82 83 <?php 84 } 72 85 73 86 74 public function Javascript() { … … 90 78 <script type="text/javascript"> 91 79 $(document).ready(function() { 92 updateSequencer( );80 updateSequencer(true); // true means it is the first refresh of the page. 93 81 }); 94 82 </script> -
Dev/trunk/css/awesome.css
r167 r168 108 108 font-weight: bold; 109 109 text-align: center; 110 line-height: 2em; 110 padding-top: 15px; 111 /*line-height: 2em;*/ 111 112 text-shadow: #555 0px 0px .2em; 112 113 height: 189px; … … 653 654 text-align: right; 654 655 margin-bottom: -0.5em; 655 float: left;656 float: right; 656 657 } 657 658 … … 799 800 font-size: 1.25em; 800 801 color: #FFF; 801 float: left; 802 display: block; 803 } 802 /*float: left;*/ 803 display: block; 804 clear: right; 805 } 806 807 fieldset p { 808 display: block; 809 } -
Dev/trunk/getInfo.php
r152 r168 3 3 require 'classes/master.php'; //should be at top of every page 4 4 5 /* 6 * Add extra POST variable in functions using this php return, describing object type. 7 * This makes it easier to decide what properties to echo and also to query the database. 8 * (Prevents repetitive session->query->question->application->user->respondent->etc queries!) 9 */ 10 11 if (isset($_POST['uid'])) { 12 if (!empty($_POST['uid'])) { 5 if (isset($_POST['uid']) && isset($_POST['type'])) { 6 if (!empty($_POST['uid']) && !empty($_POST['type'])) { 13 7 $uid = $_POST['uid']; 8 $type = $_POST['type']; 14 9 } else { 15 //$errors[] = "No uid passed!"; 10 //$errors[] = "No uid passed!"; 11 return; 16 12 } 17 13 } else { 18 //$errors[] = "Wrong call, no uid property in POST data!"; 14 //$errors[] = "Wrong call, no uid property in POST data!"; 15 return; 19 16 } 20 17 21 18 $dbi = new DatabaseInterface(); 22 19 23 // For the moment only supports sessions as object to get information for! 24 $results = $dbi->get("Session", array("uid" => $uid)); 20 $results = $dbi->get($type, array("uid" => $uid)); 25 21 26 if (count($results) > 0) { 22 if (count($results) > 0) { // check if DB object exists and assign it to variable 27 23 if ($results[0] != null) { 28 $returnString = ""; 24 $returnString = "<table border='0'>"; 25 $result = $results[0]; 26 } else 27 return; 28 } else 29 return; 29 30 30 $result = $results[0]; 31 $returnString = $returnString . "Title: $result->title. <br />"; 32 $length = count($result->pipeline); 33 $returnString = $returnString . "Number of steps: $length <br />"; 34 $returnString = $returnString . "UID: $uid"; 35 } else { 36 $returnString = "Null error!"; 37 } 38 } else { 39 $returnString = "Non-existing uid!"; 31 switch ($type) { 32 case "Session": 33 $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>"; 34 $returnString .= "<tr><td>Created</td><td>" . $result->datetime->format("H:i:s, d-m-Y") . " by " . $result->creator[0]->name . "</td></tr>"; 35 $cS = 0; $cD = 0; $cA = 0; 36 foreach ($result->pipeline as $step) { 37 switch (get_class($step)){ 38 case "Survey": 39 $cS++; 40 break; 41 case "Application": 42 $cA++; 43 break; 44 case "Dashboard": 45 $cD++; 46 break; 47 default: 48 //derp? 49 break; 50 } 51 } 52 $returnString .= "<tr><td>Number of steps</td><td><ul style='list-style-type: none;'><li style='margin-left: -40px;'>$cS Surveys<li style='margin-left: -40px;'>$cA Applications<li style='margin-left: -40px;'>$cD Dashboards</ul></td></tr>"; 53 break; 54 case "Survey": 55 $returnString .= "<tr> <td>Name</td><td>$result->title</td> </tr>"; 56 $returnString .= "<tr> <td>Creator</td> <td>LOLOL ME!!!</td> </tr>"; 57 $qCount = 0; 58 foreach ($result->questions as $q) { 59 $qCount++; 60 } 61 $returnString .= "<tr> <td>Questions</td> <td>$qCount</td> </tr>"; 62 $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>"; 63 64 break; 65 case "Application": 66 $returnString .= "<tr> <td>Name</td> <td>$result->title</td> </tr>"; 67 $returnString .= "<tr> <td>Location</td> <td>C:/folder_of_awesomeness/epicgame.exe</td> </tr>"; 68 $returnString .= "<tr> <td>Description</td> <td>$result->description</td> </tr>"; 69 break; 70 case "Dashboard": 71 break; 72 case "Respondent": 73 break; 74 case "Question": 75 break; 76 case "Answer": 77 break; 78 default: 79 break; 40 80 } 41 81 82 $returnString .= "</table>"; 42 83 echo $returnString; 43 84 ?> -
Dev/trunk/js/sequencerScripts.js
r167 r168 3 3 * and open the template in the editor. 4 4 */ 5 var timeDiff = { 6 setStartTime:function (){ 7 d = new Date(); 8 time = d.getTime(); 9 }, 10 11 getDiff:function (){ 12 d = new Date(); 13 return (d.getTime()-time); 14 } 15 } 16 17 18 19 5 20 6 21 function IsItemSelected(check, target) { … … 36 51 var pipelineType = document.getElementById("pipelineTypeField"); 37 52 var pipelineUpdated = document.getElementById("pipelineUpdatedField"); 53 document.getElementById("numSteps").value++; 38 54 39 55 newAjaxRequest(c, u, function(result){ … … 70 86 71 87 function selectStep(uid) { 88 /* 89 72 90 var nodes = document.getElementById("seqContentWrapper").childNodes; 73 91 for (var i = 0; i < nodes.length; i++) { //loop through childNodes. Skip first node (whitespace) … … 86 104 } 87 105 } 88 89 // Update selected step field with uid of currently selected step. 106 */ 107 // Hier is een snellere manier voor! 108 var element = document.getElementById(uid); 109 var prevElement = document.getElementById(document.getElementById("selectedStepField").value); 110 111 if (!element || !hasClass(element, "displayStep")) { 112 return; 113 } 114 // misschien nog checks inbouwen of het echt wel een element is? 90 115 var selectedStepField = document.getElementById("selectedStepField"); 91 selectedStepField.value = uid; 92 116 if (!hasClass(element, "selected")) { 117 if (prevElement) { 118 removeClass(prevElement, "selected"); 119 } 120 addClass(element, "selected"); 121 selectedStepField.value = uid; 122 123 var pl = stringToArray(document.getElementById("pipelineStringField").value, ","); 124 var plType = stringToArray(document.getElementById("pipelineTypeField").value, ","); 125 var type = plType[pl.indexOf(uid)]; 126 ajaxInfoRequest(uid, document.getElementById("infoPanelContent"), type); 127 128 129 } 130 else { 131 deselectStep(uid); 132 } 133 134 135 // Update selected step field with uid of currently selected step. 136 137 138 } 139 140 function deselectStep(uid) { 141 var field = document.getElementById("selectedStepField"); 142 field.value = ""; 143 var element = document.getElementById(uid); 144 removeClass(element, "selected"); 145 document.getElementById("infoPanelContent").innerHTML = ""; 93 146 } 94 147 … … 148 201 } 149 202 150 function ajaxInfoRequest(id, el) { 151 var uid = id; 203 function ajaxInfoRequest(uid, el, type) { 152 204 var c = "uid="+uid; 205 c += "&type="+type; 153 206 var u = "getInfo.php"; 154 207 newAjaxRequest(c, u, function(result) { … … 169 222 } 170 223 171 function drawSteps() { 172 173 } 174 175 function updateSequencer() { 224 225 function updateSequencer(firstLoad) { 226 // Load hidden field values 176 227 var plString = document.getElementById("pipelineStringField").value; 177 228 var plTypeString = document.getElementById("pipelineTypeField").value; 178 229 var plUpdatedString = document.getElementById("pipelineUpdatedField").value; 179 180 181 var pl = stringToArray(plString, ","); 182 var plType = stringToArray(plTypeString, ","); 183 var plUpdated = stringToArray(plUpdatedString, ","); 184 185 var count = pl.length; 186 187 document.getElementById("numSteps").value = count; 188 189 for (var i = 0; i < pl.length; i++) { // loop through pipeline contents 190 if (plUpdated[i] == "0") { // if the element is not up to date 191 // first remove the step representation from the sequencer 230 var count = document.getElementById("numSteps").value; 231 232 if (count < 1) { 233 return; 234 } 235 // If this is on page-load time 236 if (firstLoad == true) { 237 requestString = plString.slice(0, -1); 238 requestString = requestString.replace(/,/g, ",divider,"); 239 newAjaxRequest("uids="+requestString, "returnStep.php", function(result) { 192 240 var seqContent = document.getElementById("seqContentWrapper"); 193 var element = document.getElementById(pl[i]); 194 if (element == null) { 195 element = document.createElement("div"); 196 element.name = "placeholder"; 197 seqContent.appendChild(element); 241 seqContent.innerHTML = result.responseText; 242 }, true); 243 244 plUpdatedString = ""; 245 for (var i = 0; i < plString.split(",").length-1; i++) { 246 plUpdatedString += "1,"; 247 } 248 249 document.getElementById("pipelineUpdatedField").value = plUpdatedString; 250 } 251 else { // if not 252 var pl = stringToArray(plString, ","); 253 var plType = stringToArray(plTypeString, ","); 254 var plUpdated = stringToArray(plUpdatedString, ","); 255 256 var count = pl.length; 257 258 document.getElementById("numSteps").value = count; 259 var seqContent = document.getElementById("seqContentWrapper"); 260 if (seqContent.childNodes.length > (2*count)-1) { 261 seqContent.removeChild(seqContent.childNodes[0]); 262 263 } 264 265 266 for (var i = 0; i < pl.length; i++) { // loop through pipeline contents 267 if (plUpdated[i] == "0") { // if the element is not up to date 268 // first remove the step representation from the sequencer 269 //timeDiff.setStartTime(); 270 271 272 // IMPROVISE !!!!!!!!!! 273 var elementByIndex = seqContent.childNodes[2*i]; // works with moved steps 274 var elementById = document.getElementById(pl[i]); // works with ???, not moved steps though... Keeping this in here for future bugfixing. This value is not currently used. 275 var element = elementByIndex; 276 277 278 // END IMPROVISE !!!!!!!!!!!! 279 if (element == null) { 280 element = document.createElement("div"); 281 element.name = "placeholder"; 282 seqContent.appendChild(element); 283 } 284 if (element.nextSibling) { 285 var nextElement = element.nextSibling; 286 } 287 else { 288 var nextElement = document.createElement("div"); 289 nextElement.name = "placeholderNext"; 290 seqContent.appendChild(nextElement); 291 } 292 293 // now request a new step representation and insert it after previousElement 294 var holderDiv = document.createElement("div"); 295 var requestString = "uids="+pl[i]; 296 297 if (plType[i]) { 298 requestString += "&types="+plType[i]; 299 } 300 // globally declare newDiv so it can be passed to the updateDividers function 301 var newDiv; 302 303 newAjaxRequest(requestString, "returnStep.php", function(result) { 304 holderDiv.innerHTML = result.responseText; 305 newDiv = holderDiv.childNodes[1]; 306 seqContent.replaceChild(newDiv, element); 307 if (nextElement.name == "placeholderNext") { 308 seqContent.removeChild(nextElement); 309 } 310 plUpdated[i] = "1"; 311 }, false); 312 313 314 // ALTERNATIVE METHOD TO REPLACECHILD!!! 315 //seqContent.removeChild(element); 316 //seqContent.insertBefore(newDiv, nextElement); 317 318 // Now check if dividers are necessary. 319 320 //alert("INSERT CODE FOR UPDATEDIVIDERS HERE!"); 321 //alert(timeDiff.getDiff()); 322 updateDividers(newDiv); 198 323 } 199 if (element.nextSibling) { 200 var nextElement = element.nextSibling; 201 } 202 else { 203 var nextElement = document.createElement("div"); 204 nextElement.name = "placeholderNext"; 205 seqContent.appendChild(nextElement); 206 } 207 208 // now request a new step representation and insert it after previousElement 209 var holderDiv = document.createElement("div"); 210 var requestString = "uids="+pl[i]; 211 212 if (plType[i]) { 213 requestString += "&types="+plType[i]; 214 } 215 // globally declare newDiv so it can be passed to the updateDividers function 216 var newDiv; 217 218 newAjaxRequest(requestString, "returnStep.php", function(result) { 219 holderDiv.innerHTML = result.responseText; 220 newDiv = holderDiv.childNodes[1]; 221 seqContent.replaceChild(newDiv, element); 222 if (nextElement.name == "placeholderNext") { 223 seqContent.removeChild(nextElement); 224 } 225 plUpdated[i] = "1"; 226 }, false); 227 228 229 // ALTERNATIVE METHOD TO REPLACECHILD!!! 230 //seqContent.removeChild(element); 231 //seqContent.insertBefore(newDiv, nextElement); 232 233 // Now check if dividers are necessary. 234 235 //alert("INSERT CODE FOR UPDATEDIVIDERS HERE!"); 236 updateDividers(newDiv); 237 } 238 } 239 240 // afterwards, convert the arrays back to strings and set to appropriate fields 241 var newUpdatedString = arrayToString(plUpdated, ","); 242 document.getElementById("pipelineUpdatedField").value = newUpdatedString; 243 324 } 325 326 // afterwards, convert the arrays back to strings and set to appropriate fields 327 var newUpdatedString = arrayToString(plUpdated, ","); 328 document.getElementById("pipelineUpdatedField").value = newUpdatedString; 329 } 244 330 } 245 331 … … 366 452 // eerst saven, dan de object type zoeken in de typelist, dan redirecten naar de goede pagina 367 453 savePipeline(false); 368 debugger;454 369 455 var pipeline = document.getElementById("pipelineStringField").value; 370 456 var pipelineTypes = document.getElementById("pipelineTypeField").value; … … 375 461 376 462 var postForm = document.createElement("form"); 377 postForm.action = stepType.toLowerCase()+"Editor.php"; 463 postForm.action = stepType.toLowerCase()+"Editor.php"; //redirect to "type"editor.php 378 464 postForm.method = "POST"; 379 465 var objectUid = document.createElement("input"); … … 388 474 function moveStep (direction) { 389 475 // misschien maar eens een loadhiddenfields functie maken voor deze meuk? 390 debugger;476 391 477 var selectedStep = document.getElementById("selectedStepField").value; 392 478 … … 402 488 403 489 var id = pipeline.indexOf(selectedStep); 404 // Dit werkt niet, hij replaced dingen de verkeerde kant op. Lelijke versie met placeholder variables maar weer doen? 405 pipeline[id] = pipeline.splice(pipeline[id+direction], 1, pipeline[id])[0]; 406 pipelineTypes[id] = pipelineTypes.splice(pipelineTypes[id+direction], 1, pipelineTypes[id])[0]; 490 if ((id == 0 && direction == -1) || (id == pipeline.length-1 && direction == 1)){ 491 alert("Cannot move out of bounds!"); 492 return; 493 } 494 var tempString = pipeline[id], tempType = pipelineTypes[id]; 495 496 pipeline[id] = pipeline[id+direction]; 497 pipelineTypes[id] = pipelineTypes[id+direction]; 498 pipeline[id+direction] = tempString; 499 pipelineTypes[id+direction] = tempType; 407 500 updated[id] = "0"; 408 501 updated[id+direction] = "0"; … … 417 510 updateSequencer(); 418 511 419 420 421 } 512 // Then reselect the previously selected step 513 addClass(document.getElementById(selectedStep), "selected"); 514 } -
Dev/trunk/returnStep.php
r165 r168 40 40 } 41 41 } else { 42 for each ($uids as $uid) {43 $response .= processUid($uid );42 for ($i = 0; $i < count($uids); $i++) { 43 $response .= processUid($uids[$i]); 44 44 } 45 45 } -
Dev/trunk/savesession.php
r167 r168 36 36 37 37 $dbi->set($session); 38 echo "true";38 var_dump($session); 39 39 } 40 40 } -
Dev/trunk/selectSession.php
r166 r168 76 76 <fieldset name="selectionMenu"> 77 77 <!-- onchange van volgende select linkt deze aan de ajax-based info panel, script staat in sequencerScripts.js --> 78 <select name="sessionUID" style="float: left;" onChange="ajaxInfoRequest(this.value, document.getElementById(' sessionDescription'));">78 <select name="sessionUID" style="float: left;" onChange="ajaxInfoRequest(this.value, document.getElementById('infoPanelContent'), 'Session');"> 79 79 <option value="" disabled="true" selected>Please select a session</option> 80 80 <?php … … 105 105 </fieldset> 106 106 <fieldset id="sessionDescription"> 107 Info goes here: 107 <div class="fieldsetTitle"> 108 Info 109 </div> 110 <div id="infoPanelContent"> 111 </div> 108 112 </fieldset> 109 113 </form>
Note: See TracChangeset
for help on using the changeset viewer.