[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 | # +-----------------------------------------------------------------------+ |
---|
| 20 | package Uploader::GUI::wxImageReuploadDlg; |
---|
| 21 | use strict; |
---|
| 22 | use Wx qw/ |
---|
| 23 | wxDefaultSize |
---|
| 24 | wxDefaultPosition |
---|
| 25 | wxID_CANCEL |
---|
| 26 | wxID_OK |
---|
| 27 | wxGREEN |
---|
| 28 | /; |
---|
| 29 | use base qw/Wx::Dialog Class::Accessor::Fast/; |
---|
| 30 | use 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 | ); |
---|
| 41 | use Carp; |
---|
| 42 | use Uploader::GUI::DlgCommon; |
---|
| 43 | |
---|
| 44 | sub 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 | |
---|
| 72 | sub _initEventHandlers { |
---|
| 73 | my ( $self ) = @_; |
---|
| 74 | |
---|
| 75 | EVT_BUTTON( $self, $main::ID_REUPLOAD_OK, \&OnOK ); |
---|
| 76 | EVT_CLOSE( $self, \&OnClose ); |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | sub OnOK { |
---|
| 83 | my ( $self, $event ) = @_; |
---|
| 84 | |
---|
| 85 | $self->_close; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | sub OnClose { |
---|
| 89 | my ( $self, $event ) = @_; |
---|
| 90 | |
---|
| 91 | $self->_close; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | sub _close { |
---|
| 95 | my ( $self ) = @_; |
---|
| 96 | |
---|
| 97 | Uploader::GUI::DlgCommon::GetProperties($self, $self->properties); |
---|
| 98 | |
---|
| 99 | $self->Destroy; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | 1; |
---|