From 7757b8de6deea0db6a75cb60cd41745aecacba36 Mon Sep 17 00:00:00 2001 From: robiscool Date: Tue, 9 Aug 2011 10:04:28 -0700 Subject: orionids-dev, finally finished sig ips db gui, start snortsam.conf work --- .../javascript/jquery.progressbar.min.js | 38 +++++++++---------- config/orionids-dev/javascript/snort_globalsend.js | 44 +++++++++++++++++++++- 2 files changed, 61 insertions(+), 21 deletions(-) (limited to 'config/orionids-dev/javascript') diff --git a/config/orionids-dev/javascript/jquery.progressbar.min.js b/config/orionids-dev/javascript/jquery.progressbar.min.js index 77d147f9..e85e1120 100644 --- a/config/orionids-dev/javascript/jquery.progressbar.min.js +++ b/config/orionids-dev/javascript/jquery.progressbar.min.js @@ -1,20 +1,20 @@ - -(function($){$.extend({progressBar:new function(){this.defaults={steps:20,stepDuration:20,max:100,showText:true,textFormat:'percentage',width:120,height:12,callback:null,boxImage:'/snort/images/progressbar.gif',barImage:{0:'images/progressbg_red.gif',30:'images/progressbg_orange.gif',70:'images/progressbg_green.gif'},running_value:0,value:0,image:null};this.construct=function(arg1,arg2){var argvalue=null;var argconfig=null;if(arg1!=null){if(!isNaN(arg1)){argvalue=arg1;if(arg2!=null){argconfig=arg2;}}else{argconfig=arg1;}} -return this.each(function(child){var pb=this;var config=this.config;if(argvalue!=null&&this.bar!=null&&this.config!=null){this.config.value=parseInt(argvalue) -if(argconfig!=null) -pb.config=$.extend(this.config,argconfig);config=pb.config;}else{var $this=$(this);var config=$.extend({},$.progressBar.defaults,argconfig);config.id=$this.attr('id')?$this.attr('id'):Math.ceil(Math.random()*100000);if(argvalue==null) -argvalue=$this.html().replace("%","") -config.value=parseInt(argvalue);config.running_value=0;config.image=getBarImage(config);var numeric=['steps','stepDuration','max','width','height','running_value','value'];for(var i=0;i=parseInt(i)){image=config.barImage[i];}else{break;}}} -return image;} -function getText(config){if(config.showText){if(config.textFormat=='percentage'){return" "+Math.round(config.running_value)+"%";}else if(config.textFormat=='fraction'){return" "+config.running_value+'/'+config.max;}}} -config.increment=Math.round((config.value-config.running_value)/config.steps);if(config.increment<0) -config.increment*=-1;if(config.increment<1) -config.increment=1;var t=setInterval(function(){var pixels=config.width/100;if(config.running_value>config.value){if(config.running_value-config.incrementconfig.value){config.running_value=config.value;}else{config.running_value+=config.increment;}} -if(config.running_value==config.value) -clearInterval(t);var $bar=$("#"+config.id+"_pbImage");var $text=$("#"+config.id+"_pbText");var image=getBarImage(config);if(image!=config.image){$bar.css("background-image","url("+image+")");config.image=image;} -$bar.css("background-position",(((config.width*-1))+(getPercentage(config)*pixels))+'px 50%');$bar.attr('title',getText(config));$text.html(getText(config));if(config.callback!=null&&typeof(config.callback)=='function') + +(function($){$.extend({progressBar:new function(){this.defaults={steps:20,stepDuration:20,max:100,showText:true,textFormat:'percentage',width:120,height:12,callback:null,boxImage:'/snort/images/progressbar.gif',barImage:{0:'images/progressbg_red.gif',30:'images/progressbg_orange.gif',70:'images/progressbg_green.gif'},running_value:0,value:0,image:null};this.construct=function(arg1,arg2){var argvalue=null;var argconfig=null;if(arg1!=null){if(!isNaN(arg1)){argvalue=arg1;if(arg2!=null){argconfig=arg2;}}else{argconfig=arg1;}} +return this.each(function(child){var pb=this;var config=this.config;if(argvalue!=null&&this.bar!=null&&this.config!=null){this.config.value=parseInt(argvalue) +if(argconfig!=null) +pb.config=$.extend(this.config,argconfig);config=pb.config;}else{var $this=$(this);var config=$.extend({},$.progressBar.defaults,argconfig);config.id=$this.attr('id')?$this.attr('id'):Math.ceil(Math.random()*100000);if(argvalue==null) +argvalue=$this.html().replace("%","") +config.value=parseInt(argvalue);config.running_value=0;config.image=getBarImage(config);var numeric=['steps','stepDuration','max','width','height','running_value','value'];for(var i=0;i=parseInt(i)){image=config.barImage[i];}else{break;}}} +return image;} +function getText(config){if(config.showText){if(config.textFormat=='percentage'){return" "+Math.round(config.running_value)+"%";}else if(config.textFormat=='fraction'){return" "+config.running_value+'/'+config.max;}}} +config.increment=Math.round((config.value-config.running_value)/config.steps);if(config.increment<0) +config.increment*=-1;if(config.increment<1) +config.increment=1;var t=setInterval(function(){var pixels=config.width/100;if(config.running_value>config.value){if(config.running_value-config.incrementconfig.value){config.running_value=config.value;}else{config.running_value+=config.increment;}} +if(config.running_value==config.value) +clearInterval(t);var $bar=$("#"+config.id+"_pbImage");var $text=$("#"+config.id+"_pbText");var image=getBarImage(config);if(image!=config.image){$bar.css("background-image","url("+image+")");config.image=image;} +$bar.css("background-position",(((config.width*-1))+(getPercentage(config)*pixels))+'px 50%');$bar.attr('title',getText(config));$text.html(getText(config));if(config.callback!=null&&typeof(config.callback)=='function') config.callback(config);pb.config=config;},config.stepDuration);});};}});$.fn.extend({progressBar:$.progressBar.construct});})(jQuery); \ No newline at end of file diff --git a/config/orionids-dev/javascript/snort_globalsend.js b/config/orionids-dev/javascript/snort_globalsend.js index 083c40ef..dc92efba 100644 --- a/config/orionids-dev/javascript/snort_globalsend.js +++ b/config/orionids-dev/javascript/snort_globalsend.js @@ -216,7 +216,8 @@ jQuery(document).ready(function() { // ------------------------------- START remove row element --------------------------------------- - + + // removes row and deletes db entries function removeRow(){ jQuery("#maintable_" + window.RemoveRow_UUID).remove(); } @@ -255,6 +256,35 @@ jQuery(document).ready(function() { } }); + + // resets db entries + function removeRow(){ + jQuery("#maintable_" + window.RemoveRow_UUID).remove(); + } + + jQuery(".icon_r").live('click', function(){ + + var elem = getBaseElement(this.id); // this.id gets id of .icon_x + + // window.RemoveRow_UUID = jQuery("#rowlist_" + elem.index).data("options").rowuuid; + window.RemoveRow_UUID = elem.index; + window.RemoveRow_Table = jQuery("#maintable_" + window.RemoveRow_UUID).data("options").pagetable; + window.RemoveRow_DB = jQuery("#maintable_" + window.RemoveRow_UUID).data("options").pagedb; + window.RemoveRow_POST = jQuery("#maintable_" + window.RemoveRow_UUID).data("options").DoPOST; + + // snort_interfaces_whitelist + if (window.RemoveRow_POST === 'true'){ + if(confirm('Do you really want to reset this list ? (e.g. DB will reset, all saved settings will be lost!)')) { + + jQuery("#maintable_" + window.RemoveRow_UUID).fadeOut("fast"); + jQuery("#maintable_" + window.RemoveRow_UUID).fadeIn("fast"); + + jQuery(this).ajaxSubmit(optionsRSTlist); // call POST + return false; + } + } + + }); function RMlistDBDelCall(){ @@ -303,7 +333,17 @@ jQuery(document).ready(function() { type: 'POST', data: { RMlistDelRow: '1', RMlistDB: RMlistDBDelCall, RMlistTable: RMlistTableDelCall, RMlistUuid: RMlistUuidDelCall }, url: './snort_json_post.php' - }; + }; + + // declare variable for DB reset + var optionsRSTlist = { + beforeSubmit: showRequestRMlist, + dataType: 'json', + success: showResponseRMlist, + type: 'POST', + data: { RSTlistRow: '1', RSTlistDB: RMlistDBDelCall, RSTlistTable: RMlistTableDelCall, RSTlistUuid: RMlistUuidDelCall }, + url: './snort_json_post.php' + }; // STOP remove row element -- cgit v1.2.3