@global_groups = @{&GetGroups(GROUP_TYPE_GLOBAL)};
map {$tk{group_list}->insert('end',
-itemtype=> 'imagetext',
-text=> "$_",
-image=> $im{grp})}
@global_groups;
####
sub GetGroups
{
my $type = @_;
my @groups;
return \ @groups if (Win32::AdminMisc::GetGroups('',$type, \ @groups));
}
####
@global_groups = @{&GetGroups( $dr{server}, GROUP_TYPE_GLOBAL)};
####
sub GetGroups
{
my ($srv, $type) = @_;
my @groups;
return \ @groups if (Win32::AdminMisc::GetGroups(‘’,$type, \ @groups));
}
####
equire 5.006;
use strict;
use warnings 'all';
use Tk 800.005;
use Tk::TList;
use Tk::Table;
use Tk::Frame;
use Tk::DirTree;
use Tk::Adjuster;
use Tk::Scrollbar;
use Tk::DropSite;
use Tk::DragDrop;
use File::Find;
use Win32::ODBC;
use Win32::Perms;
use Win32::NetAdmin;
use Win32::AdminMisc;
use Win32::NetResource;
# use Win32;
# use OLE;
use vars qw /%tk %dr %im @local_groups @users @global_groups $dnd_token1 $dnd_token2/;
$dr{path} = 'c:/';
$dr{server} = ShowServer($dr{path});
$dr{perms} = "Permissions" . $dr{path};
$tk{mw} = MainWindow -> new(-background=> 'white');
$tk{mw}-> geometry('900x700');
$tk{top_frame} = $tk{mw}-> Frame;
$tk{left_frame} = $tk{mw}-> Frame;
$tk{adjuster} = $tk{mw}-> Adjuster(-widget=> $tk{left_frame}, -side=> 'left');
$tk{right_frame} = $tk{mw}-> Frame;
$tk{bottom_frame} = $tk{mw}-> Frame;
$tk{entry_box_label} = $tk{top_frame}-> Label(-text=> "Path: ");
$tk{entry_box} = $tk{top_frame}-> Entry(-textvariable=> \ $dr{path});
$tk{dir_tree_label} = $tk{left_frame}-> Label(-textvariable=> \ $dr{server});
$tk{dir_tree} = $tk{left_frame}-> Scrolled('DirTree', -height=> '0', -width=> '0', -scrollbars=>'e',);
$tk{group_label} = $tk{right_frame}-> Label(-text=> ":Groups List:");
$tk{group_list} = $tk{right_frame}-> Scrolled('TList', -height=> '1', -width=> '1', -scrollbars=> 'osoe',);
$im{one} = $tk{mw}-> Photo(-file=> 'c:/perl/one.gif');
$im{grp} = $tk{mw}-> Photo(-file=> 'c:/perl/grp.gif');
$tk{entry_box}-> bind('', sub {OnNewPath();});
$tk{top_frame}-> pack(qw/-side top -fill x/);
$tk{left_frame}-> pack(qw/-side left -fill y/);
$tk{adjuster}-> pack(qw/-side left -fill y/);
$tk{right_frame}-> pack(qw/-side right -fill both -expand 1/);
$tk{entry_box_label}-> pack(qw/-side left -fill both/);
$tk{entry_box}-> pack(qw/-side top -fill both -expand 1/);
$tk{dir_tree_label}-> pack(qw/-side top -fill both/);
$tk{dir_tree}-> pack(qw/-side left -fill both -expand 1/);
$tk{group_label}-> pack(qw/-side top -fill both/);
$tk{group_list}-> pack(qw/-side top -fill both -expand 1/);
# My Problems start here#
#@global_groups = @{&GetGroups(GROUP_TYPE_GLOBAL)};
@global_groups = @{&GetGroups( $dr{server},GROUP_TYPE_GLOBAL)};
map {$tk{group_list}->insert('end', -itemtype=> 'imagetext', -text=> "$_", -image=> $im{grp})} @global_groups;
####################
MainLoop;
exit (0);
sub ShowServer
{
my $drv = @_;
my $srv;
if (Win32::NetResource::GetUNCName( my $unc, $dr{path}))
{
$unc =~ s/^\\\\(\w)+//;
$srv = $&;
return $dr{server} = "[ Remote Server Name : " . uc($srv) . " ]";
}
else
{
$srv = Win32::NodeName();
return $dr{server} = "[ Local Server Name : " . uc($srv) . " ]";
}
}
sub OnNewPath
{
$tk{dir_tree}-> delete('all');
$tk{dir_tree}-> chdir ($dr{path});
ShowServer($dr{path});
}
sub GetGroups
{
my $type = @_;
my @groups;
return \ @groups if (Win32::AdminMisc::GetGroups('', $type, \ @groups));
}