%# $Header: /raid/cvsroot/rt/webrt/Ticket/Attic/Display.html,v 1.1.2.27 2000/06/15 20:43:08 tobiasb Exp $ %# Copyright 1996-2000 Jesse Vincent <& /Elements/Header, Title => "Ticket View (#".$Ticket->Id.")" &> % for (@Actions) { <%$_%>
% } <& /Ticket/Elements/TicketToolBox, Ticket => $Ticket&> <& /Ticket/Elements/ShowSummary, Ticket => $Ticket &> <& /Elements/TitleBoxEnd &>

Ticket History

<& /Ticket/Elements/ShowHistory , Ticket => $Ticket &> <& /Elements/TitleBoxEnd &> <& /Elements/Footer &> <%INIT> # TODO. This is ugly, ugly, ugly. Most of it should be formatted "right" # and moved away from the template. -- TobiX # Check if we have an id: if (!$ARGS{'id'}) { &mc_comp("/Elements/Error" , Why => "No ticket specified"); $m->abort; } use RT::Ticket; use RT::CurrentUser; # Huh? Shouldn't this be $session{CurrentUser}? -- TobiX my $Ticket = RT::Ticket->new($session{'CurrentUser'}); my $id=$ARGS{'id'}; my @Actions=(); # Eventually, create a new ticket: if ($id eq 'new') { require MIME::Entity; my ($Trans,$ErrMsg); ($id, $Trans, $ErrMsg)=$Ticket->Create( #TODO in Create_Details.html: priorities and due-date Queue=>$ARGS{queue}, Owner=>$ARGS{ValueOfOwner}, Requestors=>$ARGS{Requestors} || $session{CurrentUser}->EmailAddress, Subject=>$ARGS{Subject}, Status=>$ARGS{Status}||'open', MIMEEntity => MIME::Entity->build ( Subject => $ARGS{Subject}, From => $ARGS{Requestors}, Cc => $ARGS{Cc}, Data => $ARGS{Content} ) ); unless ($id && $Trans) { &mc_comp("/Elements/Error" , Why => $ErrMsg); $m->abort; } push(@Actions, $ErrMsg); } # Can we load it? unless ($Ticket->Load($id)) { &mc_comp("/Elements/Error" , Why => "Ticket couldn't be loaded"); $m->abort; } # Eventually, link up the ticket: if (my $l=$ARGS{'Link'}) { # There is some redundant information from the forms now - we'll # ignore one bit of it: my $luris=$ARGS{'LinkTo'} || $ARGS{'LinkFrom'}; my $ltyp=$ARGS{'LinkType'}; if (ref $ltyp) { &mc_comp("/Elements/Error" , Why => "Parameter error"); $m->abort; } for my $luri (split (/ /,$luris)) { warn $luri; my ($LinkId, $Message); if ($l eq 'LinkTo') { ($LinkId,$Message)=$Ticket->LinkTo(Target=>$luri, Type=>$ltyp); } elsif ($l eq 'LinkFrom') { ($LinkId,$Message)=$Ticket->LinkFrom(Base=>$luri, Type=>$ltyp); } else { &mc_comp("/Elements/Error" , Why => "Parameter error"); $m->abort; } warn $Message; push(@Actions, $Message); } } # Eventually, take the ticket: # TODO: What if there are more Actions? if (exists $ARGS{Action} && $ARGS{Action} eq "Take") { my ($res, $msg)=$Ticket->Take; push(@Actions, $msg); } # Eventually, steal the ticket: # TODO: What if there are more Actions? if (exists $ARGS{Action} && $ARGS{Action} eq "Steal") { my ($res, $msg)=$Ticket->Steal; push(@Actions, $msg); } # Eventually, kill the ticket: if (exists $ARGS{Action} && $ARGS{Action} eq "Kill") { my ($res, $msg)=$Ticket->Kill; push(@Actions, $msg); } # Eventually, touch the Told: if (exists $ARGS{Action} && $ARGS{Action} eq "UpdateTold") { my ($res, $msg)=$Ticket->UpdateTold; push(@Actions, $msg); }