X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Funivbrisfv%2Fstatic%2Fjs%2Funivbrisfv.js;fp=plugins%2Funivbrisfv%2Fstatic%2Fjs%2Funivbrisfv.js;h=7cefef605373ff65803341824f3ad07f408e8a3a;hb=e45ccc4c4c327a81cc6a001ceff0655358ea09c5;hp=82581ab2d8b49183dfd51207d7a4f7c4447d452b;hpb=e494918d8e6d9dab21b9ff30c3c2db2157dc0a20;p=myslice.git diff --git a/plugins/univbrisfv/static/js/univbrisfv.js b/plugins/univbrisfv/static/js/univbrisfv.js index 82581ab2..7cefef60 100644 --- a/plugins/univbrisfv/static/js/univbrisfv.js +++ b/plugins/univbrisfv/static/js/univbrisfv.js @@ -11,8 +11,10 @@ pk_flowspace_index=0; opt_flowspace_index=0; + pk_mode=0; fvf_add=1; fvf_nrow=0; + var UnivbrisFv = Plugin.extend({ @@ -95,8 +97,11 @@ initialize_table: function() { + + /* Transforms the table into DataTable, and keep a pointer to it */ var self = this; + //alert(self.options); var actual_options = { // Customize the position of Datatables elements (length,filter,button,...) // we use a fluid row on top and another on the bottom, making sure we take 12 grid elt's each time @@ -179,7 +184,7 @@ $('').appendTo('div.buttons');**/ - jQuery( "#univbris_flowspace_selection" ).hide(); + //jQuery( "#univbris_flowspace_selection" ).hide(); //$('next link').appendTo('div.submit'); @@ -189,121 +194,354 @@ //this.new_record("t"); //this.new_record("t"); this._querytable_draw_callback(); - + jQuery("#univbris_flowspace_selection").hide(); }, // initialize_table fnButsubmit:function(e){ - alert("submitting"); - var rows = $("#univbris_flowspace_selection__table").dataTable().fnGetNodes(); - var cells=[]; - for(var i=0;i=7){ + //alert(controller.substring(0,4)) + if(controller.substring(0,4)=="tcp:" | controller.substring(0,4)=="ssl:"){ + var controller_ip=controller.substring(4,controller.length); + //alert(controller_ip) + var index=controller_ip.indexOf(":") + if (index!=-1){ + var controller_ip1=controller_ip.substring(0,index); + //alert(controller_ip1); + var ip_validator= /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; + if (!controller_ip1.match(ip_validator)){ + throw "Incorrect IP format"; + } + //else{ + // throw "incorrect ip"; + //} + + var controller_port=controller_ip.substring(index+1,controller_ip.length); + if(!isNaN(controller_port)){ + controller_port=parseInt(controller_port,10); + if (!((controller_port >0) & (controller_port <65536))){ + //if(controller_port >0){ + throw "Incorrect controller port"; + } + //else{ + // throw "correct port"; + //} + } + else{ + throw "Incorrect controller port"; + } + } + else{ + throw "Incorrect controller specified"; + } + } + else{ + throw "Controller must start with tcp: or ssl:"; + } + + } + else{ + throw "Incorrect controller specified"; + } + //end of validation of controller field + + var rows = $("#univbris_flowspace_selection__table").dataTable().fnGetNodes(); + var cells=[]; + + var json_rspec={}; + json_rspec["controller"]=controller; + var groups_rspec=[]; + var matches_rspec=[]; + + if (rows.length <=0) { + throw "No Flowspace defined" + } + + + var queryStringToJSON = function (url) { + if (url === '') return ''; + var pairs = (url || location.search).slice(1).split('&'); + var result = {}; + for (var idx in pairs) { + if ($.isNumeric(idx)) { + var pair = pairs[idx].split('='); + if (!!pair[0]){ + result[pair[0].toLowerCase()] = decodeURIComponent(pair[1].replace(/\+/g, " ") || ''); + } + } + } + return result; } - } - var controller= $('#controller_loc').val(); + for(var i=0;i "+$("#flowspace_name").val()+"

"; - this.table.fnDeleteRow(fvf_nrow); - this.table.fnAddData([string, 'Edit', 'Delete']); - jQuery( "#univbris_flowspace_selection" ).show(); - //onclick=\'fnEdit("test");\' - //alert("myserialise: "+form); - //alert("added flowspace:" + sData); - }, @@ -641,6 +879,8 @@ on_all_query_done: function() { if (debug) messages.debug("1-shot initializing dataTables content with " + this.buffered_lines.length + " lines"); + + this.table.fnAddData (this.buffered_lines); this.buffered_lines=[];