diff options
author | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-01-19 01:11:21 +0100 |
---|---|---|
committer | Matteo Pasotti <matteo.pasotti@gmail.com> | 2014-01-19 01:11:21 +0100 |
commit | 97d9107d09e7112c012bd3637e30e0821b5f6885 (patch) | |
tree | a6591e00c239b8324aeab92a0169a1f8143c70ef | |
parent | 03509ca6ac225c921d5f15479198908eac6df605 (diff) | |
parent | 8be4c570361e4df7a3e319e9b9bd029d7520fb7b (diff) | |
download | colin-keep-97d9107d09e7112c012bd3637e30e0821b5f6885.tar colin-keep-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.gz colin-keep-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.bz2 colin-keep-97d9107d09e7112c012bd3637e30e0821b5f6885.tar.xz colin-keep-97d9107d09e7112c012bd3637e30e0821b5f6885.zip |
Merge branch 'master' of ssh://git.mageia.org/software/adminpanel
-rw-r--r-- | AdminPanel/Services/AdminService.pm | 228 | ||||
-rw-r--r-- | AdminPanel/Shared.pm | 53 | ||||
-rw-r--r-- | AdminPanel/Users/GUsers.pm | 36 | ||||
-rw-r--r-- | Category.pm | 19 | ||||
-rw-r--r-- | MainDisplay.pm | 96 | ||||
-rw-r--r-- | Module.pm | 8 | ||||
-rwxr-xr-x | apanel.pl | 5 | ||||
-rwxr-xr-x | modules/services/adminService | 16 | ||||
-rwxr-xr-x | modules/usermanager/adminUser | 16 | ||||
-rwxr-xr-x | modules/usermanager/mgaAddUser | 17 |
10 files changed, 370 insertions, 124 deletions
diff --git a/AdminPanel/Services/AdminService.pm b/AdminPanel/Services/AdminService.pm index 2f3f1d9..8b02227 100644 --- a/AdminPanel/Services/AdminService.pm +++ b/AdminPanel/Services/AdminService.pm @@ -21,15 +21,20 @@ package AdminPanel::Services::AdminService; - - - #-###################################################################################### #- misc imports #-###################################################################################### use strict; -use common; + +# TODO same translation atm +use lib qw(/usr/lib/libDrakX); +use common qw(N + N_ + cat_ + formatAlaTeX + translate + find); use run_program; use Moose; @@ -57,7 +62,66 @@ has '+name' => ( default => N("AdminService"), ); +has 'services' => ( + traits => ['Array'], + is => 'rw', + isa => 'ArrayRef[Str]', + default => sub { [] }, + init_arg => undef, + handles => { + all_services => 'elements', + add_service => 'push', + map_service => 'map', + service_count => 'count', + sorted_services => 'sort', + }, +); + +has 'xinetd_services' => ( + traits => ['Array'], + is => 'rw', + isa => 'ArrayRef[Str]', + default => sub { [] }, + init_arg => undef, + handles => { + all_xinetd_services => 'elements', + add_xinetd_service => 'push', + map_xinetd_service => 'map', + xinetd_service_count => 'count', + sorted_xinetd_services => 'sort', + }, +); + +has 'on_services' => ( + traits => ['Array'], + is => 'rw', + isa => 'ArrayRef[Str]', + default => sub { [] }, + init_arg => undef, + handles => { + all_on_services => 'elements', + add_on_service => 'push', + map_on_service => 'map', + on_service_count => 'count', + sorted_on_services => 'sort', + }, +); + +has 'running_services' => ( + traits => ['Array'], + is => 'rw', + isa => 'ArrayRef[Str]', + default => sub { [] }, + init_arg => undef, + handles => { + all_running_services => 'elements', + add_running_service => 'push', + map_running_service => 'map', + running_service_count => 'count', + sorted_running_services => 'sort', + }, +); =head1 VERSION Version 1.0.0 @@ -201,7 +265,29 @@ xinetd => N_("Starts other deamons on demand."), $s; } +sub BUILD { + my $self = shift; + + $self->loadServices(); +} + + +#============================================================= +=head2 start + +=head3 INPUT + + $self: this object + +=head3 DESCRIPTION + + This method extends Module::start and is invoked to + start adminService + +=cut + +#============================================================= sub start { my $self = shift; @@ -209,6 +295,49 @@ sub start { }; +#============================================================= + +=head2 loadServices + +=head3 INPUT + + $self: this object + +=head3 DESCRIPTION + + This methonds load service info into local attributes such + as xinetd_services, on_services and all the available, + services + +=cut + +#============================================================= +sub loadServices { + my $self = shift; + + my ($l, $on_services) = AdminPanel::Services::Utility::services(); + my @xinetd_services = map { $_->[0] } AdminPanel::Services::Utility::xinetd_services(); + + $self->xinetd_services(); + $self->xinetd_services(\@xinetd_services); + $self->services(\@$l); + $self->on_services(\@$on_services); + + $self->refreshRunningServices(); +} + +sub refreshRunningServices { + my $self = shift; + + my @running; + foreach ($self->all_services) { + + my $serviceName = $_; + push @running, $serviceName if is_service_running($serviceName); + } + $self->running_services(\@running); +} + ## serviceInfo sets widgets accordingly to selected service status ## param ## 'service' service name @@ -225,7 +354,14 @@ sub serviceInfo { sub serviceStatus { my ($self, $tbl, $item) = @_; - my $started = (is_service_running($item->label())? N("running") : N("stopped")); + my $started; + + if (member($item->label(), $self->all_xinetd_services)) { + $started = N("Start when requested"); + } + else { + $started = (member($item->label(), $self->all_running_services)? N("running") : N("stopped")); + } # TODO add icon green/red led my $cell = $tbl->toCBYTableItem($item)->cell(1); if ($cell) { @@ -239,11 +375,14 @@ sub servicePanel { my $self = shift; my $appTitle = yui::YUI::app()->applicationTitle(); + ## set new title to get it in dialog - yui::YUI::app()->setApplicationTitle(N("Services and daemons")); + yui::YUI::app()->setApplicationTitle($self->name); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon); - my ($l, $on_services) = services(); - my @xinetd_services = map { $_->[0] } xinetd_services(); +# my ($l, $on_services) = services(); +# my @xinetd_services = map { $_->[0] } xinetd_services(); my $mageiaPlugin = "mga"; my $factory = yui::YUI::widgetFactory; @@ -265,15 +404,24 @@ sub servicePanel { ## service list (serviceBox) my $serviceTbl = $mgaFactory->createCBTable($hbox, $yTableHeader, $yui::YCBTableCheckBoxOnLastColumn); my $itemCollection = new yui::YItemCollection; - foreach (@$l) { + foreach ($self->all_services) { + my $serviceName = $_; my $item = new yui::YCBTableItem($serviceName); - my $started = (is_service_running($serviceName)? N("running") : N("stopped")); + my $started; + if (member($serviceName, $self->all_xinetd_services)) { + $started = N("Start when requested"); + } + else { + $started = (member($serviceName, $self->all_running_services)? N("running") : N("stopped")); + } + # TODO add icon green/red led my $cell = new yui::YTableCell($started); $item->addCell($cell); - $item->check(member($serviceName, @$on_services)); + + $item->check(member($serviceName, $self->all_on_services)); $item->setLabel($serviceName); $itemCollection->push($item); $item->DISOWN(); @@ -309,12 +457,22 @@ sub servicePanel { #first item status my $item = $serviceTbl->selectedItem(); - $self->serviceInfo($item->label(), $infoPanel) if ($item); + if ($item) { + $self->serviceInfo($item->label(), $infoPanel); + if (member($item->label(), $self->all_xinetd_services)) { + $stopButton->setDisabled(); + $startButton->setDisabled(); + } + else { + $stopButton->setEnabled(1); + $startButton->setEnabled(1); + } + } while(1) { - my $event = $dialog->waitForEvent(); - my $eventType = $event->eventType(); - + my $event = $dialog->waitForEvent(); + my $eventType = $event->eventType(); + #event type checking if ($eventType == $yui::YEvent::CancelEvent) { last; @@ -322,15 +480,16 @@ sub servicePanel { elsif ($eventType == $yui::YEvent::WidgetEvent) { # widget selected my $widget = $event->widget(); - + my $wEvent = yui::toYWidgetEvent($event); + if ($widget == $closeButton) { last; } elsif ($widget == $aboutButton) { - my $license = translate($::license); + my $license = translate($AdminPanel::Shared::License); # TODO fix version value - AboutDialog({ name => N("Services and daemons"), - version => "1.0.0", + AboutDialog({ name => N("AdminService"), + version => $self->VERSION, copyright => N("Copyright (C) %s Mageia community", '2013-2014'), license => $license, comments => N("Service Manager is the Mageia service and daemon management tool \n(from the original idea of Mandriva draxservice)."), @@ -343,14 +502,29 @@ sub servicePanel { ); } elsif ($widget == $serviceTbl) { + # service selection changed $item = $serviceTbl->selectedItem(); - $self->serviceInfo($item->label(), $infoPanel) if ($item); - $item = $serviceTbl->changedItem(); if ($item) { - set_service($item->label(), $item->checked()); - # we can push/pop service, but this (slower) should return real situation - ($l, $on_services) = services(); + $self->serviceInfo($item->label(), $infoPanel); + if (member($item->label(), $self->all_xinetd_services)) { + $stopButton->setDisabled(); + $startButton->setDisabled(); + } + else { + $stopButton->setEnabled(1); + $startButton->setEnabled(1); + } + } +# TODO fix libyui-mga-XXX item will always be changed after first one + if ($wEvent->reason() == $yui::YEvent::ValueChanged) { + $item = $serviceTbl->changedItem(); + if ($item) { + + set_service($item->label(), $item->checked()); + # we can push/pop service, but this (slower) should return real situation + $self->refreshRunningServices(); + } } } elsif ($widget == $startButton) { @@ -358,7 +532,7 @@ sub servicePanel { if ($item) { restart_or_start($item->label()); # we can push/pop service, but this (slower) should return real situation - ($l, $on_services) = services(); + $self->refreshRunningServices(); $self->serviceStatus($serviceTbl, $item); } } @@ -367,7 +541,7 @@ sub servicePanel { if ($item) { stop($item->label()); # we can push/pop service, but this (slower) should return real situation - ($l, $on_services) = services(); + $self->refreshRunningServices(); $self->serviceStatus($serviceTbl, $item); } } @@ -376,7 +550,7 @@ sub servicePanel { $dialog->destroy(); #restore old application title - yui::YUI::app()->setApplicationTitle($appTitle); + yui::YUI::app()->setApplicationTitle($appTitle) if $appTitle; } no Moose; diff --git a/AdminPanel/Shared.pm b/AdminPanel/Shared.pm index c337dfc..5d052e0 100644 --- a/AdminPanel/Shared.pm +++ b/AdminPanel/Shared.pm @@ -77,18 +77,22 @@ along with this file. If not, see <http://www.gnu.org/licenses/>. use strict; use warnings; use diagnostics; -#use lib qw(/usr/lib/libDrakX); -use common qw(N); + +use lib qw(/usr/lib/libDrakX); +use common qw(N + N_); use yui; use base qw(Exporter); +# TODO move GUI dialogs to Shared::GUI our @EXPORT = qw(warningMsgBox msgBox infoMsgBox ask_YesOrNo ask_OkCancel AboutDialog - trim); + trim + member); =head1 VERSION @@ -99,6 +103,21 @@ Version 0.01 our $VERSION = '0.01'; +our $License = N_("This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +"); + #============================================================= @@ -569,4 +588,32 @@ sub trim { return $st; } +#============================================================= + +=head2 member + +=head3 INPUT + + $e: Array element to be found into array + @_: any array + +=head3 OUTPUT + + 1 or 0: if $e is a member of the given array + +=head3 DESCRIPTION + +This function look for an element into an array + +=cut + +#============================================================= +sub member { + my $e = shift; + foreach (@_) { + $e eq $_ and return 1; + } + 0; +} + 1; # End of AdminPanel::Shared diff --git a/AdminPanel/Users/GUsers.pm b/AdminPanel/Users/GUsers.pm index 5371c44..fe95a0b 100644 --- a/AdminPanel/Users/GUsers.pm +++ b/AdminPanel/Users/GUsers.pm @@ -31,9 +31,14 @@ package AdminPanel::Users::GUsers; use strict; # TODO evaluate if Moose is too heavy and use Moo # instead -use Moose; use POSIX qw(ceil); # use Time::localtime; + +# TODO same translation atm +use lib qw(/usr/lib/libDrakX); +# i18n: IMPORTANT: to get correct namespace (userdrake instead of libDrakX) +BEGIN { unshift @::textdomains, 'userdrake', 'libuser', 'drakconf' } + use common qw(N translate); use security::level; @@ -47,6 +52,7 @@ use Glib; use yui; use AdminPanel::Shared; use AdminPanel::Users::users; +use Moose; extends qw( Module ); has '+icon' => ( @@ -670,7 +676,9 @@ sub _buildUserData { =head3 INPUT - $self: this object + $self: this object + $standalone: if set the application title is set + from the name set in costructor =head3 DESCRIPTION @@ -682,6 +690,7 @@ sub _buildUserData { #============================================================= sub addUserDialog { my $self = shift; + my $standalone = shift; my $dontcreatehomedir = 0; my $is_system = 0; @@ -689,7 +698,12 @@ sub addUserDialog { ## push application title my $appTitle = yui::YUI::app()->applicationTitle(); ## set new title to get it in dialog - yui::YUI::app()->setApplicationTitle(N("Create New User")); + if ($standalone) { + yui::YUI::app()->setApplicationTitle($self->name); + } + else { + yui::YUI::app()->setApplicationTitle(N("Create New User")); + } my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; @@ -877,7 +891,7 @@ sub addUserDialog { destroy $dlg; #restore old application title - yui::YUI::app()->setApplicationTitle($appTitle); + yui::YUI::app()->setApplicationTitle($appTitle) if $appTitle; } #============================================================= @@ -2279,8 +2293,12 @@ sub manageUsersDialog { my $pixdir = '/usr/share/userdrake/pixmaps/'; ## push application title my $appTitle = yui::YUI::app()->applicationTitle(); + ## set new title to get it in dialog - yui::YUI::app()->setApplicationTitle(N("Mageia Users Management Tool")); + yui::YUI::app()->setApplicationTitle($self->name); + ## set icon if not already set by external launcher + yui::YUI::app()->setApplicationIcon($self->icon); + my $factory = yui::YUI::widgetFactory; my $optional = yui::YUI::optionalWidgetFactory; @@ -2386,7 +2404,7 @@ sub manageUsersDialog { last; } elsif ($menuLabel eq $helpMenu{about}->label()) { - my $license = translate($::license); + my $license = translate($AdminPanel::Shared::License); AboutDialog({ name => N("AdminUser"), version => $self->VERSION, copyright => N("Copyright (C) %s Mageia community", '2013-2014'), @@ -2459,7 +2477,7 @@ sub manageUsersDialog { $self->dialog->destroy() ; #restore old application title - yui::YUI::app()->setApplicationTitle($appTitle); + yui::YUI::app()->setApplicationTitle($appTitle) if $appTitle; } #============================================================= @@ -2544,9 +2562,9 @@ sub TimeOfArray { $cm and $h->{month} = $mth{$2}; $h; } -sub member { my $e = shift; foreach (@_) { $e eq $_ and return 1 } 0 } + no Moose; __PACKAGE__->meta->make_immutable; -1;
\ No newline at end of file +1; diff --git a/Category.pm b/Category.pm index 7191fab..b43a4c1 100644 --- a/Category.pm +++ b/Category.pm @@ -69,7 +69,7 @@ sub new { sub loadModule { my ($self, $module) = @_; - if (!$self->moduleLoaded($module)) { + if (!$self->moduleLoaded($module->{name})) { push ( @{$self->{modules}}, $module ); return 1; @@ -83,8 +83,8 @@ sub loadModule { =head3 INPUT - $self: this object - $module: module to look for + $self: this object + $module_name or -CLASS => name : module/CLASS name to look for =head3 OUTPUT @@ -98,15 +98,22 @@ sub loadModule { #============================================================= sub moduleLoaded { - my ($self, $module) = @_; + my $self = shift; + my (%params) = @_; + my ($module_name) = @_; + my $present = 0; - if (!$module) { + if (!$module_name) { return $present; } foreach my $mod (@{$self->{modules}}) { - if ($mod->{name} eq $module->name) { + if (exists $params{-CLASS} && ref($mod) eq $params{-CLASS}) { + $present = 1; + last; + } + elsif ($mod->{name} eq $module_name) { $present = 1; last; } diff --git a/MainDisplay.pm b/MainDisplay.pm index afb730f..ed75108 100644 --- a/MainDisplay.pm +++ b/MainDisplay.pm @@ -61,8 +61,29 @@ sub new { $self->{categories} = []; $self->{confDir} = "/etc/apanel", $self->{title} = "apanel", - $self->setupGui(); + my $cmdline = new yui::YCommandLine; + + ## TODO add parameter check + my $pos = $cmdline->find("--name"); + if ($pos > 0) + { + $self->{title} = $cmdline->arg($pos+1); + } + $pos = $cmdline->find("--conf_dir"); + if ($pos > 0) + { + $self->{confDir} = $cmdline->arg($pos+1); + } + else + { + $self->{confDir} = "/etc/$self->{title}"; + } +# print "name = ".$self->{title}."\n"; +# print "conf dir = ".$self->{confDir}."\n"; + + $self->setupGui(); + return $self; } @@ -72,11 +93,12 @@ sub start { my $reqExit = 0; ##Default category selection - $self->{currCategory} = @{$self->{categories}}[0]; + if (!$self->{currCategory}) { + $self->{currCategory} = @{$self->{categories}}[0]; + } $self->{currCategory}->addButtons($self->{rightPane}, $self->{factory}); $self->{rightPaneFrame}->setLabel($self->{currCategory}->{name}); $self->{factory}->createSpacing($self->{rightPane}, 1, 1, 1.0 ); - my $launch = 0; while(!$launch) { @@ -137,31 +159,15 @@ sub start { sub destroy { my ($self) = shift; $self->{mainWin}->destroy(); + for (my $cat=0; $cat < scalar(@{$self->{categories}}); $cat++ ) { + @{$self->{categories}}[$cat]->{button} = 0; + @{$self->{categories}}[$cat]->removeButtons(); + } } sub setupGui { my ($self) = shift; - my $cmdline = new yui::YCommandLine; - - ## TODO add parameter check - my $pos = $cmdline->find("--name"); - if ($pos > 0) - { - $self->{title} = $cmdline->arg($pos+1); - } - $pos = $cmdline->find("--conf_dir"); - if ($pos > 0) - { - $self->{confDir} = $cmdline->arg($pos+1); - } - else - { - $self->{confDir} = "/etc/$self->{title}"; - } -# print "name = ".$self->{title}."\n"; -# print "conf dir = ".$self->{confDir}."\n"; - $self->loadSettings(); yui::YUILog::setLogFileName($self->{settings}->{log}); $self->{name} = $self->{settings}->{title}; @@ -225,10 +231,12 @@ sub setupGui { ## adpanel settings sub loadSettings { - my ($self) = @_; + my ($self, $force_load) = @_; # configuration file name my $fileName = "$self->{confDir}/settings.conf"; - $self->{settings} = new SettingsReader($fileName); + if (!$self->{settings} || $force_load) { + $self->{settings} = new SettingsReader($fileName); + } } #============================================================= @@ -316,6 +324,21 @@ sub loadCategory { @{$self->{categories}}[-1]->{button}->setStretchable(0, 1); } + else { + for (my $cat=0; $cat < scalar(@{$self->{categories}}); $cat++ ) { + if( @{$self->{categories}}[$cat]->{name} eq $category->{name} && + !@{$self->{categories}}[$cat]->{button}) { + @{$self->{categories}}[$cat]->{button} = $self->{factory}->createPushButton( + $self->{leftPane}, + $self->{categories}[$cat]->{name} + ); + @{$self->{categories}}[$cat]->setIcon(); + @{$self->{categories}}[$cat]->{button}->setStretchable(0, 1); + last; + + } + } + } } sub loadCategories { @@ -331,6 +354,7 @@ sub loadCategories { push(@categoryFiles, $fileName); push(@categoryFiles, <etc/categories.conf.d/*.conf>); + my $currCategory; foreach $fileName (@categoryFiles) { my $inFile = new ConfigReader($fileName); @@ -342,10 +366,10 @@ sub loadCategories { $tmpCat = $self->getCategory($tmp->{title}); if (!$tmpCat) { $tmpCat = new Category($tmp->{title}, $tmp->{icon}); - $self->loadCategory($tmpCat); } - $hasNextCat = $inFile->hasNextCat(); - $self->{currCategory} = $tmpCat; + $self->loadCategory($tmpCat); + $hasNextCat = $inFile->hasNextCat(); + $currCategory = $tmpCat; my $hasNextMod = $inFile->hasNextMod(); while( $hasNextMod ) { @@ -353,16 +377,20 @@ sub loadCategories { my $tmpMod; my $loaded = 0; if (exists $tmp->{title}) { - $tmpMod = Module->create(name => $tmp->{title}, - icon => $tmp->{icon}, - launcher => $tmp->{launcher} - ); + if (not $currCategory->moduleLoaded($tmp->{title})) { + $tmpMod = Module->create(name => $tmp->{title}, + icon => $tmp->{icon}, + launch => $tmp->{launcher} + ); + } } elsif (exists $tmp->{class}) { - $tmpMod = Module->create(-CLASS => $tmp->{class}); + if (not $currCategory->moduleLoaded(-CLASS => $tmp->{class})) { + $tmpMod = Module->create(-CLASS => $tmp->{class}); + } } if ($tmpMod) { - $loaded = $self->{currCategory}->loadModule($tmpMod); + $loaded = $currCategory->loadModule($tmpMod); undef $tmpMod if !$loaded; } $hasNextMod = $inFile->hasNextMod(); @@ -108,9 +108,11 @@ sub removeButton { sub start { my $self = shift; - my $err = yui::YUI::app()->runInTerminal( $self->{launch} . " --ncurses"); - if ($err == -1) { - system($self->{launch}); + if ($self->{launch}) { + my $err = yui::YUI::app()->runInTerminal( $self->{launch} . " --ncurses"); + if ($err == -1) { + system($self->{launch}); + } } } @@ -37,20 +37,19 @@ my $settings = getSettings(); ask_for_authentication($settings->{priv_method}) if(require_root_capability()); -while (1) { my $mainWin = new MainDisplay(); +while (1) { my $launch = $mainWin->start(); if ($launch) { $mainWin->destroy(); $launch->start(); - undef($mainWin); } else { $mainWin->destroy(); - undef($mainWin); last; } + $mainWin->setupGui(); } diff --git a/modules/services/adminService b/modules/services/adminService index d4f8fe3..953b2cc 100755 --- a/modules/services/adminService +++ b/modules/services/adminService @@ -3,21 +3,11 @@ use strict; use lib qw(/usr/lib/libDrakX); -use standalone; #- warning, standalone must be loaded very first, for 'explanations' - -use common; -use AdminPanel::Shared; +use common qw(N); use AdminPanel::Services::AdminService; -use log; - -use yui; - -my $wm_icon = "/usr/share/mcc/themes/default/service-mdk.png"; - -yui::YUI::app()->setApplicationTitle(N("Services and daemons")); -yui::YUI::app()->setApplicationIcon($wm_icon); -my $serviceMan = AdminPanel::Services::AdminService->new(); +my $serviceMan = AdminPanel::Services::AdminService->new({icon => "/usr/share/mcc/themes/default/service-mdk.png", + name => N("Services and daemons"),}); $serviceMan->start(); 1; diff --git a/modules/usermanager/adminUser b/modules/usermanager/adminUser index e4cbe5f..c7f5b23 100755 --- a/modules/usermanager/adminUser +++ b/modules/usermanager/adminUser @@ -2,22 +2,12 @@ use lib qw(/usr/lib/libDrakX); -use standalone; #- warning, standalone must be loaded very first, for 'explanations' +use common qw(N); -use common; -use security::level; - -use AdminPanel::Shared; use AdminPanel::Users::GUsers; -use yui; - -my $wm_icon = "/usr/share/icons/userdrake.png"; - -yui::YUI::app()->setApplicationTitle(N("Mageia Users Management Tool")); -yui::YUI::app()->setApplicationIcon($wm_icon); - -my $userMan = AdminPanel::Users::GUsers->new(); +my $userMan = AdminPanel::Users::GUsers->new({icon => "/usr/share/icons/userdrake.png", + name => N("Mageia Users Management Tool"),}); $userMan->start(); 1; diff --git a/modules/usermanager/mgaAddUser b/modules/usermanager/mgaAddUser index d9d2297..f1af4bd 100755 --- a/modules/usermanager/mgaAddUser +++ b/modules/usermanager/mgaAddUser @@ -2,21 +2,12 @@ use lib qw(/usr/lib/libDrakX); -use standalone; #- warning, standalone must be loaded very first, for 'explanations' +use common qw(N); -use common; - -use AdminPanel::Shared; use AdminPanel::Users::GUsers; -use yui; - -my $wm_icon = "/usr/share/icons/userdrake.png"; - -yui::YUI::app()->setApplicationTitle(N("Mageia Add Users Tool")); -yui::YUI::app()->setApplicationIcon($wm_icon); - -my $userMan = AdminPanel::Users::GUsers->new(); -$userMan->addUserDialog(); +my $userMan = AdminPanel::Users::GUsers->new({icon => "/usr/share/icons/userdrake.png", + name => N("Mageia Add Users Tool"),}); +$userMan->addUserDialog(1); 1; |