[Rt-commit] rt branch, admin_ui, created. 1929c2c3b0c88442a9431fbad1d93026b8665359

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Nov 25 09:52:50 EST 2009


The branch, admin_ui has been created
        at  1929c2c3b0c88442a9431fbad1d93026b8665359 (commit)

- Log -----------------------------------------------------------------
commit 2da50d21210eacbd22f43bf95efdc37dca6ff301
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 20 15:54:52 2009 -0500

    No need to call /Elements/Tabs any more

diff --git a/lib/RT/View/Ticket/Create.pm b/lib/RT/View/Ticket/Create.pm
index bcbdd3f..f56b4bb 100644
--- a/lib/RT/View/Ticket/Create.pm
+++ b/lib/RT/View/Ticket/Create.pm
@@ -60,11 +60,6 @@ template 'create' => page { title => _('Create a new ticket') } content {
     my $queue = $action ? $action->argument('queue') : get('queue');
     $queue or die "Queue not specified";
 
-    render_mason('/Elements/Tabs', {
-        current_toptab => 'ticket/create',
-        title          => _("Create a new ticket"),
-    });
-
     my $create = new_action(
         class   => 'CreateTicket',
         moniker => 'create_ticket',

commit 9b52f01aa7da2a46c5b15b4928c7e6857710b671
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Nov 20 16:04:46 2009 -0500

    When you try to go to /ticket/create without a queue, show an intermediate page with clickable queues

diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 4a8cf1a..b801e14 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -746,6 +746,18 @@ before qr{^/Search/Build.html} => run {
 
 };
 
+on '/ticket/create' => run {
+    my $action = Jifty->web->request->action('create_ticket');
+    my $queue = $action ? $action->argument('queue') : get('queue');
+    if (!defined($queue)) {
+        show '/ticket/select-queue-for-create';
+    }
+    else {
+        set(queue => $queue);
+        show '/ticket/create';
+    }
+};
+
 # Backward compatibility with old RT URLs
 
 before '/NoAuth/Logout.html' => run { redirect '/logout' };
diff --git a/lib/RT/Model/QueueCollection.pm b/lib/RT/Model/QueueCollection.pm
index 7a32849..b24dcb0 100755
--- a/lib/RT/Model/QueueCollection.pm
+++ b/lib/RT/Model/QueueCollection.pm
@@ -131,6 +131,5 @@ sub add_record {
     $self->SUPER::add_record($Queue);
 }
 
-
 1;
 
diff --git a/lib/RT/View/Ticket/Create.pm b/lib/RT/View/Ticket/Create.pm
index f56b4bb..708fe6b 100644
--- a/lib/RT/View/Ticket/Create.pm
+++ b/lib/RT/View/Ticket/Create.pm
@@ -54,11 +54,7 @@ use Jifty::View::Declare -base;
 __PACKAGE__->use_mason_wrapper;
 
 template 'create' => page { title => _('Create a new ticket') } content {
-    # If we have a create_ticket action, pluck the queue out, otherwise,
-    # check the regular queue query parameter
-    my $action = Jifty->web->request->action('create_ticket');
-    my $queue = $action ? $action->argument('queue') : get('queue');
-    $queue or die "Queue not specified";
+    my $queue = get('queue');
 
     my $create = new_action(
         class   => 'CreateTicket',
@@ -74,5 +70,27 @@ template 'create' => page { title => _('Create a new ticket') } content {
     };
 };
 
+template 'select-queue-for-create' =>
+page { title => _('Create a new ticket') }
+content {
+    my $queues = RT::Model::QueueCollection->new;
+    $queues->unlimit;
+
+    p { _("Please select a queue for your new ticket.") };
+    ul {
+        while (my $queue = $queues->next) {
+            li {
+                hyperlink(
+                    label => $queue->name,
+                    url => '/ticket/create',
+                    parameters => {
+                        queue => $queue->id,
+                    },
+                );
+            }
+        }
+    }
+};
+
 1;
 

commit 75fb5f65050655320adfa96249b239816142a996
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Nov 23 10:48:35 2009 +0800

    tiny fix

diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 9e5caa2..4a9813d 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -756,7 +756,7 @@ sub create {
     # //RUZ
 
     foreach my $type ( keys %LINKTYPEMAP ) {
-        next unless ( defined $args{$type} );
+        next unless $args{$type};
         foreach my $link ( ref( $args{$type} ) ? @{ $args{$type} } : ( $args{$type} ) ) {
 
             # Check rights on the other end of the link if we must

commit 4e7c2abf40fd20eb0e63452004c8824c4f1b8056
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 17:49:42 2009 -0500

    If GPG is enabled, add sign and encrypt checkboxes to CreateTicket

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index a36d94f..f141df6 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -54,6 +54,7 @@ sub after_set_queue {
 
     $self->set_valid_statuses($queue);
     $self->set_valid_owners($queue);
+    $self->setup_gnupg($queue);
 
     $self->add_role_group_parameter(
         name          => 'requestors',
@@ -175,6 +176,21 @@ sub set_valid_owners {
     $self->fill_parameter(owner => valid_values => [ map { $_->id } @valid_owners ]);
 }
 
+sub setup_gnupg {
+    my $self  = shift;
+    my $queue = shift;
+
+    return unless RT->config->get('gnupg')->{enable};
+
+    $self->fill_parameter(sign => (
+        render_as => 'checkbox',
+    ));
+
+    $self->fill_parameter(encrypt => (
+        render_as => 'checkbox',
+    ));
+}
+
 sub set_initial_priority {
     my $self  = shift;
     my $queue = shift;

commit 6fe8c3c816b372c840666457a723cc1d124755e0
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 21:52:50 2009 -0500

    Jiftyfy t/web/gnupg-outgoing's form handling

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 011a152..e9e0cb7 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -74,16 +74,16 @@ diag "check in read-only mode that queue's props influence create/update ticket
     foreach my $variant ( @variants ) {
         set_queue_crypt_options( %$variant );
         $m->goto_create_ticket( $queue );
-        $m->form_name('ticket_create');
+        my $form = $m->action_form('create_ticket');
         if ( $variant->{'encrypt'} ) {
-            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+            ok $form->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+            ok !$form->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $m->value('sign', 2), "sign tick box is checked";
+            ok $form->value('sign'), "sign tick box is checked";
         } else {
-            ok !$m->value('sign', 2), "sign tick box is unchecked";
+            ok !$form->value('sign'), "sign tick box is unchecked";
         }
     }
 
@@ -102,16 +102,16 @@ diag "check in read-only mode that queue's props influence create/update ticket
         set_queue_crypt_options( %$variant );
         $m->goto_ticket( $id );
         $m->follow_link_ok({text => 'Reply'}, '-> reply');
-        $m->form_number(3);
+        my $form = $m->action_form('create_ticket');
         if ( $variant->{'encrypt'} ) {
-            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+            ok $form->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+            ok !$form->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $m->value('sign', 2), "sign tick box is checked";
+            ok $form->value('sign'), "sign tick box is checked";
         } else {
-            ok !$m->value('sign', 2), "sign tick box is unchecked";
+            ok !$form->value('sign'), "sign tick box is unchecked";
         }
     }
 }
@@ -259,16 +259,18 @@ sub create_a_ticket {
     RT::Test->clean_caught_mails;
 
     $m->goto_create_ticket( $queue );
-    $m->form_name('ticket_create');
-    $m->field( subject    => 'test' );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content    => 'Some content' );
+    $m->fill_in_action_ok('create_ticket' => (
+        subject    => 'test',
+        requestors => 'rt-test at example.com',
+        content    => 'Some content',
+    ));
+    my $form = $m->action_form('create_ticket');
 
     foreach ( qw(sign encrypt) ) {
         if ( $args{ $_ } ) {
-            $m->tick( $_ => 1 );
+            $form->tick( $_ => 1 );
         } else {
-            $m->untick( $_ => 1 );
+            $form->untick( $_ => 1 );
         }
     }
 

commit d85d8e776022674ce51f6a9e67d883c1d7e134c9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 22:03:44 2009 -0500

    Respect the queue's default sign/encrypt values

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index f141df6..5cf4c92 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -184,10 +184,12 @@ sub setup_gnupg {
 
     $self->fill_parameter(sign => (
         render_as => 'checkbox',
+        default   => $queue->sign,
     ));
 
     $self->fill_parameter(encrypt => (
         render_as => 'checkbox',
+        default   => $queue->encrypt,
     ));
 }
 

commit f2248c4a195b7faa1259d1c7bc5d1adfe8fa7a74
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 10:51:14 2009 +0800

    add form names, and update tests: form_number is not safe anymore

diff --git a/share/html/Admin/Global/GroupRights.html b/share/html/Admin/Global/GroupRights.html
index e72f4ba..4672c26 100755
--- a/share/html/Admin/Global/GroupRights.html
+++ b/share/html/Admin/Global/GroupRights.html
@@ -51,7 +51,7 @@
     title => _('Modify global group rights') &>  
 <& /Elements/ListActions, actions => \@results &>
 
-  <form method="post" action="GroupRights.html">
+  <form method="post" action="GroupRights.html" name="group_rights_modify">
       
 <&| /Widgets/TitleBox, title => _('Modify global group rights.')&>
       
diff --git a/share/html/Admin/Queues/Modify.html b/share/html/Admin/Queues/Modify.html
index 2824db0..2f97389 100755
--- a/share/html/Admin/Queues/Modify.html
+++ b/share/html/Admin/Queues/Modify.html
@@ -54,7 +54,7 @@
 
 
 
-<form action="<%RT->config->get('web_path')%>/Admin/Queues/Modify.html" method="post">
+<form action="<%RT->config->get('web_path')%>/Admin/Queues/Modify.html" method="post" name="queue_modify">
 <input type="hidden" class="hidden" name="set_enabled" value="1" />
 <input type="hidden" class="hidden" name="id" value="<% $create? 'new': $queue_obj->id %>" />
 
diff --git a/share/html/Search/Edit.html b/share/html/Search/Edit.html
index 9a50fe6..bded257 100755
--- a/share/html/Search/Edit.html
+++ b/share/html/Search/Edit.html
@@ -59,7 +59,7 @@
 
 <& Elements/NewListActions, actions => \@actions &>
 
-<form method="post" action="Build.html">
+<form method="post" action="Build.html" name="query_edit">
 <input type="hidden" class="hidden" name="saved_search_id" value="<% $saved_search_id %>" />
 <&|/Widgets/TitleBox, title => _('Query'), &>
 <textarea name="query" rows="8" cols="72"><% $query %></textarea>
diff --git a/share/html/Ticket/Modify.html b/share/html/Ticket/Modify.html
index 2f48630..577b492 100755
--- a/share/html/Ticket/Modify.html
+++ b/share/html/Ticket/Modify.html
@@ -53,7 +53,7 @@
 % $m->callback(callback_name => 'BeforeActionList', actions => \@results, args_ref => \%ARGS, ticket => $ticket_obj);
 
 <& /Elements/ListActions, actions => \@results &>
-<% Jifty->web->form->start( submit_to => '?id=' . $ticket_obj->id ) %>
+<% Jifty->web->form->start( name => 'ticket_modify', submit_to => '?id=' . $ticket_obj->id ) %>
 % $m->callback( callback_name => 'FormStart', args_ref => \%ARGS );
 <input type="hidden" class="hidden" name="id" value="<% $ticket_obj->id %>" />
 
diff --git a/t/mail/gnupg-bad.t b/t/mail/gnupg-bad.t
index b706a4f..1f2b537 100644
--- a/t/mail/gnupg-bad.t
+++ b/t/mail/gnupg-bad.t
@@ -42,7 +42,7 @@ $m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'ticket_create',
          fields      => { correspond_address => 'rt at example.com' } );
 $m->content_like(qr/rt\@example.com.* - never/, 'has key info.');
 ok(my $user = RT::Model::User->new(current_user => RT->system_user));
diff --git a/t/mail/gnupg-incoming.t b/t/mail/gnupg-incoming.t
index d1fce46..23c00a7 100644
--- a/t/mail/gnupg-incoming.t
+++ b/t/mail/gnupg-incoming.t
@@ -48,7 +48,7 @@ $m->login();
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'queue_modify',
 		 fields      => { correspond_address => 'general at example.com' } );
 $m->content_like(qr/general\@example.com.* - never/, 'has key info.');
 
diff --git a/t/mail/gnupg-realmail.t b/t/mail/gnupg-realmail.t
index bda9e00..7fe0ba4 100644
--- a/t/mail/gnupg-realmail.t
+++ b/t/mail/gnupg-realmail.t
@@ -45,7 +45,7 @@ my ($baseurl, $m) = RT::Test->started_ok;
 ok $m->login, 'we did log in';
 $m->get_ok( '/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_number => 3,
+$m->submit_form( form_name => 'queue_modify',
          fields      => { correspond_address => 'rt-recipient at example.com' } );
 $m->content_like(qr/rt-recipient\@example.com.* - never/, 'has key info.');
 
diff --git a/t/web/cf_access.t b/t/web/cf_access.t
index 217a52e..d6c9da4 100644
--- a/t/web/cf_access.t
+++ b/t/web/cf_access.t
@@ -18,7 +18,8 @@ diag "Create a CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -36,7 +37,7 @@ diag "apply the CF to General queue" if $ENV{'TEST_VERBOSE'};
 my ( $cf, $cfid, $tid );
 {
     $m->title_is(q/Created CustomField img/, 'admin-cf Created');
-    $m->follow_link( text => 'Queues' );
+    $m->follow_link( text => 'Queues', url_regex => qr!/Admin/Queues! );
     $m->title_is(q/Admin queues/, 'admin-queues screen');
     $m->follow_link( text => 'General' );
     $m->title_is(q/Editing Configuration for queue General/, 'admin-queue: general');
@@ -122,7 +123,7 @@ diag "check that we have no the CF on the create"
 
     $m->follow_link( text => 'Custom Fields' );
     $m->content_unlike(qr/Upload multiple images/, 'has no upload image field');
-    $form = $m->form_number(3);
+    $form = $m->form_name('ticket_modify');
     ok !$form->find_input( "J:A:F-$cfid-$cf_moniker" ), 'no form field on the page';
 }
 
diff --git a/t/web/cf_onqueue.t b/t/web/cf_onqueue.t
index e12c759..986fdce 100644
--- a/t/web/cf_onqueue.t
+++ b/t/web/cf_onqueue.t
@@ -10,7 +10,8 @@ diag "Create a queue CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -51,7 +52,7 @@ diag "Edit the CF value for default queue" if $ENV{'TEST_VERBOSE'};
     $m->title_is(q/Editing Configuration for queue General/, 'default queue configuration screen');
     $m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on default queue' );
     $m->submit_form(
-        form_number => 3,
+        form_name => 'queue_modify',
         # The following doesn't want to works :(
         #with_fields => { 'object-RT::Model::Queue-1-CustomField-1-value' },
         fields => {
diff --git a/t/web/cf_select_one.t b/t/web/cf_select_one.t
index d642593..f79a7aa 100644
--- a/t/web/cf_select_one.t
+++ b/t/web/cf_select_one.t
@@ -17,7 +17,8 @@ diag "Create a CF" if $ENV{'TEST_VERBOSE'};
 {
     $m->follow_link( text => 'Configuration' );
     $m->title_is(q/RT Administration/, 'admin screen');
-    $m->follow_link( text => 'Custom Fields' );
+    $m->follow_link( text => 'Custom Fields', url_regex =>
+            qr!Admin/CustomFields! );
     $m->title_is(q/Select a Custom Field/, 'admin-cf screen');
     $m->follow_link( text => 'Create' );
     $m->submit_form(
@@ -95,12 +96,12 @@ diag "check that values of the CF are case insensetive(asd vs. ASD)"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'correct value is selected';
     $m->submit;
     $m->content_unlike(qr/\Q$cf_name\E.*?changed/mi, 'field is not changed');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'the same value is still selected';
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
     $ticket->load( $tid );
@@ -117,14 +118,14 @@ diag "check that 0 is ok value of the CF"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, 'asd', 'correct value is selected';
     $m->select("J:A:F-$cfid-$cf_moniker" => 0 );
     $m->submit;
     $m->content_like(qr/\Q$cf_name\E.*?changed/mi, 'field is changed');
     $m->content_unlike(qr/0 is no longer a value for custom field/mi, 'no bad message in results');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, '0', 'new value is selected';
 
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
@@ -142,13 +143,13 @@ diag "check that we can set empty value when the current is 0"
     $m->title_like(qr/Modify ticket/i, 'modify ticket');
     $m->content_like(qr/\Q$cf_name/, 'CF on the page');
 
-    my $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    my $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is lc $value, '0', 'correct value is selected';
     $m->select("J:A:F-$cfid-$cf_moniker" => '' );
     $m->submit;
     $m->content_like(qr/0 is no longer a value for custom field/mi, '0 is no longer a value');
 
-    $value = $m->form_number(3)->value("J:A:F-$cfid-$cf_moniker");
+    $value = $m->form_name('ticket_modify')->value("J:A:F-$cfid-$cf_moniker");
     is $value, '', '(no value) is selected';
 
     my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index e9e0cb7..e5d1c66 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -293,7 +293,7 @@ sub update_ticket {
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->field( update_content => 'Some content' );
 
     foreach ( qw(sign encrypt) ) {
diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index d14094c..57af1b6 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -57,7 +57,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( sign => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -71,7 +71,6 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
 }
-
 {
     RT::Test->import_gnupg_key('rt-recipient at example.com');
     RT::Test->trust_gnupg_key('rt-recipient at example.com');
@@ -84,7 +83,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -98,7 +97,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -119,7 +118,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -133,7 +132,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -166,7 +165,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -180,7 +179,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -212,7 +211,7 @@ diag "check that we see key selector even if only one key is trusted but there a
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -226,7 +225,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -240,7 +239,7 @@ diag "check that key selector works and we can select trusted key"
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -254,7 +253,7 @@ diag "check that key selector works and we can select trusted key"
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -272,7 +271,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_number(3);
+    $m->form_name('ticket_create');
     $m->tick( encrypt => 1 );
     $m->field( requestors => 'rt-test at example.com' );
     $m->field( content => 'Some content' );
@@ -287,7 +286,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_create');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/gnupg-select-keys-on-update.t b/t/web/gnupg-select-keys-on-update.t
index df115cd..e28f766 100644
--- a/t/web/gnupg-select-keys-on-update.t
+++ b/t/web/gnupg-select-keys-on-update.t
@@ -69,7 +69,7 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( sign => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -97,7 +97,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -111,7 +111,7 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
 
     my @mail = RT::Test->fetch_caught_mails;
@@ -134,7 +134,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -148,7 +148,7 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 1, 'one option';
 
@@ -182,7 +182,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -196,7 +196,7 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -228,7 +228,7 @@ diag "check that we see key selector even if only one key is trusted but there a
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -242,7 +242,7 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -256,7 +256,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -270,7 +270,7 @@ diag "check that key selector works and we can select trusted key" if $ENV{TEST_
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
@@ -289,7 +289,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
-    $m->form_number(3);
+    $m->form_name('ticket_update');
     $m->tick( encrypt => 1 );
     $m->field( update_cc => 'rt-test at example.com' );
     $m->field( update_content => 'Some content' );
@@ -304,7 +304,7 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_number(3);
+    my $form = $m->form_name('ticket_update');
     ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
     is scalar $input->possible_values, 2, 'two options';
 
diff --git a/t/web/query_builder.t b/t/web/query_builder.t
index 38ff64d..24f46de 100644
--- a/t/web/query_builder.t
+++ b/t/web/query_builder.t
@@ -146,7 +146,7 @@ diag "click advanced, enter 'C1 OR ( C2 AND C3 )', apply, aggregators should sta
 {
     my $response = $agent->get($url."/Search/Edit.html");
     ok( $response->is_success, "Fetched /Search/Edit.html" );
-    ok($agent->form_number(3), "found the form");
+    ok($agent->form_name('query_edit'), "found the form");
     $agent->field("query", "Status = 'new' OR ( Status = 'open' AND subject LIKE 'office' )");
     $agent->submit;
     is( get_query_from_form,
@@ -234,7 +234,7 @@ diag "input a condition, select (several conditions), click delete"
 {
     my $response = $agent->get( $url."/Search/Edit.html" );
     ok $response->is_success, "Fetched /Search/Edit.html";
-    ok $agent->form_number(3), "found the form";
+    ok $agent->form_name('query_edit'), "found the form";
     $agent->field("query", "( Status = 'new' OR Status = 'open' )");
     $agent->submit;
     is( get_query_from_form,
diff --git a/t/web/rights.t b/t/web/rights.t
index 2645c08..cf6a256 100644
--- a/t/web/rights.t
+++ b/t/web/rights.t
@@ -16,7 +16,7 @@ sub get_rights {
     my $agent = shift;
     my $principal_id = shift;
     my $object = shift;
-    $agent->form_number(3);
+    $agent->form_name('group_rights_modify');
     my @inputs = $agent->current_form->find_input("revoke_right-$principal_id-$object");
     my @Rights = sort grep $_, map $_->possible_values, grep $_, @inputs;
     return @Rights;
@@ -33,7 +33,7 @@ my ($everyone, $everyone_gid);
 diag "revoke all global rights from Everyone group" if $ENV{'TEST_VERBOSE'};
 my @has = get_rights( $m, $everyone_gid, 'RT::System-1' );
 if ( @has ) {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->tick("revoke_right-$everyone_gid-RT::System-1", $_) foreach @has;
     $m->submit;
     
@@ -44,7 +44,7 @@ if ( @has ) {
 
 diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->select("grant_right-$everyone_gid-RT::System-1", ['SuperUser']);
     $m->submit;
 
@@ -56,7 +56,7 @@ diag "grant SuperUser right to everyone" if $ENV{'TEST_VERBOSE'};
 
 diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->tick("revoke_right-$everyone_gid-RT::System-1", 'SuperUser');
     $m->submit;
 
@@ -69,7 +69,7 @@ diag "revoke the right" if $ENV{'TEST_VERBOSE'};
 
 diag "return rights the group had in the beginning" if $ENV{'TEST_VERBOSE'};
 if ( @has ) {
-    $m->form_number(3);
+    $m->form_name('group_rights_modify');
     $m->select("grant_right-$everyone_gid-RT::System-1", \@has);
     $m->submit;
 
diff --git a/t/web/ticket_owner.t b/t/web/ticket_owner.t
index eeceb3b..2a23ed0 100644
--- a/t/web/ticket_owner.t
+++ b/t/web/ticket_owner.t
@@ -102,7 +102,7 @@ diag "user A can not change owner after create" if $ENV{TEST_VERBOSE};
         $agent->goto_ticket( $id );
         diag("Going to ticket $id") if $ENV{TEST_VERBOSE};
         $agent->follow_link_ok(text => 'Basics');
-        my $form = $agent->form_number(3);
+        my $form = $agent->form_name('ticket_modify');
         is $agent->action_field_value(
             $agent->moniker_for('RT::Action::UpdateTicket'), 'owner'
           ),
@@ -142,7 +142,7 @@ diag "on reply correct owner is selected" if $ENV{TEST_VERBOSE};
     $agent_a->goto_ticket( $id );
     $agent_a->follow_link_ok(text => 'Reply');
 
-    my $form = $agent_a->form_number(3);
+    my $form = $agent_a->form_name('ticket_update');
     is $form->value('owner'), '', 'empty value selected';
     $agent_a->submit;
 

commit 86635dd7090712fa33eceb9a462e909faed971a8
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 22:25:27 2009 -0500

    Give a better error when the gpg homedir doesn't exist

diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index d177d04..932e702 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -147,11 +147,22 @@ sub validate_gnupg {
         if ( $value->{enable} ) {
             my $gpgopts = $self->argument_value('gnupg_options')
               || RT->config->get('gnupg_options') || {};
-            unless ( -d $gpgopts->{homedir} && -r _ ) {    # no homedir, no gpg
+
+            # no homedir, no gpg
+            my $homedir = $gpgopts->{homedir};
+            unless ( -d $homedir ) {
+                return $self->validation_error(
+                    gnupg => _(
+"your configured GnuPG home directory does not exist: '%1'",
+                        $homedir
+                      )
+                );
+            }
+            unless ( -r $homedir ) {
                 return $self->validation_error(
                     gnupg => _(
-"couldn't successfully read your configured GnuPG home directory: '%1'",
-                        $gpgopts->{homedir}
+"couldn't read your configured GnuPG home directory: '%1'",
+                        $homedir
                       )
                 );
             }

commit 202d051d14c304ea1510353412522079c2ea5453
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 22:27:47 2009 -0500

    Use action_field_input since it handles J:A:F-style names

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index e5d1c66..b5a53e8 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -74,16 +74,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
     foreach my $variant ( @variants ) {
         set_queue_crypt_options( %$variant );
         $m->goto_create_ticket( $queue );
-        my $form = $m->action_form('create_ticket');
+        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
+        my $sign    = $m->action_field_input('create_ticket', 'sign');
         if ( $variant->{'encrypt'} ) {
-            ok $form->value('encrypt'), "encrypt tick box is checked";
+            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$form->value('encrypt'), "encrypt tick box is unchecked";
+            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $form->value('sign'), "sign tick box is checked";
+            ok $sign->value('sign'), "sign tick box is checked";
         } else {
-            ok !$form->value('sign'), "sign tick box is unchecked";
+            ok !$sign->value('sign'), "sign tick box is unchecked";
         }
     }
 
@@ -102,16 +103,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
         set_queue_crypt_options( %$variant );
         $m->goto_ticket( $id );
         $m->follow_link_ok({text => 'Reply'}, '-> reply');
-        my $form = $m->action_form('create_ticket');
+        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
+        my $sign    = $m->action_field_input('create_ticket', 'sign');
         if ( $variant->{'encrypt'} ) {
-            ok $form->value('encrypt'), "encrypt tick box is checked";
+            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
         } else {
-            ok !$form->value('encrypt'), "encrypt tick box is unchecked";
+            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
         }
         if ( $variant->{'sign'} ) {
-            ok $form->value('sign'), "sign tick box is checked";
+            ok $sign->value('sign'), "sign tick box is checked";
         } else {
-            ok !$form->value('sign'), "sign tick box is unchecked";
+            ok !$sign->value('sign'), "sign tick box is unchecked";
         }
     }
 }

commit 6e05b1a89eeea20468a2f5a054aeca8cd5975882
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Mon Nov 23 22:31:00 2009 -0500

    Clearer error messages
    
        This was kind of special, I was getting the error:
            your configured GnuPG home directory does not exist:
            ''/home/sartak/.gnupg''
        but those double single-quotes looked like single double-quotes, so
        I didn't notice the problem - that it was checking the existence of
        the path '/home/sartak/.gnupg' quotes included. There's an error in
        config parsing too, apparently!

diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index 932e702..bcf84f3 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -153,7 +153,7 @@ sub validate_gnupg {
             unless ( -d $homedir ) {
                 return $self->validation_error(
                     gnupg => _(
-"your configured GnuPG home directory does not exist: '%1'",
+'your configured GnuPG home directory does not exist: "%1"',
                         $homedir
                       )
                 );
@@ -161,7 +161,7 @@ sub validate_gnupg {
             unless ( -r $homedir ) {
                 return $self->validation_error(
                     gnupg => _(
-"couldn't read your configured GnuPG home directory: '%1'",
+'could not read your configured GnuPG home directory: "%1"',
                         $homedir
                       )
                 );

commit 22bff0c31daf78bd707ffa72db17c9f9913ec2e1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 01:19:58 2009 -0500

    key is named default_value not default
    
        Grrr...

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 5cf4c92..7d9253a 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -183,13 +183,13 @@ sub setup_gnupg {
     return unless RT->config->get('gnupg')->{enable};
 
     $self->fill_parameter(sign => (
-        render_as => 'checkbox',
-        default   => $queue->sign,
+        render_as     => 'checkbox',
+        default_value => $queue->sign,
     ));
 
     $self->fill_parameter(encrypt => (
-        render_as => 'checkbox',
-        default   => $queue->encrypt,
+        render_as     => 'checkbox',
+        default_value => $queue->encrypt,
     ));
 }
 

commit 2d1f0bb97c919276dc752219a0ce825bdf731d5f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 01:23:48 2009 -0500

    Update form isn't jiftyized yet

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index b5a53e8..20af62d 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -103,18 +103,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
         set_queue_crypt_options( %$variant );
         $m->goto_ticket( $id );
         $m->follow_link_ok({text => 'Reply'}, '-> reply');
-        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
-        my $sign    = $m->action_field_input('create_ticket', 'sign');
-        if ( $variant->{'encrypt'} ) {
-            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
-        } else {
-            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
-        }
-        if ( $variant->{'sign'} ) {
-            ok $sign->value('sign'), "sign tick box is checked";
-        } else {
-            ok !$sign->value('sign'), "sign tick box is unchecked";
-        }
+        $m->form_number(3);
+         if ( $variant->{'encrypt'} ) {
+            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+         } else {
+            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+         }
+         if ( $variant->{'sign'} ) {
+            ok $m->value('sign', 2), "sign tick box is checked";
+         } else {
+            ok !$m->value('sign', 2), "sign tick box is unchecked";
+         }
     }
 }
 

commit 2e4c772eb31a2ccbf4827aa75aad457d4399cfa4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 01:42:25 2009 -0500

    Form name fix

diff --git a/t/mail/gnupg-bad.t b/t/mail/gnupg-bad.t
index 1f2b537..3125e81 100644
--- a/t/mail/gnupg-bad.t
+++ b/t/mail/gnupg-bad.t
@@ -42,7 +42,7 @@ $m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_name => 'ticket_create',
+$m->submit_form( form_name => 'queue_modify',
          fields      => { correspond_address => 'rt at example.com' } );
 $m->content_like(qr/rt\@example.com.* - never/, 'has key info.');
 ok(my $user = RT::Model::User->new(current_user => RT->system_user));

commit d8e7cc4a2f30d018a1e3dd5c24c25b81ed6049b9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 01:42:45 2009 -0500

    tick/untick doesn't work on fields, gotta use ->value

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 20af62d..8dc10c1 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -265,13 +265,13 @@ sub create_a_ticket {
         requestors => 'rt-test at example.com',
         content    => 'Some content',
     ));
-    my $form = $m->action_form('create_ticket');
 
     foreach ( qw(sign encrypt) ) {
+        my $field = $m->action_field_input('create_ticket', $_);
         if ( $args{ $_ } ) {
-            $form->tick( $_ => 1 );
+            $field->value(1);
         } else {
-            $form->untick( $_ => 1 );
+            $field->value(0);
         }
     }
 

commit 784e4c0a54fb8893e2958fcc694ec276aa1ad2b1
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 01:54:09 2009 -0500

    jiftyify crypt-gnupg.t

diff --git a/t/web/crypt-gnupg.t b/t/web/crypt-gnupg.t
index 3f8af4a..6d1db3a 100644
--- a/t/web/crypt-gnupg.t
+++ b/t/web/crypt-gnupg.t
@@ -88,12 +88,16 @@ $m->submit;
 RT::Test->clean_caught_mails;
 
 $m->goto_create_ticket( $queue );
-$m->form_name('ticket_create');
+$m->fill_in_action_ok(create_ticket => (
+    subject => 'Encryption test',
+    content => 'Some content',
+));
 
-$m->field('subject', 'Encryption test');
-$m->field('content', 'Some content');
-ok($m->value('encrypt', 2), "encrypt tick box is checked");
-ok(!$m->value('sign', 2), "sign tick box is unchecked");
+my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
+my $sign    = $m->action_field_input('create_ticket', 'sign');
+
+ok($encrypt->value, "encrypt tick box is checked");
+ok(!$sign->value, "sign tick box is unchecked");
 $m->submit;
 is($m->status, 200, "request successful");
 
@@ -157,11 +161,15 @@ $m->submit;
 RT::Test->clean_caught_mails;
 
 $m->goto_create_ticket( $queue );
-$m->form_name('ticket_create');
-$m->field('subject', 'Signing test');
-$m->field('content', 'Some other content');
-ok(!$m->value('encrypt', 2), "encrypt tick box is unchecked");
-ok($m->value('sign', 2), "sign tick box is checked");
+$m->fill_in_action_ok(create_ticket => (
+    subject => 'Signing test',
+    content => 'Some other content',
+));
+
+$encrypt = $m->action_field_input('create_ticket', 'encrypt');
+$sign    = $m->action_field_input('create_ticket', 'sign');
+ok(!$encrypt->value, "encrypt tick box is unchecked");
+ok($sign->value, "sign tick box is checked");
 $m->submit;
 is($m->status, 200, "request successful");
 
@@ -230,11 +238,15 @@ RT::Test->clean_caught_mails;
 
 $user->set_email('recipient at example.com');
 $m->goto_create_ticket( $queue );
-$m->form_name('ticket_create');
-$m->field('subject', 'Crypt+Sign test');
-$m->field('content', 'Some final? content');
-ok($m->value('encrypt', 2), "encrypt tick box is checked");
-ok($m->value('sign', 2), "sign tick box is checked");
+$m->fill_in_action_ok(create_ticket => (
+    subject => 'Crypt+Sign test',
+    content => 'Some final? content',
+));
+
+$encrypt = $m->action_field_input('create_ticket', 'encrypt');
+$sign    = $m->action_field_input('create_ticket', 'sign');
+ok($encrypt->value, "encrypt tick box is checked");
+ok($sign->value, "sign tick box is checked");
 $m->submit;
 is($m->status, 200, "request successful");
 $m->get($baseurl); # ensure that the mail has been processed
@@ -296,12 +308,16 @@ MAIL
 RT::Test->fetch_caught_mails;
 
 $m->goto_create_ticket( $queue );
-$m->form_name('ticket_create');
-$m->field('subject', 'Test crypt-off on encrypted queue');
-$m->field('content', 'Thought you had me figured out didya');
-$m->field(encrypt => undef, 2); # turn off encryption
-ok(!$m->value('encrypt', 2), "encrypt tick box is now unchecked");
-ok($m->value('sign', 2), "sign tick box is still checked");
+$m->fill_in_action_ok(create_ticket => (
+    subject => 'Test crypt-off on encrypted queue',
+    content => 'Thought you had me figured out didya',
+    encrypt => undef, # turn off encryption
+));
+
+$encrypt = $m->action_field_input('create_ticket', 'encrypt');
+$sign    = $m->action_field_input('create_ticket', 'sign');
+ok(!$encrypt->value, "encrypt tick box is now unchecked");
+ok($sign->value, "sign tick box is still checked");
 $m->submit;
 is($m->status, 200, "request successful");
 

commit 31213e386712d60727683f0d21db43b81c159c98
Merge: 784e4c0 69657b3
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 15:41:00 2009 +0800

    merge emnu-take4

diff --cc t/web/gnupg-outgoing.t
index 8dc10c1,b5a53e8..1ea2d7d
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@@ -265,13 -266,13 +266,14 @@@ sub create_a_ticket 
          requestors => 'rt-test at example.com',
          content    => 'Some content',
      ));
+     my $form = $m->action_form('create_ticket');
  
      foreach ( qw(sign encrypt) ) {
 +        my $field = $m->action_field_input('create_ticket', $_);
          if ( $args{ $_ } ) {
-             $field->value(1);
+             $form->tick( $_ => 1 );
          } else {
-             $field->value(0);
+             $form->untick( $_ => 1 );
          }
      }
  

commit 6add9fca33b9da76111bfff78a640037e86254d5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 16:09:58 2009 +0800

    seems lost one fix

diff --git a/t/mail/gnupg-bad.t b/t/mail/gnupg-bad.t
index 1f2b537..4777341 100644
--- a/t/mail/gnupg-bad.t
+++ b/t/mail/gnupg-bad.t
@@ -41,8 +41,8 @@ my ($baseurl, $m) = RT::Test->started_ok;
 $m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
-$m->follow_link_ok( {text => 'General'} );
-$m->submit_form( form_name => 'ticket_create',
+$m->follow_link_ok( text => 'General', url_regex => qr!/Admin/Queues! );
+$m->submit_form( form_name => 'queue_modify',
          fields      => { correspond_address => 'rt at example.com' } );
 $m->content_like(qr/rt\@example.com.* - never/, 'has key info.');
 ok(my $user = RT::Model::User->new(current_user => RT->system_user));

commit 32bd0cb6479a4ca3962c53ec6f81d9203d49cfd9
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 16:16:32 2009 +0800

    rescue d8e7cc4a2f: it has been overritten by accident

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 1ea2d7d..7f20488 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -266,14 +266,13 @@ sub create_a_ticket {
         requestors => 'rt-test at example.com',
         content    => 'Some content',
     ));
-    my $form = $m->action_form('create_ticket');
 
     foreach ( qw(sign encrypt) ) {
         my $field = $m->action_field_input('create_ticket', $_);
         if ( $args{ $_ } ) {
-            $form->tick( $_ => 1 );
+            $field->value(1); 
         } else {
-            $form->untick( $_ => 1 );
+            $field->value(0);
         }
     }
 

commit 7af738f89515868eb7f555dd3d97cd8c78795239
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Nov 24 16:23:00 2009 +0800

    rescue 2d1f0bb

diff --git a/t/web/gnupg-outgoing.t b/t/web/gnupg-outgoing.t
index 7f20488..e4f1750 100644
--- a/t/web/gnupg-outgoing.t
+++ b/t/web/gnupg-outgoing.t
@@ -103,18 +103,17 @@ diag "check in read-only mode that queue's props influence create/update ticket
         set_queue_crypt_options( %$variant );
         $m->goto_ticket( $id );
         $m->follow_link_ok({text => 'Reply'}, '-> reply');
-        my $encrypt = $m->action_field_input('create_ticket', 'encrypt');
-        my $sign    = $m->action_field_input('create_ticket', 'sign');
-        if ( $variant->{'encrypt'} ) {
-            ok $encrypt->value('encrypt'), "encrypt tick box is checked";
-        } else {
-            ok !$encrypt->value('encrypt'), "encrypt tick box is unchecked";
-        }
-        if ( $variant->{'sign'} ) {
-            ok $sign->value('sign'), "sign tick box is checked";
-        } else {
-            ok !$sign->value('sign'), "sign tick box is unchecked";
-        }
+        $m->form_name('ticket_update');
+         if ( $variant->{'encrypt'} ) {
+            ok $m->value('encrypt', 2), "encrypt tick box is checked";
+         } else {
+            ok !$m->value('encrypt', 2), "encrypt tick box is unchecked";
+         }
+         if ( $variant->{'sign'} ) {
+            ok $m->value('sign', 2), "sign tick box is checked";
+         } else {
+            ok !$m->value('sign', 2), "sign tick box is unchecked";
+         }
     }
 }
 

commit a0c5441e54e132b05d111faa023ff65ba632cc86
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 24 20:00:13 2009 -0500

    jiftyify select-keys-on-create

diff --git a/t/web/gnupg-select-keys-on-create.t b/t/web/gnupg-select-keys-on-create.t
index 57af1b6..6e60de7 100644
--- a/t/web/gnupg-select-keys-on-create.t
+++ b/t/web/gnupg-select-keys-on-create.t
@@ -57,10 +57,11 @@ diag "check that signing doesn't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( sign => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        sign       => 1,
+        requestors => 'rt-test at example.com',
+        content    => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/unable to sign outgoing email messages/i,
@@ -83,10 +84,11 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -97,8 +99,12 @@ diag "check that things don't work if there is no key" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok !$form->find_input( 'UseKey-rt-test at example.com' ), 'no key selector';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
@@ -118,10 +124,11 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -132,9 +139,13 @@ diag "check that things still doesn't work if key is not trusted" if $ENV{TEST_V
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 1, 'one option';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 1, 'one option';
+    }
+    else {
+        fail("could not find create_ticket form");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -165,10 +176,11 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -179,9 +191,13 @@ diag "check that things still doesn't work if two keys are not trusted" if $ENV{
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -211,10 +227,11 @@ diag "check that we see key selector even if only one key is trusted but there a
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -225,9 +242,13 @@ diag "check that we see key selector even if only one key is trusted but there a
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     my @mail = RT::Test->fetch_caught_mails;
     ok !@mail, 'there are no outgoing emails';
@@ -239,10 +260,11 @@ diag "check that key selector works and we can select trusted key"
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -253,9 +275,13 @@ diag "check that key selector works and we can select trusted key"
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;
@@ -271,11 +297,12 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
     RT::Test->clean_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
-    $m->form_name('ticket_create');
-    $m->tick( encrypt => 1 );
-    $m->field( requestors => 'rt-test at example.com' );
-    $m->field( content => 'Some content' );
-    $m->field( attach => $0 );
+    $m->fill_in_action_ok(create_ticket => (
+        encrypt => 1,
+        requestors => 'rt-test at example.com',
+        content => 'Some content',
+        attach => $0,
+    ));
     $m->submit;
     $m->content_like(
         qr/You are going to encrypt outgoing email messages/i,
@@ -286,9 +313,13 @@ diag "check encrypting of attachments" if $ENV{TEST_VERBOSE};
         'problems with keys'
     );
 
-    my $form = $m->form_name('ticket_create');
-    ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
-    is scalar $input->possible_values, 2, 'two options';
+    if (my $form = $m->form_name('create_ticket')) {
+        ok my $input = $form->find_input( 'UseKey-rt-test at example.com' ), 'found key selector';
+        is scalar $input->possible_values, 2, 'two options';
+    }
+    else {
+        fail("there should have been a validation error");
+    }
 
     $m->select( 'UseKey-rt-test at example.com' => $fpr1 );
     $m->submit;

commit b64585d696c6cb23491a76f13017520823f9697b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 25 09:14:58 2009 +0800

    use eval in ConfigSystem action

diff --git a/etc/initialdata b/etc/initialdata
index e695133..32f852a 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -667,12 +667,12 @@ Hour:         { $subscription_obj->sub_value('Hour') }
     'drop_long_attachments'        => undef,
     'email_input_encodings'        => [ 'utf-8', 'iso-8859-1', 'us-ascii' ],
     'email_output_encoding'        => 'utf-8',
-    'email_subject_tag_regex'      => '{{rtname}}',
+    'email_subject_tag_regex'      => 'example.com',
     'enable_reminders'             => 1,
     'extract_subject_tag_match'    => '\[.+? #\d+\]',
     'forward_from_user'            => 0,
     'friendly_from_line_format'    => '"%s via RT" <%s>',
-    'friendly_to_line_format'      => '"%s of {{rtname}} Ticket #%s":;',
+    'friendly_to_line_format'      => '"%s of example.com Ticket #%s":;',
     'full_text_search' => {
         enable  => 0,
         indexed => 0,
diff --git a/lib/RT/Action/ConfigSystem.pm b/lib/RT/Action/ConfigSystem.pm
index bcf84f3..f5dbce7 100644
--- a/lib/RT/Action/ConfigSystem.pm
+++ b/lib/RT/Action/ConfigSystem.pm
@@ -5,6 +5,7 @@ package RT::Action::ConfigSystem;
 use base qw/RT::Action Jifty::Action/;
 use Scalar::Defer; 
 use Try::Tiny;
+use Data::Dumper;
 
 sub arguments {
     my $self = shift;
@@ -14,26 +15,13 @@ sub arguments {
     my $configs = RT::Model::ConfigCollection->new;
     $configs->unlimit;
     while ( my $config = $configs->next ) {
+        my $value = RT->config->get( $config->name );
         $args->{ $config->name } = {
             default_value => defer {
-                my $value = $config->value;
-                $value = ''
-                  if defined $value && $value eq $config->_empty_string;
-                if ( ref $value eq 'ARRAY' ) {
-                    return '[' . join( ', ', @$value ) . ']';
-                }
-                elsif ( ref $value eq 'HASH' ) {
-                    my $str = '{';
-                    for my $key ( keys %$value ) {
-                        $str .= qq{$key => $value->{$key},};
-                    }
-                    $str .= '}';
-                    return $str;
-                }
-                else {
-                    return $value;
-                }
-            }
+                local $Data::Dumper::Terse = 1;
+                Dumper $value,
+            },
+            ref $value ? ( render_as => 'textarea' ) : (),
         };
     }
     return $self->{__cached_arguments} = $args;
@@ -102,27 +90,16 @@ sub _canonicalize_arguments {
     for my $arg ( $self->argument_names ) {
         if ( $self->has_argument($arg) ) {
             my $value = $self->argument_value( $arg );
-            if ( $value && $value !~ /^{{\w+}}/ ) {
-                if ( $value =~ /^\[ \s* (.*?) \s* \]\s*$/x ) {
-                    my $v = $1;
-                    if ( $v =~ /\S/ ) {
-                        $value = [ split /\s*,\s*/, $v ];
-                    }
-                    else {
-                        $value = [];
-                    }
-                }
-                elsif ( $value =~ /^{ \s* (.*?) \s* } \s* $/x ) {
-                    my $pair = $1;
-                    if ( $pair =~ /\S/ ) {
-                        $value = { split /\s*(?:,|=>)\s*/, $pair };
-                    }
-                    else {
-                        $value = {};
-                    }
-                }
-                $self->argument_value( $arg, $value );
+            next unless defined $value;
+            my $eval = eval $value;
+            if ( $@ ) {
+                return $self->validation_error(
+                    $arg => _( "invalid value: %1", $value ) );
+            }
+            else {
+                $value = $eval;
             }
+            $self->argument_value( $arg, $value );
         }
     }
     return 1;
diff --git a/lib/RT/Config.pod b/lib/RT/Config.pod
index 6d5721e..c913f92 100644
--- a/lib/RT/Config.pod
+++ b/lib/RT/Config.pod
@@ -35,7 +35,7 @@ C<qr/(example.com|example.org)/i>
 This setting would make RT behave exactly as it does without the 
 setting enabled.
 
-default: C<'{{rtname}}' >
+default: C<"example.com">
 
 =item C<organization>
 
@@ -375,7 +375,7 @@ default: C<0>
 C<sprintf()> format of the friendly 'From:' header; its arguments
 are WatcherType and TicketId.
 
-default: C<"\"%s of {{rtname}} Ticket #%s\":;">
+default: C<"\"%s of example.com Ticket #%s\":;">
 
 =item C<notify_actor>
 
diff --git a/lib/RT/Model/Config.pm b/lib/RT/Model/Config.pm
index 281c577..97b0c12 100644
--- a/lib/RT/Model/Config.pm
+++ b/lib/RT/Model/Config.pm
@@ -100,14 +100,7 @@ sub get {
         }
     }
 
-    my $value = $self->_get( $name );
-    if ( defined $value ) {
-        $value =~ s/{{(\w+)}}/$self->get($1) || ''/ge if $value && !ref $value;
-        return $value;
-    }
-    else {
-        return;
-    }
+    return $self->_get( $name );
 }
 
 sub set {

commit d31dde1ada7f50b0354668c56eb81352e80c266b
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Nov 25 16:55:47 2009 +0800

    hack /admin/queues/ view

diff --git a/lib/RT/View/Admin/Queues.pm b/lib/RT/View/Admin/Queues.pm
index be7b6a4..6c904a1 100644
--- a/lib/RT/View/Admin/Queues.pm
+++ b/lib/RT/View/Admin/Queues.pm
@@ -50,11 +50,78 @@ use strict;
 
 package RT::View::Admin::Queues;
 use Jifty::View::Declare -base;
-use base 'RT::View::CRUD';
+#use base 'RT::View::CRUD';
 
-use constant page_title      => 'Queue Management';
-use constant object_type     => 'Queue';
-use constant display_columns => qw(id name description correspond_address initial_priority default_due_in);
+#use constant page_title      => 'Queue Management';
+#use constant object_type     => 'Queue';
+#use constant display_columns => qw(id name description correspond_address
+#        comment_address initial_priority default_due_in);
+
+template 'index.html' =>
+page { title => _('Queues') }
+content {
+  my $include_disable = get( 'find_disabled_queues' );
+  if ( $include_disable ) {
+    h1 { _('All Queues') };
+  }
+  else {
+    h1 { _('Enabled Queues') };
+  }
+
+  my $queues = RT::Model::QueueCollection->new;
+  $queues->find_all_rows;
+  if ( $include_disable ) {
+      $queues->{'find_disabled_rows'} = 1;
+  }
+
+  p { _("Select a queue") };
+  unless ( $queues->count ) {
+    em { _('No queues matching search criteria found.') };
+  } else {
+    my @fields = ( '#', qw/name description address priority default_due_in/ );
+    push @fields, 'disabled' if $include_disable;
+    table {
+        thead { row { 
+            for my $head ( @fields ) {
+                cell { { class is 'labeltop' }; $head };
+            }
+        } };
+        tbody { 
+          while ( my $queue = $queues->next ) {
+            row { 
+                for my $field ( @fields ) {
+                    cell { { class is 'value' };
+                        if ( $field eq '#' ) {
+                            $queue->id
+                        }
+                        elsif ( $field eq 'disabled' ) {
+                            $queue->disabled ? 'disabled' : 'enabled'
+                        }
+                        elsif ( $field eq 'address' ) {
+                            ( $queue->correspond_address ||'-'). '/' .
+                                ($queue->comment_address || '-')
+                        }
+                        elsif ( $field eq 'priority' ) {
+                            ( $queue->initial_priority || 0 ). '/' .
+                                ( $queue->final_priority || 0 )
+                        }
+                        else {
+                            $queue->$field
+                        } 
+                    };
+                }
+            };
+          }
+        }
+    };
+    }
+
+    hyperlink(
+        label       => _('Include disabled queues in listing.'),
+        url         => '/admin/queues',
+        parameters => { find_disabled_queues => 1 },
+    );
+};
 
 
 1;

commit bc05fcc190152f08d62c9989252f370da926aea4
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:15:51 2009 -0500

    Add a parameter for sign_using if the user has a key

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 7d9253a..8e432aa 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -187,6 +187,15 @@ sub setup_gnupg {
         default_value => $queue->sign,
     ));
 
+    if (my $user_key = $self->current_user->user_object->private_key) {
+        $self->fill_parameter(sign_using => (
+            valid_values => [
+                { name => '', display => _("Queue's key") },
+                "$user_key",
+            ],
+        ));
+    }
+
     $self->fill_parameter(encrypt => (
         render_as     => 'checkbox',
         default_value => $queue->encrypt,

commit 60b14da35d94b431fde8f9791f13e50d881fc528
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:27:00 2009 -0500

    select_key_for_encryption though there's a lot more that needs to be ported

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 8e432aa..a5985fa 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -200,6 +200,38 @@ sub setup_gnupg {
         render_as     => 'checkbox',
         default_value => $queue->encrypt,
     ));
+
+}
+
+sub select_key_for_encryption {
+    my $self    = shift;
+    my $email   = shift;
+    my $default = shift;
+
+    require RT::Crypt::GnuPG;
+    my %res = RT::Crypt::GnuPG::get_keys_for_encryption($email);
+
+    # move the preferred key to the top of the list
+    my $d;
+    my @keys = map {
+                   $_->{'fingerprint'} eq ( $default || '' )
+                       ?  do { $d = $_; () }
+                       : $_
+               }
+               @{ $res{'info'} };
+
+    @keys = sort { $b->{'trust_level'} <=> $a->{'trust_level'} } @keys;
+
+    unshift @keys, $d if defined $d;
+
+    return map {
+        my $display = _("%1 (trust: %2)", $_->{fingerprint}, $_->{trust_terse});
+
+        {
+            value   => $_->{fingerprint},
+            display => $display,
+        }
+    } @keys;
 }
 
 sub set_initial_priority {

commit eb65bad7d117b06f20e65569cd5c8b1e258f6c93
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:33:59 2009 -0500

    basic sign_using validation

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index a5985fa..88a1c31 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -200,6 +200,26 @@ sub setup_gnupg {
         render_as     => 'checkbox',
         default_value => $queue->encrypt,
     ));
+}
+
+sub validate_sign_using {
+    my $self    = shift;
+    my $address = shift;
+
+    return if !$self->argument_value('sign');
+
+    # XXX: how should this fit into RT4?
+    #$address ||= ($self->{'update_type'} && $self->{'update_type'} eq "private")
+    #    ? ( $queue_obj->comment_address || RT->config->get('comment_address') )
+    #    : ( $queue_obj->correspond_address || RT->config->get('correspond_address') );
+
+    unless ( RT::Crypt::GnuPG::dry_sign($address) ) {
+        return $self->validation_error(sign_using => _("The system is unable to sign outgoing email messages. This usually indicates that the passphrase was mis-set, or that GPG Agent is down. Please alert your system administrator immediately. The problem address is: %1", $address));
+    } else {
+        # should this use argument_value('sign_using') or $address?
+        RT::Crypt::GnuPG::use_key_for_signing($self->argument_value('sign_using'))
+            if $self->argument_value('sign_using');
+    }
 
 }
 

commit 20f2f2a8f0673809389ebc55aa2a8c12a1afc953
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:41:06 2009 -0500

    Always have a sign_using parameter so it's always validated

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 88a1c31..ec0fe6c 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -195,6 +195,13 @@ sub setup_gnupg {
             ],
         ));
     }
+    else {
+        # always have sign_using so it can be validated
+        $self->fill_parameter(sign_using => (
+            default_value => '',
+            render_as => 'hidden',
+        ));
+    }
 
     $self->fill_parameter(encrypt => (
         render_as     => 'checkbox',

commit 0741ad2380da9f1e7b61eff77e79c5d8dc3ce876
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 06:44:28 2009 -0500

    Canonicalize empty address to the queue's correspond address

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index ec0fe6c..4a3e77f 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -209,17 +209,25 @@ sub setup_gnupg {
     ));
 }
 
+sub canonicalize_sign_using {
+    my $self = shift;
+    my $address = shift;
+
+    return $address if length $address;
+
+    my $queue_id = $self->argument_value('queue');
+    my $queue = RT::Model::Queue->new;
+    $queue->load($queue_id);
+
+    return $queue->correspond_address;
+}
+
 sub validate_sign_using {
     my $self    = shift;
     my $address = shift;
 
     return if !$self->argument_value('sign');
 
-    # XXX: how should this fit into RT4?
-    #$address ||= ($self->{'update_type'} && $self->{'update_type'} eq "private")
-    #    ? ( $queue_obj->comment_address || RT->config->get('comment_address') )
-    #    : ( $queue_obj->correspond_address || RT->config->get('correspond_address') );
-
     unless ( RT::Crypt::GnuPG::dry_sign($address) ) {
         return $self->validation_error(sign_using => _("The system is unable to sign outgoing email messages. This usually indicates that the passphrase was mis-set, or that GPG Agent is down. Please alert your system administrator immediately. The problem address is: %1", $address));
     } else {

commit 1929c2c3b0c88442a9431fbad1d93026b8665359
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Nov 25 07:19:58 2009 -0500

    Jifty hides validation errors from hidden fields, so attach the validation error to "sign"

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 4a3e77f..27ea5a2 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -228,14 +228,15 @@ sub validate_sign_using {
 
     return if !$self->argument_value('sign');
 
-    unless ( RT::Crypt::GnuPG::dry_sign($address) ) {
-        return $self->validation_error(sign_using => _("The system is unable to sign outgoing email messages. This usually indicates that the passphrase was mis-set, or that GPG Agent is down. Please alert your system administrator immediately. The problem address is: %1", $address));
-    } else {
-        # should this use argument_value('sign_using') or $address?
-        RT::Crypt::GnuPG::use_key_for_signing($self->argument_value('sign_using'))
-            if $self->argument_value('sign_using');
+    if (!RT::Crypt::GnuPG::dry_sign($address)) {
+        return $self->validation_error(sign=> _("The system is unable to sign outgoing email messages. This usually indicates that the passphrase was mis-set, or that GPG Agent is down. Please alert your system administrator immediately. The problem address is: %1", $address));
     }
 
+    # should this use argument_value('sign_using') or $address?
+    RT::Crypt::GnuPG::use_key_for_signing($self->argument_value('sign_using'))
+        if $self->argument_value('sign_using');
+
+    return $self->validation_ok('sign');
 }
 
 sub select_key_for_encryption {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list