From cc143f97f3e0a31f057feb90eefccca49aa8884b Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Fri, 12 Dec 2014 11:30:07 +0100 Subject: code review, avoid code duplication --- modules/rpmdragora/rpmdragora | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'modules') diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora index a19fa3d..a0ed1af 100755 --- a/modules/rpmdragora/rpmdragora +++ b/modules/rpmdragora/rpmdragora @@ -163,29 +163,13 @@ sub detaillist_changeditem_callback { return; } -sub detaillist_callback { +sub _detaillist_callback { my ($selection, $info, $options, $show_options) = @_; $info->setValue(""); return if( ref $selection ne "yui::YItem"); - my $info_text ="

" . $loc->N("Informations") . "

"; - - my @data = get_info($options->{table_item_list}[$selection->index()], $show_options); - for(@{$data[0]}){ - if(ref $_ ne "ARRAY"){ - $info_text .= "
" . $_; - }else{ - $info_text .= "
"; - for my $subitem(@{$_}) { - $info_text .= "
" . "
   " . $subitem; - } - } - } - # change \n to
- $info_text =~ s|\n|
|g; - - $info->setValue($info_text); + AdminPanel::Rpmdragora::gui::setInfoOnWidget($options->{table_item_list}[$selection->index()], $info, $show_options); } sub _do_search($$$$$$) { @@ -1094,7 +1078,7 @@ sub run_treeview_dialog { my $url = yui::toYMenuEvent($event)->id (); if (AdminPanel::Rpmdragora::gui::info_details($url, $info_options) ) { $item = $detail_list->selectedItem(); - detaillist_callback($item, $info, \%$options, $info_options); + _detaillist_callback($item, $info, \%$options, $info_options); } else { # default it's really a URL @@ -1204,7 +1188,7 @@ print "Menu " . $menuLabel . " chosen\n"; yui::YUI::app()->normalCursor(); tree_callback($tree->currentItem(),\%$options); } - detaillist_callback($detail_list->selectedItem(), $info, \%$options); + _detaillist_callback($detail_list->selectedItem(), $info, \%$options); } elsif ($widget == $QuitButton) { last if quit(); -- cgit v1.2.1