- Timestamp:
- 09/14/11 14:56:19 (14 years ago)
- Location:
- Dev/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/QuestionCreationTool.php
r103 r104 24 24 var type = select.valueOf().value; 25 25 clearSpecifications(); 26 26 27 27 /* set answerCount for options */ 28 28 document.getElementById("answerSpecifications").answerCount = 1; 29 29 30 30 switch (type) { 31 31 case "text": … … 44 44 break; 45 45 default: 46 47 break; 48 } 49 50 } 51 46 47 break; 48 } 49 50 } 51 52 52 function clearSpecifications() 53 53 { … … 56 56 specs.clicked = null; 57 57 specs.lastAnswer = null; 58 58 59 59 var questionType = document.getElementById("questionType"); 60 60 var buttons = document.getElementById("questionButtons"); … … 62 62 questionType.removeChild(buttons); 63 63 } 64 64 65 65 function addOption() 66 66 { 67 67 var specs = document.getElementById("answerSpecifications"); 68 68 69 69 addAddRemoveOptionButtonsOnce(specs); 70 70 addAnswerInput(specs); 71 72 } 73 71 72 } 73 74 74 function removeOption() 75 75 { 76 76 var specs = document.getElementById("answerSpecifications"); 77 77 78 78 if(specs.lastAnswer.prev != null) 79 79 { … … 83 83 } 84 84 } 85 85 86 86 function addAnswerInput(specs) 87 87 { 88 88 var answerCount = specs.answerCount; 89 89 90 90 /* set value for option textbox */ 91 91 var optionStr = "Option " + answerCount; 92 92 93 93 /* the input textbox */ 94 94 var answerInput = document.createElement("input"); … … 97 97 answerInput.setAttribute("value", optionStr); 98 98 answerInput.className = "answerInput"; 99 99 100 100 specs.appendChild(answerInput); 101 101 102 102 /* Singly linked list */ 103 103 answerInput.prev = specs.lastAnswer; // remember last one 104 104 specs.lastAnswer = answerInput; // new lastAnswer 105 105 106 106 specs.answerCount++; 107 107 } 108 108 109 109 function addAddRemoveOptionButtonsOnce(specs) 110 110 { … … 116 116 var typeBox = document.getElementById("questionType"); 117 117 typeBox.appendChild(buttonsDiv); 118 118 119 119 addAddOptionButton(buttonsDiv); 120 120 addRemoveOptionButton(buttonsDiv); 121 121 122 122 specs.clicked = true; 123 123 } 124 124 } 125 125 126 126 function addAddOptionButton(buttonsDiv) 127 127 { … … 134 134 buttonsDiv.appendChild(addOpt); 135 135 } 136 136 137 137 function addRemoveOptionButton(buttonsDiv) 138 138 { … … 144 144 buttonsDiv.appendChild(removeOpt); 145 145 } 146 146 147 147 function minMax(min, max) 148 148 { … … 151 151 if (max == null) 152 152 var max = ''; 153 154 var specs = document.getElementById("answerSpecifications"); 155 153 154 var specs = document.getElementById("answerSpecifications"); 155 156 156 var answerDiv = document.createElement("div"); 157 157 158 158 answerDiv.className = "answerDiv"; 159 159 answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' class='intBox' onchange='checkInt(this)' value='" + min + "' name='ans1' />" + 160 160 "<label for='max'>Max</label><input type='text' class='intBox' onchange='checkInt(this)' value='" + max + "' name='ans2' />"; 161 161 162 162 specs.appendChild(answerDiv); 163 163 } 164 164 165 165 function checkInt(input) 166 166 { … … 178 178 } 179 179 } 180 180 181 181 function minMaxIncr(left, right, incr) 182 182 { … … 191 191 if (incr == null) 192 192 var incr = ''; 193 194 var specs = document.getElementById("answerSpecifications"); 195 193 194 var specs = document.getElementById("answerSpecifications"); 195 196 196 var answerDiv = document.createElement("div"); 197 197 answerDiv.className = "answerDiv"; 198 198 199 199 var leftLabel = document.createElement("label"); 200 200 var rightLabel = document.createElement("label"); … … 203 203 rightLabel.innerHTML = "Right label"; 204 204 scaleLabel.innerHTML = "Scale count"; 205 205 206 206 var leftInput = document.createElement("input"); 207 207 leftInput.type = "text"; … … 209 209 leftInput.name= "ans1"; 210 210 leftInput.setAttribute("onchange", "handleAnswerChange()"); 211 211 212 212 var rightInput = document.createElement("input"); 213 213 rightInput.type = "text"; … … 215 215 rightInput.name = "ans2"; 216 216 rightInput.setAttribute("onchange", "handleAnswerChange()"); 217 217 218 218 var scaleInput = document.createElement("input"); 219 219 scaleInput.type = "text"; … … 223 223 scaleInput.setAttribute("onchange", ""); 224 224 scaleInput.name = "ans3"; 225 225 226 226 answerDiv.appendChild(leftLabel); 227 227 answerDiv.appendChild(leftInput); … … 230 230 answerDiv.appendChild(scaleLabel); 231 231 answerDiv.appendChild(scaleInput); 232 232 233 233 specs.appendChild(answerDiv); 234 234 } 235 235 236 236 </script> 237 237 <?php … … 249 249 private function displayEditPanel() { 250 250 ?> 251 <div id="creation"> 252 <form id="questionEditForm" action=""> 253 <table class="questionTable"> 254 <tr> 255 <td><label for="questionCode">Code</label></td> 256 <td><input id="questionCode" name="questionCode" size="5" /></td> 257 </tr> 258 <tr> 259 <td><label for="questionTitle">Title</label></td> 260 <td><input id="questionTitle" name="questionTitle" size="30" /></td> 261 </tr> 262 <tr> 263 <td><label for="questionDescription">Description</label></td> 264 <td><input id="questionDescription" name="questionDescription" size="60" /></td> 265 </tr> 266 <tr> 267 <td><label for="questionType">Type answer</label></td> 268 <td id="questionType"> 269 <select name="questionType" onchange="handleType(this)"> 270 <option value='text' selected='selected'>Text</option> 271 <option value='int'>Integer</option> 272 <option value='mc'>Multiple choice</option> 273 <option value='checkboxes'>Checkboxes</option> 274 <option value='scale'>Scale</option> 275 </select> 276 </td> 277 </tr> 278 </table> 279 <div id="answerSpecifications"></div> 280 </form> 251 <div id="questionCreation" class="floatLeft"> 252 <?php $this->displayForm(); ?> 281 253 </div> 254 <?php 255 } 256 257 private function displayForm() { 258 ?> 259 <form id="questionEditForm" method="post" action="" onsubmit=""> 260 <table class="questionTable"> 261 <tr> 262 <td><label for="questionCode">Code</label></td> 263 <td><input id="questionCode" name="questionCode" size="5" /></td> 264 </tr> 265 <tr> 266 <td><label for="questionTitle">Title</label></td> 267 <td><input id="questionTitle" name="questionTitle" size="30" /></td> 268 </tr> 269 <tr> 270 <td><label for="questionDescription">Description</label></td> 271 <td><input id="questionDescription" name="questionDescription" size="60" /></td> 272 </tr> 273 <tr> 274 <td><label for="questionType">Type answer</label></td> 275 <td id="questionType"> 276 <select name="questionType" onchange="handleType(this)"> 277 <option value='text' selected='selected'>Text</option> 278 <option value='int'>Integer</option> 279 <option value='mc'>Multiple choice</option> 280 <option value='checkboxes'>Checkboxes</option> 281 <option value='scale'>Scale</option> 282 </select> 283 </td> 284 </tr> 285 </table> 286 <div id="answerSpecifications"></div> 287 <input id="saveQuestion" type="submit" class="surveyButton" value="Save" /> 288 </form> 282 289 <?php 283 290 } -
Dev/trunk/css/awesome.css
r103 r104 33 33 34 34 label { 35 font-size: small; 36 font-weight: bold; 37 color: #333; 35 38 text-shadow: #fff 0px 0px 1px; 36 39 } … … 290 293 } 291 294 292 label {293 font-size: small;294 font-weight: bold;295 color: #555;296 }297 298 295 299 296 … … 368 365 } 369 366 367 .leftMargin { 368 margin-left: 10px; 369 } 370 370 371 .width100p { 371 372 width: 100%; 373 } 374 375 .floatLeft { 376 float: left; 372 377 } 373 378 … … 427 432 /* ################################################################## 428 433 ===================== STYLESHEET OF GLORY ======================== */ 434 435 #questionEditForm { 436 437 } 438 439 #saveQuestion { 440 position: absolute; 441 top: 1em; 442 right: 1em; 443 } 444 445 /* ################################################################## 446 ===================== STYLESHEET OF GLORY ======================== */ 429 447 #sessionCreationForm { 430 448 padding-bottom: 16em; … … 493 511 /* ################################################################## 494 512 ===================== STYLESHEET OF GLORY ======================== */ 513 #questionCreation 514 { 515 position: relative; 516 min-height: 10em; 517 min-width: 500px; 518 width: 50%; 519 background-image: url('../images/bg/graygradient.png'); 520 background-repeat: repeat-x; 521 background-color: #aeb2b3; 522 -moz-border-radius: 15px; 523 border-radius: 15px; 524 -moz-box-shadow: 2px 2px 2px #888; 525 -webkit-box-shadow: 2px 2px 2px #888; 526 box-shadow: 2px 2px 2px #888; 527 padding: 2em; 528 border: 1px solid white; 529 } 530 495 531 #questionListWrapper { 532 float: left; 496 533 text-align: center; 497 margin-bottom: 2em; 534 margin-bottom: 5em; 535 width: 40%; 536 margin-right: 2em; 498 537 } 499 538 500 539 #questionListWrapper #questionsList { 501 width: 80%;502 min-width: 800px;503 540 height: 30em; 541 width: 100%; 504 542 } 505 543 -
Dev/trunk/questioncreation.php
r102 r104 19 19 20 20 <div id="content"> 21 <?php var_dump($_POST); ?> 21 22 <?php 22 23 new QuestionCreationTool();
Note: See TracChangeset
for help on using the changeset viewer.