From: <te...@us...> - 2006-05-26 04:14:42
|
Revision: 4494 Author: tewok Date: 2006-05-25 21:14:32 -0700 (Thu, 25 May 2006) ViewCVS: http://svn.sourceforge.net/net-policy/?rev=4494&view=rev Log Message: ----------- Added several additional ways to view notifications. Now they can be viewed in these manners: - last 50 notifications - all notifications - by a specific status value Modified Paths: -------------- trunk/net-policy/modules/administrative/report-notifications.pm Modified: trunk/net-policy/modules/administrative/report-notifications.pm =================================================================== --- trunk/net-policy/modules/administrative/report-notifications.pm 2006-05-25 22:55:47 UTC (rev 4493) +++ trunk/net-policy/modules/administrative/report-notifications.pm 2006-05-26 04:14:32 UTC (rev 4494) @@ -15,21 +15,171 @@ # add_primary('admin_display_notifs', - title => "Notifications received from remote hosts", - introduction => 'Recently received notifications', - allow_refresh => 1, - sub_modules => 'display_indiv_notifs', + title => "Display Notifications Received from Remote Hosts", + introduction => 'Select notifications to display.', questions => [ - qw_label('','Select notifications to display detail about:'), + { + name => 'notify_choice', + type => 'radio', + text => 'Choose notification display:', + default => 'step', + submit => 1, + labels => + [ + 'all' => 'All Notifications', + 'status' => 'Notifications by Status', + 'top50' => '50 Most Recent Notifications', + ], + }, + + ], + + post_answers => + [ + sub + { + my $qwp = qwparam("notify_choice"); + + if($qwp eq "top50") + { + $_[0]->add_todos('admin_display_notifs_top50'); + } + elsif($qwp eq "all") + { + $_[0]->add_todos('admin_display_notifs_all'); + } + elsif($qwp eq "status") + { + $_[0]->add_todos('admin_display_notifs_status'); + } + + } + ], +); + +######################################################################## +# + +add_primary('admin_display_notifs_status', + title => "Notifications Selection by Status", + introduction => 'Notifications will be displayed based on status value selected by the user.', + questions => + [ + { + name => "notify_status_choice", + type => 'radio', + submit => 1, + values => [[\¬ify_status]], + }, + ], + + post_answers => + [ + sub + { + $_[0]->add_todos('admin_display_notifs_gotstatus'); + } + ], +); + +######################################################################## +# + +add_primary('admin_display_notifs_all', + title => "All Notifications Received from Remote Hosts", +# introduction => 'All received notifications', + introduction => sub + { +print STDERR "\nadmin_display_notifs_all: intro\n"; + return('All received notifications'); + }, + allow_refresh => 1, + sub_modules => 'display_indiv_notifs', + questions => + [ + qw_label('','Select notifications about which to display details:'), "", { + type => 'table', + headers => [['Mark', 'From', 'Time Received', 'Version', 'Type', + 'Security Name', 'Security Level', 'Notification', + 'Status']], + values => sub { +print STDERR "\nadmin_display_notifs_all: working out values\n"; + my $data = net_policy_select_noflat("select id, remaddr, receivedtime, protoversion, notiftype, secname, seclevel, varval, status from notifications, notificationvars where notifications.id = notificationvars.notifid and notificationvars.varoid = 'snmpTrapOID.0' order by id desc"); + map { + $_->[0] = qw_checkbox('id' . $_->[0], '', 1, 0); + $_->[3] = 'SNMP' . $versiontypes[$_->[3]]; + $_->[4] = $notiftypes[$_->[4]]; + $_->[6] = $sectypes[$_->[6]]; + } @$data; + return [$data]; + }, + } + ] +); + +######################################################################## +# + +add_primary('admin_display_notifs_top50', + title => "50 Most Recent Notifications Received from Remote Hosts", + introduction => 'Recently received notifications', + allow_refresh => 1, + sub_modules => 'display_indiv_notifs', + questions => + [ + qw_label('','Select notifications about which to display details:'), + "", + { + type => 'table', + headers => [['Mark', 'From', 'Time Received', 'Version', 'Type', + 'Security Name', 'Security Level', 'Notification', + 'Status']], + values => sub { + my $data = net_policy_select_noflat("select id, remaddr, receivedtime, protoversion, notiftype, secname, seclevel, varval, status from notifications, notificationvars where notifications.id = notificationvars.notifid and notificationvars.varoid = 'snmpTrapOID.0' order by id desc limit 50"); + map { + $_->[0] = qw_checkbox('id' . $_->[0], '', 1, 0); + $_->[3] = 'SNMP' . $versiontypes[$_->[3]]; + $_->[4] = $notiftypes[$_->[4]]; + $_->[6] = $sectypes[$_->[6]]; + } @$data; + return [$data]; + }, + } + ] +); + +######################################################################## +# + +add_primary('admin_display_notifs_gotstatus', + title => sub + { + my $qwp = qwparam("notify_status_choice"); + my $str; + $str = "Notifications Received from Remote Hosts -- in State $qwp", + return($str); + }, + introduction => sub + { + my $qwp = qwparam("notify_status_choice"); + my $str; + $str = "Notifications received from remote hosts -- in state $qwp", + return($str); + }, + sub_modules => 'display_indiv_notifs', + questions => + [ + { type => 'table', headers => [['Mark', 'From', 'Time Received', 'Version', 'Type', 'Security Name', 'Security Level', 'Notification', 'Status']], values => sub { - my $data = net_policy_select_noflat("select id, remaddr, receivedtime, protoversion, notiftype, secname, seclevel, varval, status from notifications, notificationvars where notifications.id = notificationvars.notifid and notificationvars.varoid = 'snmpTrapOID.0' order by id desc limit 50"); + my $qwp = qwparam("notify_status_choice"); + my $data = net_policy_select_noflat("select id, remaddr, receivedtime, protoversion, notiftype, secname, seclevel, varval, status from notifications, notificationvars where notifications.id = notificationvars.notifid and notificationvars.varoid = 'snmpTrapOID.0' and status = '$qwp' order by id desc"); map { $_->[0] = qw_checkbox('id' . $_->[0], '', 1, 0); $_->[3] = 'SNMP' . $versiontypes[$_->[3]]; @@ -38,13 +188,15 @@ } @$data; return [$data]; }, - }]); + } + ] +); ######################################################################## # add_primary('display_indiv_notifs', - title => "Notification details", + title => "Notification Details", introduction => 'Variables enclosed in the marked notifications.', questions => [{ @@ -131,10 +283,10 @@ { my @nmvals = [ - "reported", + "fixed", + "claimed", "seen", - "claimed", - "fixed" + "reported" ]; return(@nmvals); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |