Adding a Spam Ticket Tab

Hello all,

I found that someone has done this already and I have implemented it in
our RT setup:

http://lists.bestpractical.com/pipermail/rt-users/2005-December/036007.ht
ml

but it is not working and I just don’t understand why. Here is what I
added to /opt/rt3/share/html/Ticket/Elements/Tabs

if ( $Ticket->CurrentUserHasRight(‘ModifyTicket’) ) {
if ( $Ticket->Status ne ‘resolved’ ) {
$actions->{‘B’} = {

         path => 

“Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=” . $id,
title => loc(‘Resolve’) };
}
if ( $Ticket->Status ne ‘open’ ) {
$actions->{‘C’} = { path =>
“Ticket/Display.html?Status=open&id=” . $id,
title => loc(‘Open it’) };
}
# Spam stuff.
if ( $Ticket->CurrentUserHasRight(‘DeleteTicket’) ) {
$actions->{‘G’} = {
title => loc(‘Spam’),
path =>
“Ticket/Modify.html?id=$id&Status=deleted&Queue=16” };
}
}

However, I don’t see any change at all. What else do I have to do to
get this working. Note that I’m
using RT 3.4.4.

Bernd

Check Out the new free AIM(R) Mail – 2 GB of storage and
industry-leading spam and email virus protection.

-----Original Message-----
Hello all,

I found that someone has done this already and I have
implemented it in
our RT setup:

but it is not working and I just don’t understand why. Here is what I
added to /opt/rt3/share/html/Ticket/Elements/Tabs

if ( $Ticket->CurrentUserHasRight(‘ModifyTicket’) ) {
if ( $Ticket->Status ne ‘resolved’ ) {
$actions->{‘B’} = {

         path => 

“Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=” . $id,
title => loc(‘Resolve’) };
}
if ( $Ticket->Status ne ‘open’ ) {
$actions->{‘C’} = { path =>
“Ticket/Display.html?Status=open&id=” . $id,
title => loc(‘Open it’) };
}
# Spam stuff.
if ( $Ticket->CurrentUserHasRight(‘DeleteTicket’) ) {
$actions->{‘G’} = {
title => loc(‘Spam’),
path =>
“Ticket/Modify.html?id=$id&Status=deleted&Queue=16” };
}
}

However, I don’t see any change at all. What else do I have to do to
get this working. Note that I’m
using RT 3.4.4.


Bernd

Bernd,

Did you stop & restart apache after making the change?

Generally, it’s the best practice to make changes to “local” copies of the
RT files rather than editing them directly (see
Request Tracker Wiki). In your setup,
you’d copy the Tabs file to /opt/rt3/local/html/Ticket/Elements and edit
that file.

Actually, in this case there’s a callback for extending the Tabs - you
shouldn’t even need to edit the Tabs file. If you create
/opt/rt3/local/html/Callbacks/xxxxx/Ticket/Elements/Tabs/Default and make it
look like this, you should be all set:

%# BEGIN CODE
<%args>
$Ticket => undef
$actions => undef
$tabs => undef
$display_page => ‘Display’
</%args>

<%init>
if ( defined $Ticket && $Ticket->CurrentUserHasRight(‘DeleteTicket’) ) {
$actions->{‘G’} = {
title => loc(‘Spam’),
path =>
‘Ticket/Modify.html?id=’.$Ticket->id.‘&Status=deleted’ };
}
</%init>
%# END CODE

Make sure the key you choose for the actions hash (‘G’ in this case) is not
used in the stock Tabs file.

Steve

Stephen Turner
Senior Programmer/Analyst - Client Support Services
MIT Information Services and Technology (IS&T)

Did you stop & restart apache after making the change?

Yes I did but nothing happened.

Generally, it’s the best practice to make changes to “local” copies
of the
RT files rather than editing them directly (see

Request Tracker Wiki). In your
setup,
you’d copy the Tabs file to /opt/rt3/local/html/Ticket/Elements and
edit
that file.

Interesting. I never knew that.

Actually, in this case there’s a callback for extending the Tabs -
you
shouldn’t even need to edit the Tabs file. If you create

/opt/rt3/local/html/Callbacks/xxxxx/Ticket/Elements/Tabs/Default and
make it
look like this, you should be all set:

%# BEGIN CODE

<%args>

$Ticket => undef

$actions => undef

$tabs => undef

$display_page => ‘Display’

</%args>

<%init>

if ( defined $Ticket && $Ticket->CurrentUserHasRight(‘DeleteTicket’)
) {
$actions->{‘G’} = {

          title => loc('Spam'),                                   
          path  =>                                                

‘Ticket/Modify.html?id=’.$Ticket->id.‘&Status=deleted’ };

}

</%init>

%# END CODE

Make sure the key you choose for the actions hash (‘G’ in this case)
is not
used in the stock Tabs file.

Thanks for the help Steve. That worked perfectly. I will continue

to investigate this callback mechanism. It’s pretty cool.

