diff options
| author | Angelo Naselli <anaselli@linux.it> | 2014-06-24 15:46:33 +0200 | 
|---|---|---|
| committer | Angelo Naselli <anaselli@linux.it> | 2014-06-24 15:46:33 +0200 | 
| commit | f30b6901ddffa5e2a523f2b23953788d55286006 (patch) | |
| tree | 2ba391a5c84244ed2b04c9c8ec758a678a922288 | |
| parent | 4f80ad579583eceeca0411557af092de2a363d7b (diff) | |
| download | manatools-f30b6901ddffa5e2a523f2b23953788d55286006.tar manatools-f30b6901ddffa5e2a523f2b23953788d55286006.tar.gz manatools-f30b6901ddffa5e2a523f2b23953788d55286006.tar.bz2 manatools-f30b6901ddffa5e2a523f2b23953788d55286006.tar.xz manatools-f30b6901ddffa5e2a523f2b23953788d55286006.zip  | |
Managed leaf only selection (param any_item_selection to avoid)
| -rw-r--r-- | lib/AdminPanel/Shared/GUI.pm | 21 | 
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/AdminPanel/Shared/GUI.pm b/lib/AdminPanel/Shared/GUI.pm index a31c451a..f5fdc434 100644 --- a/lib/AdminPanel/Shared/GUI.pm +++ b/lib/AdminPanel/Shared/GUI.pm @@ -687,17 +687,26 @@ sub ask_fromTreeList {                  last;              }              elsif ($widget == $selectButton) { +        $DB::single = 1;                  my $item = $treeWidget->selectedItem();                  if ($info->{skip_path} && $info->{skip_path} != 0) {                      $choice = $item->label() if ($item);                  }                  else { -                    my $separator = exists $info->{item_separator} ? $info->{item_separator} : '/'; -                    if ($item) { -                        $choice = $item->label(); -                        my $parent = $item; -                        while($parent = $parent->parent()) { -                            $choice = $parent->label() . $separator . $choice ; +                    my $getChoice = 1; +                    if (!exists $info->{any_item_selection} || $info->{any_item_selection} != 0) { +                        if ($item) { +                            $getChoice = (!$item->hasChildren()); +                        } +                    } +                    if ($getChoice) { +                        my $separator = exists $info->{item_separator} ? $info->{item_separator} : '/'; +                        if ($item) { +                            $choice = $item->label(); +                            my $parent = $item; +                            while($parent = $parent->parent()) { +                                $choice = $parent->label() . $separator . $choice ; +                            }                          }                      }                  }  | 
