diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-01-16 22:56:16 +0100 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-01-16 22:56:16 +0100 |
commit | ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85 (patch) | |
tree | f65b8e09b1d611f9b2581875ca15873b24a48d2d | |
parent | fed16eef71eacf5e06b7efb633e6cbf1e55f38f0 (diff) | |
download | colin-keep-ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85.tar colin-keep-ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85.tar.gz colin-keep-ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85.tar.bz2 colin-keep-ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85.tar.xz colin-keep-ce5290dcdbba11a8ea5c80fb8ba9f221c6863f85.zip |
Added License into Shared to be used by admin panel modules easily
set back dependency from /usr/lib/libDrakX to use apanel without -I
-rw-r--r-- | AdminPanel/Services/AdminService.pm | 11 | ||||
-rw-r--r-- | AdminPanel/Shared.pm | 53 | ||||
-rw-r--r-- | AdminPanel/Users/GUsers.pm | 10 |
3 files changed, 67 insertions, 7 deletions
diff --git a/AdminPanel/Services/AdminService.pm b/AdminPanel/Services/AdminService.pm index 7313249..5055683 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 c337dfc..21f9868 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 97f3558..fe95a0b 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; |