[Bps-public-commit] r17502 - in Net-Trac/trunk: .

trs at bestpractical.com trs at bestpractical.com
Wed Dec 31 18:06:32 EST 2008


Author: trs
Date: Wed Dec 31 18:06:32 2008
New Revision: 17502

Modified:
   Net-Trac/trunk/   (props changed)
   Net-Trac/trunk/lib/Net/Trac/Ticket.pm
   Net-Trac/trunk/lib/Net/Trac/TicketSearch.pm

Log:
 r43368 at zot:  tom | 2008-12-31 17:46:49 -0500
 Update a bunch of metadata information, although we're not really using it yet


Modified: Net-Trac/trunk/lib/Net/Trac/Ticket.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Ticket.pm	(original)
+++ Net-Trac/trunk/lib/Net/Trac/Ticket.pm	Wed Dec 31 18:06:32 2008
@@ -17,15 +17,23 @@
 
 has _attachments     => ( isa => 'ArrayRef', is => 'rw' );
 
-has valid_milestones => ( isa => 'ArrayRef', is => 'rw' );
-has valid_types      => ( isa => 'ArrayRef', is => 'rw' );
-has valid_components => ( isa => 'ArrayRef', is => 'rw' );
-has valid_priorities => ( isa => 'ArrayRef', is => 'rw' );
+has valid_milestones  => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
+has valid_types       => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
+has valid_components  => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
+has valid_priorities  => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
+has valid_resolutions => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
+has valid_severities  => ( isa => 'ArrayRef', is => 'rw', default => sub {[]} );
 
-our @PROPS = qw( id summary type status priority resolution owner reporter cc
-                 description keywords component milestone version );
+sub basic_statuses {
+    qw( new accepted assigned reopened closed )
+}
+
+sub valid_props {
+    qw( id summary type status priority severity resolution owner reporter cc
+        description keywords component milestone version )
+}
 
-for my $prop (@PROPS) {
+for my $prop ( __PACKAGE__->valid_props ) {
     no strict 'refs';
     *{ "Net::Trac::Ticket::" . $prop } = sub { shift->state->{$prop} };
 }
@@ -86,11 +94,27 @@
     $self->valid_priorities(
         [ $form->find_input("field_priority")->possible_values ] );
 
-    my @inputs = $form->inputs;
+    my $severity = $form->find_input("field_severity");
+    $self->valid_severities( $severity->possible_values ) if $severity;
+    
+#    my @inputs = $form->inputs;
+#
+#    for my $in (@inputs) {
+#        my @values = $in->possible_values;
+#    }
+
+    return 1;
+}
 
-    for my $in (@inputs) {
-        my @values = $in->possible_values;
-    }
+sub _fetch_update_ticket_metadata {
+    my $self = shift;
+    my ($form, $form_num) = $self->_get_update_ticket_form;
+
+    return undef unless $form;
+
+    my $resolutions = $form->find_input("action_resolve_resolve_resolution");
+    $self->valid_resolutions( $resolutions->possible_values ) if $resolutions;
+    
     return 1;
 }
 
@@ -98,20 +122,7 @@
     my $self = shift;
     my %args = validate(
         @_,
-        {   summary     => 0,
-            reporter    => 0,
-            description => 0,
-            owner       => 0,
-            type        => 0,
-            priority    => 0,
-            milestone   => 0,
-            component   => 0,
-            version     => 0,
-            keywords    => 0,
-            cc          => 0,
-            status      => 0
-
-        }
+        { map { $_ => 0 } grep { !/resolution/ } $self->valid_props }
     );
 
     my ($form,$form_num)  = $self->_get_new_ticket_form();
@@ -140,22 +151,13 @@
     my %args = validate(
         @_,
         {
-            comment     => 0,
-            summary     => 0,
-            reporter    => 0,
-            description => 0,
-            owner       => 0,
-            type        => 0,
-            priority    => 0,
-            milestone   => 0,
-            component   => 0,
-            version     => 0,
-            keywords    => 0,
-            cc          => 0,
-            status      => 0
+            comment  => 0,
+            map { $_ => 0 } $self->valid_props
         }
     );
 
+#    if ( $update 
+
     my ($form,$form_num)= $self->_get_update_ticket_form();
 
     my %form = map { ($_ eq 'comment' ? $_ : 'field_' . $_) => $args{$_} } keys %args;

Modified: Net-Trac/trunk/lib/Net/Trac/TicketSearch.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/TicketSearch.pm	(original)
+++ Net-Trac/trunk/lib/Net/Trac/TicketSearch.pm	Wed Dec 31 18:06:32 2008
@@ -18,7 +18,7 @@
 
     # Build a URL from the fields we want and the query
     my $url = '/query?format=csv&order=id&max=' . $self->limit;
-    $url .= '&' . join '&', map { "col=$_" } @Net::Trac::Ticket::PROPS;
+    $url .= '&' . join '&', map { "col=$_" } Net::Trac::Ticket->valid_props;
     $url .= '&' . join '&', map { "$_=".$query{$_} } keys %query;
 
     my $content = $self->connection->_fetch( $url );



More information about the Bps-public-commit mailing list