diff --git a/lib/WebGUI/PassiveAnalytics/Flow.pm b/lib/WebGUI/PassiveAnalytics/Flow.pm index c7fbacb4f..a1b9905bf 100644 --- a/lib/WebGUI/PassiveAnalytics/Flow.pm +++ b/lib/WebGUI/PassiveAnalytics/Flow.pm @@ -110,7 +110,7 @@ sub www_editRuleflow { ); $f->integer( name => 'pauseInterval', - value => $session->form->get('pauseInterval') || 300, + value => $session->form->get('pauseInterval') || $session->setting->get('passiveAnalyticsInterval') || 300, label => $i18n->get('pause interval'), hoverHelp => $i18n->get('pause interval help'), ); @@ -131,6 +131,7 @@ sub www_editRuleflow { } $steps .= ' Other
'; my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics'); + $ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=settings'), $i18n->get('Passive Analytics Settings')); return $ac->render($error.$f->print.$addmenu.$steps, 'Passive Analytics'); } @@ -251,4 +252,64 @@ sub www_promoteRule { return www_editRuleflow($session); } +#------------------------------------------------------------------- + +=head2 www_settings ( session ) + +Configure Passive Analytics settings. + +=cut + +sub www_settings { + my $session = shift; + my $error = shift; + return $session->privilege->insufficient() unless canView($session); + if ($error) { + $error = qq|
$error
\n|; + } + my $i18n = WebGUI::International->new($session, "PassiveAnalytics"); + my $f = WebGUI::HTMLForm->new($session); + $f->hidden( + name=>'op', + value=>'passiveAnalytics' + ); + $f->hidden( + name=>'func', + value=>'settingsSave' + ); + $f->integer( + name => 'pauseInterval', + value => $session->form->get('pauseInterval') || $session->setting->get('passiveAnalyticsInterval') || 300, + label => $i18n->get('default pause interval'), + hoverHelp => $i18n->get('default pause interval help'), + ); + $f->yesNo( + name => 'deleteDelta', + value => $session->form->get('deleteDelta') || $session->setting->get('passiveAnalyticsDeleteDelta') || 0, + label => $i18n->get('Delete Delta Table?'), + hoverHelp => $i18n->get('Delete Delta Table? help'), + ); + $f->submit(); + my $ac = WebGUI::AdminConsole->new($session,'passiveAnalytics'); + $ac->addSubmenuItem($session->url->page('op=passiveAnalytics;func=editRuleflow'), $i18n->get('Passive Analytics')); + return $ac->render($error.$f->print, 'Passive Analytics Settings'); +} + +#------------------------------------------------------------------- + +=head2 www_settingsSave ( session ) + +Save Passive Analytics settings. + +=cut + +sub www_settingsSave { + my $session = shift; + return $session->privilege->insufficient() unless canView($session); + my $form = $session->form; + $session->setting->set('passiveAnalyticsInterval', $form->process('pauseInterval', 'integer')); + $session->setting->set('passiveAnalyticsDeleteDelta', $form->process('deleteDelta', 'yesNo' )); + return www_settings($session); +} + 1; diff --git a/lib/WebGUI/i18n/English/PassiveAnalytics.pm b/lib/WebGUI/i18n/English/PassiveAnalytics.pm index 205cc5f24..98a99bc41 100644 --- a/lib/WebGUI/i18n/English/PassiveAnalytics.pm +++ b/lib/WebGUI/i18n/English/PassiveAnalytics.pm @@ -20,6 +20,16 @@ our $I18N = { lastUpdated => 0, }, + 'default pause interval' => { + message => q|Default Pause Threshold|, + lastUpdated => 0, + }, + + 'default pause interval help' => { + message => q|Set the default pause interval displayed the user sees in the Passive Analytics screen.|, + lastUpdated => 0, + }, + 'other' => { message => q|Other|, lastUpdated => 0, @@ -65,6 +75,12 @@ home\?func=match, or
context => q|| }, + 'Passive Analytics Settings' => { + message => q|Passive Analytics Settings|, + lastUpdated => 0, + context => q|| + }, + 'Edit Rule' => { message => q|Edit Rule|, lastUpdated => 0, @@ -95,6 +111,18 @@ home\?func=match, or
context => q|Button label to begin analyzing the logs.| }, + 'Delete Delta Table?' => { + message => q|Delete Delta Table?|, + lastUpdated => 0, + context => q|Button label to begin analyzing the logs.| + }, + + 'Delete Delta Table? help' => { + message => q|Should the delta table be cleaned up after the Passive Analytics analyzer is done?|, + lastUpdated => 0, + context => q|Button label to begin analyzing the logs.| + }, + }; 1; diff --git a/sbin/installPassiveAnalytics.pl b/sbin/installPassiveAnalytics.pl index 9a8afd140..45398e8f3 100644 --- a/sbin/installPassiveAnalytics.pl +++ b/sbin/installPassiveAnalytics.pl @@ -35,6 +35,7 @@ installPassiveAnalyticsRule($session); installPassiveAnalyticsConfig($session); installWorkflow($session); #addAdminGroup($session); +addPassiveAnalyticsSettings($session); finish($session); @@ -93,6 +94,17 @@ sub installPassiveAnalyticsRule { print "DONE!\n"; } +#---------------------------------------------------------------------------- +# Add the PassiveAnalytics Rule table +sub addPassiveAnalyticsSettings { + my $session = shift; + print "\tInstall Passive Analytics settings... "; + # and here's our code + $session->setting->add('passiveAnalyticsInterval', 300); + $session->setting->add('passiveAnalyticsDeleteDelta', 0); + print "DONE!\n"; +} + #---------------------------------------------------------------------------- # Add the Passive Analytics config file entry # for the adminConsole and the content handler