Bernd
Check Out the new free AIM(R) Mail – 2 GB of storage and
industry-leading spam and email virus protection.

Actually, in this case there’s a callback for extending the Tabs -
you shouldn’t even need to edit the Tabs file. If you create

/opt/rt3/local/html/Callbacks/xxxxx/Ticket/Elements/Tabs/Default and
make it look like this, you should be all set:

%# BEGIN CODE

<%args>

$Ticket => undef

$actions => undef

$tabs => undef

$display_page => ‘Display’

</%args>

<%init>

if ( defined $Ticket && $Ticket->CurrentUserHasRight(‘DeleteTicket’)
) {
$actions->{‘G’} = {

          title => loc('Spam'),                                   
          path  =>                                                

‘Ticket/Modify.html?id=’.$Ticket->id.’&Status=deleted’ };

}

</%init>

%# END CODE

I changed

path => ‘Ticket/Modify.html?id=’.$Ticket->id.’&Status=deleted’ };

to

path =>
‘Ticket/Modify.html?id=’.$Ticket->id.’&Status=deleted&Queue=16’ };

and restarted Apache. The change has not taken effect. I even deleted
all of my browser’s cache just to be sure. What else should I do to
make this change take effect?

Bernd

Check Out the new free AIM® Mail – 2 GB of storage and
industry-leading spam and email virus protection.

Hello everyone,

On the main page of my RT website, I have a table called “15 newest
unknown tickets…” and each ticket on that table has a link on the
right side called “Take”. I would like to add another link called
"Spam" just beside “Take” that will delete the ticket it is refering
to. Is this possible? How would I accomplish this? I’m sure there is a
callback for this.

Bernd
Check Out the new free AIM® Mail – 2 GB of storage and
industry-leading spam and email virus protection.

hmmm ;
Just read this list posting/messages for today … there is a thread
about Adding a Spam ticket Tab …
Roy
berndlosert@aim.com wrote:

hmmm ;
Just read this list posting/messages for today … there is a thread
about Adding a Spam ticket Tab …

Yes, I know. I started that thread.

Bernd

-----Original Message-----

Hello everyone,

On the main page of my RT website, I have a table called “15 newest
unknown tickets…” and each ticket on that table has a link on the
right side called “Take”. I would like to add another link called
"Spam" just beside “Take” that will delete the ticket it is refering
to. Is this possible? How would I accomplish this? I’m sure
there is a
callback for this.


Bernd

Aah - I thought you wanted the spam link to appear on the ticket
reply/comment screen (Ticket/Modify.html). That’s what the mod you
originally made would have done. You should investigate the mason component
that displays the list of unowned tickets and see if there’s a callback in
there that would help. If not, make a copy of the element and add in the
spam link.

Good luck,
Steve

Stephen Turner
Senior Programmer/Analyst - Client Support Services
MIT Information Services and Technology (IS&T)

Aah - I thought you wanted the spam link to appear on the ticket
reply/comment screen (Ticket/Modify.html). That’s what the mod you
originally made would have done. You should investigate the mason
component
that displays the list of unowned tickets and see if there’s a
callback in
there that would help. If not, make a copy of the element and add in
the
spam link.

I want both. The spam tab is already implemented (thanks to you). You
wouldn’t happen to know which mason component shows the unowned tickets
now would you?

Thanks in advance,
Bernd

Check Out the new free AIM® Mail – 2 GB of storage and
industry-leading spam and email virus protection.

I want both. The spam tab is already implemented (thanks to you). You
wouldn’t happen to know which mason component shows the unowned
tickets
now would you?

I think I found it. Is it in share/html/Elements/MyRequests? Do I copy
this to
local/html/Elements/MyRequests and update it accordingly?

Bernd

Check Out the new free AIM® Mail – 2 GB of storage and
industry-leading spam and email virus protection.

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf
Of berndlosert@aim.com
Sent: Thursday, November 09, 2006 1:04 PM
To: berndlosert@aim.com; sturner@mit.edu;
rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Adding a Spam Link on Main Page

I want both. The spam tab is already implemented (thanks to
you). You
wouldn’t happen to know which mason component shows the unowned
tickets
now would you?

I think I found it. Is it in share/html/Elements/MyRequests?
Do I copy
this to
local/html/Elements/MyRequests and update it accordingly?


Bernd

That looks like the right element, Bernd - yes, you just need to make that
local copy and edit.

Steve

I think I found it. Is it in share/html/Elements/MyRequests?
Do I copy this to
local/html/Elements/MyRequests and update it accordingly?

That looks like the right element, Bernd - yes, you just need to make
that
local copy and edit.

Yep. That is what I did. Unfortunately it didn’t work on the first try
and RT
would ignore any updates to the file. After searching the mailing list,
I found
out that I had to delete mason’s cached data under var/mason_data. Now
it works perfectly. Thanks a lot.

Bernd

Check Out the new free AIM® Mail – 2 GB of storage and
industry-leading spam and email virus protection.