diff options
author | Chinthakayala,Sheshashailavas(sc2914) <sc2914@att.com> | 2018-06-27 16:11:44 +0000 |
---|---|---|
committer | Chinthakayala,Sheshashailavas(sc2914) <sc2914@att.com> | 2018-06-27 16:25:31 +0000 |
commit | 8f6a6c445eaeb7356e1db9d10d10b7d3fa42f27e (patch) | |
tree | bf1e5c83c357fbd4a0158cac6d41bd936e949a80 /dgbuilder/nodes/dge/dgelogic | |
parent | e14a02086c9119532f9153c78346d5c1d6789ca9 (diff) |
removed dependency on built-editor.min.js
and added ability to test DG from dgbuilder
and fixed the break node on XML generation
and added ability to download
formatted DG XML and DG JSON
Issue-ID: SDNC-353
Change-Id: I799de5de2c4f61e9b56dbe996d8ac3e3b28061f7
Signed-off-by: Chinthakayala,Sheshashailavas(sc2914) <sc2914@att.com>
Diffstat (limited to 'dgbuilder/nodes/dge/dgelogic')
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/block.html | 91 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/breakNode.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/call.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/configure.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/delete.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/execute.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/exists.html | 79 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/forNode.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/get-resource.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/is-available.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/notify.html | 80 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/record.html | 80 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/release.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/reserve.html | 77 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/save.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/set.html | 78 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/switchNode.html | 80 | ||||
-rw-r--r-- | dgbuilder/nodes/dge/dgelogic/update.html | 80 |
18 files changed, 747 insertions, 678 deletions
diff --git a/dgbuilder/nodes/dge/dgelogic/block.html b/dgbuilder/nodes/dge/dgelogic/block.html index fadf8a8c..4e6d2b98 100644 --- a/dgbuilder/nodes/dge/dgelogic/block.html +++ b/dgbuilder/nodes/dge/dgelogic/block.html @@ -107,10 +107,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -126,69 +126,72 @@ $('#node-input-atomic-chkBox').prop('checked', false); } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + blockXmlEditor=that.editor; + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - blockXmlEditor=that.editor; - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ - //console.log("validate clicked."); + console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ @@ -196,26 +199,26 @@ } delete this.editor; delete blockXmlEditor; - } + } }); function updateXml(){ if($("#node-input-atomic-chkBox").is(':checked')){ $("#node-input-name").val("block : atomic"); $("#node-input-atomic").val("true"); //alert($("#node-input-xml-editor div.textview div.textviewContent").text()); - var xmlStr = blockXmlEditor.getText(); + var xmlStr = blockXmlEditor.getValue(); var re = new RegExp("<block[^<]+"); xmlStr=xmlStr.replace(re,"<block atomic='true'>"); //$("#node-input-xml-editor div.textview div.textviewContent").text(xmlStr); - blockXmlEditor.setText(xmlStr); + blockXmlEditor.setValue(xmlStr); //console.log("block xmlStr:" + xmlStr); }else{ $("#node-input-name").val("block"); $("#node-input-atomic").val("false"); - var xmlStr = blockXmlEditor.getText(); + var xmlStr = blockXmlEditor.getValue(); var re = new RegExp("<block[^<]+"); xmlStr=xmlStr.replace(re,"<block>"); - blockXmlEditor.setText(xmlStr); + blockXmlEditor.setValue(xmlStr); //$("#node-input-xml-editor div.textview div.textviewContent").text(xmlStr); //console.log("block xmlStr:" + xmlStr); } diff --git a/dgbuilder/nodes/dge/dgelogic/breakNode.html b/dgbuilder/nodes/dge/dgelogic/breakNode.html index e3edef9d..8bb20f41 100644 --- a/dgbuilder/nodes/dge/dgelogic/breakNode.html +++ b/dgbuilder/nodes/dge/dgelogic/breakNode.html @@ -77,11 +77,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -90,72 +89,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/call.html b/dgbuilder/nodes/dge/dgelogic/call.html index 0e49e26c..d207ec9f 100644 --- a/dgbuilder/nodes/dge/dgelogic/call.html +++ b/dgbuilder/nodes/dge/dgelogic/call.html @@ -99,11 +99,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -112,72 +111,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - //console.log("show Values clicked."); - showValuesBox(that.editor,rpcValues); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/configure.html b/dgbuilder/nodes/dge/dgelogic/configure.html index 7503b1f1..9deda0df 100644 --- a/dgbuilder/nodes/dge/dgelogic/configure.html +++ b/dgbuilder/nodes/dge/dgelogic/configure.html @@ -143,10 +143,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -155,73 +155,77 @@ } } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/delete.html b/dgbuilder/nodes/dge/dgelogic/delete.html index b4c7f52f..31008bf7 100644 --- a/dgbuilder/nodes/dge/dgelogic/delete.html +++ b/dgbuilder/nodes/dge/dgelogic/delete.html @@ -103,11 +103,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -116,72 +115,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/execute.html b/dgbuilder/nodes/dge/dgelogic/execute.html index 3d5fc6d7..4832745a 100644 --- a/dgbuilder/nodes/dge/dgelogic/execute.html +++ b/dgbuilder/nodes/dge/dgelogic/execute.html @@ -113,10 +113,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -125,73 +125,77 @@ } } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/exists.html b/dgbuilder/nodes/dge/dgelogic/exists.html index 001e8ca1..b499e459 100644 --- a/dgbuilder/nodes/dge/dgelogic/exists.html +++ b/dgbuilder/nodes/dge/dgelogic/exists.html @@ -102,11 +102,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -115,73 +114,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/forNode.html b/dgbuilder/nodes/dge/dgelogic/forNode.html index c7327db4..8126b11a 100644 --- a/dgbuilder/nodes/dge/dgelogic/forNode.html +++ b/dgbuilder/nodes/dge/dgelogic/forNode.html @@ -88,11 +88,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -101,72 +100,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/get-resource.html b/dgbuilder/nodes/dge/dgelogic/get-resource.html index b3b65581..31478d7b 100644 --- a/dgbuilder/nodes/dge/dgelogic/get-resource.html +++ b/dgbuilder/nodes/dge/dgelogic/get-resource.html @@ -108,11 +108,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -121,72 +120,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/is-available.html b/dgbuilder/nodes/dge/dgelogic/is-available.html index 8bc45ef5..32d76650 100644 --- a/dgbuilder/nodes/dge/dgelogic/is-available.html +++ b/dgbuilder/nodes/dge/dgelogic/is-available.html @@ -102,11 +102,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -115,72 +114,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/notify.html b/dgbuilder/nodes/dge/dgelogic/notify.html index e5bc24bc..ec91980c 100644 --- a/dgbuilder/nodes/dge/dgelogic/notify.html +++ b/dgbuilder/nodes/dge/dgelogic/notify.html @@ -111,10 +111,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -123,73 +123,77 @@ } } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ - //console.log("validate clicked."); + console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/record.html b/dgbuilder/nodes/dge/dgelogic/record.html index 3eb7a2e6..facc79cd 100644 --- a/dgbuilder/nodes/dge/dgelogic/record.html +++ b/dgbuilder/nodes/dge/dgelogic/record.html @@ -90,7 +90,7 @@ category: 'DGElogic', defaults: { name: {value:"record"}, - xml: {value:"<record>\n"}, + xml: {value:"<record plugin=''>\n"}, comments:{value:""}, outputs: {value:1} }, @@ -101,11 +101,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -114,72 +113,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/release.html b/dgbuilder/nodes/dge/dgelogic/release.html index 044616a9..dfaf2e9d 100644 --- a/dgbuilder/nodes/dge/dgelogic/release.html +++ b/dgbuilder/nodes/dge/dgelogic/release.html @@ -108,11 +108,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -121,72 +120,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/reserve.html b/dgbuilder/nodes/dge/dgelogic/reserve.html index bcd3fcb9..d706544a 100644 --- a/dgbuilder/nodes/dge/dgelogic/reserve.html +++ b/dgbuilder/nodes/dge/dgelogic/reserve.html @@ -106,10 +106,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -118,72 +118,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/save.html b/dgbuilder/nodes/dge/dgelogic/save.html index 6e022154..a34b534c 100644 --- a/dgbuilder/nodes/dge/dgelogic/save.html +++ b/dgbuilder/nodes/dge/dgelogic/save.html @@ -105,11 +105,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -118,72 +117,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/set.html b/dgbuilder/nodes/dge/dgelogic/set.html index bcbcae30..5410d3fe 100644 --- a/dgbuilder/nodes/dge/dgelogic/set.html +++ b/dgbuilder/nodes/dge/dgelogic/set.html @@ -78,11 +78,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -91,72 +90,77 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> diff --git a/dgbuilder/nodes/dge/dgelogic/switchNode.html b/dgbuilder/nodes/dge/dgelogic/switchNode.html index 35c9fe67..3088d395 100644 --- a/dgbuilder/nodes/dge/dgelogic/switchNode.html +++ b/dgbuilder/nodes/dge/dgelogic/switchNode.html @@ -120,11 +120,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -133,75 +132,78 @@ } } - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); - //To increase the width of dialogbox - //$(".ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-front.ui-dialog-buttons.ui-draggable.ui-resizable").css("width","1400px"); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); function encodeTestStr(xmlStr){ diff --git a/dgbuilder/nodes/dge/dgelogic/update.html b/dgbuilder/nodes/dge/dgelogic/update.html index a7d28283..f6c3adc3 100644 --- a/dgbuilder/nodes/dge/dgelogic/update.html +++ b/dgbuilder/nodes/dge/dgelogic/update.html @@ -111,10 +111,10 @@ return this.name; }, oneditprepare: function() { + var that = this; $( "#node-input-outputs" ).spinner({ min:1 }); - var comments = $( "#node-input-comments").val(); if(comments != null){ comments = comments.trim(); @@ -123,73 +123,77 @@ } } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); + function functionDialogResize() { + var rows = $("#dialog-form>div:not(.node-text-editor-row)"); + var height = $("#dialog-form").height(); + for (var i=0;i<rows.size();i++) { + height -= $(rows[i]).outerHeight(true); + } + var editorRow = $("#dialog-form>div.node-text-editor-row"); + height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom"))); + $(".node-text-editor").css("height",height+"px"); + that.editor.resize(); }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); $( "#dialog" ).on("dialogresize", functionDialogResize); $( "#dialog" ).one("dialogopen", function(ev) { var size = $( "#dialog" ).dialog('option','sizeCache-function'); if (size) { - functionDialogResize(null,{size:size}); + $("#dialog").dialog('option','width',size.width); + $("#dialog").dialog('option','height',size.height); + functionDialogResize(); } }); + $( "#dialog" ).one("dialogclose", function(ev,ui) { + var height = $( "#dialog" ).dialog('option','height'); + $( "#dialog" ).off("dialogresize",functionDialogResize); + }); + this.editor = RED.editor.createEditor({ + id: 'node-input-xml-editor', + mode: 'ace/mode/html' + }); + this.editor.setValue($("#node-input-xml").val(),-1); + /* + RED.library.create({ + url:"functions", // where to get the data from + type:"function", // the type of object the library is for + editor:this.editor, // the field name the main text body goes to + mode:"ace/mode/html", + fields:['name','outputs'] + }); + */ + this.editor.focus(); /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ + $( "#node-input-xml-editor" ).keyup(function(event){ if(event.which == 27 ) { $("#node-dialog-cancel").click(); } }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('node-input-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - RED.library.create({ - url:"functions", // where to get the data from - type:"function", // the type of object the library is for - editor:that.editor, // the field name the main text body goes to - fields:['name','outputs'] - }); - $("#node-input-name").focus(); $("#node-input-validate").click(function(){ - //console.log("validate clicked."); + console.log("validate clicked."); //console.dir(that.editor); //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); + var val = that.editor.getValue(); validateXML(val); }); $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); + //console.log("show Values clicked."); + showValuesBox(that.editor,sliValuesObj); }); - - }); //for click of add comments button $("#node-input-btnComments").click(function(e){ showCommentsBox(); }); - }, + }, oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); + $("#node-input-xml").val(this.editor.getValue()); + var resp=validateXML(this.editor.getValue()); if(resp){ this.status = {fill:"green",shape:"dot",text:"OK"}; }else{ this.status = {fill:"red",shape:"dot",text:"ERROR"}; } delete this.editor; - } + } }); </script> |