[Rt-commit] rt branch, admin_ui, updated. 8653eb14277f2ac9f599c86580a7b48be00c4dd7

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Dec 21 01:16:40 EST 2009


The branch, admin_ui has been updated
       via  8653eb14277f2ac9f599c86580a7b48be00c4dd7 (commit)
      from  6ff23025bfe2b9a9050484fabef6a11fb4e88d05 (commit)

Summary of changes:
 lib/RT/Action/ShredderWipeoutObjects.pm |   56 ++++++++++++++++++++++++++++--
 1 files changed, 52 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 8653eb14277f2ac9f599c86580a7b48be00c4dd7
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Dec 21 14:16:22 2009 +0800

    make display values more specific for objects to be wiped out

diff --git a/lib/RT/Action/ShredderWipeoutObjects.pm b/lib/RT/Action/ShredderWipeoutObjects.pm
index 161929d..6b0b068 100644
--- a/lib/RT/Action/ShredderWipeoutObjects.pm
+++ b/lib/RT/Action/ShredderWipeoutObjects.pm
@@ -63,11 +63,59 @@ sub arguments {
         }
     }
 
-    # TODO need more spec to the display values
+
     $args->{'wipeout_objects'} = {
-        available_values => [
-            map { { display => $_->_as_string, value => $_->_as_string } } @objs
-        ],
+        available_values => defer {
+            my @values;
+            for my $object (@objs) {
+                my $display;
+                if ( ref $object eq 'RT::Model::Ticket' ) {
+                    $display =
+                        '<a href="'
+                      . Jifty->web->url
+                      . '/ticket/display.html?id='
+                      . $object->id . '">'
+                      . 'Ticket(id:'
+                      . $object->id
+                      . ', Subject: '
+                      . substr( $object->subject, 0, 30 )
+                      . '...)</a>';
+                }
+                elsif ( ref eq 'RT::Model::Attachment' ) {
+                    $display =
+                        '<a href="'
+                      . Jifty->web->url
+                      . '/ticket/attachment/'
+                      . $object->transaction_id . '/'
+                      . $object->id . '">'
+                      . 'Attachment(id:'
+                      . $object->id
+                      . ', Filename: '
+                      . $object->filename
+                      || '(no value)' . ')</a>';
+                }
+                elsif ( ref $object eq 'RT::Model::Ticket' ) {
+                    $display =
+                        '<a href="'
+                      . Jifty->web->url
+                      . '/admin/users/modify?id='
+                      . $object->id . '">'
+                      . 'User(id:'
+                      . $object->id
+                      . ', name: '
+                      . $object->name . ')</a>';
+                }
+                else {
+                    $display = $object->_as_string;
+                }
+                push @values,
+                  {
+                    display => $display,
+                    value   => $object->_as_string
+                  };
+            }
+            return \@values;
+        },
         render_as => 'Checkboxes',
         label => _('Check objects to be wiped out'),
     };

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


More information about the Rt-commit mailing list