[rt-commit] [svn] r560 - in rt/branches: . rt-3.3 rt-3.3/bin rt-3.3/etc rt-3.3/html rt-3.3/html/Admin/Users rt-3.3/html/Elements rt-3.3/html/NoAuth rt-3.3/html/REST/1.0/Forms/ticket rt-3.3/html/REST/1.0/ticket rt-3.3/html/Search rt-3.3/html/Search/Elements rt-3.3/html/Ticket rt-3.3/html/Ticket/Elements rt-3.3/lib/RT rt-3.3/lib/RT/Action rt-3.3/lib/RT/Condition rt-3.3/lib/RT/URI

autrijus at fsck.com autrijus at fsck.com
Fri Mar 12 21:44:07 EST 2004


Author: autrijus
Date: Fri Mar 12 21:44:05 2004
New Revision: 560

Added:
   rt/branches/rt-3.3/html/Ticket/Elements/FindAttachments
Modified:
   rt/branches/   (props changed)
   rt/branches/rt-3.3/README
   rt/branches/rt-3.3/bin/rt-mailgate.in
   rt/branches/rt-3.3/bin/rt.in
   rt/branches/rt-3.3/etc/RT_Config.pm.in
   rt/branches/rt-3.3/etc/schema.Oracle
   rt/branches/rt-3.3/html/Admin/Users/Modify.html
   rt/branches/rt-3.3/html/Elements/Footer
   rt/branches/rt-3.3/html/Elements/Header
   rt/branches/rt-3.3/html/Elements/Login
   rt/branches/rt-3.3/html/Elements/SelectQueue
   rt/branches/rt-3.3/html/Elements/TicketList
   rt/branches/rt-3.3/html/NoAuth/webrt.css
   rt/branches/rt-3.3/html/REST/1.0/Forms/ticket/attachments
   rt/branches/rt-3.3/html/REST/1.0/ticket/comment
   rt/branches/rt-3.3/html/Search/Build.html
   rt/branches/rt-3.3/html/Search/Elements/BuildFormatString
   rt/branches/rt-3.3/html/Search/Elements/PickBasics
   rt/branches/rt-3.3/html/Search/Elements/PickRestriction
   rt/branches/rt-3.3/html/Search/Results.html
   rt/branches/rt-3.3/html/Search/Results.rdf
   rt/branches/rt-3.3/html/Ticket/Display.html
   rt/branches/rt-3.3/html/Ticket/Elements/PreviewScrips
   rt/branches/rt-3.3/html/Ticket/Elements/ShowAttachments
   rt/branches/rt-3.3/html/Ticket/Elements/ShowHistory
   rt/branches/rt-3.3/html/Ticket/Elements/ShowSummary
   rt/branches/rt-3.3/html/Ticket/Elements/ShowTransaction
   rt/branches/rt-3.3/html/Ticket/Elements/Tabs
   rt/branches/rt-3.3/html/Ticket/History.html
   rt/branches/rt-3.3/html/autohandler
   rt/branches/rt-3.3/lib/RT/Action/Autoreply.pm
   rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm
   rt/branches/rt-3.3/lib/RT/Condition/OwnerChange.pm
   rt/branches/rt-3.3/lib/RT/Handle.pm
   rt/branches/rt-3.3/lib/RT/Link_Overlay.pm
   rt/branches/rt-3.3/lib/RT/Record.pm
   rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
   rt/branches/rt-3.3/lib/RT/URI/fsck_com_rt.pm
   rt/branches/rt-3.3/lib/RT/User_Overlay.pm
   rt/branches/rt-3.3/releng.cnf
Log:
* smerge rt-3.1 to rt-3.3.


Modified: rt/branches/rt-3.3/README
==============================================================================
--- rt/branches/rt-3.3/README	(original)
+++ rt/branches/rt-3.3/README	Fri Mar 12 21:44:05 2004
@@ -34,7 +34,7 @@
 
         Jesse Vincent
         Best Practical Solutions, LLC
-        March 2003
+        March 2004
 
 
 
@@ -51,9 +51,6 @@
 
     Perl versions prior to 5.8.3 contain bugs that could result in data
     corruption. We recommend strongly that you use 5.8.3 or newer.
-
-    Perl 5.6.1 is currently deprecated and will be officially desupported
-    in a future release
 
 o   A DB backend; MySQL is recommended ( http://www.mysql.com ) 
         Currently supported:  Mysql 4.0.13 or later. 

Modified: rt/branches/rt-3.3/bin/rt-mailgate.in
==============================================================================
--- rt/branches/rt-3.3/bin/rt-mailgate.in	(original)
+++ rt/branches/rt-3.3/bin/rt-mailgate.in	Fri Mar 12 21:44:05 2004
@@ -165,6 +165,8 @@
 $u->Load('doesnotexist-2 at example.com');
 ok( $u->Id == 0, " user does not exist and was not created by ticket correspondence submission");
 # }}}
+
+
 # {{{  can another random reply to a ticket after being granted privs? answer should be yes
 
 

Modified: rt/branches/rt-3.3/bin/rt.in
==============================================================================
--- rt/branches/rt-3.3/bin/rt.in	(original)
+++ rt/branches/rt-3.3/bin/rt.in	Fri Mar 12 21:44:05 2004
@@ -30,6 +30,7 @@
 
 use Cwd;
 use LWP;
+use Text::ParseWords;
 use HTTP::Request::Common;
 
 # We derive configuration information from hardwired defaults, dotfiles,
@@ -75,6 +76,7 @@
 my %handlers = (
 #   handler     => [ ...aliases... ],
     version     => ["version", "ver"],
+    shell       => ["shell"],
     logout      => ["logout"],
     help        => ["help", "man"],
     show        => ["show", "cat"],
@@ -86,18 +88,25 @@
     grant       => ["grant", "revoke"],
 );
 
-# Once we find and call an appropriate handler, we're done.
-
-my (%actions, $action);
+my %actions;
 foreach my $fn (keys %handlers) {
     foreach my $alias (@{ $handlers{$fn} }) {
         $actions{$alias} = \&{"$fn"};
     }
 }
-if (@ARGV && exists $actions{$ARGV[0]}) {
-    $action = shift @ARGV;
+
+# Once we find and call an appropriate handler, we're done.
+
+sub handler {
+    my $action;
+
+    if (@ARGV && exists $actions{$ARGV[0]}) {
+        $action = shift @ARGV;
+    }
+    $actions{$action || "help"}->($action || ());
 }
-$actions{$action || "help"}->($action || ());
+
+handler();
 exit;
 
 # Handler functions.
@@ -105,6 +114,20 @@
 #
 # The following subs are handlers for each entry in %actions.
 
+sub shell {
+    $|=1;
+    print "rt> ";
+    while (<>) {
+        chomp;
+        next if /^#/ || /^\s*$/;
+
+        @ARGV = shellwords($_);
+        handler();
+        print "rt> ";
+    }
+    print "\n";
+}
+
 sub version {
     print "rt $VERSION\n";
 }
@@ -113,18 +136,21 @@
     submit("$REST/logout") if defined $session->cookie;
 }
 
+my %help;
 sub help {
     my ($action, $type) = @_;
-    my (%help, $key);
+    my $key;
 
     # What help topics do we know about?
-    local $/ = undef;
-    foreach my $item (@{ Form::parse(<DATA>) }) {
-        my $title = $item->[2]{Title};
-        my @titles = ref $title eq 'ARRAY' ? @$title : $title;
+    if (!%help) {
+        local $/ = undef;
+        foreach my $item (@{ Form::parse(<DATA>) }) {
+            my $title = $item->[2]{Title};
+            my @titles = ref $title eq 'ARRAY' ? @$title : $title;
 
-        foreach $title (grep $_, @titles) {
-            $help{$title} = $item->[2]{Text};
+            foreach $title (@titles) {
+                $help{$title} = $item->[2]{Text};
+            }
         }
     }
 
@@ -166,7 +192,7 @@
 # Displays a list of objects that match some specified condition.
 
 sub list {
-    my ($q, $type, %data, $orderby);
+    my ($q, $type, %data);
     my $bad = 0;
 
     while (@ARGV) {
@@ -179,7 +205,7 @@
             $bad = 1, last unless get_var_argument(\%data);
         }
         elsif (/^-o$/) {
-            $orderby = shift @ARGV;
+            $data{orderby} = shift @ARGV;
         }
         elsif (/^-([isl])$/) {
             $data{format} = $1;
@@ -209,7 +235,7 @@
     }
     return help("list", $type) if $bad;
 
-    my $r = submit("$REST/search/$type", { query => $q, %data, orderby => $orderby || "" });
+    my $r = submit("$REST/search/$type", { query => $q, %data });
     print $r->content;
 }
 
@@ -451,7 +477,7 @@
 
     if ($output) {
         print $text;
-        exit;
+        return;
     }
 
     my $synerr = 0;
@@ -477,7 +503,7 @@
             }
             else {
                 print $r->content;
-                exit -1;
+                return;
             }
         }
         print $r->content;
@@ -506,7 +532,7 @@
             if (/-a/) {
                 unless (-f $ARGV[0] && -r $ARGV[0]) {
                     whine "Cannot read attachment: '$ARGV[0]'.";
-                    exit -1;
+                    return;
                 }
                 push @files, shift @ARGV;
             }
@@ -544,6 +570,7 @@
             Attachment => [ @files ],
             TimeWorked => $wtime || '',
             Text       => $msg || '',
+            Status => ''
         }
     ];
 
@@ -555,7 +582,7 @@
 
         do {
             my $ntext = vi($text);
-            exit if ($error && $ntext eq $text);
+            return if ($error && $ntext eq $text);
             $text = $ntext;
             $form = Form::parse($text);
             $error = 0;
@@ -567,7 +594,7 @@
                 goto NEXT;
             }
             elsif (!@$o) {
-                exit;
+                return;
             }
             @files = @{ vsplit($k->{Attachment}) };
 

Modified: rt/branches/rt-3.3/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/rt-3.3/etc/RT_Config.pm.in	(original)
+++ rt/branches/rt-3.3/etc/RT_Config.pm.in	Fri Mar 12 21:44:05 2004
@@ -138,6 +138,10 @@
 Set($CanonicalizeEmailAddressMatch   , 'subdomain.example.com$');
 Set($CanonicalizeEmailAddressReplace , 'example.com');
 
+# set this to true and the create new user page will use the values that you
+# enter in the form but use the function CanonicalizeUserInfo in User_Local.pm
+Set($CanonicalizeOnCreate , 0);
+
 # If $SenderMustExistInExternalDatabase is true, RT will refuse to
 # create non-privileged accounts for unknown users if you are using
 # the "LookupSenderInExternalDatabase" option.

Modified: rt/branches/rt-3.3/etc/schema.Oracle
==============================================================================
--- rt/branches/rt-3.3/etc/schema.Oracle	(original)
+++ rt/branches/rt-3.3/etc/schema.Oracle	Fri Mar 12 21:44:05 2004
@@ -348,7 +348,7 @@
 CREATE SEQUENCE ATTRIBUTES_seq;
 CREATE TABLE Attributes (
 	id 			NUMBER(11,0) PRIMARY KEY,
-	Name 			VARCHAR2(255) UNIQUE NOT NULL,
+	Name 			VARCHAR2(255) NOT NULL,
 	Description 		VARCHAR2(255),
   	Content 	CLOB,
     ContentType VARCHAR(16),
@@ -357,7 +357,7 @@
 	Creator 		NUMBER(11,0) DEFAULT 0 NOT NULL,
 	Created 		DATE,
 	LastUpdatedBy 		NUMBER(11,0) DEFAULT 0 NOT NULL,
-	LastUpdated		DATE,
+	LastUpdated		DATE
 );
 
 CREATE INDEX Attributes1 on Attributes(Name);

