- Timestamp:
- 09/14/11 14:01:25 (14 years ago)
- Location:
- Dev/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/ApplicationCreationTool.php
r89 r103 45 45 private function init() { 46 46 ?> 47 <div class="creation">47 <div id="creation"> 48 48 <form id="applicationCreationForm" action="" method="post"> 49 49 <?php -
Dev/trunk/classes/QuestionCreationTool.php
r102 r103 12 12 13 13 public function __construct() { 14 $this->javascript(); 14 15 $this->displayList(); 15 16 $this->displayEditPanel(); 17 } 18 19 private function javascript() { 20 ?> 21 <script type="text/javascript"> 22 function handleType(select) 23 { 24 var type = select.valueOf().value; 25 clearSpecifications(); 26 27 /* set answerCount for options */ 28 document.getElementById("answerSpecifications").answerCount = 1; 29 30 switch (type) { 31 case "text": 32 break; 33 case "mc": 34 addOption(); 35 break; 36 case "int": 37 minMax(); 38 break; 39 case "checkboxes": 40 addOption(); 41 break; 42 case "scale": 43 minMaxIncr(); 44 break; 45 default: 46 47 break; 48 } 49 50 } 51 52 function clearSpecifications() 53 { 54 var specs = document.getElementById("answerSpecifications"); 55 specs.innerHTML = ""; 56 specs.clicked = null; 57 specs.lastAnswer = null; 58 59 var questionType = document.getElementById("questionType"); 60 var buttons = document.getElementById("questionButtons"); 61 if(buttons != null) 62 questionType.removeChild(buttons); 63 } 64 65 function addOption() 66 { 67 var specs = document.getElementById("answerSpecifications"); 68 69 addAddRemoveOptionButtonsOnce(specs); 70 addAnswerInput(specs); 71 72 } 73 74 function removeOption() 75 { 76 var specs = document.getElementById("answerSpecifications"); 77 78 if(specs.lastAnswer.prev != null) 79 { 80 specs.removeChild(specs.lastAnswer); 81 specs.lastAnswer = specs.lastAnswer.prev; 82 specs.answerCount--; 83 } 84 } 85 86 function addAnswerInput(specs) 87 { 88 var answerCount = specs.answerCount; 89 90 /* set value for option textbox */ 91 var optionStr = "Option " + answerCount; 92 93 /* the input textbox */ 94 var answerInput = document.createElement("input"); 95 answerInput.setAttribute("type", "text"); 96 answerInput.setAttribute("name", "ans" + answerCount); 97 answerInput.setAttribute("value", optionStr); 98 answerInput.className = "answerInput"; 99 100 specs.appendChild(answerInput); 101 102 /* Singly linked list */ 103 answerInput.prev = specs.lastAnswer; // remember last one 104 specs.lastAnswer = answerInput; // new lastAnswer 105 106 specs.answerCount++; 107 } 108 109 function addAddRemoveOptionButtonsOnce(specs) 110 { 111 if (specs.clicked == null) 112 { 113 var buttonsDiv = document.createElement("div"); 114 buttonsDiv.id = "questionButtons"; 115 buttonsDiv.style.display = "inline"; 116 var typeBox = document.getElementById("questionType"); 117 typeBox.appendChild(buttonsDiv); 118 119 addAddOptionButton(buttonsDiv); 120 addRemoveOptionButton(buttonsDiv); 121 122 specs.clicked = true; 123 } 124 } 125 126 function addAddOptionButton(buttonsDiv) 127 { 128 var addOpt = document.createElement("input"); 129 addOpt.setAttribute("type", "button"); 130 addOpt.setAttribute("id", "addOpt"); 131 addOpt.setAttribute("class", "surveyButton"); 132 addOpt.setAttribute("onclick", "addOption()"); 133 addOpt.setAttribute("value", "Add Option"); 134 buttonsDiv.appendChild(addOpt); 135 } 136 137 function addRemoveOptionButton(buttonsDiv) 138 { 139 var removeOpt = document.createElement("input"); 140 removeOpt.setAttribute("type", "button"); 141 removeOpt.className = "surveyButton"; 142 removeOpt.setAttribute("onclick", "removeOption()"); 143 removeOpt.setAttribute("value", "x"); 144 buttonsDiv.appendChild(removeOpt); 145 } 146 147 function minMax(min, max) 148 { 149 if (min == null) 150 var min = ''; 151 if (max == null) 152 var max = ''; 153 154 var specs = document.getElementById("answerSpecifications"); 155 156 var answerDiv = document.createElement("div"); 157 158 answerDiv.className = "answerDiv"; 159 answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' class='intBox' onchange='checkInt(this)' value='" + min + "' name='ans1' />" + 160 "<label for='max'>Max</label><input type='text' class='intBox' onchange='checkInt(this)' value='" + max + "' name='ans2' />"; 161 162 specs.appendChild(answerDiv); 163 } 164 165 function checkInt(input) 166 { 167 input.style.borderWidth = '1px' ; 168 var value = input.value; 169 if (isNaN(value)) 170 { 171 input.style.borderColor = 'red'; 172 input.checkPassed = 'no'; 173 } 174 else 175 { 176 input.style.border = '1px solid #888;'; 177 input.checkPassed = null; 178 } 179 } 180 181 function minMaxIncr(left, right, incr) 182 { 183 if (left == null) 184 var left = ''; 185 else 186 left.replace("'", "'"); 187 if (right == null) 188 var right = ''; 189 else 190 right.replace("'", "'"); 191 if (incr == null) 192 var incr = ''; 193 194 var specs = document.getElementById("answerSpecifications"); 195 196 var answerDiv = document.createElement("div"); 197 answerDiv.className = "answerDiv"; 198 199 var leftLabel = document.createElement("label"); 200 var rightLabel = document.createElement("label"); 201 var scaleLabel = document.createElement("label"); 202 leftLabel.innerHTML = "Left label"; 203 rightLabel.innerHTML = "Right label"; 204 scaleLabel.innerHTML = "Scale count"; 205 206 var leftInput = document.createElement("input"); 207 leftInput.type = "text"; 208 leftInput.value = left; 209 leftInput.name= "ans1"; 210 leftInput.setAttribute("onchange", "handleAnswerChange()"); 211 212 var rightInput = document.createElement("input"); 213 rightInput.type = "text"; 214 rightInput.value = right; 215 rightInput.name = "ans2"; 216 rightInput.setAttribute("onchange", "handleAnswerChange()"); 217 218 var scaleInput = document.createElement("input"); 219 scaleInput.type = "text"; 220 scaleInput.className = "intBox"; 221 scaleInput.value = incr; 222 scaleInput.setAttribute("onblur", "checkInt(this)"); 223 scaleInput.setAttribute("onchange", ""); 224 scaleInput.name = "ans3"; 225 226 answerDiv.appendChild(leftLabel); 227 answerDiv.appendChild(leftInput); 228 answerDiv.appendChild(rightLabel); 229 answerDiv.appendChild(rightInput); 230 answerDiv.appendChild(scaleLabel); 231 answerDiv.appendChild(scaleInput); 232 233 specs.appendChild(answerDiv); 234 } 235 236 </script> 237 <?php 16 238 } 17 239 … … 19 241 ?> 20 242 <div id="questionListWrapper"> 21 <select id="questionsList" size=" 2">243 <select id="questionsList" size="9999"> 22 244 </select> 23 245 </div> … … 27 249 private function displayEditPanel() { 28 250 ?> 29 <div class="creation">251 <div id="creation"> 30 252 <form id="questionEditForm" action=""> 31 253 <table class="questionTable"> … … 44 266 <tr> 45 267 <td><label for="questionType">Type answer</label></td> 46 <td >47 <select name="questionType" onchange >268 <td id="questionType"> 269 <select name="questionType" onchange="handleType(this)"> 48 270 <option value='text' selected='selected'>Text</option> 49 271 <option value='int'>Integer</option> … … 55 277 </tr> 56 278 </table> 279 <div id="answerSpecifications"></div> 57 280 </form> 58 281 </div> -
Dev/trunk/classes/SessionCreationTool.php
r94 r103 22 22 ?> 23 23 24 <div class="creation">24 <div id="creation"> 25 25 <form id="sessionCreationForm" action="" onsubmit="submitPipeline()" method="post"> 26 26 <?php -
Dev/trunk/classes/SurveyCreationTool.php
r98 r103 21 21 ?> 22 22 23 <div id=" surveyCreation" class="creation"><form id="survey" action="surveycreation.php" method="post">23 <div id="creation"><form id="survey" action="surveycreation.php" method="post"> 24 24 <?php 25 25 $this->surveyHead(); … … 462 462 } 463 463 464 function checkInt(input) 465 { 466 input.style.borderWidth = '1px' ; 467 var value = input.value; 468 if (isNaN(value)) 469 { 470 input.style.borderColor = 'red'; 471 input.checkPassed = 'no'; 472 } 473 else 474 { 475 input.style.border = '1px solid #888;'; 476 input.checkPassed = null; 477 } 478 } 464 479 465 480 466 </script> -
Dev/trunk/css/awesome.css
r102 r103 30 30 font-weight: normal; 31 31 color: #333; 32 } 33 34 label { 35 text-shadow: #fff 0px 0px 1px; 32 36 } 33 37 … … 125 129 ===================== STYLESHEET OF GLORY ======================== */ 126 130 127 .creation {131 #creation { 128 132 position: relative; 129 133 min-height: 10em; … … 371 375 ===================== STYLESHEET OF GLORY ======================== */ 372 376 377 .answerInput { 378 display: block; 379 } 380 373 381 .answerBox { 374 382 padding-left: 1em;
Note: See TracChangeset
for help on using the changeset viewer.