source: extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm @ 4467

Last change on this file since 4467 was 4467, checked in by ronosman, 14 years ago

Feature 1052 added : photo re-upload management. When uploading an already added photo, the user is warned and has a choice on action for files, simple properties and multi-values properties.

File size: 1.4 KB
Line 
1package Uploader::GUI::DlgCommon;
2use strict;
3
4sub SetProperties {
5    my ($dlg, $properties ) = @_;
6       
7        map {
8        my $ctrl =$dlg->FindWindow($_);
9        #printf("ctrl %s : %s\n", $_, $ctrl);           
10        if(defined $ctrl){
11                # checkbox, static text
12                $ctrl->SetLabel(
13           $dlg->properties->{$_}->{label}
14                ) if exists$dlg->properties->{$_}->{label};
15
16        $ctrl->SetValue(
17           $dlg->properties->{$_}->{value}->()
18                ) if exists$dlg->properties->{$_}->{value};
19
20        # radiobox
21        my $labels =$dlg->properties->{$_}->{labels};
22                $labels||=[];
23                for(my $i=0; $i < scalar @$labels ; $i++){
24                    $ctrl->SetItemLabel($i, $labels->[$i]);
25                }
26                # only works for control with items
27                $ctrl->SetSelection(
28                    $dlg->properties->{$_}->{selection}->()                     
29                ) if exists $dlg->properties->{$_}->{selection};
30               
31                }
32    }
33        keys %$properties;
34}
35
36sub GetProperties {
37    my ($dlg, $properties ) = @_;
38
39        map {
40        my $ctrl =$dlg->FindWindow($_);
41        #printf("ctrl %s : %s\n", $_, $ctrl);           
42        if(defined $ctrl){
43                # checkbox, static text
44
45        $dlg->properties->{$_}->{value}->(
46            $ctrl->GetValue()
47                ) if exists$dlg->properties->{$_}->{value};
48
49        $dlg->properties->{$_}->{selection}->(
50                    $ctrl->GetSelection()                       
51                ) if exists $dlg->properties->{$_}->{selection};
52               
53                }
54    }
55        keys %$properties;
56}
571;
Note: See TracBrowser for help on using the repository browser.