[Rt-commit] rt branch, 4.0/reformat-code-for-loc_qw, created. rt-4.0.8-353-g8244a8e

? sunnavy sunnavy at bestpractical.com
Wed Jan 9 10:50:50 EST 2013


The branch, 4.0/reformat-code-for-loc_qw has been created
        at  8244a8ea6fad545ae4d748a88e0a069983876891 (commit)

- Log -----------------------------------------------------------------
commit c4f1a8121b14700ba1e720f33f1ecaa2231f17c5
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Jan 13 19:27:08 2012 -0500

    First stab at a ColumnMap for Transactions
    
    We may want to add the rest of the columns, but I suspect that
    Object* and Description are generally the most useful ones.

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
new file mode 100644
index 0000000..c0653d5
--- /dev/null
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -0,0 +1,127 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ARGS>
+$Name
+$Attr => undef
+</%ARGS>
+<%ONCE>
+my $COLUMN_MAP = {
+    id => {
+        title     => '#', # loc
+        attribute => 'id',
+        value     => sub { return $_[0]->id },
+    },
+    ObjectType => {
+        title     => 'ObjectType', # loc
+        attribute => 'ObjectType',
+        value     => sub { return $_[0]->ObjectType() },
+    },
+    ObjectId => {
+        title     => 'ObjectId', # loc
+        attribute => 'ObjectId',
+        value     => sub { return $_[0]->ObjectId() },
+    },
+    Type => {
+        title     => 'Type', # loc
+        attribute => 'Type',
+        value     => sub { return $_[0]->Type() },
+    },
+    Field => {
+        title     => 'Field', # loc
+        attribute => 'Field',
+        value     => sub { return $_[0]->Field() },
+    },
+    OldValue => {
+        title     => 'OldValue', # loc
+        attribute => 'OldValue',
+        value     => sub { return $_[0]->OldValue() },
+    },
+    NewValue => {
+        title     => 'NewValue', # loc
+        attribute => 'NewValue',
+        value     => sub { return $_[0]->NewValue() },
+    },
+    TimeTaken => {
+        title     => 'TimeTaken', # loc
+        attribute => 'TimeTaken',
+        value     => sub { return $_[0]->TimeTaken() },
+    },
+    Description => {
+        title     => 'Description', # loc
+        attribute => 'Description',
+        value     => sub { return $_[0]->Description() },
+    },
+    BriefDescription => {
+        title     => 'BriefDescription', # loc
+        attribute => 'BriefDescription',
+        value     => sub { return $_[0]->BriefDescription() },
+    },
+    ObjectName => {
+        title     => 'Name', # loc
+        attribute => 'ObjectName',
+        value     => sub { my $object = $_[0]->Object;
+            # this is awful, but can() doesn't work (AUTOLOAD), and we don't
+            # have any sort of standard Description field, since not everything
+            # has a Name.
+            if ( $_[0]->ObjectType eq 'RT::Ticket' ) {
+                return $object->Subject;
+            } elsif ( $object->_Accessible('Name','read') ) {
+                return $object->Name;
+            } else {
+                return loc('No Name');
+            }
+        },
+    },
+};
+
+
+</%ONCE>
+<%INIT>
+$m->callback( COLUMN_MAP => $COLUMN_MAP, CallbackName => 'ColumnMap', CallbackOnce => 1 );
+return GetColumnMapEntry( Map => $COLUMN_MAP, Name => $Name, Attribute => $Attr );
+</%INIT>

commit c79a7b91bb9d30528d04abdc31c6fb861d429077
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jan 18 14:38:00 2012 -0500

    attribute shouldn't be used on virtual/unsortable columns
    
    I also scrubbed the Title for Brief Description while I was in there.

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index c0653d5..2457973 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -93,17 +93,14 @@ my $COLUMN_MAP = {
     },
     Description => {
         title     => 'Description', # loc
-        attribute => 'Description',
         value     => sub { return $_[0]->Description() },
     },
     BriefDescription => {
-        title     => 'BriefDescription', # loc
-        attribute => 'BriefDescription',
+        title     => 'Brief Description', # loc
         value     => sub { return $_[0]->BriefDescription() },
     },
     ObjectName => {
         title     => 'Name', # loc
-        attribute => 'ObjectName',
         value     => sub { my $object = $_[0]->Object;
             # this is awful, but can() doesn't work (AUTOLOAD), and we don't
             # have any sort of standard Description field, since not everything

commit 0555ab72083b0e5f4921c28608d098360e92195f
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Jan 18 17:17:30 2012 -0500

    Add a TimeWorked column
    
    Calculates what work was done during this transaction by looking at
    TimeTaken and changes to the TimeWorked field.
    This is naive and will do the wrong thing if you move your TimeWorked
    backwards.

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index 2457973..d8c862d 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -114,6 +114,16 @@ my $COLUMN_MAP = {
             }
         },
     },
