| Aut-UI-Wx documentation | Contained in the Aut-UI-Wx distribution. |
new([parent]) --> Aut::UI::Wxmessage_ok(text, [title], [parent]) --> voidask_pass(text,[title],[parent]) --> stringlogin(aut:Aut, [title], [parent]) --> Aut::Ticketlogout(aut:Aut, ticket:Aut::Ticket) --> voidchange_pass(aut:Aut, ticket:Aut::Ticket, [title], [parent]) --> voidadmin(aut::Aut, ticket:Aut::Ticket, [title], [parent]) --> voidAut::UI::Wx - A wxPerl User Interface for the Aut framework.
This module provides a wxPerl User Interface for the authorization framework (see Aut::UI::Console for an interface description).
This User Interface has the same interface as Aut::UI::Console.
Please refere to this interface for more information.
The interface extends the minimal Aut::UI::Console interface.
new([parent]) --> Aut::UI::WxThe new function of this interface accepts a 'parent' window id.
Which is normal for wxWidgets.
message_ok(text, [title], [parent]) --> voidThis function accepts beneath the standard text also a title and
a parent. It will display a messagebox with an OK buttonthat is centered
on the parent.
ask_pass(text,[title],[parent]) --> stringThis function accepts beneath the standard text also a title and
a parent. It will display a dialog asking for a password with a
Cancel and an OK button.
Returns 'undef' in case of a Cancel, or if an empty password
has been given.
login(aut:Aut, [title], [parent]) --> Aut::TicketSee Aut::UI::Console. This function displays
a dialog with a Cancel and a OK button. Cancel will
yield an invalid ticket.
logout(aut:Aut, ticket:Aut::Ticket) --> voidCurrently only invalidates the ticket.
change_pass(aut:Aut, ticket:Aut::Ticket, [title], [parent]) --> voidChanges the password, see Aut::UI::Console.
admin(aut::Aut, ticket:Aut::Ticket, [title], [parent]) --> voidAdministers the accounts, see Aut::UI::Console.
Hans Oesterholt-Dijkema <oesterhol@cpan.org>
(c)2004 Hans Oesterholt-Dijkema, This module is distributed under Artistic license.
| Aut-UI-Wx documentation | Contained in the Aut-UI-Wx distribution. |
package Aut::UI::Wx; use strict; use Locale::Framework; use Aut::UI::wxGUI; use Aut; use Aut::Ticket; use Wx qw(:everything); our $VERSION='0.02'; ##################################################### # Instantiation/Initialization ##################################################### sub new { my $class=shift; my $parent=shift; my $self; if (defined $parent) { $self->{"parent"}=$parent; } else { $self->{"parent"}=undef; } $self->{"levels"}=undef; $self->{"admin"}=undef; bless $self,$class; return $self; } sub initialize { my $self=shift; my $levels=shift; my $adminlevel=shift; $self->{"levels"}=$levels; $self->{"admin"}=$adminlevel; } sub levels { my $self=shift; return @{$self->{"levels"}}; } ##################################################### # Messages ##################################################### sub message_ok { my $self=shift; my $text=shift; my $title=shift; my $parent=shift; if (not defined $title) { $title=_T("Alert"); } if (not defined $parent) { $parent=$self->{"parent"}; } #my $dlg=new __Aut__Msg($parent,-1,$title); #$dlg->set_label($text); #$dlg->ShowModal(); #$dlg->Destroy(); Wx::MessageBox( $text, $title, wxOK|wxCENTRE, $parent ); } sub message { } ##################################################### # Password/account related ##################################################### sub ask_pass { my $self=shift; my $aut=shift; my $text=shift; my $title=shift; my $parent=shift; my $pass; if (not defined $title) { $title=_T("Give password"); } if (not defined $parent) { $parent=$self->{"parent"}; } my $dlg=new __Aut__Entry($parent,-1,$title); $dlg->set_label($text); $dlg->SetTitle($title); if ($dlg->ShowModal()==wxID_OK) { $pass=$dlg->get_value(); if ($pass eq "") { $pass=undef; } } else { $pass=undef; } $dlg->Destroy(); return $pass; } sub login { my $self=shift; my $aut=shift; my $title=shift; my $parent=shift; if (not defined $title) { $title=_T("Login"); } if (not defined $parent) { $parent=$self->{"parent"}; } my $dlg=new __Aut__dlgLogin($parent,-1,$title); $dlg->set_aut($aut); $dlg->set_ui($self); $dlg->ShowModal(); my $ticket=$dlg->ticket(); $dlg->Destroy(); return $ticket; } sub logout { my $self=shift; my $aut=shift; my $ticket=shift; $ticket->invalidate(); return 1; } sub change_pass { my $self=shift; my $aut=shift; my $ticket=shift; my $title=shift; my $parent=shift; if (not defined $title) { $title=_T("Change Password"); } if (not defined $parent) { $parent=$self->{"parent"}; } my $dlg=new __Aut__ChangePass($parent,-1,$title); $dlg->set_aut($aut); $dlg->set_ui($self); $dlg->set_account($ticket->account()); $dlg->set_ticket($ticket); $dlg->ShowModal(); $dlg->Destroy(); } ##################################################### # Administration ##################################################### sub admin { my $self=shift; my $aut=shift; my $ticket=shift; my $title=shift; my $parent=shift; if (not defined $title) { $title=_T("Account Administration"); } if (not defined $parent) { $parent=$self->{"parent"}; } my $dlg=new __Aut__AdminAccounts($parent,-1,$title); $dlg->set_aut($aut); $dlg->set_ui($self); $dlg->set_ticket($ticket); if ($dlg->initialize()) { $dlg->ShowModal(); } $dlg->Destroy(); } 1; __END__