From 682d65a169d3d9ba641b94214c809ecc3fd6d930 Mon Sep 17 00:00:00 2001
From: baigner <benedikt.aigner@rwth-aachen.de>
Date: Wed, 30 May 2018 13:30:19 +0200
Subject: [PATCH] Continued adding of design competences (Not finished)

Former-commit-id: 170eb361201eeb91a358cadd5e01e6b7177825ce
---
 kadmos/vistoms/templates/VISTOMS.html | 147 +++++---------------------
 1 file changed, 24 insertions(+), 123 deletions(-)

diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html
index f7b92d3f1..88572bd26 100644
--- a/kadmos/vistoms/templates/VISTOMS.html
+++ b/kadmos/vistoms/templates/VISTOMS.html
@@ -19609,132 +19609,33 @@
                 {               
                     bootbox.hideAll();
                     
-                    var html = d3.select("html")
-                    var form_content = html.append("div").attr("class","form-content").attr("style","display:none")
-                    var form = form_content.append("form").attr("class","form").attr("role","form")
-                    var form_group, input;
-                        
-                    //Tool information
-                    form_group = form.append("div").attr("class","form-group")
-                    form_group.append("text").text("Name")
-                    input = form_group.append("input")
-                        .attr("id","function_node")
-                        .attr("class","form-control")
-                        .attr("name","function_node")
-                        .attr("placeholder","Add a tool name here...")
-                    //Tool input nodes
-                    form_group = form.append("div").attr("class","form-group")
-                    form_group.append("text").text("Tool input nodes")
-                    input = form_group.append("input")
-                        .attr("id","input_nodes_xPath")
-                        .attr("class","form-control")
-                        .attr("name","input_nodes_xPath")
-                        .attr("placeholder","xPaths of the input nodes (please seperate with comma)")
-                    input = form_group.append("input")
-                        .attr("id","input_nodes_name")
-                        .attr("class","form-control")
-                        .attr("name","input_nodes_name")
-                        .attr("placeholder","Variable names of the input nodes (Please separate with comma)")
-                    //Tool output nodes
-                    form_group = form.append("div").attr("class","form-group")
-                    form_group.append("text").text("Tool output nodes")
-                    input = form_group.append("input")
-                        .attr("id","output_node_xPath")
-                        .attr("class","form-control")
-                        .attr("name","output_node_xPath")
-                        .attr("placeholder","xPath of the output node")
-                    input = form_group.append("input")
-                        .attr("id","equation")
-                        .attr("class","form-control")
-                        .attr("name","equation")
-                        .attr("placeholder","Equation for the output node")
-                    input = form_group.append("input")
-                        .attr("id","language")
-                        .attr("class","form-control")
-                        .attr("name","language")
-                        .attr("placeholder","Programming language (e.g. 'Python')")
-                        
-                    //aigner: HIER WEITER!!!
-                    var modal = bootbox.dialog({
-                        message: $(".form-content").html(),
+                    bootbox.dialog({
                         title: "Add design competence",
-                        size: "large",
-                        buttons: [
-                          {
-                            label: "Cancel",
-                            className: "btn btn-default pull-left",
-                            callback: function() {
-                              modal.modal("hide");
-                              d3.selectAll(".form-content").remove();
-                            }
-                          },
-                          {
-                            label: "OK",
-                            className: "btn btn-primary pull-left",
-                            callback: function() {
-                                
-                                //get form data
-                                var form_data = {
-                                    function_node: $('form #function_node').val(),
-                                    input_nodes_xPath: $('form #input_nodes_xPath').val(),
-                                    input_nodes_name: $('form #input_nodes_name').val(),
-                                    output_node_xPath: $('form #output_node_xPath').val(),
-                                    equation: $('form #equation').val(),
-                                    language: $('form #language').val()
-                                }
-                                
-                                
-                                var bootboxContent = {title: "Add mathematical function", message: '<p>Please be patient...</p>'};
-                                var xhr = $.ajax({
-                                    type: 'POST',
-                                    url: '/kadmos_add_mathematical_function',
-                                    data: {'graphID':graphID, 'currentOrder':nodeOrder, 'form_data':JSON.stringify(form_data)},
-                                    success: function(result)
-                                    {
-                                        if (result.includes("ERROR:"))
-                                        {
-                                            bootboxContent.message = result
-                                            kadmosErrorMessage(bootboxContent);
-                                        }
-                                        else
-                                        {
-                                            var updatedData = {};
-                                            updatedData = data;
-                                            var graphData = JSON.parse(result);             
-                                            for (var i = 0; i < updatedData.graphs.length; i++)
-                                            {
-                                                if (graphID == updatedData.graphs[i].id)
-                                                {
-                                                    updatedData.graphs[i] = graphData.graphs[0];   
-                                                }
-                                            }
-                                            
-                                            clearView();
-                                            makeKadmosMenu(updatedData);
-                                            xdsm_script(updatedData,graphID);
-                                            
-                                            bootboxContent.message = "Success!"
-                                            kadmosSuccessMessage(bootboxContent)
-                                        }
-                                    },
-                                    error: function(result)
-                                    {
-                                        bootboxContent.message = result
-                                        kadmosErrorMessage(bootboxContent);
-                                    }
-                                });
-                                kadmosHavePatience(xhr, bootboxContent)
-                                kadmosHavePatience(xhr, bootboxContent)
-                                modal.modal("hide");
-                                d3.selectAll(".form-content").remove();
+                        message: "<form id='scriptForm' method='post' enctype='multipart/form-data'>" 
+                                +"<label>"
+                                +"<text>Upload input xml file:</text>"
+                                +"<input style='margin-bottom:20px;' type='file' name='file1' />"
+                                +"<text>Upload output xml file:</text>"
+                                +"<input type='file' name='file2' />"
+                                +"<input style='margin-top:20px;' type='button' value='Submit' onclick='submitForms()'/>"
+                                +"</label></form>",
+                        buttons : 
+                        { 
+                            cancel: {
+                                label: "Cancel",
+                                className: 'btn-danger'
                             }
-                          }
-                        ],
-                        onEscape: function() {
-                          modal.modal("hide");
-                          d3.selectAll(".form-content").remove();
-                        }
+                        }                                
                     });
+                    
+                    var submitForms = function(){
+                        document.forms["file1"].submit();
+                        document.forms["file2"].submit();
+                        return true;
+                    }
+                    
+                    console.log(submitForms)
+                    
                 }
                 
                 function addDCMetadata(aNode=null)
-- 
GitLab