source: extensions/pLoader/trunk/src/Uploader/GUI/wxImageReuploadDlg.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: 2.9 KB
RevLine 
[4467]1# +-----------------------------------------------------------------------+
2# | pLoader - a Perl photo uploader for Piwigo                            |
3# +-----------------------------------------------------------------------+
4# | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
5# +-----------------------------------------------------------------------+
6# | This program is free software; you can redistribute it and/or modify  |
7# | it under the terms of the GNU General Public License as published by  |
8# | the Free Software Foundation                                          |
9# |                                                                       |
10# | This program is distributed in the hope that it will be useful, but   |
11# | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13# | General Public License for more details.                              |
14# |                                                                       |
15# | You should have received a copy of the GNU General Public License     |
16# | along with this program; if not, write to the Free Software           |
17# | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18# | USA.                                                                  |
19# +-----------------------------------------------------------------------+
20package Uploader::GUI::wxImageReuploadDlg;
21use strict;
22use Wx qw/
23             wxDefaultSize
24             wxDefaultPosition
25             wxID_CANCEL
26             wxID_OK
27             wxGREEN
28         /;
29use base qw/Wx::Dialog Class::Accessor::Fast/;
30use Wx::Event qw/
31                    EVT_UPDATE_UI
32                    EVT_BUTTON
33                                        EVT_CLOSE
34                /;
35
36__PACKAGE__->mk_accessors( 
37    qw/
38        properties
39      / 
40);
41use Carp;
42use Uploader::GUI::DlgCommon;
43
44sub new {
45    my ($this, $params) = @_;
46    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
47    my $class = ref($this) || $this;
48
49
50    my $self = $class->SUPER::new( undef, -1, $params->{title}, wxDefaultPosition, wxDefaultSize);
51    # load controls
52    eval {
53      &main::Reupload($self, 1);
54
55            $self->properties(
56            $params->{properties}
57        );
58
59        Uploader::GUI::DlgCommon::SetProperties($self, $self->properties);
60        $self->_initEventHandlers();
61
62                if($@){
63                        Wx::LogMessage("Error during dialogbox initialization");
64                }
65        };
66
67    $self;   
68}
69
70
71
72sub _initEventHandlers {
73    my ( $self ) = @_;
74   
75    EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK );
76    EVT_CLOSE( $self, \&OnClose );
77   
78       
79}
80
81
82sub OnOK {
83    my ( $self, $event ) = @_;
84   
85    $self->_close;
86}
87
88sub OnClose {
89    my ( $self, $event ) = @_;
90       
91        $self->_close;
92}
93
94sub _close {
95    my ( $self ) = @_;
96
97    Uploader::GUI::DlgCommon::GetProperties($self, $self->properties);
98               
99    $self->Destroy;
100}
101
1021;
Note: See TracBrowser for help on using the repository browser.