Changeset 230 for Dev


Ignore:
Timestamp:
01/13/12 11:30:11 (13 years ago)
Author:
jkraaijeveld
Message:

Made most functionality from the demo branch work with new database.

Location:
Dev
Files:
27 added
10 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/jos-branch/classes/master.php

    r212 r230  
    2020        else if (file_exists('classes/models/' . $class_name . '.php'))
    2121                require 'classes/models/' . $class_name . '.php';
     22        else if (file_exists('classes/widgets/' . $class_name . '.php'))
     23                require 'classes/widgets/' . $class_name . '.php';
     24        else if (file_exists('classes/styles/' . $class_name . '.php'))
     25                require 'classes/styles/' . $class_name . '.php';
    2226}
    2327
  • Dev/branches/jos-branch/getInfo.php

    r208 r230  
    1515    return;
    1616}
     17echo $type;
    1718
    18 $dbi = new DatabaseInterface();
    1919
    20 $results = $dbi->get($type, array("uid" => $uid));
     20$results = $type::get(array("uid" => $uid));
    2121
    2222if (count($results) > 0) {      // check if DB object exists and assign it to variable
  • Dev/branches/jos-branch/index.php

    r208 r230  
    1616if (isset($_POST['register'])) {
    1717    if (isset($_POST['username']) && isset($_POST['password'])) {
    18         $dbi = new DatabaseInterface();
    19         $user_results = $dbi->get("user", array("name" => $_POST['username']));
     18        $user_results = User::get(array("name" => $_POST['username']));
    2019        if (count($user_results) == 0 || !$user_results) {
    2120            if (strlen($_POST['password']) > 6) {
    2221                $user = new User(null, $_POST['username'], $_POST['password']);
    23                 $dbi->set($user);
     22                                $user->save();
    2423                $_SESSION['userUid'] = $user->uid;
    2524            } else {
     
    3534
    3635if (isset($_POST['login'])) {   // User clicked the login button
    37     $dbi = new DatabaseInterface();
    38     $user_results = $dbi->get("user", array("name" => $_POST['username']));
     36    $user_results = User::get(array("name" => $_POST['username']));
    3937    if (isset($user_results[0])) {
    4038        if ($user_results[0]->password == $_POST['password']) {
  • Dev/branches/jos-branch/selectSession.php

    r208 r230  
    1111}
    1212
    13 $dbi = new DatabaseInterface();
    14 
    1513if (isset($_POST['createSession'])) {
    1614    //check if name is set
     
    1816        // check if name is available
    1917        if (!empty($_POST['newSessionName'])) {
    20             $session_results = $dbi->get("Session", array("title" => $_POST['newSessionName']));
     18            $session_results = Session::get(array("title" => $_POST['newSessionName']));
    2119            if (count($session_results) == 0) {
    2220                // make new session!
    2321                unset($session_results);
    24                 $creators = $dbi->get("User", array("uid" => $_SESSION['userUid']));
     22                $creators = User::get(array("uid" => $_SESSION['userUid']));
    2523                $creator = $creators[0];
    2624                $session = new Session(null, $_POST['newSessionName'], $creator, new DateTime(), null, null);
    27                 $dbi->set($session);
     25                                $session->save();
    2826            } else {
    2927                $errorMessage[] = "A session with the name " . $_POST['newSessionName'] . " already exists!";
     
    4442        var_dump($_POST);
    4543    if (isset($_POST['sessionUid'])) {
    46         $session_results = $dbi->get("SESSION", array("uid" => $_POST['sessionUid']));
     44        $session_results = Session::get((array("uid" => $_POST['sessionUid'])));
    4745                var_dump($session_results);
    4846        if (count($session_results) == 1 && $session_results[0] != null) {
     
    5755//Get available sessions for current user
    5856//$sessions = $dbi->get("Session", array("creator"=>$_SESSION['username']));  //This does not work, session.php does not yet have a property 'creator'
    59 $sessions = $dbi->get("Session");  // Let's just load everything then...
     57$sessions = Session::get(array());  // Let's just load everything then...
    6058?>
    6159
  • Dev/branches/jos-branch/testpage.php

    r217 r230  
    11<?php
    22    require 'classes/master.php';
    3        
    4         $sessionInstance = new Sessioninstance(null, "Titel", "Locatie", "9043f64705e67ceb8f28242207b83adf", new Datetime(), new Datetime(), array(), "293b162b0b774ec1b303ce839b60ebd2", null);
    5         $sessionInstance->save();
    63        $result = SessionInstance::get(array());
    7         print_r($result);
     4        $sessionInstance = $result[0];
     5        $sessionInstance->evaluate();
     6        print_r($sessionInstance);
     7
    88?>
  • Dev/trunk/css/awesome.css

    r218 r230  
    565565
    566566
     567/*
     568#pipelineFrame{
     569    height: 12em;
     570    width: 96em;
     571    display: block;
     572    background-image: url('../images/bg/pipelineFrameBG.png');
     573    background-color: #e3eff3;
     574}
     575
     576.pipelineFrame .pipelineObject {
     577    width: 10em;
     578    height: 10em;
     579    margin: 1em auto 1em auto;
     580    text-align: center;
     581}
     582*/
     583
     584/*
     585*
     586*
     587*   Horizontal sequencer styling
     588*
     589*
     590*/
     591
    567592#sequencer {
    568593    width: 100%;
  • Dev/trunk/css/visualeditors.css

    r226 r230  
    1818html {
    1919    background-image: url('../images/bg/blueishgridblock.png');
     20    /*background-image: url('../images/icons/nyan.gif');*/
    2021    height: 100%;
    2122    font-size: 12px;
     
    2728    min-width: 800px;
    2829    margin: 0 auto;
     30    clear:both;
    2931}
    3032
     
    3335    position: relative;
    3436    padding: 2em 0;
     37}
     38
     39#logo {
     40    float: left;
     41    width:250px;
     42    margin: 0 0 10px 0;
     43    padding: 10px 40px;
     44    background-image: linear-gradient(top, #B0B0B0 21%, #888888 80%);
     45    background-image: -o-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     46    background-image: -moz-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     47    background-image: -webkit-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     48    background-image: -ms-linear-gradient(top, #B0B0B0 21%, #888888 80%);
     49
     50    background-image: -webkit-gradient(
     51        linear,
     52        left top,
     53        left bottom,
     54        color-stop(0.21, #B0B0B0),
     55        color-stop(0.8, #888888)
     56        );
     57    background-position: bottom;
     58    background-repeat: repeat-x;
     59    border: 1px solid #FFF;
     60    border-top-style: none;
     61}
     62
     63#logo #logoImage {
     64    color: #FFF;
     65    margin: 0;
     66    padding: 0;
     67    font: bold 22px Arial;
     68}
     69
     70#logo #logoControls {
     71    border-top: 1px solid #555;
     72    font: 12px Arial;
     73    color: #555;
     74    text-align: right;
     75    width: auto;
     76}
     77
     78#logoControls a {
     79    color: #FFF;
     80    font: bold 12px arial;
     81    text-decoration: none;
     82    text-align: right;
    3583}
    3684
     
    67115    border-radius: 1em;
    68116    -moz-border-radius: 1em;
     117}
     118
     119.largeFrame .content {
     120    clear: left;
    69121}
    70122
     
    108160}
    109161
     162.largeFrame.side {
     163    clear: none;
     164    margin: 0 10px;
     165}
     166
     167.largeFrame.side .innerLargeFrame {
     168    width: 400px;
     169    height: 400px;
     170}
     171
    110172.smallFrame {
    111173    margin: 0.5em auto;
     
    194256
    195257.bigButton.vertical {
    196     width: 2em;
     258    margin: 0.25em;
     259    text-align: center;
     260    min-width: 7em;
     261    max-width: 12em;
    197262    height: 2em;
    198263    font-size: 20px;
     
    212277    cursor: default;
    213278}
     279
     280.bigButton.icon
    214281
    215282.bigButton:hover {
     
    250317}
    251318
    252 /********************/
    253 /* DD MENU SPECIFIC */
    254 /********************/
    255 
    256 #btnAddMenu {
    257     margin: 0;
    258     padding: 5px;
    259     background: #5970B2;
    260     font: bold 16px arial;
    261     color: #FFF;
    262     float: left;
    263 }
    264 
    265 #btnAddMenu.down {
    266     background: #334167;
    267 }
    268 
    269 #creationMenu {
    270     margin: 0;
    271     padding: 0;
    272     z-index: 30;
    273     visibility: hidden;
    274     float: left;
    275 }
    276 
    277 #creationMenu li {
    278     margin: 0;
    279     padding: 0;
    280     list-style: none;
    281     float: left;
    282     clear: left;
    283     font: bold 11px arial;
    284 }
    285 
    286 #creationMenu li a img {
    287     float: left;
    288     clear: left;
    289 }
    290 
    291 #creationMenu li a {
    292     display: block;
    293     float: left;
    294     margin: 0 1px 0 0;
    295     padding: 4px 10px;
    296     width: 100px;
    297     background: #5970B2;
    298     color: #FFF;
    299     text-align: center;
    300     text-decoration: none;
    301 }
    302 
    303 #creationMenu li a:hover {
    304     background: #49A3FF;
    305 }
    306 
    307 #creationMenu div {
    308     position: absolute;
    309     visibility: hidden;
    310     margin: 0;
    311     padding: 0;
    312     background: #eaebd8;
    313     border: 1px solid #5970B2;
    314 }
    315 
    316 #creationMenu div a{
    317     position: relative;
    318     float: left;
    319     display: block;
    320     clear: left;
    321     margin: 0;
    322     padding: 5px 10px 5px 10px;
    323     width: 75px;
    324     white-space: nowrap;
    325     text-align: left;
    326     text-decoration: none;
    327     background: #eaebd8;
    328     color: #2875DE;
    329     font: 11px arial;
    330 }
    331 
    332 #creationMenu div a:hover {
    333     background: #49a3ff;
    334     color: #fff;
    335 }
    336319
    337320/****************************/
     
    506489}
    507490
    508 /****************************/
    509 /* Question editor specific */
    510 /****************************/
    511 
    512 .questionParamField {
    513     float: left;
    514 }
    515 
    516 .questionParamLabel {
    517     float: left;
    518     width: 100px;
    519 }
    520 
    521 .questionParamLabel.lAlign {
    522     clear: left;
    523 }
    524 
    525 .questionParamLabel.rAlign {
    526     clear: right;
    527 }
    528 
    529 .qBodyTextField {
    530     resize: none;
    531     width: 595px;
    532 }
     491/**************************/
     492/* Survey Editor Specific */
     493/**************************/
     494
     495#leftColumn {
     496    float: left;
     497    clear: left;
     498}
     499
     500#rightColumn {
     501    float: left;
     502    clear: none;
     503}
     504
     505.largeFrame.C{
     506    clear: left;
     507    margin: 10px;
     508    padding: 5px;
     509
     510    height: auto;
     511    max-height: 400px;
     512}
     513
     514.largeFrame.Cu{
     515    clear: left;
     516    margin: 10px;
     517    padding: 5px;
     518    width: 640px;
     519}
     520
     521.largeFrame.Cv {
     522    clear: left;
     523    margin: 10px;
     524    padding: 5px;
     525    width: 200px;
     526}
     527
     528.checkboxList {
     529    overflow-y: scroll;
     530    overflow-x: hidden;
     531    clear: left;
     532    width: auto;
     533    height: 250px;
     534    background-color: #FFF;
     535    border-width: 2px;
     536    border-style: solid;
     537    border-bottom-color: #AAA;
     538    border-top-color: #555;
     539    border-right-color: #AAA;
     540    border-left-color: #555;
     541}
     542
     543.dbDataList {
     544    width: 300px;
     545    float: left;
     546    clear: left;
     547    margin: 0 10px 0 10px;
     548}
     549
     550#dbShoppingCart .content {
     551    height: 415px;
     552}
     553
     554/*******************/
     555/* DDMenu specific */
     556/*******************/
     557
     558#toolboxMenu li .bigButton.toolbox div {
     559    position: absolute;
     560    visibility: hidden;
     561    margin: 0;
     562    padding: 0;
     563    border: 1px solid #555;
     564    background: #eaebd8;
     565}
     566
     567#toolboxMenu li .bigButton.toolbox div a {
     568    position: relative;
     569    float: left;
     570    clear: left;
     571    margin: 0;
     572    padding: 5px 10px;
     573    width: 75px;
     574    white-space: nowrap;
     575    text-align: left;
     576    text-decoration: none;
     577    color: #2875de;
     578    font: 11px arial;
     579}
     580
     581#toolboxMenu li .bigButton.toolbox div a:hover {
     582    background: #49a3ff;
     583    color: #fff;
     584}
  • Dev/trunk/js/generalScripts.js

    r228 r230  
    208208            instance.ddMenuItem.style.visibility = "hidden";
    209209        }
    210             instance.Toggle();
     210        instance.Toggle();
    211211       
    212212    }
     
    244244        else{
    245245            //Show the menu
    246             instance.menuElement.style.visibility = "visible";
    247             instance.parentButton.className = "down";
     246            if (instance.menuElement) {
     247                instance.menuElement.style.visibility = "visible";
     248                instance.parentButton.className = "down";
     249            }
    248250            instance.visible = true;
    249251        }
  • Dev/trunk/js/questionEditorScripts.js

    r218 r230  
    2323//////////////////////////
    2424
    25 //////////////////////
    26 /* CREATE FUNCTIONS */
    27 //////////////////////
    28 
    29 function createQuestionEditor() {
    30     // Outer div
    31     var editorElement = ce("div");
    32     this.className = "smallFrame questionEditor";
    33     editorElement.id = sequencer.state.selectedObject.uid;
    34     // Header
    35     var titleDiv = ce("div");
    36     titleDiv.className = "smallTitle";
    37     var numberDiv = ce("div");
    38     numberDiv.className = "listNumber";
    39     numberDiv.innerHTML = "4";
    40     var nameSpan = ce("span");
    41     nameSpan.innerHTML = "New question";
    42     titleDiv.appendChild(numberDiv);
    43     titleDiv.innerHTML += "Editing: ";
    44     titleDiv.appendChild(nameSpan);
    45     editorElement.appendChild(titleDiv);
    46    
    47     //Content area
    48     var contentDiv = ce("div");
    49     contentDiv.className = "content";
    50     var bodyText = createNewElement("textarea", null, "qBodyTextField", "qBodyTextField", null);
    51     bodyText.value = "Question body text goes here";
    52    
    53    
    54     // The dynamic questionParams div, where all the control elements and inputs will be located
    55     var questionParams = ce("div");
    56     questionParams.className = "questionParams";
    57     contentDiv.appendChild(bodyText);
    58     var qIdentField = createNewElement("input", "text", "qIdentField", "questionParamField", null);
    59     var qIdentField_lbl = createNewInputLabel("Question code:","qIdentField", "l");
    60     questionParams.appendChild(qIdentField_lbl);
    61     questionParams.appendChild(qIdentField);
    62    
    63     var qTypeField = createNewElement("select", null, "qTypeField", "questionParamField", null);
    64     var qTypeField_lbl = createNewInputLabel("Answer type:","qTypeField", "l");
    65     questionParams.appendChild(qTypeField_lbl);
    66     questionParams.appendChild(qTypeField);
    67     qTypeField.addEventListener("change", function(){
    68         debugger;
    69         selectAnswerType();
    70     }, false);
    71     // Add the select options. Do this in a block scope to prevent the o1 var from messing things up.
    72     // Also helps in structuring code.
    73     {
    74         var o1 = ce("option");
    75         o1.value = null;
    76         o1.text = "";
    77         qTypeField.appendChild(o1);
    78        
    79         o1 = ce("option");
    80         o1.value = "int";
    81         o1.text = "Integer";
    82         qTypeField.appendChild(o1);
    83        
    84         o1 = ce("option");
    85         o1.value = "scale";
    86         o1.text = "Scale";
    87         qTypeField.appendChild(o1);
    88        
    89         o1 = ce("option");
    90         o1.value = "choice";
    91         o1.text = "Multiple choice";
    92         qTypeField.appendChild(o1);
    93        
    94         o1 = ce("option");
    95         o1.value = "text";
    96         o1.text = "Text";
    97         qTypeField.appendChild(o1);
    98     }
    99    
    100     contentDiv.appendChild(questionParams);
    101     editorElement.appendChild(contentDiv);
    102    
    103     // Controls bar
    104     var controlsDiv = ce("div");
    105     controlsDiv.className = "controls";
    106     var btnDiscard = createNewElement("input", "button", "btnDiscard", null, "Discard");
    107     var btnSave = createNewElement("input", "button", "btnSave", null, "Save");
    108     controlsDiv.appendChild(btnDiscard);
    109     controlsDiv.appendChild(btnSave);
    110     btnSave.addEventListener("click", function(){
    111         swapQuestionState(true);
    112     }, false);
    113     btnDiscard.addEventListener("click", function(){
    114         swapQuestionState(false);
    115     }, false);
    116     editorElement.appendChild(controlsDiv);
    117    
    118     return editorElement;
    119 }
    120 
    121 function swapQuestionState(save) {
    122     // Function that replaces a question display with the question editor, or vice versa.
    123     if (sequencer.state.editing == false) {
    124         // Start editing
    125         sequencer.state.editing = true;
    126         var questionElement = ge(sequencer.state.selectedObject.uid);
    127         // test
    128         var editor = new QuestionEditor();
    129         editor.init();
    130         // end test
    131         //var editorElement = createQuestionEditor();
    132         var content = ge("seqContentWrapper");
    133         content.replaceChild(editor.element, questionElement);
    134     }
    135     else {
    136        
    137         if (save) {
    138             if (save == true) {
    139                 alert("Saving shit yo!");
    140             // User is done editing
    141             // 1. Create the edited question in db (createObject.php), then set the proper properties (saveObject.php)
    142             // 2. Revert back to question display
    143             }
    144             else {
    145                 // Anders discard gewoon alles en haal de question display weg.
    146                 ge("seqContentWrapper").removeChild(ge(sequencer.state.selectedObject.uid));
    147             }
    148         }
    149    
    150     }
    151 }
    152 
    153 
    154 //////////////////////////
    155 /* END CREATE FUNCTIONS */
    156 //////////////////////////
    15725
    15826var qUID, parentObjectUID, qName, qTag, qType, qAnswerLength;
    15927
    16028function selectAnswerType(){
    161     var selectBox = document.getElementById("qTypeField");
     29    var selectBox = document.getElementById("questionType");
    16230    if (selectBox.value != undefined && selectBox.value != "") {
    16331        qType = selectBox.value;
     
    18856
    18957function createNewElement(tag, type, id, cl, value) {
    190     // This is a double of the ce() alias function in generalScripts.js.
    191     // It allows for more specific creation of elements on one line,
    192     // instead of 5 subsequent lines of code defining tag, id, class, value, etc...
    193     // This is handy when doing creation-heavy operations such as adding inputs
    194     //!!! Since this is defined in questionEditorScripts.js, it should only be used in this context.
    195     //!!! Use ce() whenever possible, since it's included on every page and works faster.
    196    
    19758    var newElement = document.createElement(tag);
    19859    if (type != undefined) newElement.type = type;
     
    20667}
    20768
    208 function createNewInputLabel(text, target, align) {
     69function createNewInputLabel(text, target) {
    20970    var newLabel = document.createElement("label");
    21071    if (target) newLabel.setAttribute("for",target);
    211     if (align) newLabel.className = "questionParamLabel "+align+"Align"; else newLabel.className="questionParamLabel";
    21272    newLabel.innerHTML = text;
    21373    return newLabel;
     
    335195    alert(userText);
    336196}
    337 
    338 
    339 //TEST FUNCTIONS
    340 
    341 /*
    342  * These functions are an attempt at making editors class based, for easier organisation and parameter storage and access.
    343  * It prevents having to add more question-specific clutter to the sequencer object
    344  */
    345 
    346 function QuestionEditor() {
    347     // Properties   
    348     this.uid = null;
    349     this.element = null;
    350     this.paramsElement = null;
    351    
    352     // Basic functionality
    353     this.setValues = function(arguments) {
    354         // Query question information from database, then fill element fields with correct information.
    355        
    356     }
    357     this.init = function() {
    358         // Outer div
    359         this.element = ce("div");
    360         this.element.className = "smallFrame questionEditor";
    361         this.element.id = sequencer.state.selectedObject.uid;
    362         this.uid = sequencer.state.selectedObject.uid;
    363         // Header
    364         var titleDiv = ce("div");
    365         titleDiv.className = "smallTitle";
    366         var numberDiv = ce("div");
    367         numberDiv.className = "listNumber";
    368         numberDiv.innerHTML = "4";
    369         var nameSpan = ce("span");
    370         nameSpan.id = "qTitleField";
    371         nameSpan.innerHTML = "New question";
    372         titleDiv.appendChild(numberDiv);
    373         titleDiv.innerHTML += "Editing: ";
    374         titleDiv.appendChild(nameSpan);
    375         this.element.appendChild(titleDiv);
    376    
    377         //Content area
    378         var contentDiv = ce("div");
    379         contentDiv.className = "content";
    380         var bodyText = createNewElement("textarea", null, "qBodyTextField", "qBodyTextField", null);
    381         bodyText.value = "Question body text goes here";
    382    
    383    
    384         // The dynamic questionParams div, where all the control elements and inputs will be located
    385         var questionParams = ce("div");
    386         this.paramsElement = questionParams;
    387         questionParams.className = "questionParams";
    388         contentDiv.appendChild(bodyText);
    389         var qIdentField = createNewElement("input", "text", "qIdentField", "questionParamField", null);
    390         var qIdentField_lbl = createNewInputLabel("Question code:","qIdentField", "l");
    391         questionParams.appendChild(qIdentField_lbl);
    392         questionParams.appendChild(qIdentField);
    393    
    394         var qTypeField = createNewElement("select", null, "qTypeField", "questionParamField", null);
    395         var qTypeField_lbl = createNewInputLabel("Answer type:","qTypeField", "l");
    396         questionParams.appendChild(qTypeField_lbl);
    397         questionParams.appendChild(qTypeField);
    398         qTypeField.addEventListener("change", function(){
    399             debugger;
    400             selectAnswerType();
    401         }, false);
    402         // Add the select options. Do this in a block scope to prevent the o1 var from messing things up.
    403         // Also helps in structuring code.
    404         {
    405             var o1 = ce("option");
    406             o1.value = null;
    407             o1.text = "";
    408             qTypeField.appendChild(o1);
    409        
    410             o1 = ce("option");
    411             o1.value = "int";
    412             o1.text = "Integer";
    413             qTypeField.appendChild(o1);
    414        
    415             o1 = ce("option");
    416             o1.value = "scale";
    417             o1.text = "Scale";
    418             qTypeField.appendChild(o1);
    419        
    420             o1 = ce("option");
    421             o1.value = "choice";
    422             o1.text = "Multiple choice";
    423             qTypeField.appendChild(o1);
    424        
    425             o1 = ce("option");
    426             o1.value = "text";
    427             o1.text = "Text";
    428             qTypeField.appendChild(o1);
    429         }
    430    
    431         contentDiv.appendChild(questionParams);
    432         this.element.appendChild(contentDiv);
    433    
    434         // Controls bar
    435         var controlsDiv = ce("div");
    436         controlsDiv.className = "controls";
    437         var btnDiscard = createNewElement("input", "button", "btnDiscard", null, "Discard");
    438         var btnSave = createNewElement("input", "button", "btnSave", null, "Save");
    439         controlsDiv.appendChild(btnDiscard);
    440         controlsDiv.appendChild(btnSave);
    441         btnSave.addEventListener("click", function(){
    442             swapQuestionState(true);
    443         }, false);
    444         btnDiscard.addEventListener("click", function(){
    445             swapQuestionState(false);
    446         }, false);
    447         this.element.appendChild(controlsDiv);
    448         var request = {
    449             "uid": this.uid,
    450             "type": "Question"
    451         }
    452         var requestString = "args="+JSON.stringify(request);
    453         newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
    454             // Fill in the element with the correct values
    455             // Result is sent to setValues in object form already, perhaps better idea to send in string format and parse within the target method?
    456             this.setValues(JSON.parse(result.responseText));
    457         }, true);
    458     }
    459     this.submit = function() {
    460         var request = {
    461             "title": ge("qTitleField").value,
    462             "type": ge("qTypeField").value
    463         }
    464        
    465         newAjaxRequest(requestString, "createObject.php", function(result){
    466             // Display a success message, or throw an error.
    467         }, true);
    468     }
    469    
    470     // Updating input fields
    471     this.selectAnswertype = function () {
    472         // Switch statement, call this.type_x where x is the relevant answer type.
    473         // For all this.type_X funtions:
    474         // Use the createNewElement and createNewInputLabel methods to add controls or input fields.
    475         // Input field convention:  class = questionParamField, id = qTypeField / qScaleSize, etc...
    476         // Input label class: "l" or "r" depending on alignment with respect to parent ("for") input element.
    477         // Important: use the this.paramsElement to access the questionParams div!
    478         // To fully make use of this class-based approach, the editor should be added to a global variable. This global variable should be removed on page unload!
    479     }
    480     this.type_Scale = function () {
    481        
    482     }
    483     this.type_Integer = function () {
    484        
    485     }
    486     this.type_Text = function () {
    487        
    488     }
    489     this.type_Choice = function() {
    490        
    491     }
    492    
    493 }
    494 
    495 function newEditor() {
    496     // Get variables, ofc not null...
    497     var arguments = null;
    498     var editor = new QuestionEditor(arguments);
    499     editor.setValues(arguments);
    500     ge("seqContentWrapper").appendChild(editor.element);
    501 // Etc. We can put the switchModes() command in here as well, I'd say...
    502 // Or should that be in the QuestionEditor class? That's probably better, since it has direct access to all the internal variables.
    503 }
    504 
    505 function startEditingQuestion(uid) {
    506     if (sequencer.state.editing == true) return;
    507    
    508     var element = ge(uid);
    509     var editor = new QuestionEditor();
    510     var newElement = editor.createElement();
    511     // Query parameters
    512     editor.setValues(parameters);
    513     element.parentNode.replaceChild(newElement, element);
    514     sequencer.state.editing = true;
    515 }
  • Dev/trunk/js/sequencerScripts.js

    r218 r230  
    7373        // settings fields first
    7474        initSequencer();
    75        
     75        debugger;
    7676        switch (sequencer.settings.content.contentType.toLowerCase()) {
    7777            case "session":
     
    414414       
    415415    newAjaxRequest(c, u, function(result) {
    416         debugger;
    417416        sequencer.survey.questions.uids.push(removeNL(result.responseText));
    418417        sequencer.survey.questions.upToDate.push(false);
     
    566565        removeButton.className = "smallButton";
    567566        editButton.addEventListener("click", function(e){
    568             debugger;
    569             selectStep(this.parentNode.parentNode.id);
    570             if (sequencer.state.editing != true) swapQuestionState();
     567            alert('Editing not yet supported!');
    571568        }, false);
    572569        removeButton.addEventListener("click", function(e){
     
    632629}
    633630
    634 
    635 
    636 
    637 
    638631// general functions and user actions
    639632
     
    675668                break;
    676669        }
    677         (type != "Question") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/;
     670        (type != "survey") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/;
    678671        sequencer.state.selectedObject.uid = uid;
    679672        sequencer.state.selectedObject.index = null;  //Don't know how to do this yet.
Note: See TracChangeset for help on using the changeset viewer.