[rt-users] creat MAILTO link in search format

Payam Poursaied payam at rasana.net
Thu Jun 10 16:50:27 EDT 2010


Based on my previous email, I wanted to have mailto link in my search page
and also ticket display page to easily use local mail clients such as
outlook to send correspond and add comment for a specific ticket.

Based on Kevin's help, now I created a column map and also a callback. I put
them here so may someone else find it useful. ( it might be so simple for
many ones here but it took me a time to create it so I put it for those who
may be interested )

* create "Link to Correspond and Comment" in Search result
- modify rt3/share/html/Elements/RT__Ticket/ColumnMap and add the
followings:

    LinkToCorrespond => {
        title => 'Correspond', # loc
        value => sub {
            return \('<a
href="mailto:'.$_[0]->QueueObj->CorrespondAddress().'?subject=['.$_[0]->Queu
eObj->SubjectTag().' #'.$_[0]->id.']'. $_[0]->Subject() .'">'),
                $_[0]->loc('Reply'), \'</a>';
        },
    },
    LinkToComment => {
        title => 'Comment', # loc
        value => sub {
            return \('<a
href="mailto:'.$_[0]->QueueObj->CommentAddress().'?subject=['.$_[0]->QueueOb
j->SubjectTag().' #'.$_[0]->id.']'. $_[0]->Subject() .'">'),
                $_[0]->loc('Comment'), \'</a>';
        },
    },


- reload the webserver
- go to the ticket search page and switch to advanced mode
- now in the "Format" textarea you could have '__LinkToCorrespond__' and
'__LinkToComment__'


* create "Link to Correspond and Comment" in ticket display page
- create the directory hierarchy :
rt3/local/html/Callbacks/YOURCallbacks/Ticket/Elements/ShowBasics
- create "EndOfList" file and put the followings inside it:
  <tr>
    <td class="label top"><&|/l&>Action</&>:</td>
    <td class="label top">
<a href="mailto:<% $Ticket->QueueObj->CorrespondAddress() %>?subject=[<%
$Ticket->QueueObj->SubjectTag() %> #<% $Ticket->id %>]<% $Ticket->Subject()
%>">Reply</a>
|
<a href="mailto:<% $Ticket->QueueObj->CommentAddress() %>?subject=[<%
$Ticket->QueueObj->SubjectTag() %> #<% $Ticket->id %>]<% $Ticket->Subject()
%>">Comment</a>


</td>
  </tr>
<%ARGS>
$Ticket => undef
</%ARGS>
<%INIT>
</%INIT>

- Reload the webserver and then you will find two links in the basic part of
summery.


P.S. Internet Explorer has some problem with these links when open mail
client! Everything in the subject after "#" disappear! But firefox works
fine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5180 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20100611/a5a919d0/attachment.bin>


More information about the rt-users mailing list