stta/stta/tmp/t/tarantella/tta_sess-save.cgi
2021-10-01 20:35:43 +01:00

134 lines
4.4 KiB
Perl
Executable File

#!/usr/bin/perl
# tta_sess.cgi
# Display Tarantella Services Sessions
require './tarantella-lib.pl';
&foreign_require("proc", "proc-lib.pl");
&header($text{'index_ttasess'}, "", "ttasess");
$ttases_id="Session ID";
$ttases_app="Application";
$ttases_client="Client";
$ttases_appserv="Application Server";
$ttases_time="Start Time";
$ttases_user="User";
$ttases_pe="Protocol Engine ID";
$ttases_resume="Resumable For";
$ttases_status="Status";
$ttases_serveruser="Application Server User";
$debug=2;
if ( $debug gt 0 ) {
$DebugFile="/tmp/log";
open(DebugLog, ">$DebugFile");
}
print "<hr><p>\n";
print "<table width=100% border>\n";
print "<tr $tb> <td><b>$text{'titidx_ttasess'}</b></td> </tr>\n";
print "<tr $cb> <td><table width=100%>\n";
print "<hr>\n";
print "<tr><td>\n";
# $str=$config{'tta_sessions'};
# loading object attributes ...
$type_cmd="emulatorsession";
# &run_tta_cmd($type_cmd);
$temp_f="/tmp/emu-tta2";
@datases=&load_tta_emulses();
$lnum = 0;
$nlin = 0;
foreach $lin (@datases) {
# print "if ( ".$lin->{'property'}." eq ".$ttases_id." ) \n";
if ( $lin->{'property'} eq $ttases_id ) {
if ( $nlin > 0 ) {$all_ttasess[$lnum++] = \%tta_sess; };
#print "<TR>-->".$lin->{'value'}."-- $lnum -- $nlin <\TR>\n";
my (%tta_sess);
# $lnum++;
$all_ttasess{'id'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_app ) {
$tta_sess{'application'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_client ) {
$tta_sess{'client'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_appserv ) {
$tta_sess{'applicationServer'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_time ) {
$tta_sess{'startTime'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_user ) {
$tta_sess{'user'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_pe ) {
$tta_sess{'pe_id'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_resume ) {
$tta_sess{'resume'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_status ) {
$tta_sess{'status'} = $lin->{'value'};
}
if ( $lin->{'property'} eq $ttases_serveruser ) {
$tta_sess{'serverUser'} = $lin->{'value'};
}
$nlin++;
}
print "<tr> $all_ttasess[0]{'user'}\n";
print "<tr> $all_ttasess[1]{'user'}\n";
print "<tr> $all_ttasess[2]{'user'}\n";
$all_ttasess[$lnum++] = \%tta_sess; ;
if ($#all_ttasess < 0) {
print "<TR><TD colspan=4>" . $text{msg_1} . "\n"
} else {
# print "<P><B>-- $text{'f_ldapserver'} ";
# if ( "$ldap_server" eq "1" ) {
# print $config{ldap_servertitle}." (".$config{ldap_server}.") ";
# } elsif ( "$ldap_server" eq "2" ) {
# print $config{ldap2_servertitle}." (".$config{ldap2_server}.") ";
# }
# print "<B>-- $text{'l_orderby'} ";
# if ($sort_on eq "email") {
# @users = sort {$a->{$sort_on} <=> $b->{$sort_on}} @all_ttasess;
# @ttasess = @all_ttasess;
# print $text{l_sn} . "\n";
# }
print "<TR>Nro($#all_ttasess)";
foreach $ttasess (@all_ttasess) {
$UserName=$ttasess->{'user'};
$AppName=$ttasess->{'application'};
$HostName=$ttasess->{'applicationServer'};
&scan_envsess();
print "<TD>" . $ttasess->{'id'}."</TD>";
print "<TR>\n";
print "<TD>" . $ttasess->{'pe_id'}."</TD>\n";
print "<TD><A href=\"javascript:alert('$ttasess->{'applicationServer'}')\">";
print "$NameUser ($OuName) $userType</A></TD>";
print "<TD>" . $ttasess->{'client'}."</TD>\n";
print "<TD><A href=\"javascript:alert('$ttasess->{'application'}')\">";
print "$NameApp ($NameAppGrp)</A></TD>";
print "<TD>" . $ttasess->{'startTime'}."</TD>\n";
print "<TD>" . $ttasess->{'resume'}."</TD>\n";
print "<TD>" . $ttasess->{'status'}."</TD>\n";
print "<TD><A href=\"javascript:alert('$ttasess->{'applicationServer'}')\">";
print "$NameHost ($NameHostGrp)</A></TD>";
print "<TD>" . $ttasess->{'serverUser'}."</TD>\n";
print "<\TR>\n";
if ( $debug gt 0 ) { &print_emulses(); }
}
if ( $debug gt 0 ) { close (DebugLog); }
}
print "<p></TABLE>\n";
print "<tr>\n";
print "<tr>\n";
print "<tr>\n";
print "</table></table><p>\n";
&footer($config{'back_return'},$text{'index'});
do "footer.pl";
exit;