source: extras/pLoader/trunk/src/Uploader/GUI/wxLoginDlg.pm @ 2597

Last change on this file since 2597 was 2597, checked in by ronosman, 16 years ago

pLoader initial release

  • Property svn:eol-style set to LF
File size: 3.3 KB
Line 
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::wxLoginDlg;
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                /;
34
35__PACKAGE__->mk_accessors( 
36    qw/
37           btok
38           url
39           username
40           password
41      / 
42);
43
44
45sub new {
46    my ($this, $params) = @_;
47    #on recupere le nom de la classe en fonction du type d'appel de la méthode.
48    my $class = ref($this) || $this;
49
50
51    my $self = $class->SUPER::new( undef, -1, $params->{title}, wxDefaultPosition, wxDefaultSize);
52    # load controls
53    &main::Login($self, 1);
54   
55    $self->url(
56        $params->{site_url}
57    );
58
59    $self->username(
60        $params->{site_username}
61    );
62
63    $self->password(
64        $params->{site_password}
65    );
66
67    $self->_initEventHandlers();
68   
69    $self->btok( $self->FindWindow($main::ID_PWG_OK) );
70
71    $self->FindWindow($main::ID_PWG_URL)->SetValue(
72        $self->url->()
73    );
74   
75   
76    $self->FindWindow($main::ID_PWG_USERNAME)->SetValue(
77        $self->username->() 
78    );
79   
80    $self->FindWindow($main::ID_PWG_PASSWORD)->SetValue( 
81        $self->password->() 
82    );
83     
84    $self;   
85}
86
87
88sub _initEventHandlers {
89    my ( $self ) = @_;
90   
91    EVT_BUTTON( $self, $main::ID_PWG_OK, \&OnLoginOK );
92    EVT_BUTTON( $self, $main::ID_PWG_CANCEL, \&OnLoginCancel );
93   
94       
95}
96
97
98
99sub OnLoginOK {
100    my ( $self, $event ) = @_;
101   
102    $self->url->(
103        $self->FindWindow($main::ID_PWG_URL)->GetValue   
104    );
105
106    $self->username->(
107        $self->FindWindow($main::ID_PWG_USERNAME)->GetValue
108    );
109   
110    $self->password->(
111        $self->FindWindow($main::ID_PWG_PASSWORD)->GetValue
112    );
113
114    $self->EndModal(1);
115}
116
117sub OnLoginCancel {
118    my ( $self, $event ) = @_;
119   
120   
121    $self->EndModal(0);
122 
123}
124
125
1261;
Note: See TracBrowser for help on using the repository browser.