+    TimeWorked => {
+        title     => 'Time Worked', # loc
+        value     => sub {
+            return $_[0]->TimeTaken if $_[0]->TimeTaken;
+            if ( $_[0]->Field eq 'TimeWorked' ) {
+                return ( $_[0]->NewValue - $_[0]->OldValue );
+            }
+            return;
+        }
+    },
 };
 
 

commit 0297d57698c426ced13b20ef65367f62d6efe3c1
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Jan 27 09:09:45 2012 -0500

    Warnings avoidance

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index d8c862d..01492fe 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -118,7 +118,7 @@ my $COLUMN_MAP = {
         title     => 'Time Worked', # loc
         value     => sub {
             return $_[0]->TimeTaken if $_[0]->TimeTaken;
-            if ( $_[0]->Field eq 'TimeWorked' ) {
+            if ( $_[0]->Field && $_[0]->Field eq 'TimeWorked' ) {
                 return ( $_[0]->NewValue - $_[0]->OldValue );
             }
             return;

commit bfa7839a1640dae442bc68a21cd6923f8ac720e4
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Jan 27 16:03:50 2012 -0500

    some better default Titles

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index 01492fe..ec2e80e 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -57,12 +57,12 @@ my $COLUMN_MAP = {
         value     => sub { return $_[0]->id },
     },
     ObjectType => {
-        title     => 'ObjectType', # loc
+        title     => 'Object Type', # loc
         attribute => 'ObjectType',
         value     => sub { return $_[0]->ObjectType() },
     },
     ObjectId => {
-        title     => 'ObjectId', # loc
+        title     => 'Object Id', # loc
         attribute => 'ObjectId',
         value     => sub { return $_[0]->ObjectId() },
     },
@@ -77,17 +77,17 @@ my $COLUMN_MAP = {
         value     => sub { return $_[0]->Field() },
     },
     OldValue => {
-        title     => 'OldValue', # loc
+        title     => 'Old Value', # loc
         attribute => 'OldValue',
         value     => sub { return $_[0]->OldValue() },
     },
     NewValue => {
-        title     => 'NewValue', # loc
+        title     => 'New Value', # loc
         attribute => 'NewValue',
         value     => sub { return $_[0]->NewValue() },
     },
     TimeTaken => {
-        title     => 'TimeTaken', # loc
+        title     => 'Time Taken', # loc
         attribute => 'TimeTaken',
         value     => sub { return $_[0]->TimeTaken() },
     },

commit e7507e8c5ca311bd5f945f0747cbd06b05c8f85a
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Tue Jan 31 11:30:09 2012 -0500

    Allow the TimeWorked column to be sorted, but note the restrictions
    
    There are some tickets open to be more consistent about what
    transactions we record and when we update TimeTaken.  As we get better
    about that, this will work better also.  The only way to actually sort
    by this column is using a DB specific SQL function.

diff --git a/share/html/Elements/RT__Transaction/ColumnMap b/share/html/Elements/RT__Transaction/ColumnMap
index ec2e80e..495b8d6 100644
--- a/share/html/Elements/RT__Transaction/ColumnMap
+++ b/share/html/Elements/RT__Transaction/ColumnMap
@@ -116,6 +116,8 @@ my $COLUMN_MAP = {
     },
     TimeWorked => {
         title     => 'Time Worked', # loc
+        # this won't sort right all the time, because it doesn't handle the TimeWorked update, but it lets the virtual column be somewhat sortable.
+        attribute => 'TimeTaken',
         value     => sub {
             return $_[0]->TimeTaken if $_[0]->TimeTaken;
             if ( $_[0]->Field && $_[0]->Field eq 'TimeWorked' ) {

commit 8244a8ea6fad545ae4d748a88e0a069983876891
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jan 9 23:36:35 2013 +0800

    reformat code to make "loc_qw" parser happy

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index 08d6ac4..7519172 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -60,7 +60,10 @@ sub Groupings {
     my @fields =
       map { $self->CurrentUser->loc($_), $_ } qw( Status Queue );    # loc_qw
 
-    foreach my $type ( qw(Owner Creator LastUpdatedBy Requestor Cc AdminCc Watcher) ) { # loc_qw
+    foreach my $type (
+        qw(Owner Creator LastUpdatedBy Requestor Cc AdminCc Watcher)    # loc_qw
+      )
+    {
         for my $field (
             qw( Name EmailAddress RealName NickName Organization Lang City Country Timezone ) # loc_qw
           )
@@ -72,8 +75,14 @@ sub Groupings {
     }
 
 
-    for my $field (qw(Due Resolved Created LastUpdated Started Starts Told)) { # loc_qw
-        for my $frequency (qw(Hourly Daily Monthly Annually)) { # loc_qw
+    for my $field (
+        qw(Due Resolved Created LastUpdated Started Starts Told)    # loc_qw
+      )
+    {
+        for my $frequency (
+            qw(Hourly Daily Monthly Annually)                       # loc_qw
+          )
+        {
             push @fields,
               $self->CurrentUser->loc($field)
               . $self->CurrentUser->loc($frequency),

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


More information about the Rt-commit mailing list