diff options
author | Angelo Naselli <anaselli@linux.it> | 2014-05-29 19:23:09 +0200 |
---|---|---|
committer | Angelo Naselli <anaselli@linux.it> | 2014-05-29 19:23:09 +0200 |
commit | 38212d4ef22cc0ed017c4c259e6434dab36cb852 (patch) | |
tree | ab0a277a91e8e59ceea5787354fc0d49c945fd49 /lib/AdminPanel/Shared.pm | |
parent | 1a663c782f6dbd7027954a2fd2c39e8bcf0e182f (diff) | |
download | manatools-38212d4ef22cc0ed017c4c259e6434dab36cb852.tar manatools-38212d4ef22cc0ed017c4c259e6434dab36cb852.tar.gz manatools-38212d4ef22cc0ed017c4c259e6434dab36cb852.tar.bz2 manatools-38212d4ef22cc0ed017c4c259e6434dab36cb852.tar.xz manatools-38212d4ef22cc0ed017c4c259e6434dab36cb852.zip |
now AdminPanel::Shared::Users is under Moose
Diffstat (limited to 'lib/AdminPanel/Shared.pm')
-rw-r--r-- | lib/AdminPanel/Shared.pm | 80 |
1 files changed, 52 insertions, 28 deletions
diff --git a/lib/AdminPanel/Shared.pm b/lib/AdminPanel/Shared.pm index 5aceca1d..4755b3e2 100644 --- a/lib/AdminPanel/Shared.pm +++ b/lib/AdminPanel/Shared.pm @@ -78,6 +78,8 @@ use strict; use warnings; use diagnostics; +use Digest::MD5; + use lib qw(/usr/lib/libDrakX); use common qw(N N_); @@ -247,34 +249,21 @@ This function create an OK-Cancel dialog with a 'title' and a sub ask_OkCancel { my ($title, $text) = @_; my $retVal = 0; - my $factory = yui::YUI::widgetFactory; - - my $msg_box = $factory->createPopupDialog($yui::YDialogNormalColor); - my $layout = $factory->createVBox($msg_box); - - my $align = $factory->createAlignment($layout, 3, 0); - ## title with headings true - $factory->createLabel( $align, $title, 1, 0); - $align = $factory->createLeft($layout); - $factory->createLabel( $align, $text, 0, 0); - - $align = $factory->createRight($layout); - my $hbox = $factory->createHBox($align); - my $okButton = $factory->createPushButton($hbox, N("Ok")); - my $cancelButton = $factory->createPushButton($hbox, N("Cancel")); - - my $event = $msg_box->waitForEvent(); - - my $eventType = $event->eventType(); - - if ($eventType == $yui::YEvent::WidgetEvent) { - # widget selected - my $widget = $event->widget(); - $retVal = ($widget == $okButton) ? 1 : 0; - } - - destroy $msg_box; - + yui::YUI::widgetFactory; + my $factory = yui::YExternalWidgets::externalWidgetFactory("mga"); + $factory = yui::YMGAWidgetFactory::getYMGAWidgetFactory($factory); + my $dlg = $factory->createDialogBox($yui::YMGAMessageBox::B_TWO); + $dlg->setTitle($title); + $dlg->setText($text); + $dlg->setButtonLabel(N("Ok"), $yui::YMGAMessageBox::B_ONE ); + $dlg->setButtonLabel(N("Cancel"), $yui::YMGAMessageBox::B_TWO); + $dlg->setDefaultButton($yui::YMGAMessageBox::B_ONE); + $dlg->setMinSize(50, 5); + + $retVal = $dlg->show() == $yui::YMGAMessageBox::B_ONE ? 1 : 0; + + $dlg = undef; + return $retVal; } @@ -716,4 +705,39 @@ sub member { 0; } +#============================================================= + +=head2 md5sum + +=head3 INPUT + +$filename: file for md5 calculation + +=head3 OUTPUT + +md5 sum + +=head3 DESCRIPTION + + compute MD5 for the given file + +=cut + +#============================================================= + +sub md5sum { + my @files = @_; + + my @md5 = map { + my $sum; + if (open(my $FILE, $_)) { + binmode($FILE); + $sum = Digest::MD5->new->addfile($FILE)->hexdigest; + close($FILE); + } + $sum; + } @files; + return wantarray() ? @md5 : $md5[0]; +} + 1; # End of AdminPanel::Shared |