Modified: rt/branches/rt-3.3/html/Admin/Users/Modify.html
==============================================================================
--- rt/branches/rt-3.3/html/Admin/Users/Modify.html	(original)
+++ rt/branches/rt-3.3/html/Admin/Users/Modify.html	Fri Mar 12 21:44:05 2004
@@ -236,8 +236,37 @@
 
     $current_tab = 'Admin/Users/Modify.html?id='.$id;
     if ($id eq 'new') {
-	($val, $msg) = $UserObj->Create( Name => $Name,
-					 EmailAddress => $ARGS{'EmailAddress'}
+    ( $val, $msg ) = $UserObj->Create(
+        Name                  => $Name,
+        EmailAddress          => $ARGS{'EmailAddress'},
+        Name                  => $ARGS{'Name'},
+        Comments              => $ARGS{'Comments'},
+        Signature             => $ARGS{'Signature'},
+        EmailAddress          => $ARGS{'EmailAddress'},
+        FreeformContactInfo   => $ARGS{'FreeformContactInfo'},
+        Organization          => $ARGS{'Organization'},
+        RealName              => $ARGS{'RealName'},
+        NickName              => $ARGS{'NickName'},
+        Lang                  => $ARGS{'Lang'},
+        EmailEncoding         => $ARGS{'EmailEncoding'},
+        WebEncoding           => $ARGS{'WebEncoding'},
+        ExternalContactInfoId => $ARGS{'ExternalContactInfoId'},
+        ContactInfoSystem     => $ARGS{'ContactInfoSystem'},
+        Gecos                 => $ARGS{'Gecos'},
+        ExternalAuthId        => $ARGS{'ExternalAuthId'},
+        AuthSystem            => $ARGS{'AuthSystem'},
+        HomePhone             => $ARGS{'HomePhone'},
+        WorkPhone             => $ARGS{'WorkPhone'},
+        MobilePhone           => $ARGS{'MobilePhone'},
+        PagerPhone            => $ARGS{'PagerPhone'},
+        Address1              => $ARGS{'Address1'},
+        Address2              => $ARGS{'Address2'},
+        City                  => $ARGS{'City'},
+        State                 => $ARGS{'State'},
+        Zip                   => $ARGS{'Zip'},
+        Country               => $ARGS{'Country'},
+        Privileged           => $ARGS{'Privileged'},
+        Disabled            => ($ARGS{'Enabled'} ? 0 : 1) 
 				       );
 	if ($val) {
 		push @results, $msg;
@@ -247,7 +276,6 @@
 
 	# set the id, so the the menu will have the right info
 	$id = $UserObj->Id;	
-
     } else {
 	$UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
 	$val = $UserObj->Id();
@@ -271,7 +299,7 @@
 
 
 # If we have a user to modify, lets try. 
-if ($UserObj->Id) {
+if ($UserObj->Id && $id ne 'new') {
     
     my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo 
 		    Organization RealName NickName Lang EmailEncoding WebEncoding 

Modified: rt/branches/rt-3.3/html/Elements/Footer
==============================================================================
--- rt/branches/rt-3.3/html/Elements/Footer	(original)
+++ rt/branches/rt-3.3/html/Elements/Footer	Fri Mar 12 21:44:05 2004
@@ -29,7 +29,15 @@
 % }
 <& /Elements/Callback, %ARGS &>
 <div class="bpscredits">
-&#187;&#124;&#171; <&|/l, $RT::VERSION &>RT [_1] from <a href="http://bestpractical.com">Best Practical Solutions, LLC</a>.</&>
+<&|/l,     '&#187;&#124;&#171;', 
+     $RT::VERSION, 
+     '2004', 
+    '<a href="http://www.bestpractical.com?rt='.$RT::VERSION.'">Best Practical Solutions, LLC</a>',
+&>[_1] RT [_2] Copyright 1996-[_3] [_4].</&><br>
+% if (!$Menu) {
+<&|/l&>Distributed under version 2 <a href="http://www.gnu.org/copyleft/gpl.html"> of the GNU GPL.</a></&><br>
+<&|/l, '<a href="mailto:sales at bestpractical.com">sales at bestpractical.com</a>' &>To inquire about support, training, custom development or licensing, please contact [_1].</&><br>
+% }
 </div>
 % if ($Debug) {
 <HR>

Modified: rt/branches/rt-3.3/html/Elements/Header
==============================================================================
--- rt/branches/rt-3.3/html/Elements/Header	(original)
+++ rt/branches/rt-3.3/html/Elements/Header	Fri Mar 12 21:44:05 2004
@@ -21,7 +21,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+%#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <HTML>
 <HEAD>
 <TITLE><%$Title%></TITLE>

Modified: rt/branches/rt-3.3/html/Elements/Login
==============================================================================
--- rt/branches/rt-3.3/html/Elements/Login	(original)
+++ rt/branches/rt-3.3/html/Elements/Login	Fri Mar 12 21:44:05 2004
@@ -91,8 +91,7 @@
 <BR>
 <BR>
 <HR>
-<&|/l, '2003'&>RT is &copy; Copyright 1996-[_1] Jesse Vincent &lt;jesse at bestpractical.com&gt;.  It is distributed under <a href="http://www.gnu.org/copyleft/gpl.html">Version 2 of the GNU General Public License.</a></&>
-
+<& /Elements/Footer, Menu => 0 &>
 <%ARGS>
 $user => ""
 $pass => undef

Modified: rt/branches/rt-3.3/html/Elements/SelectQueue
==============================================================================
--- rt/branches/rt-3.3/html/Elements/SelectQueue	(original)
+++ rt/branches/rt-3.3/html/Elements/SelectQueue	Fri Mar 12 21:44:05 2004
@@ -22,6 +22,8 @@
 %# 
 %# END LICENSE BLOCK
 % if ($Lite) {
+% my $d = new RT::Queue($session{'CurrentUser'});
+% $d->Load($Default);
 <INPUT NAME="<%$Name%>" size=25 DEFAULT="<%$d->Name%>">
 % } else {
 <SELECT NAME ="<%$Name%>">
@@ -30,7 +32,7 @@
 % }
 % while (my $queue=$q->Next) {
 % if ($ShowAllQueues || $queue->CurrentUserHasRight('CreateTicket')) {
-<OPTION VALUE="<%$queue->Id%>" <%($Default && ($queue->Id == $Default)) && 'SELECTED'%>><%$queue->Name%>
+<OPTION VALUE="<%($NamedValues ? $queue->Name : $queue->Id) %>" <%( $queue->Id == $Default ? 'SELECTED' : '')%>><%$queue->Name%>
 %   if (($Verbose) and ($queue->Description) ){
 (<%$queue->Description%>)
 %  }
@@ -44,6 +46,7 @@
 $ShowAllQueues => 1
 $Name => undef
 $Verbose => undef
+$NamedValues => 0
 $Default => 0
 $Lite => 0
 </%ARGS>
@@ -52,8 +55,5 @@
 
 my $q=new RT::Queues($session{'CurrentUser'});
 $q->UnLimit;
-
-my $d = new RT::Queue($session{'CurrentUser'});
-$d->Load($Default);
 
 </%INIT>

Modified: rt/branches/rt-3.3/html/Elements/TicketList
==============================================================================
--- rt/branches/rt-3.3/html/Elements/TicketList	(original)
+++ rt/branches/rt-3.3/html/Elements/TicketList	Fri Mar 12 21:44:05 2004
@@ -25,7 +25,6 @@
 <TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
 <& .Header, 
     Format => \@Format, 
-    map => $map, 
     AllowSorting => $AllowSorting, 
     Order => $Order, 
     Query => $Query,
@@ -36,11 +35,12 @@
 % my $i;
 % while (my $record = $Collection->Next) {
 % $i++;
-<& .Row, Format => \@Format, i => $i, record => $record, map => $map &>
+<& .Row, Format => \@Format, i => $i, record => $record &>
 % }
 </TABLE>
 % if ($ShowNavigation) {
-<&|/l, $Page, int($TotalFound/$Rows)&>Page [_1] of [_2]</&>
+<hr>
+<&|/l, $Page, int($TotalFound/$Rows)+1&>Page [_1] of [_2]</&>
 % if ($Page != 1) {
 <A href="<%$BaseURL%>?Page=<%$Page-1%>&Rows=<%$Rows%>&Format=<%$Format%>&Query=<%$Query%>"><&|/l&>Previous Page</&></a>
 % }
@@ -50,11 +50,65 @@
 % }
 <%INIT>
 
-$Format = $RT::DefaultSearchResultFormat unless $Format;
+use vars qw($COLUMN_MAP $CUSTOM_FIELD_MAP);
+
+$Format ||= $RT::DefaultSearchResultFormat;
+
+$Rows ||= '25'; # we need a positive value
 
-$Rows = '25' unless ($Rows); # we need a positive value
 # {{{ item map
-my $map = {
+
+sub ColumnMap {
+    my $name = shift;
+    my $attr = shift;
+
+    # First deal with the simple things from the map
+    if ( $COLUMN_MAP->{$name} ) {
+        return ( $COLUMN_MAP->{$name}->{$attr} );
+    }
+
+    # now, let's deal with harder things, like Custom Fields
+
+    elsif ( $name =~ /^(?:CF|CustomField).(.*)$/ ) {
+        my $field = $1;
+        my $cf;
+        if ( $CUSTOM_FIELD_MAP->{$field} ) {
+            $cf = $CUSTOM_FIELD_MAP->{$field};
+        }
+        else {
+
+            $cf = RT::CustomField->new( $session{'CurrentUser'} );
+
+            if ( $field =~ /^(.+?)\.{(.+)}$/ ) {
+                $cf->LoadByNameAndQueue( Queue => $1, Name => $2 );
+            }
+            else {
+                $field = $1 if $field =~ /^{(.+)}$/;    # trim { }
+                $cf->LoadByNameAndQueue( Queue => "0", Name => $field );
+            }
+            $CUSTOM_FIELD_MAP->{$field} = $cf if ( $cf->id );
+        }
+
+        unless ( $cf->id ) {
+            return undef;
+        }
+
+        if ( $attr eq 'attribute' ) {
+            return (undef);
+        }
+        elsif ( $attr eq 'title' ) {
+            return ( $cf->Name );
+        }
+        elsif ( $attr eq 'value' ) {
+               my $value = eval "sub {
+                    my \$values = \$_[0]->CustomFieldValues('".$cf->id."');
+                    return ( join( ', ', map { \$_->Content } \@{ \$values->ItemsArrayRef } ))
+                  }" || die $@;
+            return($value);
+            }
+        }
+    }
+$COLUMN_MAP = {
     QueueName => {
         attribute => 'Queue',
         title => 'Queue',
@@ -66,13 +120,16 @@
         value => sub { return $_[0]->OwnerObj->Name }
     },
     id => {
+        attribute => 'id',
         align => 'right',
         value => sub { return $_[0]->id }
     },
     Status => {
+        attribute => 'Status',
         value => sub { return $_[0]->Status }
     },
     Subject => {
+        attribute => 'Subject',
         value => sub { return $_[0]->Subject || "(".loc('No subject').")" }
     },
     ExtendedStatus => {
@@ -97,27 +154,35 @@
 
         }
     }, Priority => {
+        attribute => 'Priority',
         value => sub { return $_[0]->Priority }
     },
     InitialPriority => {
+        attribute => 'InitialPriority',
         value => sub { return $_[0]->InitialPriority }
     },
     FinalPriority => {
+        attribute => 'FinalPriority',
         value => sub { return $_[0]->FinalPriority }
     },
     EffectiveId => {
+        attribute => 'EffectiveId',
         value => sub { return $_[0]->EffectiveId }
     },
     Type => {
+        attribute => 'Type',
         value => sub { return $_[0]->Type }
     },
     TimeWorked => {
+        attribute => 'TimeWorked',
         value => sub { return $_[0]->TimeWorked }
     },
     TimeLeft => {
+        attribute => 'TimeLeft',
         value => sub { return $_[0]->TimeLeft }
     },
     TimeEstimated => {
+        attribute => 'TimeEstimated',
         value => sub { return $_[0]->TimeEstimated }
     },
     Requestors => {
@@ -165,26 +230,123 @@
         value => sub { return $_[0]->ResolvedObj->AgeAsString }
     },
     Starts => {
+        attribute => 'Starts',
         value => sub { return $_[0]->StartsObj->AsString }
     },
     Started => {
+        attribute => 'Started',
         value => sub { return $_[0]->StartedObj->AsString }
     },
     Created => {
+        attribute => 'Created',
         value => sub { return $_[0]->CreatedObj->AsString }
     },
     LastUpdated => {
+        attribute => 'LastUpdated',
         value => sub { return $_[0]->LastUpdatedObj->AsString }
     },
     Told => {
+        attribute => 'Told',
         value => sub { return $_[0]->ToldObj->AsString }
     },
     Due => {
+        attribute => 'Due',
         value => sub { return $_[0]->DueObj->AsString }
     },
     Resolved => {
+        attribute => 'Resolved',
         value => sub { return $_[0]->ResolvedObj->AsString }
     },
+
+    DependedOnBy => {
+        value => sub {
+            my $links = $_[0]->DependedOnBy;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->BaseURI->Resolver->HREF . '">'
+                          . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+    Members => {
+        value => sub {
+            my $links = $_[0]->HasMember;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->BaseURI->Resolver->HREF . '">'
+                          . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+    ReferredToBy => {
+        value => sub {
+            my $links = $_[0]->ReferredToBy;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->BaseURI->Resolver->HREF . '">'
+                          . ( $_->BaseIsLocal ? $_->LocalBase : $_->Base )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+
+    DependsOn => {
+        value => sub {
+            my $links = $_[0]->DependsOn;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->TargetURI->Resolver->HREF . '">'
+                          . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+    MemberOf => {
+        value => sub {
+            my $links = $_[0]->MemberOf;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->TargetURI->Resolver->HREF . '">'
+                          . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+    RefersTo => {
+        value => sub {
+            my $links = $_[0]->RefersTo;
+            return (
+                join(
+                    "<br>",
+                    map {
+                            '<A HREF="'
+                          . $_->TargetURI->Resolver->HREF . '">'
+                          . ( $_->TargetIsLocal ? $_->LocalTarget : $_->Target )
+                          . '</A>'
+                      } @{ $links->ItemsArrayRef } ) );
+          }
+    },
+
+
+
+
     '_CLASS' => {
         value => sub { return  $_[1] %2 ? 'oddline' : 'evenline' } 
         },
@@ -231,7 +393,6 @@
 <%DEF .Header>
 <%ARGS>
 @Format => undef
-$map => undef
 $AllowSorting => undef
 $Order=>undef
 $BaseURL => undef
@@ -251,14 +412,10 @@
         $m->out('<TH align="center">');
         my $title = $col->{title};
         $title =~ s/^__(.*)__$/$1/o;
-        $title = ( $map->{$title}->{title} || $title );
-        if ( $AllowSorting && $col->{'attribute'} ) {
+        $title = ( ColumnMap($title, 'title')  || $title );
+        if ( $AllowSorting && $col->{'attribute'} && ColumnMap($col->{'attribute'},'attribute')) {
             my @query_args = @generic_query_args;
-            push @query_args,
-              ( "OrderBy="
-              . ( $map->{ $col->{'attribute'} }->{'attribute'}
-              ? $map->{ $col->{'attribute'} }->{'attribute'}
-              : $col->{'attribute'} ) );
+            push @query_args, ( "OrderBy=" . ( ColumnMap($col->{'attribute'}, 'attribute') || $col->{'attribute'} ) );
             push @query_args,
               ( "Order=" . ( $ARGS{'Order'} eq 'ASC'  
               ? 'DESC'
@@ -283,7 +440,6 @@
 $i => undef
 @Format => undef
 $record => undef
-$map => undef
 </%ARGS>
 <%PERL>
 $m->out( '<TR class="' . ( $i % 2 ? 'oddline' : 'evenline' ) . '" >' );
@@ -297,8 +453,12 @@
     foreach my $subcol ( @{ $column->{output} } ) {
         if ( $subcol =~ /^__(.*?)__$/o ) {
             my $col = $1;
-            if ( $map->{$col}->{value} && ref( $map->{$col}->{value} ) ) {
-                $m->out( &{ $map->{$col}->{value} } ( $record, $i ) );
+            my $value = ColumnMap($col, 'value');
+
+            if ( $value && ref($value)) {
+                $m->out( &{ $value } ( $record, $i ) );
+            } else {
+                $m->out($value );
             }
         }
         else {

Modified: rt/branches/rt-3.3/html/NoAuth/webrt.css
==============================================================================
--- rt/branches/rt-3.3/html/NoAuth/webrt.css	(original)
+++ rt/branches/rt-3.3/html/NoAuth/webrt.css	Fri Mar 12 21:44:05 2004
@@ -155,7 +155,7 @@
 
 TD.mainbody {
         padding-top: 0.5em;
-        padding-left: 0em;
+        padding-left: 1em;
         padding-right: 1em;
         margin-left: 1em;
         margin-right: 1em;
@@ -331,6 +331,10 @@
 	margin-bottom:0;
 }
 
+%# Provide a callback for adding/modifying the style sheet.
+%# http://www.w3.org/TR/REC-CSS1 - section 3.2, says:
+%#   "latter specified rule wins"
+<& /Elements/Callback &>
 <%flags>
 inherit => undef
 </%flags>

Modified: rt/branches/rt-3.3/html/REST/1.0/Forms/ticket/attachments
==============================================================================
--- rt/branches/rt-3.3/html/REST/1.0/Forms/ticket/attachments	(original)
+++ rt/branches/rt-3.3/html/REST/1.0/Forms/ticket/attachments	Fri Mar 12 21:44:05 2004
@@ -86,11 +86,10 @@
     while (my $t = $transactions->Next) {
         my $attachments = $t->Attachments;
         while (my $a = $attachments->Next) {
-            next unless $a->Filename;
             my $size = length($a->Content);
             if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
             else              { $size .= "b" }
-            push @attachments, $a->Id.": ".$a->Filename." (".$size.")";
+            push @attachments, $a->Id.": ".$a->Filename." (".$a->ContentType . " / ".$size.")";
         }
     }
 

Modified: rt/branches/rt-3.3/html/REST/1.0/ticket/comment
==============================================================================
--- rt/branches/rt-3.3/html/REST/1.0/ticket/comment	(original)
+++ rt/branches/rt-3.3/html/REST/1.0/ticket/comment	Fri Mar 12 21:44:05 2004
@@ -141,6 +141,10 @@
                                BccMessageTo => $bcc,
                                TimeTaken => $k->{TimeWorked} || 0);
 $output = $s;
+if ($k->{Status}) {
+   my  ($status_n, $status_s) = $ticket->SetStatus($k->{'Status'} );   
+  $output .= "\n".$status_s;
+}
 
 OUTPUT:
 </%INIT>

Modified: rt/branches/rt-3.3/html/Search/Build.html
==============================================================================
--- rt/branches/rt-3.3/html/Search/Build.html	(original)
+++ rt/branches/rt-3.3/html/Search/Build.html	Fri Mar 12 21:44:05 2004
@@ -952,7 +952,7 @@
 
 # {{{ Deal with format changes
 my ($AvailableColumns, $CurrentFormat);
-($Format, $AvailableColumns, $CurrentFormat) = $m->comp('Elements/BuildFormatString', %ARGS);
+($Format, $AvailableColumns, $CurrentFormat) = $m->comp('Elements/BuildFormatString', cfqueues => \%queues, %ARGS);
 
 $ARGS{'Format'} = $Format;
 $ARGS{'Query'}  = $Query;

Modified: rt/branches/rt-3.3/html/Search/Elements/BuildFormatString
==============================================================================
--- rt/branches/rt-3.3/html/Search/Elements/BuildFormatString	(original)
+++ rt/branches/rt-3.3/html/Search/Elements/BuildFormatString	Fri Mar 12 21:44:05 2004
@@ -1,5 +1,6 @@
 <%args>
 $Format => undef
+%cfqueues => undef
 </%args>
 <%init>
 

Modified: rt/branches/rt-3.3/html/Search/Elements/PickBasics
==============================================================================
--- rt/branches/rt-3.3/html/Search/Elements/PickBasics	(original)
+++ rt/branches/rt-3.3/html/Search/Elements/PickBasics	Fri Mar 12 21:44:05 2004
@@ -99,7 +99,7 @@
 					TrueVal=> '=', 
 					FalseVal => '!=' &>
 </td><td>
-<& /Elements/SelectQueue, Name => "ValueOfQueue" &>
+<& /Elements/SelectQueue, Name => "ValueOfQueue", NamedValues => 1 &>
 % } elsif ($field eq "id") {
 <&|/l&>Id</&>
 </td><td>

Modified: rt/branches/rt-3.3/html/Search/Elements/PickRestriction
==============================================================================
--- rt/branches/rt-3.3/html/Search/Elements/PickRestriction	(original)
+++ rt/branches/rt-3.3/html/Search/Elements/PickRestriction	Fri Mar 12 21:44:05 2004
@@ -48,7 +48,7 @@
 					False => loc("isn't"), 
 					TrueVal=> '=', 
 					FalseVal => '!=' &>
-<& /Elements/SelectQueue, Name => "ValueOfQueue" &>
+<& /Elements/SelectQueue, Name => "ValueOfQueue", NamedValues => '1' &>
 
 
 <li><&|/l&>Priority</&> <& /Elements/SelectEqualityOperator, Name => "PriorityOp" &>

Modified: rt/branches/rt-3.3/html/Search/Results.html
==============================================================================
--- rt/branches/rt-3.3/html/Search/Results.html	(original)
+++ rt/branches/rt-3.3/html/Search/Results.html	Fri Mar 12 21:44:05 2004
@@ -44,6 +44,7 @@
 <a href="Bulk.html<%$QueryString%>"><&|/l&>Update all these tickets at once</&></a><br>
 <a href="Results.tsv<%$QueryString%>"><&|/l&>spreadsheet</&></a><br>
 <a href="Results.rdf<%$QueryString%>"><&|/l&>RSS</&></a><br>
+<a href="<%$RT::WebPath%>/Tools/Offline.html<%$QueryString%>"><&|/l&>Download</&></a><br>
 </div>
 <%INIT>
 my ($title, $ticketcount);

Modified: rt/branches/rt-3.3/html/Search/Results.rdf
==============================================================================
--- rt/branches/rt-3.3/html/Search/Results.rdf	(original)
+++ rt/branches/rt-3.3/html/Search/Results.rdf	Fri Mar 12 21:44:05 2004
@@ -38,3 +38,43 @@
 $m->out($rss->as_string);
 $m->abort();
 </%INIT>
+<%INIT>
+
+my $Tickets = RT::Tickets->new($session{'CurrentUser'});
+$Tickets->FromSQL($ARGS{'Query'});
+    $r->content_type('xml/rss');
+
+
+
+        # create an RSS 1.0 file (http://purl.org/rss/1.0/)
+        use XML::RSS;
+        my $rss = new XML::RSS (version => '1.0');
+        $rss->channel(
+          title        => "$RT::rtname: Syndicated Search",
+          link         => $RT::WebURL,
+          description  => "",
+          dc => {
+          },
+          syn => {
+            updatePeriod     => "hourly",
+            updateFrequency  => "1",
+            updateBase       => "1901-01-01T00:00+00:00",
+          },
+        );
+
+
+    while ( my $Ticket = $Tickets->Next()) {
+       my $row;
+        $rss->add_item(
+          title       =>  $Ticket->Subject,
+          link        => $RT::WebURL."/Ticket/Display.html?id=".$Ticket->id,
+          description => $Ticket->Transactions->First->Content,
+          dc => {
+            subject  => $Ticket->Subject,
+            creator  => $Ticket->CreatorObj->RealName . "<".$Ticket->CreatorObj->EmailAddress.">",
+          },
+        );
+    }
+$m->out($rss->as_string);
+$m->abort();
+</%INIT>

Modified: rt/branches/rt-3.3/html/Ticket/Display.html
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Display.html	(original)
+++ rt/branches/rt-3.3/html/Ticket/Display.html	Fri Mar 12 21:44:05 2004
@@ -32,14 +32,17 @@
 
 <& /Elements/TitleBoxStart, title => loc('Ticket metadata'), contentbg =>
 '#ffffff' &>
-<& /Ticket/Elements/ShowSummary,  Ticket => $TicketObj &>
+<& /Ticket/Elements/ShowSummary,  Ticket => $TicketObj, Attachments => $attachments &>
 <& /Elements/TitleBoxEnd &>
 
 <BR>
 <& /Ticket/Elements/ShowHistory , 
       Ticket => $TicketObj, 
       Collapsed => $ARGS{'Collapsed'}, 
-      ShowHeaders => $ARGS{'ShowHeaders'} &> 
+      ShowHeaders => $ARGS{'ShowHeaders'},
+      Attachments => $attachments 
+      
+      &> 
 
   
 <%ARGS>
@@ -113,6 +116,10 @@
 
     push (@Actions, @BasicActions, @results);
 }
+
+my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj);
+
+
 </%INIT>
 
 

Added: rt/branches/rt-3.3/html/Ticket/Elements/FindAttachments
==============================================================================
--- (empty file)
+++ rt/branches/rt-3.3/html/Ticket/Elements/FindAttachments	Fri Mar 12 21:44:05 2004
@@ -0,0 +1,50 @@
+<%INIT>
+my %documents;
+
+#A default implementation here loops through all transactions and pulls out all their attachments.
+# We end up doing an end-run around that to get a bit more performance
+
+# We force the cache of ticket transactions to get populated up front. otherwise, the 
+# code that looks at attachments will look at each one in turn.
+my $transactions = $Ticket->Transactions->First;
+
+
+my $attachments = RT::Attachments->new( $session{'CurrentUser'} );
+
+$attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId Created));
+
+if ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
+    my $transactions = $attachments->NewAlias('Transactions');
+    $attachments->Join( ALIAS1 => 'main',
+                                           FIELD1 => 'TransactionId',
+                                           ALIAS2 => $transactions,
+                                           FIELD2 => 'id' );
+    
+    my $tickets = $attachments->NewAlias('Tickets');
+
+    $attachments->Join( ALIAS1 => $transactions,
+                        FIELD1 => 'Ticket',
+                        ALIAS2 => $tickets,
+                        FIELD2 => 'id' );
+
+    $attachments->Limit( ALIAS => $tickets,
+                         FIELD => 'EffectiveId',
+                         VALUE => $Ticket->id() );
+    # if the user may not see comments do not return them
+    unless ( $Ticket->CurrentUserHasRight('ShowTicketComments') ) {
+        $attachments->Limit( ALIAS    => $transactions,
+                             FIELD    => 'Type',
+                             OPERATOR => '!=',
+                             VALUE    => "CommentEmailRecord" );
+        $attachments->Limit( ALIAS    => $transactions,
+                             FIELD    => 'Type',
+                             OPERATOR => '!=',
+                             VALUE    => "Comment" );
+    }
+}
+return ($attachments);
+</%INIT>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+

Modified: rt/branches/rt-3.3/html/Ticket/Elements/PreviewScrips
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/PreviewScrips	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/PreviewScrips	Fri Mar 12 21:44:05 2004
@@ -22,7 +22,7 @@
 
 my $action;
 
-if ( $ARGS{'UpdateType'} eq 'response' ) {
+if (( $ARGS{'UpdateType'} eq 'response' ) || ($ARGS{'Action'} eq 'Respond' )) {
     $action = 'Correspond';
 }
 else {
@@ -45,18 +45,8 @@
 
 my @non_recipients = $TicketObj->SquelchMailTo;
 </%init>
-
-<h2><&|/l&>Squelched message recipients</&></h2>
-<i><&|/l&>(Check boxes to enable notifications to the listed recipients)</&></i>
-<br>
-<ul>
-% foreach my $recipient (@non_recipients) {
-<li><input type="checkbox" name="Ticket-<%$TicketObj->id%>-UnsquelchMailTo" value="<%$recipient->Content%>">
-<% $recipient->Content %>
-% }
-</ul>
-<h2><&|/l&>Message recipients</&></h2>
-<i><&|/l&>(Check boxes to disable notifications to the listed recipients)</&></i>
+<h2><&|/l&>This message will be sent to...</&></h2>
+<i><&|/l&>(Check boxes to disable notifications to the listed recipients)</&></i><br>
 % foreach my $scrip (@{$Object->Scrips->Prepared}) {
 % next unless $scrip->ActionObj->Action->isa('RT::Action::SendEmail');
 <b><%$scrip->Description%></b><br>
@@ -64,20 +54,26 @@
 <br>
 %foreach my $type qw(To Cc Bcc) {
 %my @addresses =  $scrip->ActionObj->Action->$type();
-% next unless $addresses[0];
-<%loc($type)%>:
 <ul>
 %foreach my $addr (@addresses) {
-<li><input type="checkbox" name="Ticket-<%$TicketObj->id%>-SquelchMailTo" value="<%$addr->address%>"> <%$addr->address%>
+<li> <b><%loc($type)%></b>: <input type="checkbox" name="Ticket-<%$TicketObj->id%>-SquelchMailTo" value="<%$addr->address%>"> <%$addr->address%>
 % }
 </ul>
-<br>
 % }
 % if ($RT::PreviewScripMessages) {
 <textarea cols=80 rows="5">
 <%$scrip->ActionObj->TemplateObj->MIMEObj->as_string%>
 </textarea>
 % }
-<hr>
 %}
+<br>
+<h2><&|/l&>Messages about this ticket will not be sent to...</&></h2>
+<i><&|/l&>(Check boxes to enable notifications to the listed recipients)</&></i>
+<br>
+<ul>
+% foreach my $recipient (@non_recipients) {
+<li><input type="checkbox" name="Ticket-<%$TicketObj->id%>-UnsquelchMailTo" value="<%$recipient->Content%>">
+<% $recipient->Content %>
+% }
+</ul>
 <& /Elements/Submit, Value => 'UpdatePreview', Label => loc('Save changes')&>  

Modified: rt/branches/rt-3.3/html/Ticket/Elements/ShowAttachments
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/ShowAttachments	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/ShowAttachments	Fri Mar 12 21:44:05 2004
@@ -47,7 +47,7 @@
 </%PERL>
 
 <li><font <%$fontsize%>>
-        <A HREF="<%$RT::WebPath%>/Ticket/Attachment/<%$rev->TransactionObj->Id%>/<%$rev->Id%>/<%$rev->Filename | u%>"><%$rev->CreatedAsString%> (<% $size %>)</a></font></li>
+        <A HREF="<%$RT::WebPath%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>"><%$rev->CreatedAsString%> (<% $size %>)</a></font></li>
 % }
 % $fontsize='size="-2"';
 % }
@@ -60,20 +60,15 @@
 
 <%INIT>
 my %documents;
-my $transactions = $Ticket->Transactions();
-while (my $trans = $transactions->Next()) {
-        my $attachments = $trans->Attachments();
-	$attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId) );
-        $attachments->Limit(FIELD => 'Filename', OPERATOR => 'IS NOT', VALUE => 'NULL', QUOTEVALUE => 0, ENTRYAGGREGATOR => 'AND');
-        $attachments->Limit(FIELD => 'Filename', OPERATOR => '!=', VALUE => '', ENTRYAGGREGATOR => 'AND');
-        while (my $attach = $attachments->Next()) {
-              next unless ($attach->Filename());
-              # most recent at the top
-              unshift (@{$documents{$attach->Filename}}, $attach);
-        }
+
+while ( my $attach = $Attachments->Next() ) {
+    next unless ($attach->Filename());
+   unshift( @{ $documents{ $attach->Filename } }, $attach );
 }
+
 </%INIT>
 <%ARGS>
 $Ticket => undef
+$Attachments => undef
 </%ARGS>
 

Modified: rt/branches/rt-3.3/html/Ticket/Elements/ShowHistory
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/ShowHistory	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/ShowHistory	Fri Mar 12 21:44:05 2004
@@ -57,16 +57,43 @@
 % }
 
 <TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=2 BORDER=0>
-% while (my $Transaction = $Transactions->Next) {
-% my $skip = 0;
-% $m->comp('/Elements/Callback', _CallbackName => 'SkipTransaction', Transaction => $Transaction, skip => \$skip, %ARGS);
-% next if $skip;
-% $i++;
-%	if ($Transactions->IsLast) {
-	<a name="lasttrans"></a>
-% 	}
-	    <& ShowTransaction, Ticket => $Ticket, Transaction => $Transaction, ShowHeaders => $ShowHeaders, Collapsed => $Collapsed, RowNum => $i, ShowTitleBarCommands => $ShowTitleBarCommands, %ARGS &>
-% }
+<%perl>
+my @attachments = @{$Attachments->ItemsArrayRef()};
+
+
+
+
+
+while ( my $Transaction = $Transactions->Next ) {
+    my $skip = 0;
+    $m->comp( '/Elements/Callback',
+              _CallbackName => 'SkipTransaction',
+              Transaction   => $Transaction,
+              skip          => \$skip,
+              %ARGS );
+    next if $skip;
+    $i++;
+
+    $m->out('<a name="lasttrans"></a>') if ( $Transactions->IsLast );
+
+    my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments;
+
+   
+    #Args is first because we're clobbering the "Attachments" parameter 
+    $m->comp( 'ShowTransaction',
+            %ARGS,
+
+              Ticket               => $Ticket,
+              Transaction          => $Transaction,
+              ShowHeaders          => $ShowHeaders,
+              Collapsed            => $Collapsed,
+              RowNum               => $i,
+              ShowTitleBarCommands => $ShowTitleBarCommands,
+              Attachments          => \@trans_attachments,
+ );
+}
+
+</%perl>
 </TABLE>
 % if ($ShowDisplayModes or $ShowTitle) {
 <& /Elements/TitleBoxEnd &>
@@ -77,10 +104,13 @@
 my $i;
 
 
+$Attachments ||=  $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
+
 </%INIT>
 <%ARGS>
 $URIFile => 'Display.html'
 $Ticket => undef
+$Attachments => undef
 $ShowHeaders => undef
 $Collapsed => undef
 $ShowTitle => 1

Modified: rt/branches/rt-3.3/html/Ticket/Elements/ShowSummary
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/ShowSummary	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/ShowSummary	Fri Mar 12 21:44:05 2004
@@ -65,7 +65,7 @@
 	        <& /Ticket/Elements/ShowLinks, Ticket => $Ticket &>
 	<& /Elements/TitleBoxEnd &>
         <BR>
-	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket &>
+	  <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments &>
 
 	  <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
 
@@ -75,6 +75,7 @@
     </TABLE>
 <%ARGS>
 $Ticket => undef
+$Attachments => undef
 </%ARGS>
 
 

Modified: rt/branches/rt-3.3/html/Ticket/Elements/ShowTransaction
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/ShowTransaction	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/ShowTransaction	Fri Mar 12 21:44:05 2004
@@ -44,8 +44,7 @@
 <%PERL>
 
 unless ($Collapsed) {
-    $attachments->GotoFirstItem;
-    while ( my $message = $attachments->Next ) {
+ foreach my $message (@$Attachments) { 
 
         my $quoted;
         my $headers = $message->Headers;
@@ -74,9 +73,7 @@
       <TD>&nbsp;&nbsp;</TD>
       <TD COLSPAN=3 VALIGN=TOP>
 <span class="message">
-	<PRE>
 <& ShowMessageHeaders, Headers => $headers, Transaction => $Transaction, DisplayHeaders => \@DisplayHeaders &>
-</PRE>
 % if ($ShowBody) {
 % if (!length($quoted) && $message->ContentType =~ m#^text/#) {
 <blockquote><i>
@@ -121,6 +118,7 @@
 $ShowTitleBarCommands => 1
 $RowNum => 1
 $AttachPath => $RT::WebPath."/Ticket/Attachment"
+$Attachments => undef
 $ShowBody => 1
 </%ARGS>
 
@@ -166,10 +164,12 @@
 if ( $Transaction->TimeTaken > 0 ) {
     $TimeTaken = $Transaction->TimeTaken . " min";
 }
-my $attachments = $Transaction->Attachments;
-$attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId)
-);
 
+unless ($Attachments) { 
+    my $attachments = $Transaction->Attachments;
+    $attachments->Columns( qw( Id Filename ContentType Headers Subject Parent ContentEncoding ContentType TransactionId) );
+    $Attachments = $attachments->ItemsArrayRef();
+}
 my $titlebar_commands = '&nbsp;';
 
 my @DisplayHeaders=qw ( _all);
@@ -198,7 +198,7 @@
         @DisplayHeaders = qw(To From RT-Send-Cc Cc Bcc Date Subject);
     }
 
-    if ( $Transaction->Attachments->First && $ShowTitleBarCommands ) {
+    if ( $Attachments->[0] && $ShowTitleBarCommands ) {
         if ( $Transaction->TicketObj->CurrentUserHasRight('ReplyToTicket') ) {
             $titlebar_commands .=
                 "[<a href=\"Update.html?id="

Modified: rt/branches/rt-3.3/html/Ticket/Elements/Tabs
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/Elements/Tabs	(original)
+++ rt/branches/rt-3.3/html/Ticket/Elements/Tabs	Fri Mar 12 21:44:05 2004
@@ -173,10 +173,14 @@
 $tabs->{"h"} = { path      => "Search/Edit.html$args",
                  title     => loc('Advanced'),
                  separator => 1 };
+if ($current_tab =~  "Search/Results.html") {
 $tabs->{"i"} = { path      => "Search/Results.html$args",
                  title     => loc('Show Results'),
                  separator => 1 };
 
+$current_tab = "Search/Results.html$args";
+
+}
 </%INIT>
 
   

Modified: rt/branches/rt-3.3/html/Ticket/History.html
==============================================================================
--- rt/branches/rt-3.3/html/Ticket/History.html	(original)
+++ rt/branches/rt-3.3/html/Ticket/History.html	Fri Mar 12 21:44:05 2004
@@ -28,7 +28,7 @@
 
 <BR>
       
-<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, ShowHeaders => $ARGS{'ShowHeaders'}, URIFile => 'History.html' &> 
+<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, ShowHeaders => $ARGS{'ShowHeaders'}, URIFile => 'History.html', Attachments => $attachments &> 
 
 
 <%ARGS>
@@ -44,6 +44,8 @@
 unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
 	Abort("No permission to view ticket");
 }
+
+my $attachments = $m->comp('Elements/FindAttachments', Ticket => $Ticket);
 
 </%INIT>
 

Modified: rt/branches/rt-3.3/html/autohandler
==============================================================================
--- rt/branches/rt-3.3/html/autohandler	(original)
+++ rt/branches/rt-3.3/html/autohandler	Fri Mar 12 21:44:05 2004
@@ -93,7 +93,7 @@
 	if ($RT::WebExternalAuto and !$session{'CurrentUser'}->Id() ) {
 	    # Create users on-the-fly
 	    
-	    my $UserObj = RT::User->new(RT::CurrentUser->new('root'));
+	    my $UserObj = RT::User->new(RT::CurrentUser->new('RT_System'));
 	    
 	    my ($val, $msg) = $UserObj->Create(
 					       %{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},

Modified: rt/branches/rt-3.3/lib/RT/Action/Autoreply.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Action/Autoreply.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Action/Autoreply.pm	Fri Mar 12 21:44:05 2004
@@ -28,6 +28,18 @@
 use vars qw/@ISA/;
 @ISA = qw(RT::Action::SendEmail);
 
+=head2 Prepare
+
+Set up the relevant recipients, then call our parent.
+
+=cut
+
+
+sub Prepare {
+    my $self = shift;
+    $self->SetRecipients();
+    $self->SUPER::Prepare();
+}
 
 # {{{ sub SetRecipients
 

Modified: rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Action/CreateTickets.pm	Fri Mar 12 21:44:05 2004
@@ -309,12 +309,15 @@
     my $self = shift;
     my (@links, @postponed);
 
+    my @results;
+
     # XXX: cargo cult programming that works. i'll be back.
     use bytes;
 
     # Create all the tickets we care about
     return(1) unless $self->TicketObj->Type eq 'ticket';
 
+    my @results;
     %T::Tickets = ();
 
     foreach my $template_id ( @{ $self->{'template_order'} } ) {

Modified: rt/branches/rt-3.3/lib/RT/Condition/OwnerChange.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Condition/OwnerChange.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Condition/OwnerChange.pm	Fri Mar 12 21:44:05 2004
@@ -50,9 +50,7 @@
              CustomIsApplicableCode => '',
              CustomPrepareCode => 'return 1',
              CustomCommitCode => '
-                   $RT::Logger->crit("Before, prio is ".$self->TicketObj->Priority);
                     $self->TicketObj->SetPriority($self->TicketObj->Priority+1);
-                   $RT::Logger->crit("After, prio is ".$self->TicketObj->Priority);
                 return(1);
             ',
              Template => 'Blank'

Modified: rt/branches/rt-3.3/lib/RT/Handle.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Handle.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Handle.pm	Fri Mar 12 21:44:05 2004
@@ -69,6 +69,8 @@
 			 User => $RT::DatabaseUser,
 			 Password => $RT::DatabasePassword,
 			);
+
+    $self->dbh->{LongReadLen} = $RT::MaxAttachmentSize;
    
 }
 

Modified: rt/branches/rt-3.3/lib/RT/Link_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Link_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Link_Overlay.pm	Fri Mar 12 21:44:05 2004
@@ -87,8 +87,6 @@
                               . $base->Scheme
                               . "' into a URI\n" );
 
-        #use Data::Dumper;
-        #$RT::Logger->warning(scalar Dumper $base);
         return (undef);
     }
 
@@ -100,8 +98,6 @@
                               . $args{'Target'} . " - "
                               . "' into a URI\n" );
 
-        #use Data::Dumper;
-        #$RT::Logger->warning(scalar Dumper $target);
         return (undef);
     }
 

Modified: rt/branches/rt-3.3/lib/RT/Record.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Record.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Record.pm	Fri Mar 12 21:44:05 2004
@@ -460,6 +460,25 @@
 
 # }}}
 
+# {{{ sub URI 
+
+=head2 URI
+
+Returns this record's URI
+
+=cut
+
+sub URI {
+    my $self = shift;
+    my $uri = RT::URI::fsck_com_rt->new($self->CurrentUser);
+    return($uri->URIForObject($self));
+}
+
+# }}}
+ 
+
+
+
 
 =head2 SQLType attribute
 

Modified: rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/Ticket_Overlay.pm	Fri Mar 12 21:44:05 2004
@@ -372,13 +372,13 @@
 
     # If there's no queue default initial priority and it's not set, set it to 0
     $args{'InitialPriority'} = ( $QueueObj->InitialPriority || 0 )
-      unless ( defined $args{'InitialPriority'} );
+      unless ( $args{'InitialPriority'} );
 
     #Final priority 
 
     # If there's no queue default final priority and it's not set, set it to 0
     $args{'FinalPriority'} = ( $QueueObj->FinalPriority || 0 )
-      unless ( defined $args{'FinalPriority'} );
+      unless ( $args{'FinalPriority'} );
 
     # Priority may have changed from InitialPriority, for the case
     # where we're importing tickets (eg, from an older RT version.)
@@ -2556,14 +2556,18 @@
 my $t3 = RT::Ticket->new($RT::SystemUser);
 my ($id3, $trans, $msg3) = $t3->Create(Subject => 'DepTest3', Queue => 'general', Type => 'approval');
 ok($id3, "Created dep test 3 - $msg3");
+my ($addid, $addmsg);
+ok (($addid, $addmsg) =$t1->AddLink( Type => 'DependsOn', Target => $t2->id));
+ok ($addid, $addmsg);
+ok (($addid, $addmsg) =$t1->AddLink( Type => 'DependsOn', Target => $t3->id));
 
-ok ($t1->AddLink( Type => 'DependsOn', Target => $t2->id));
-ok ($t1->AddLink( Type => 'DependsOn', Target => $t3->id));
-
+ok ($addid, $addmsg);
 ok ($t1->HasUnresolvedDependencies, "Ticket ".$t1->Id." has unresolved deps");
 ok (!$t1->HasUnresolvedDependencies( Type => 'blah' ), "Ticket ".$t1->Id." has no unresolved blahs");
 ok ($t1->HasUnresolvedDependencies( Type => 'approval' ), "Ticket ".$t1->Id." has unresolved approvals");
 ok (!$t2->HasUnresolvedDependencies, "Ticket ".$t2->Id." has no unresolved deps");
+;
+
 my ($rid, $rmsg)= $t1->Resolve();
 ok(!$rid, $rmsg);
 ok($t2->Resolve);
@@ -2838,6 +2842,7 @@
                  Silent => undef,
                  @_ );
 
+
     unless ( $self->CurrentUserHasRight('ModifyTicket') ) {
         return ( 0, $self->loc("Permission Denied") );
     }
@@ -2853,13 +2858,13 @@
     }
     elsif ( $args{'Base'} ) {
         $args{'Target'} = $self->URI();
-	$remote_link = $args{'Base'};
-    	$direction = 'Target';
+        $remote_link    = $args{'Base'};
+        $direction      = 'Target';
     }
     elsif ( $args{'Target'} ) {
         $args{'Base'} = $self->URI();
-	$remote_link = $args{'Target'};
-        $direction='Base';
+        $remote_link  = $args{'Target'};
+        $direction    = 'Base';
     }
     else {
         return ( 0, $self->loc('Either base or target must be specified') );
@@ -2883,11 +2888,12 @@
 
     # Storing the link in the DB.
     my $link = RT::Link->new( $self->CurrentUser );
-    my ($linkid) = $link->Create( Target => $args{Target},
+    my ($linkid, $linkmsg) = $link->Create( Target => $args{Target},
                                   Base   => $args{Base},
                                   Type   => $args{Type} );
 
     unless ($linkid) {
+        $RT::Logger->error("Link could not be created: ".$linkmsg);
         return ( 0, $self->loc("Link could not be created") );
     }
 
@@ -2911,22 +2917,6 @@
         return ( $Trans, $self->loc( "Link created ([_1])", $TransString ) );
     }
 
-}
-
-# }}}
-
-# {{{ sub URI 
-
-=head2 URI
-
-Returns this ticket's URI
-
-=cut
-
-sub URI {
-    my $self = shift;
-    my $uri = RT::URI::fsck_com_rt->new($self->CurrentUser);
-    return($uri->URIForObject($self));
 }
 
 # }}}

Modified: rt/branches/rt-3.3/lib/RT/URI/fsck_com_rt.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/URI/fsck_com_rt.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/URI/fsck_com_rt.pm	Fri Mar 12 21:44:05 2004
@@ -34,9 +34,9 @@
 
 
 
-=head2 LocalURIPrefix 
+=head2 LocalURIPrefix  
 
-Returns the prefix for a local ticket URI
+Returns the prefix for a local URI. 
 
 =begin testing
 
@@ -53,7 +53,7 @@
 ok ($uri->isa('RT::URI::base'), "It's an RT::URI::base");
 ok ($uri->isa('RT::Base'), "It's an RT::Base");
 
-is ($uri->LocalURIPrefix , 'fsck.com-rt://example.com/ticket/');
+is ($uri->LocalURIPrefix , 'fsck.com-rt://example.com');
 
 =end testing
 
@@ -63,99 +63,100 @@
 
 sub LocalURIPrefix {
     my $self = shift;
-    my $prefix = $self->Scheme. "://$RT::Organization/ticket/";
+    
+    my $prefix = $self->Scheme. "://$RT::Organization";
+
     return ($prefix);
 }
 
+=head2 ObjectType
+
+=cut
+
+sub ObjectType {
+    my $self = shift;
+    my $object = shift;
 
+    my $type = 'ticket';
+    if (ref($object) && (ref($object) ne 'RT::Ticket')) {
+            $type = ref($object);
+    }
 
+    return ($type);
+}
 
 
-=head2 URIForObject RT::Ticket
 
-Returns the RT URI for a local RT::Ticket object
+
+=head2 URIForObject RT::Record
+
+Returns the RT URI for a local RT::Record object
 
 =begin testing
 
 my $ticket = RT::Ticket->new($RT::SystemUser);
 $ticket->Load(1);
 my $uri = RT::URI::fsck_com_rt->new($ticket->CurrentUser);
-is($uri->LocalURIPrefix . "1" , $uri->URIForObject($ticket));
+is($uri->LocalURIPrefix. "/ticket/1" , $uri->URIForObject($ticket));
 
 =end testing
 
 =cut
 
 sub URIForObject {
-
     my $self = shift;
-
     my $obj = shift;
-    return ($self->LocalURIPrefix. $obj->Id);
+    return ($self->LocalURIPrefix."/".$self->ObjectType($obj)."/". $obj->Id);
 }
 
 
-=head2 ParseObject $TicketObj
-
-When handed an RT::Ticekt object, figure out its URI
+=head2 ParseURI URI
 
+When handed an fsck.com-rt: URI, figures out things like whether its a local record and what its ID is
 
 =cut
 
 
+sub ParseURI {
+    my $self = shift;
+    my $uri  = shift;
 
-=head2 ParseURI URI
+    if ( $uri =~ /^(\d+)$/ ) {
+        my $ticket = RT::Ticket->new( $self->CurrentUser );
+        $ticket->Load($uri);
+        $self->{'uri'} = $ticket->URI;
+        $self->{'object'} = $ticket;
+        return($ticket->id);
+    }
+    else {
+        $self->{'uri'} = $uri;
+    }
 
-When handed an fsck.com-rt: URI, figures out things like whether its a local ticket
-and what its ID is
+    #If it's a local URI, load the ticket object and return its URI
+    if ( $self->IsLocal ) {
 
-=cut
+        my $local_uri_prefix = $self->LocalURIPrefix;
+        if ( $self->{'uri'} =~ /^$local_uri_prefix\/(.*?)\/(\d+)$/i ) {
+            my $type = $1;
+            my $id   = $2;
 
+            if ( $type eq 'ticket' ) { $type = 'RT::Ticket' }
 
-sub ParseURI { 
-    my $self = shift;
-    my $uri = shift;
-
-	my $ticket;
- 
- 	if ($uri =~ /^(\d+)$/) {
- 		$ticket = RT::Ticket->new($self->CurrentUser);
- 		$ticket->Load($uri);	
- 		$self->{'uri'} = $ticket->URI;
- 	}
- 	else {
-	    $self->{'uri'} = $uri;
- 	}
- 
- 
- 
-       #If it's a local URI, load the ticket object and return its URI
-    if ( $self->IsLocal) {
-   
-        my $local_uri_prefix = $self->LocalURIPrefix;
-    	if ($self->{'uri'} =~ /^$local_uri_prefix(\d+)$/i) {
-    		my $id = $1;
-    	
-    
-	        $ticket = RT::Ticket->new( $self->CurrentUser );
-    	    $ticket->Load($id);
+            # We can instantiate any RT::Record subtype. but not anything else
 
-    	    #If we couldn't find a ticket, return undef.
-    	    unless ( defined $ticket->Id ) {
-    	    	return undef;
-    	    }
-    	    } else {
-    	    return undef;
-    	    }	
-    }
- 
- 	$self->{'object'} = $ticket;
-    if ( UNIVERSAL::can( $ticket, 'Id' ) ) {
-        return ( $ticket->Id );
-    }
-    else {
-        return undef;
+            if ( UNIVERSAL::isa( $type, 'RT::Record' ) ) {
+                my $record = $type->new( $self->CurrentUser );
+                $record->Load($id);
+
+                if ( $record->Id ) {
+                    $self->{'object'} = $record;
+                    return ( $record->Id );
+                }
+            }
+
+        }
     }
+    return undef;
 }
 
 =head2 IsLocal 
@@ -194,7 +195,7 @@
 
 =head2 Scheme
 
-Return the URI scheme for RT tickets
+Return the URI scheme for RT records
 
 =cut
 
@@ -214,7 +215,7 @@
 
 sub HREF {
     my $self = shift;
-    if ($self->IsLocal && $self->Object) {
+    if ($self->IsLocal && $self->Object && ($self->ObjectType eq 'ticket')) {
         return ( $RT::WebURL . "Ticket/Display.html?id=".$self->Object->Id);
     }   
     else {
@@ -231,7 +232,7 @@
 sub AsString {
     my $self = shift;
     if ($self->IsLocal && $self->Object) {
-	    return $self->loc("ticket #[_1]", $self->Object->Id);
+	    return $self->loc("[_1] #[_2]", $self->ObjectType, $self->Object->Id);
     }
     else {
 	    return $self->URI;

Modified: rt/branches/rt-3.3/lib/RT/User_Overlay.pm
==============================================================================
--- rt/branches/rt-3.3/lib/RT/User_Overlay.pm	(original)
+++ rt/branches/rt-3.3/lib/RT/User_Overlay.pm	Fri Mar 12 21:44:05 2004
@@ -62,7 +62,7 @@
     {
 
         Name                    => { public => 1,  admin => 1 },
-          Password              => { read   => 0,  admin => 1 },
+          Password              => { read   => 0 },
           EmailAddress          => { public => 1 },
           Organization          => { public => 1,  admin => 1 },
           RealName              => { public => 1 },
@@ -160,7 +160,13 @@
         return ( 0, $self->loc('No permission to create users') );
     }
 
+
+    unless ($self->CanonicalizeUserInfo(\%args)) {
+        return ( 0, $self->loc("Could not set user info") );
+    }
+
     $args{'EmailAddress'} = $self->CanonicalizeEmailAddress($args{'EmailAddress'});
+
     # if the user doesn't have a name defined, set it to the email address
     $args{'Name'} = $args{'EmailAddress'} unless ($args{'Name'});
 
@@ -623,6 +629,32 @@
         $email =~ s/$RT::CanonicalizeEmailAddressMatch/$RT::CanonicalizeEmailAddressReplace/gi;
     }
     return ($email);
+}
+
+
+# }}}
+
+# {{{ sub CanonicalizeUserInfo
+
+
+
+=item CanonicalizeUserInfo HASH of ARGS
+
+# CanonicalizeUserInfo can convert all User->Create options.
+# it takes a hashref of all the params sent to User->Create and
+# returns that same hash, by default nothing is done.
+
+# This function is intended to allow users to have their info looked up via
+# an outside source and modified upon creation.
+
+=cut
+
+sub CanonicalizeUserInfo {
+    my $self = shift;
+    my $args = shift;
+    my $success = 1;
+
+    return ($success);
 }
 
 

Modified: rt/branches/rt-3.3/releng.cnf
==============================================================================
--- rt/branches/rt-3.3/releng.cnf	(original)
+++ rt/branches/rt-3.3/releng.cnf	Fri Mar 12 21:44:05 2004
@@ -1,5 +1,5 @@
 PRODUCT			        = rt
-TAG			            = 3.1.5
+TAG			            = 3.1.10
 CANONICAL_REPO		    = svn+ssh://svn.bestpractical.com/svn/bps-public/rt/
 TAGS		            = tags/
 TRUNK	                = branches/rt-3.1/



More information about the Rt-commit mailing list