2021-10-01 20:35:43 +01:00

124 lines
4.8 KiB
Plaintext
Executable File

sub get_acttitles
{
local ($scr, $item,$nItems);
local (@l_target, @l_conditions, @l_conditions_tit);
local (@l_actions, @l_actions_tit);
local (@l_how, @l_how_tit);
local (@l_when, @l_when_tit);
local (@l_target);
local (%h_list);
@l_target = split(/,/,$text{'mon_target_value'}, -1);
foreach $item (@l_target) {
if ( $item eq $monTarget ) {
$targetext='mon_'.$item.'_sess';
$t_monTarget=$text{$targetext};
last;
}
}
@l_conditions = split(/,/,$text{'mon_conditions_value'}, -1);
@l_conditions_tit = split(/,/,$text{'mon_conditions_desc'}, -1);
$nItems=0;
foreach $item (@l_conditions) {
if ( $item eq $monCondition ) {
$t_monCondition=$l_conditions_tit[$nItems];
last;
}
$nItems++;
}
@l_actions = split(/,/,$text{'mon_actions_value'}, -1);
@l_actions_tit = split(/,/,$text{'mon_actions_desc'}, -1);
$nItems=0;
foreach $item (@l_actions) {
if ( $item eq $monAction ) {
$t_monAction=$l_actions_tit[$nItems];
last;
}
$nItems++;
}
%h_list=&load_scriptlist();
if ( $h_list{$monScript}->{'name'} eq $monScript ) {
$t_monScript="<A href=\"file_mod.cgi?fName=".$h_list{$monScript}->{'name'}."&perm=all&wkdir=$config{monitor_scripts_path}&fPerm=0700\">".$h_list{$monScript}->{'name'}."</A> (".$h_list{$monScript}->{'desc'}.")";
}
@l_how = split(/,/,$text{'mon_how_value'}, -1);
@l_how_tit = split(/,/,$text{'mon_how_desc'}, -1);
$nItems=0;
foreach $item (@l_how) {
if ( $item eq $monHow ) {
$t_monHow=$l_how_tit[$nItems];
last;
}
$nItems++;
}
if ( $monHow eq "auto" && $monWhen ne "" ) {
@l_when = split(/,/,$text{'mon_when_value'}, -1);
@l_when_tit = split(/,/,$text{'mon_when_desc'}, -1);
$nItems=0;
foreach $item (@l_when) {
if ( $item eq $monWhen ) {
$t_monWhen=$l_when_tit[$nItems];
last;
}
}
$nItems++;
} elsif ( $monHow eq "task" ) {
@l_when = split(/ /, $monWhen, -1);
$t_monWhen="$text{'edit_mins'}: $l_when[0]".
" $text{'edit_hours'}: $l_when[1]".
" $text{'edit_days'}: $l_when[2]".
" $text{'edit_months'}: $l_when[3]".
" $text{'edit_weekdays'}: $l_when[4]";
} elsif ( $monHow eq "manual" ) {
$t_monWhen=" - ";
}
$t_monObject=$monObject;
if ( $monObject ne "" ) {
if ( $monTarget eq "user" ) {
$dn = "$monObject,".$config{ldap_base};
$ldap_server=1;
&connect ();
$entry = $conn->browse ($dn);
if ($err = $conn->getErrorCode ()) {
$t_monObject=$monObject;
&additional_log($dn, undef, $err);
} else {
$dn_ou=$monObject;
$dn_ou=~s/cn=$entry->{cn}[0],//;
$organizationname="";
%h_list=&list_ous(2);
if ( $h_list{$dn_ou}->{'obj'} eq $dn_ou ) {
$organizationname=$h_list{$dn_ou}->{name};
}
$t_monObject=$entry->{cn}[0]." ".$entry->{sn}[0]." ".$organizationname;
}
&webmin_log("monitor:read User OU", "browse", "ldap", "$dn");
} elsif ( $monTarget eq "ou" ) {
%h_list=&list_ous();
if ( $h_list{$monObject}->{'alias'} eq $monObject ) {
$t_monObject=$h_list{$monObject}->{'name'};
}
} elsif ( $monTarget eq "host" ) {
%h_list=&list_hosts();
if ( $h_list{$monObject}->{'alias'} eq $monObject ) {
$t_monObject=$h_list{$monObject}->{'name'};
}
} elsif ( $monTarget eq "grphosts" ) {
%h_list=&list_grphosts();
if ( $h_list{$monObject}->{'alias'} eq $monObject ) {
$t_monObject=$h_list{$monObject}->{'name'};
}
} elsif ( $monTarget eq "app" ) {
%h_list=&list_apps();
if ( $h_list{$monObject}->{'alias'} eq $monObject ) {
$t_monObject=$h_list{$monObject}->{'name'};
}
} elsif ( $monTarget eq "grpapps" ) {
%h_list=&list_grpapps();
if ( $h_list{$monObject}->{'alias'} eq $monObject ) {
$t_monObject=$h_list{$monObject}->{'name'};
}
}
}
}