Index: Dev/trunk/js/dashboardScripts.js
===================================================================
--- Dev/trunk/js/dashboardScripts.js	(revision 230)
+++ Dev/trunk/js/dashboardScripts.js	(revision 230)
@@ -0,0 +1,183 @@
+dbSelectionInfoTimeout = null;
+currentlySelected = {
+    titles: [],
+    uids: [],
+    type: null
+}
+
+shoppingCart = {
+    contents: {
+        titles: [],
+        uids: [],
+        types: []
+    }
+}
+
+function infoPanelTimeout(event) {
+    // If no event, crash.
+    if (event == undefined || event == null) return;
+    // Cancel previous timeout if present.
+    if (dbSelectionInfoTimeout) {
+        window.clearTimeout(dbSelectionInfoTimeout);
+    }
+    // Gather parameters about event.
+    var dbSelectionInfoTime = 500;
+    var selectBox = event.target;
+    var values = getMultipleListValue(selectBox).values;
+    var titles = getMultipleListValue(selectBox).titles;
+    var uid = values[values.length-1];
+    var type;
+    switch (selectBox.id) {
+        case "dbSessionInstancesList":
+            // This should be session instance, not session. Testing purpose only.
+            type = "Session";
+            break;
+        case "dbGamedataList":
+            // This is obviously not the real type, change before committing
+            type = "Application";
+            break;
+        default:
+            alert("No valid type passed!");
+            break;
+    }
+    currentlySelected.uids = values;
+    currentlySelected.titles = titles;
+    currentlySelected.type = type;
+    // Set timeout of 500ms, then execute ajaxInfoRequest with previously gathered parameters.
+    dbSelectionInfoTimeout = window.setTimeout(ajaxInfoRequest, dbSelectionInfoTime, uid, ge("dbInfoPanelContent"), type);
+    
+}
+
+function getMultipleListValue(element) {
+    // Get multiple values from multiple select box
+    //TODO: 
+    var result = {
+        values: [],
+        titles: []
+    }
+        
+    for (var i = 0; i < element.options.length; i++) {
+        if (element.options[i].selected == true) {
+            result.values.push(element.options[i].value);
+            result.titles.push(element.options[i].text);
+        }
+    }
+    return result;
+}
+
+function addDataToList() {
+    // Take selected objects and add to shopping cart
+        
+    // set element
+    var element;
+    switch (currentlySelected.type){
+        case "Session":
+            element = ge("dbSessionInstancesList");
+            break;
+        case "Application":
+            element = ge("dbGamedataList");
+            break;
+        default:
+            // ???
+            break;
+    }
+    var uid;
+    while (uid = currentlySelected.uids.pop()) {
+        // Add to shopping cart
+        shoppingCart.contents.uids.push(uid);
+        shoppingCart.contents.titles.push(currentlySelected.titles.pop());
+        shoppingCart.contents.types.push(currentlySelected.type);
+        
+        // Remove option from list
+        for (var i = 0; i < element.options.length; i++) {
+            if (element.options[i].value == uid) {
+                element.remove(i);
+                break;
+            }
+        }
+    }
+    
+    // Then add display of shopping cart contents
+    drawShoppingCart();
+    
+}
+
+function removeFromList(event) {
+    if (event == null || event == undefined) return;
+    
+    var id = event.target.parentNode.id;
+    var uid = id.split("shoppingCartItem")[1];
+    // find index, remove from object
+    var indexInCart = shoppingCart.contents.uids.indexOf(uid);
+    var tempTitle = shoppingCart.contents.titles[indexInCart];
+    var cn = confirm("Are you sure you want to remove: "+tempTitle+"?");
+    if (cn == false) return;
+    
+    
+    shoppingCart.contents.uids.splice(indexInCart, 1);
+    var title = shoppingCart.contents.titles.splice(indexInCart, 1)[0];
+    var type = shoppingCart.contents.types.splice(indexInCart, 1)[0];
+    //Then replace element back into relevant list
+    // First set element
+        
+    var element;
+    switch (type){
+        case "Session":
+            element = ge("dbSessionInstancesList");
+            break;
+        case "Application":
+            element = ge("dbGamedataList");
+            break;
+        default:
+            // ???
+            break;
+    }
+    
+    var option = ce("option");
+    option.value = uid;
+    option.text = title;
+    element.add(option,null);
+    
+    
+    
+    // Lastly, refresh
+    drawShoppingCart();
+    }
+
+function drawShoppingCart() {
+        var scElement = ge("shoppingCartContent");
+        scElement.innerHTML = "";
+        for (var i = 0; i < shoppingCart.contents.uids.length; i++) {
+            var newLine = ce("div");
+            newLine.className = "shoppingCartItem";
+            newLine.id = "shoppingCartItem"+shoppingCart.contents.uids[i];
+            var icon = ce("image");
+            icon.src = "images/ui/DeleteIcon.gif";
+            icon.addEventListener("click", function(event){
+                // TODO: Actually write this function
+                removeFromList(event);
+            }, false);
+            var titleField = ce("text");
+            titleField.innerHTML = shoppingCart.contents.titles[i];
+            newLine.appendChild(icon);
+            newLine.appendChild(titleField);
+            scElement.appendChild(newLine);
+        }
+    
+        // reset type after empty
+        currentlySelected.type = null;
+    }
+    
+function configureDashboard() {
+    var data = JSON.stringify(shoppingCart);
+    var form = ce("form");
+    //changed to dashboardGraphSelection.php
+    form.action = "dashboardGraphSelection.php";
+    form.method = "POST";
+    var input = ce("input");
+    input.type = "hidden";
+    input.name = "selectedData";
+    input.value = data;
+    form.appendChild(input);
+    form.submit();
+}
Index: Dev/trunk/js/generalScripts.js
===================================================================
--- Dev/trunk/js/generalScripts.js	(revision 228)
+++ Dev/trunk/js/generalScripts.js	(revision 230)
@@ -208,5 +208,5 @@
             instance.ddMenuItem.style.visibility = "hidden";
         }
-            instance.Toggle();
+        instance.Toggle();
         
     }
@@ -244,6 +244,8 @@
         else{
             //Show the menu
-            instance.menuElement.style.visibility = "visible";
-            instance.parentButton.className = "down";
+            if (instance.menuElement) {
+                instance.menuElement.style.visibility = "visible";
+                instance.parentButton.className = "down";
+            }
             instance.visible = true;
         }
Index: Dev/trunk/js/questionEditorScripts.js
===================================================================
--- Dev/trunk/js/questionEditorScripts.js	(revision 228)
+++ Dev/trunk/js/questionEditorScripts.js	(revision 230)
@@ -23,141 +23,9 @@
 //////////////////////////
 
-//////////////////////
-/* CREATE FUNCTIONS */
-//////////////////////
-
-function createQuestionEditor() {
-    // Outer div
-    var editorElement = ce("div");
-    this.className = "smallFrame questionEditor";
-    editorElement.id = sequencer.state.selectedObject.uid;
-    // Header
-    var titleDiv = ce("div");
-    titleDiv.className = "smallTitle";
-    var numberDiv = ce("div");
-    numberDiv.className = "listNumber";
-    numberDiv.innerHTML = "4";
-    var nameSpan = ce("span");
-    nameSpan.innerHTML = "New question";
-    titleDiv.appendChild(numberDiv);
-    titleDiv.innerHTML += "Editing: ";
-    titleDiv.appendChild(nameSpan);
-    editorElement.appendChild(titleDiv);
-    
-    //Content area
-    var contentDiv = ce("div");
-    contentDiv.className = "content";
-    var bodyText = createNewElement("textarea", null, "qBodyTextField", "qBodyTextField", null);
-    bodyText.value = "Question body text goes here";
-    
-    
-    // The dynamic questionParams div, where all the control elements and inputs will be located
-    var questionParams = ce("div");
-    questionParams.className = "questionParams";
-    contentDiv.appendChild(bodyText);
-    var qIdentField = createNewElement("input", "text", "qIdentField", "questionParamField", null);
-    var qIdentField_lbl = createNewInputLabel("Question code:","qIdentField", "l");
-    questionParams.appendChild(qIdentField_lbl);
-    questionParams.appendChild(qIdentField);
-    
-    var qTypeField = createNewElement("select", null, "qTypeField", "questionParamField", null);
-    var qTypeField_lbl = createNewInputLabel("Answer type:","qTypeField", "l");
-    questionParams.appendChild(qTypeField_lbl);
-    questionParams.appendChild(qTypeField);
-    qTypeField.addEventListener("change", function(){
-        debugger;
-        selectAnswerType();
-    }, false);
-    // Add the select options. Do this in a block scope to prevent the o1 var from messing things up. 
-    // Also helps in structuring code.
-    {
-        var o1 = ce("option");
-        o1.value = null;
-        o1.text = "";
-        qTypeField.appendChild(o1);
-        
-        o1 = ce("option");
-        o1.value = "int";
-        o1.text = "Integer";
-        qTypeField.appendChild(o1);
-        
-        o1 = ce("option");
-        o1.value = "scale";
-        o1.text = "Scale";
-        qTypeField.appendChild(o1);
-        
-        o1 = ce("option");
-        o1.value = "choice";
-        o1.text = "Multiple choice";
-        qTypeField.appendChild(o1);
-        
-        o1 = ce("option");
-        o1.value = "text";
-        o1.text = "Text";
-        qTypeField.appendChild(o1);
-    }
-    
-    contentDiv.appendChild(questionParams);
-    editorElement.appendChild(contentDiv);
-    
-    // Controls bar
-    var controlsDiv = ce("div");
-    controlsDiv.className = "controls";
-    var btnDiscard = createNewElement("input", "button", "btnDiscard", null, "Discard");
-    var btnSave = createNewElement("input", "button", "btnSave", null, "Save");
-    controlsDiv.appendChild(btnDiscard);
-    controlsDiv.appendChild(btnSave);
-    btnSave.addEventListener("click", function(){
-        swapQuestionState(true);
-    }, false);
-    btnDiscard.addEventListener("click", function(){
-        swapQuestionState(false);
-    }, false);
-    editorElement.appendChild(controlsDiv);
-    
-    return editorElement;
-}
-
-function swapQuestionState(save) {
-    // Function that replaces a question display with the question editor, or vice versa.
-    if (sequencer.state.editing == false) {
-        // Start editing
-        sequencer.state.editing = true;
-        var questionElement = ge(sequencer.state.selectedObject.uid);
-        // test
-        var editor = new QuestionEditor();
-        editor.init();
-        // end test
-        //var editorElement = createQuestionEditor();
-        var content = ge("seqContentWrapper");
-        content.replaceChild(editor.element, questionElement);
-    }
-    else {
-        
-        if (save) {
-            if (save == true) {
-                alert("Saving shit yo!");
-            // User is done editing
-            // 1. Create the edited question in db (createObject.php), then set the proper properties (saveObject.php)
-            // 2. Revert back to question display
-            }
-            else {
-                // Anders discard gewoon alles en haal de question display weg.
-                ge("seqContentWrapper").removeChild(ge(sequencer.state.selectedObject.uid));
-            }
-        }
-    
-    }
-}
-
-
-//////////////////////////
-/* END CREATE FUNCTIONS */
-//////////////////////////
 
 var qUID, parentObjectUID, qName, qTag, qType, qAnswerLength;
 
 function selectAnswerType(){
-    var selectBox = document.getElementById("qTypeField");
+    var selectBox = document.getElementById("questionType");
     if (selectBox.value != undefined && selectBox.value != "") {
         qType = selectBox.value;
@@ -188,11 +56,4 @@
 
 function createNewElement(tag, type, id, cl, value) {
-    // This is a double of the ce() alias function in generalScripts.js. 
-    // It allows for more specific creation of elements on one line, 
-    // instead of 5 subsequent lines of code defining tag, id, class, value, etc...
-    // This is handy when doing creation-heavy operations such as adding inputs
-    //!!! Since this is defined in questionEditorScripts.js, it should only be used in this context.
-    //!!! Use ce() whenever possible, since it's included on every page and works faster.
-    
     var newElement = document.createElement(tag);
     if (type != undefined) newElement.type = type;
@@ -206,8 +67,7 @@
 }
 
-function createNewInputLabel(text, target, align) {
+function createNewInputLabel(text, target) {
     var newLabel = document.createElement("label");
     if (target) newLabel.setAttribute("for",target);
-    if (align) newLabel.className = "questionParamLabel "+align+"Align"; else newLabel.className="questionParamLabel";
     newLabel.innerHTML = text;
     return newLabel;
@@ -335,181 +195,2 @@
     alert(userText);
 }
-
-
-//TEST FUNCTIONS
-
-/*
- * These functions are an attempt at making editors class based, for easier organisation and parameter storage and access.
- * It prevents having to add more question-specific clutter to the sequencer object
- */
-
-function QuestionEditor() {
-    // Properties    
-    this.uid = null;
-    this.element = null;
-    this.paramsElement = null;
-    
-    // Basic functionality
-    this.setValues = function(arguments) {
-        // Query question information from database, then fill element fields with correct information.
-        
-    }
-    this.init = function() {
-        // Outer div
-        this.element = ce("div");
-        this.element.className = "smallFrame questionEditor";
-        this.element.id = sequencer.state.selectedObject.uid;
-        this.uid = sequencer.state.selectedObject.uid;
-        // Header
-        var titleDiv = ce("div");
-        titleDiv.className = "smallTitle";
-        var numberDiv = ce("div");
-        numberDiv.className = "listNumber";
-        numberDiv.innerHTML = "4";
-        var nameSpan = ce("span");
-        nameSpan.id = "qTitleField";
-        nameSpan.innerHTML = "New question";
-        titleDiv.appendChild(numberDiv);
-        titleDiv.innerHTML += "Editing: ";
-        titleDiv.appendChild(nameSpan);
-        this.element.appendChild(titleDiv);
-    
-        //Content area
-        var contentDiv = ce("div");
-        contentDiv.className = "content";
-        var bodyText = createNewElement("textarea", null, "qBodyTextField", "qBodyTextField", null);
-        bodyText.value = "Question body text goes here";
-    
-    
-        // The dynamic questionParams div, where all the control elements and inputs will be located
-        var questionParams = ce("div");
-        this.paramsElement = questionParams;
-        questionParams.className = "questionParams";
-        contentDiv.appendChild(bodyText);
-        var qIdentField = createNewElement("input", "text", "qIdentField", "questionParamField", null);
-        var qIdentField_lbl = createNewInputLabel("Question code:","qIdentField", "l");
-        questionParams.appendChild(qIdentField_lbl);
-        questionParams.appendChild(qIdentField);
-    
-        var qTypeField = createNewElement("select", null, "qTypeField", "questionParamField", null);
-        var qTypeField_lbl = createNewInputLabel("Answer type:","qTypeField", "l");
-        questionParams.appendChild(qTypeField_lbl);
-        questionParams.appendChild(qTypeField);
-        qTypeField.addEventListener("change", function(){
-            debugger;
-            selectAnswerType();
-        }, false);
-        // Add the select options. Do this in a block scope to prevent the o1 var from messing things up. 
-        // Also helps in structuring code.
-        {
-            var o1 = ce("option");
-            o1.value = null;
-            o1.text = "";
-            qTypeField.appendChild(o1);
-        
-            o1 = ce("option");
-            o1.value = "int";
-            o1.text = "Integer";
-            qTypeField.appendChild(o1);
-        
-            o1 = ce("option");
-            o1.value = "scale";
-            o1.text = "Scale";
-            qTypeField.appendChild(o1);
-        
-            o1 = ce("option");
-            o1.value = "choice";
-            o1.text = "Multiple choice";
-            qTypeField.appendChild(o1);
-        
-            o1 = ce("option");
-            o1.value = "text";
-            o1.text = "Text";
-            qTypeField.appendChild(o1);
-        }
-    
-        contentDiv.appendChild(questionParams);
-        this.element.appendChild(contentDiv);
-    
-        // Controls bar
-        var controlsDiv = ce("div");
-        controlsDiv.className = "controls";
-        var btnDiscard = createNewElement("input", "button", "btnDiscard", null, "Discard");
-        var btnSave = createNewElement("input", "button", "btnSave", null, "Save");
-        controlsDiv.appendChild(btnDiscard);
-        controlsDiv.appendChild(btnSave);
-        btnSave.addEventListener("click", function(){
-            swapQuestionState(true);
-        }, false);
-        btnDiscard.addEventListener("click", function(){
-            swapQuestionState(false);
-        }, false);
-        this.element.appendChild(controlsDiv);
-        var request = {
-            "uid": this.uid,
-            "type": "Question"
-        }
-        var requestString = "args="+JSON.stringify(request);
-        newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
-            // Fill in the element with the correct values
-            // Result is sent to setValues in object form already, perhaps better idea to send in string format and parse within the target method?
-            this.setValues(JSON.parse(result.responseText));
-        }, true);
-    }
-    this.submit = function() {
-        var request = {
-            "title": ge("qTitleField").value,
-            "type": ge("qTypeField").value
-        }
-        
-        newAjaxRequest(requestString, "createObject.php", function(result){
-            // Display a success message, or throw an error.
-        }, true);
-    }
-    
-    // Updating input fields
-    this.selectAnswertype = function () {
-        // Switch statement, call this.type_x where x is the relevant answer type.
-        // For all this.type_X funtions:
-        // Use the createNewElement and createNewInputLabel methods to add controls or input fields.
-        // Input field convention:  class = questionParamField, id = qTypeField / qScaleSize, etc...
-        // Input label class: "l" or "r" depending on alignment with respect to parent ("for") input element.
-        // Important: use the this.paramsElement to access the questionParams div!
-        // 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!
-    }
-    this.type_Scale = function () {
-        
-    }
-    this.type_Integer = function () {
-        
-    }
-    this.type_Text = function () {
-        
-    }
-    this.type_Choice = function() {
-        
-    }
-    
-}
-
-function newEditor() {
-    // Get variables, ofc not null...
-    var arguments = null;
-    var editor = new QuestionEditor(arguments);
-    editor.setValues(arguments);
-    ge("seqContentWrapper").appendChild(editor.element);
-// Etc. We can put the switchModes() command in here as well, I'd say...
-// Or should that be in the QuestionEditor class? That's probably better, since it has direct access to all the internal variables.
-}
-
-function startEditingQuestion(uid) {
-    if (sequencer.state.editing == true) return;
-    
-    var element = ge(uid);
-    var editor = new QuestionEditor();
-    var newElement = editor.createElement();
-    // Query parameters
-    editor.setValues(parameters);
-    element.parentNode.replaceChild(newElement, element);
-    sequencer.state.editing = true;
-}
Index: Dev/trunk/js/sequencerScripts.js
===================================================================
--- Dev/trunk/js/sequencerScripts.js	(revision 228)
+++ Dev/trunk/js/sequencerScripts.js	(revision 230)
@@ -73,5 +73,5 @@
         // settings fields first
         initSequencer();
-        
+        debugger;
         switch (sequencer.settings.content.contentType.toLowerCase()) {
             case "session":
@@ -414,5 +414,4 @@
         
     newAjaxRequest(c, u, function(result) {
-        debugger;
         sequencer.survey.questions.uids.push(removeNL(result.responseText));
         sequencer.survey.questions.upToDate.push(false);
@@ -566,7 +565,5 @@
         removeButton.className = "smallButton";
         editButton.addEventListener("click", function(e){
-            debugger;
-            selectStep(this.parentNode.parentNode.id);
-            if (sequencer.state.editing != true) swapQuestionState();
+            alert('Editing not yet supported!');
         }, false);
         removeButton.addEventListener("click", function(e){
@@ -632,8 +629,4 @@
 }
 
-
-
-
-
 // general functions and user actions
 
@@ -675,5 +668,5 @@
                 break;
         }
-        (type != "Question") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/;
+        (type != "survey") ? ajaxInfoRequest(uid, ge("infoPanelContent"), type) : type=type /*This does nothing*/;
         sequencer.state.selectedObject.uid = uid;
         sequencer.state.selectedObject.index = null;  //Don't know how to do this yet.
