From ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Thu, 16 Jan 2014 22:56:16 +0100 Subject: Added License into Shared to be used by admin panel modules easily set back dependency from /usr/lib/libDrakX to use apanel without -I --- AdminPanel/Services/AdminService.pm | 11 ++++++-- AdminPanel/Shared.pm | 53 ++++++++++++++++++++++++++++++++++--- AdminPanel/Users/GUsers.pm | 10 +++++-- 3 files changed, 67 insertions(+), 7 deletions(-) (limited to 'AdminPanel') diff --git a/AdminPanel/Services/AdminService.pm b/AdminPanel/Services/AdminService.pm index 7313249e..5055683c 100644 --- a/AdminPanel/Services/AdminService.pm +++ b/AdminPanel/Services/AdminService.pm @@ -26,7 +26,14 @@ package AdminPanel::Services::AdminService; #-###################################################################################### use strict; -use common; + +# TODO same translation atm +use lib qw(/usr/lib/libDrakX); +use common qw(N + N_ + cat_ + formatAlaTeX + translate); use run_program; use Moose; @@ -478,7 +485,7 @@ sub servicePanel { last; } elsif ($widget == $aboutButton) { - my $license = translate($::license); + my $license = translate($AdminPanel::Shared::License); # TODO fix version value AboutDialog({ name => N("AdminService"), version => $self->VERSION, diff --git a/AdminPanel/Shared.pm b/AdminPanel/Shared.pm index c337dfcc..21f98684 100644 --- a/AdminPanel/Shared.pm +++ b/AdminPanel/Shared.pm @@ -77,18 +77,22 @@ along with this file. If not, see . 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 97f35588..fe95a0b2 100644 --- a/AdminPanel/Users/GUsers.pm +++ b/AdminPanel/Users/GUsers.pm @@ -33,6 +33,12 @@ use strict; # instead 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; @@ -2398,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'), @@ -2556,7 +2562,7 @@ 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; -- cgit v1.2.1