[Bps-public-commit] r10218 - in RT-Client-Console: trunk trunk/lib/RT/Client trunk/lib/RT/Client/Console trunk/lib/RT/Client/Console/Session trunk/lib/RT/Client/Console/Session/Ticket
dams at bestpractical.com
dams at bestpractical.com
Mon Dec 31 15:14:47 EST 2007
Author: dams
Date: Mon Dec 31 15:14:43 2007
New Revision: 10218
Modified:
RT-Client-Console/ (props changed)
RT-Client-Console/trunk/Makefile.PL
RT-Client-Console/trunk/lib/RT/Client/Console.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Cnx.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Root.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/TabBar.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Attachments.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/CustFields.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Header.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Links.pm
RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Transactions.pm
Log:
r67 at pundit: dams | 2007-12-31 20:14:30 +0000
use relative (Maddingue's patch)
Modified: RT-Client-Console/trunk/Makefile.PL
==============================================================================
--- RT-Client-Console/trunk/Makefile.PL (original)
+++ RT-Client-Console/trunk/Makefile.PL Mon Dec 31 15:14:43 2007
@@ -20,6 +20,7 @@
'version' => 0,
'Error' => 0,
'parent' => 0,
+ 'relative' => 0,
},
EXE_FILES => [ 'bin/rtconsole' ],
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
Modified: RT-Client-Console/trunk/lib/RT/Client/Console.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console.pm Mon Dec 31 15:14:43 2007
@@ -10,10 +10,7 @@
use Curses::Widgets::ListBox;
use List::Util qw(min max);
use Params::Validate qw(:all);
-use RT::Client::Console::Session::Root;
-use RT::Client::Console::Session::KeyHandler;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session;
+use relative -aliased => qw(Cnx Session Session::Root Session::KeyHandler);
our $VERSION = '0.0.4';
@@ -36,16 +33,16 @@
$curses_handler = delete $params{curses_handler};
- RT::Client::Console::Session::Root->create();
+ Root->create();
- RT::Client::Console::Session::KeyHandler->create();
+ KeyHandler->create();
if ( exists $params{rt_servername}) {
- RT::Client::Console::Cnx->connect(%params);
+ Cnx->connect(%params);
}
# starts POE runtime
- RT::Client::Console::Session->run();
+ Session->run();
}
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Cnx.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Cnx.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Cnx.pm Mon Dec 31 15:14:43 2007
@@ -10,7 +10,7 @@
use Error qw(:try);
use Params::Validate qw(:all);
use RT::Client::REST;
-use RT::Client::Console::Session::Ticket;
+use relative -aliased => qw(::Session::Ticket);
# global connection data
@@ -67,7 +67,7 @@
undef $cnx_data{username};
undef $cnx_data{password};
my $ticket;
- while ($ticket = RT::Client::Console::Session::Ticket->get_current_ticket()) {
+ while ($ticket = Ticket->get_current_ticket()) {
$ticket->unload();
}
return;
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Root.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Root.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Root.pm Mon Dec 31 15:14:43 2007
@@ -7,11 +7,10 @@
use Params::Validate qw(:all);
use POE;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session::Progress;
-use RT::Client::Console::Session::Status;
-use RT::Client::Console::Session::TabBar;
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session);
+use relative -to => "RT::Client::Console::Session",
+ -aliased => qw(Progress Status TabBar Ticket);
# class method
@@ -44,14 +43,14 @@
},
available_keys => sub {
my @available_list = ();
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
push @available_list, ['q', 'quit', 'quit'];
if (!$rt_handler) {
push @available_list, ['s', 'connect to RT server', 'connect_server'];
} else {
push @available_list, ['d', 'disconnect', 'disconnect_server'];
push @available_list, ['o', 'open a ticket', 'open_ticket'];
- if (defined RT::Client::Console::Session::Ticket->get_current_id()) {
+ if (defined Ticket->get_current_id()) {
push @available_list, ['c', 'close current tab', 'close_tab'];
push @available_list, ['p', 'prev. tab', 'prev_tab'];
push @available_list, ['n', 'next tab', 'next_tab'];
@@ -70,35 +69,35 @@
},
quit => sub {
my ($kernel, $heap) = @_[ KERNEL, HEAP ];
- RT::Client::Console::Session->remove_all();
+ Session->remove_all();
},
create_tab_bar => sub {
- RT::Client::Console::Session::TabBar->create();
+ TabBar->create();
},
create_status_session => sub {
- RT::Client::Console::Session::Status->create();
+ Status->create();
},
create_progress_session => sub {
- RT::Client::Console::Session::Progress->create();
+ Progress->create();
},
connect_server => sub {
- RT::Client::Console::Cnx->connect();
+ Cnx->connect();
},
disconnect_server => sub {
- RT::Client::Console::Cnx->disconnect();
+ Cnx->disconnect();
},
open_ticket => sub {
print STDERR "root.pm : opening ticket\n";
- RT::Client::Console::Session::Ticket->load();
+ Ticket->load();
},
close_tab => sub {
- RT::Client::Console::Session::Ticket->get_current_ticket()->unload();
+ Ticket->get_current_ticket()->unload();
},
next_tab => sub {
- RT::Client::Console::Session::Ticket->next_ticket();
+ Ticket->next_ticket();
},
prev_tab => sub {
- RT::Client::Console::Session::Ticket->prev_ticket();
+ Ticket->prev_ticket();
},
}
);
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/TabBar.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/TabBar.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/TabBar.pm Mon Dec 31 15:14:43 2007
@@ -8,7 +8,8 @@
use Curses::Forms;
use Curses::Widgets::Label;
use POE;
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket);
# class method
@@ -32,7 +33,7 @@
my ($kernel,$heap) = @_[ KERNEL, HEAP ];
my $curses_handler = $class->get_curses_handler();
- my @tickets = RT::Client::Console::Session::Ticket->get_tickets_list();
+ my @tickets = Ticket->get_tickets_list();
@tickets > 0 or return;
# clear the tab bar
@@ -48,7 +49,7 @@
});
$label->draw($curses_handler);
- my $current_id = RT::Client::Console::Session::Ticket->get_current_id();
+ my $current_id = Ticket->get_current_id();
my @visible_tickets = @tickets;
while (! _is_visible($current_id, \@visible_tickets, $heap->{width})) {
shift @visible_tickets;
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket.pm Mon Dec 31 15:14:43 2007
@@ -12,11 +12,9 @@
use Params::Validate qw(:all);
use RT::Client::REST;
use RT::Client::REST::Ticket;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session::Ticket::Header;
-use RT::Client::Console::Session::Ticket::CustFields;
-use RT::Client::Console::Session::Ticket::Links;
-use RT::Client::Console::Session::Ticket::Transactions;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session);
+use relative -aliased => qw(Header CustFields Links Transactions);
@@ -74,13 +72,13 @@
my ($class) = @_;
foreach my $ticket (@tickets_list) {
foreach my $session (@{$ticket->{sessions}}) {
- RT::Client::Console::Session->set_display($session, 0);
+ Session->set_display($session, 0);
}
}
my $current_ticket = $class->get_current_ticket();
defined $current_ticket or return;
foreach my $session (@{$current_ticket->{sessions}}) {
- RT::Client::Console::Session->set_display($session, 1);
+ Session->set_display($session, 1);
}
}
@@ -116,10 +114,10 @@
# the 'create' methods returns the name of the session, so the array
# contains keep the list of child sessions.
- $self->{sessions} = [ RT::Client::Console::Session::Ticket::Header->create($id),
- RT::Client::Console::Session::Ticket::CustFields->create($id),
- RT::Client::Console::Session::Ticket::Links->create($id),
- RT::Client::Console::Session::Ticket::Transactions->create($id),
+ $self->{sessions} = [ Header->create($id),
+ CustFields->create($id),
+ Links->create($id),
+ Transactions->create($id),
];
return bless $self, $class;
}
@@ -148,7 +146,7 @@
my ($self) = @_;
# break references
foreach my $session_name (@{$self->{sessions}}) {
- RT::Client::Console::Session->remove($session_name);
+ Session->remove($session_name);
}
# remove from the list of tickets
@tickets_list = grep { $_ ne $self } @tickets_list;
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Attachments.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Attachments.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Attachments.pm Mon Dec 31 15:14:43 2007
@@ -13,9 +13,8 @@
use POE;
use Memoize;
use RT::Client::REST::User;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session::Progress;
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket Session::Progress);
# class method
@@ -145,7 +144,7 @@
if (defined $attachment) {
try {
my $user_id = $attachment->creator_id();
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
my ($user, $user_name, $user_email, $user_real_name, $user_gecos, $user_comments)
= _get_user_details( rt => $rt_handler,
@@ -242,11 +241,11 @@
if (defined $attachment->transaction_id()) {
my $id = $attachment->transaction_id();
$s .= "\n--- transaction $id ----\n";
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
my $transaction = $rt_handler->get_transaction(parent_id => $ticket_id,
id => $id);
-# my $ticket = RT::Client::Console::Session::Ticket->get_ticket_from_id($ticket_id);
+# my $ticket = Ticket->get_ticket_from_id($ticket_id);
#RT::Client::REST::Ticket
# my $transaction = RT::Client::REST($ticket,parent_id => $ticket_id,
# id => $id);
@@ -285,13 +284,13 @@
my @ids;
my $idx = 0;
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
my $iterator;
- RT::Client::Console::Session::Progress->add_progress(
+ Progress->add_progress(
steps_nb => sub { $heap->{total} },
caption => sub { 'attachments' },
initially => sub {
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
my $attachments_obj = $ticket->attachments();
my $count = $attachments_obj->count();
$heap->{total} = $count;
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/CustFields.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/CustFields.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/CustFields.pm Mon Dec 31 15:14:43 2007
@@ -9,7 +9,8 @@
use Params::Validate qw(:all);
use POE;
use POSIX qw(floor);
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket);
# class method
@@ -48,7 +49,7 @@
my ( $kernel, $heap) = @_[ KERNEL, HEAP ];
my $label;
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
my @custom_fields = sort $ticket->cf();
my $per_col = POSIX::floor(@custom_fields/3);
my @custom_fields_labels;
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Header.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Header.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Header.pm Mon Dec 31 15:14:43 2007
@@ -10,7 +10,8 @@
use POE;
use RT::Client::Console::Session::Ticket;
use RT::Client::Console::Session::Ticket;
-
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket);
# class method
@@ -38,7 +39,7 @@
},
change_header => sub {
my ( $kernel, $heap ) = @_[ KERNEL, HEAP ];
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
$class->create_modal( title => 'Change ticket headers',
text => '',
keys => {
@@ -108,7 +109,7 @@
my ($kernel, $heap) = @_[ KERNEL, HEAP ];
my $label;
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
my @requestors = $ticket->requestors();
my @requestor_text_list = map {
[ 'Requestor ' . $_ . ':' => $requestors[$_-1] ]
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Links.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Links.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Links.pm Mon Dec 31 15:14:43 2007
@@ -8,9 +8,8 @@
use Curses::Forms;
use Params::Validate qw(:all);
use POE;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session::Progress;
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket Session::Progress);
# class method
@@ -94,7 +93,7 @@
my ( $kernel, $heap) = @_[ KERNEL, HEAP ];
my $label;
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
if (!defined($heap->{parents})) {
$class->_generate_job($kernel, $heap, 'parents', q(HasMember=') . $ticket->id() . q('))
}
@@ -214,8 +213,8 @@
$heap->{$element} = [];
my @ids;
my $idx = 0;
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
- RT::Client::Console::Session::Progress->add_progress(
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
+ Progress->add_progress(
steps_nb => sub { scalar(@ids) },
caption => sub { $element },
initially => sub {
@@ -227,7 +226,7 @@
defined $id or return;
print STDERR "->>>>>> got id : [$id]\n";
push @{$heap->{$element}},
- RT::Client::Console::Session::Ticket->open_from_id($id);
+ Ticket->open_from_id($id);
# $kernel->post('ticket_links', 'draw');
return 1;
},
Modified: RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Transactions.pm
==============================================================================
--- RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Transactions.pm (original)
+++ RT-Client-Console/trunk/lib/RT/Client/Console/Session/Ticket/Transactions.pm Mon Dec 31 15:14:43 2007
@@ -10,9 +10,8 @@
use Curses::Widgets::ListBox;
use Curses::Widgets::TextMemo;
use POE;
-use RT::Client::Console::Cnx;
-use RT::Client::Console::Session::Progress;
-use RT::Client::Console::Session::Ticket;
+use relative -to => "RT::Client::Console",
+ -aliased => qw(Cnx Session Session::Ticket Session::Progress);
# class method
@@ -222,8 +221,8 @@
use Data::Dumper;
my $s = Dumper($transaction);
-# use RT::Client::Console::Session::Ticket;
-# my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+# use Ticket;
+# my $ticket = Ticket->get_current_ticket();
# my $attachments_obj = $ticket->attachments();
# my $iterator = $attachments_obj->get_iterator();
# my $linked_attachement;
@@ -280,13 +279,13 @@
my @ids;
my $idx = 0;
- my $rt_handler = RT::Client::Console::Cnx->get_cnx_data()->{handler};
+ my $rt_handler = Cnx->get_cnx_data()->{handler};
my $iterator;
- RT::Client::Console::Session::Progress->add_progress(
+ Progress->add_progress(
steps_nb => sub { $heap->{total} },
caption => sub { 'transactions' },
initially => sub {
- my $ticket = RT::Client::Console::Session::Ticket->get_current_ticket();
+ my $ticket = Ticket->get_current_ticket();
my $transactions_obj = $ticket->transactions();
my $count = $transactions_obj->count();
$heap->{total} = $count;
More information about the Bps-public-commit
mailing list