[rt-users] Ticket/Display.html is just not controllable
Wolfram Huettermann
wolfram.huettermann at desy.de
Thu May 27 03:12:55 EDT 2010
Kevin Falcone wrote:
> On Wed, May 26, 2010 at 09:46:42AM +0200, Wolfram Huettermann wrote:
>
>> Hello,
>>
>> I am dealing with Ticket/Display.html. What I found out:
>>
>> - there is NO change in the page source the when you change the
>> Mason-block
>> - I cannot get any information of the callback-functions used.
>>
>> My task was to limit the size of the layers in which you can see the
>> metadata and the history of the ticket. It is more user-friendly to
>> scroll them.
>>
>> Has anybody an idea how it could work anyway? Or is it just impossible?
>>
>
> Without knowing what you did, it is impossible to know what is wrong.
> However, it sounds like Christian Loos has already implemented a
> similar module
>
> http://github.com/cloos/rt-extension-briefhistory
>
> -kevin
>
> ------------------------------------------------------------------------
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
Hi Kevin,
I wanted to change the module Ticket/Display.html in the HTML-block. But
its appearance and its source code remained the same, even after I
had cut this block. It seems that the <%init%>-block creates the module
and overlays the HTML-code.
I even haven't got any information of the callback-functions in that
block. Here is the init-block of Ticket/Display.html.
<%INIT>
$m->callback( TicketObj => $TicketObj, ARGSRef => \%ARGS, CallbackName
=> 'Initial' );
my (@Actions, $Tickets);
unless ($id || $TicketObj) {
Abort('No ticket specified');
}
if ($ARGS{'id'} eq 'new') {
# {{{ Create a new ticket
my $Queue = new RT::Queue( $session{'CurrentUser'} );
$Queue->Load($ARGS{'Queue'});
unless ( $Queue->id ) {
Abort('Queue not found');
}
unless ( $Queue->CurrentUserHasRight('CreateTicket') ) {
Abort('You have no permission to create tickets in that queue.');
}
($TicketObj, @Actions) = CreateTicket(
Attachments => delete $session{'Attachments'},
%ARGS,
);
unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) {
Abort("No permission to view newly created ticket
#".$TicketObj->id.".");
}
# }}}
} else {
$TicketObj ||= LoadTicket($ARGS{'id'});
$m->callback( CallbackName => 'BeforeProcessArguments',
TicketObj => $TicketObj, Tickets => $Tickets,
ActionsRef => \@Actions, ARGSRef => \%ARGS );
if ( defined $ARGS{'Action'} ) {
if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
my $action = $1;
my ($res, $msg) = $TicketObj->$action();
push(@Actions, $msg);
}
}
$m->callback(CallbackName => 'ProcessArguments',
Ticket => $TicketObj,
ARGSRef => \%ARGS,
Actions => \@Actions);
$ARGS{UpdateAttachments} = $session{'Attachments'};
push @Actions,
ProcessUpdateMessage(
ARGSRef => \%ARGS,
Actions => \@Actions,
TicketObj => $TicketObj,
);
delete $session{'Attachments'};
#Process status updates
push @Actions, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj =>
$TicketObj );
push @Actions, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj =>
$TicketObj );
push @Actions, ProcessTicketLinks( ARGSRef => \%ARGS, TicketObj =>
$TicketObj );
push @Actions, ProcessTicketDates( ARGSRef => \%ARGS, TicketObj =>
$TicketObj );
push @Actions, ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS,
TicketObj => $TicketObj );
# XXX: we shouldn't block actions here if user has no right to see
the ticket,
# but we should allow him to see actions he has done
unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
Abort("No permission to view ticket");
}
if ( $ARGS{'MarkAsSeen'} ) {
$TicketObj->SetAttribute(
Name => 'User-'. $TicketObj->CurrentUser->id .'-SeenUpTo',
Content => $TicketObj->LastUpdated,
);
push @Actions, loc('Marked all messages as seen');
}
}
$m->callback(
CallbackName => 'BeforeDisplay',
TicketObj => \$TicketObj,
Tickets => \$Tickets,
Actions => \@Actions,
ARGSRef => \%ARGS,
);
# This code does automatic redirection if any updates happen.
if (@Actions) {
# We've done something, so we need to clear the decks to avoid
# resubmission on refresh.
# But we need to store Actions somewhere too, so we don't lose them.
my $key = Digest::MD5::md5_hex( rand(1024) );
push @{ $session{"Actions"}->{$key} ||= [] }, @Actions;
$session{'i'}++;
RT::Interface::Web::Redirect( RT->Config->Get('WebURL') .
"Ticket/Display.html?id=" . $TicketObj->id . "&results=" . $key );
}
my $attachments = $m->comp('Elements/FindAttachments', Ticket =>
$TicketObj, Tickets => $Tickets);
my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket
=> $TicketObj);
my %link_rel;
if (defined $session{'tickets'} and ($ARGS{'Query'} or
$session{'CurrentSearchHash'}->{'Query'})) {
my $item_map = $session{'tickets'}->ItemMap;
$link_rel{first} = "Ticket/Display.html?id=" .
$item_map->{first} if $item_map->{$TicketObj->Id}{prev};
$link_rel{prev} = "Ticket/Display.html?id=" .
$item_map->{$TicketObj->Id}{prev} if $item_map->{$TicketObj->Id}{prev};
$link_rel{next} = "Ticket/Display.html?id=" .
$item_map->{$TicketObj->Id}{next} if $item_map->{$TicketObj->Id}{next};
$link_rel{last} = "Ticket/Display.html?id=" .
$item_map->{last} if $item_map->{$TicketObj->Id}{next};
}
</%INIT>
Thank you for your advice.
Wolfram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100527/cdd218b1/attachment.htm>
More information about the rt-users
mailing list