<br><font size=2 face="sans-serif">Hello,</font>
<br>
<br><font size=2 face="sans-serif">thank you very much for all the code
hint, it makes it simpler and easy to follow.</font>
<br><font size=2 face="sans-serif">I'm not very aware of HTML security
problems. so far, what i understand from your explanation is to escape
the html code with the \ symbol before the quoted html text.</font>
<br><font size=2 face="sans-serif">the new code is now here, i also added
a link at the bottom to create a new dependson ticket wit a specific queue&owner.</font>
<br><font size=2 face="sans-serif">It's one more open road to great RT
customisation !</font>
<br>
<br><font size=2 face="sans-serif"> LinksList =></font>
<br><font size=2 face="sans-serif"> {</font>
<br><font size=2 face="sans-serif"> title
=> 'Liens', # loc</font>
<br><font size=2 face="sans-serif"> attribute
=> 'Status',</font>
<br><font size=2 face="sans-serif"> value
=> sub {</font>
<br><font size=2 face="sans-serif">
my $Ticket = shift;</font>
<br><font size=2 face="sans-serif">
my @result;</font>
<br><font size=2 face="sans-serif"> my
$base_url = RT->Config->Get('WebPath') . '/Ticket/Display.html?id=';
</font>
<br><font size=2 face="sans-serif">
#tickets with DependsOn relation</font>
<br><font size=2 face="sans-serif">
my $DepOn = $Ticket->DependsOn;</font>
<br><font size=2 face="sans-serif"> while(
my $copain = $DepOn->Next ) {</font>
<br><font size=2 face="sans-serif">
my $url = $base_url . $copain->TargetObj->id;</font>
<br><font size=2 face="sans-serif">
if ($copain->TargetObj->Status =~ /^(?:new|open|stalled)$/
) {</font>
<br><font size=2 face="sans-serif">
push (@result, (\"<FONT
COLOR=\"red\"><LI><a href=\"$url\">", $copain->TargetObj->Subject,
\"</a></LI></FONT>"));}
elsif ($copain->TargetObj->Status
=~ /^resolved$/ ) {</font>
<br><font size=2 face="sans-serif">
push (@result, (\"<SPAN
CLASS=\"ticket-inactive\"><LI><a href=\"$url\">", $copain->TargetObj->Subject,
\"</a></LI></SPAN>"));}</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif">
#tickets with Child relation</font>
<br><font size=2 face="sans-serif">
my $members = $Ticket->Members();</font>
<br><font size=2 face="sans-serif">
while( my $copain = $members->Next ) {</font>
<br><font size=2 face="sans-serif">
my $url = $base_url . $copain->BaseObj->id;</font>
<br><font size=2 face="sans-serif">
if ($copain->BaseObj->Status =~ /^(?:new|open|stalled)$/
) {</font>
<br><font size=2 face="sans-serif">
push (@result, (\"<FONT
COLOR=\"blue\"><LI><a href=\"$url\">", $copain->BaseObj->Subject,
\"</a></LI></FONT>"));}</font>
<br><font size=2 face="sans-serif">
elsif ($copain->BaseObj->Status =~ /^resolved$/
) {</font>
<br><font size=2 face="sans-serif">
push (@result, (\"<SPAN
CLASS=\"ticket-inactive\"><LI><a href=\"$url\">", $copain->BaseObj->Subject,
\"</a></LI></SPAN>"));}</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif"> if
( @result ) { # found links</font>
<br><font size=2 face="sans-serif">
@result = (\'<ul>', @result, \'</ul>');</font>
<br><font size=2 face="sans-serif"> }
</font>
<br><font size=2 face="sans-serif"> $base_url
= RT->Config->Get('WebPath') . '/Ticket/Create.html?CloneTicket=';</font>
<br><font size=2 face="sans-serif"> push(@result,
( \"<a href=\"", $base_url, $Ticket->id, \"&DependsOn-new=",
$Ticket->id,\"&Queue=1&Owner=6\">", "CREER
NOUVELLE TACHE", \"</a>" ));</font>
<br><font size=2 face="sans-serif"> return
@result;</font>
<br><font size=2 face="sans-serif"> }</font>
<br><font size=2 face="sans-serif">},</font>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Raphaël MOUNEYRES<br>
</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Ruslan Zakirov <ruz@bestpractical.com></b>
</font>
<br><font size=1 face="sans-serif">Envoyé par : ruslan.zakirov@gmail.com</font>
<p><font size=1 face="sans-serif">10/08/2011 15:13</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">Raphaël MOUNEYRES <raphael.mouneyres@sagemcom.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">Re: [rt-users] adding Ticket links in
search result</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3><br>
</font>
<br><font size=3>2011/8/10 Raphaël MOUNEYRES <</font><a href=mailto:raphael.mouneyres@sagemcom.com><font size=3 color=blue><u>raphael.mouneyres@sagemcom.com</u></font></a><font size=3>></font>
<br><font size=2 face="sans-serif"><br>
Hi,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Ruz : I can see something related to a $LinkCallback, but the perl code
is still too tricky for me. Maybe in a few month ;)</font><font size=3>
</font>
<br>
<br><font size=3>Comments on code below.</font>
<br><font size=3> </font>
<br><font size=2 face="sans-serif">So, I managed to have a new ColumnMap
definition, working, with a great usefull color customization (see attached
image).</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I had it working adding manually the '__LinksList__' in the Advanced tab
of search page, <b>now i have to figure out how to add it to the default
choice list...</b></font><font size=3> </font><font size=2 face="sans-serif"><br>
a good training !</font><font size=3> </font>
<br>
<br><font size=3>Look at share/html/Search/Elements/BuildFormatString</font>
<br><font size=3> </font>
<br>
<br>
<br><font size=2 face="sans-serif">Here is the revelant code added to /opt/rt3/share/html/Elements/RT__Ticket/ColumnMap
: </font>
<br>
<br><font size=3>See comments inlined:</font>
<br><font size=3> </font>
<br><font size=2 face="sans-serif"><br>
LinksList =></font><font size=3> </font><font size=2 face="sans-serif"><br>
{</font><font size=3> </font><font size=2 face="sans-serif"><br>
title => 'Liens', # loc</font><font size=3>
</font><font size=2 face="sans-serif"><br>
attribute => 'Status',</font><font size=3>
</font><font size=2 face="sans-serif"><br>
value => sub {</font><font size=3>
</font><font size=2 face="sans-serif"><br>
my $Ticket = shift;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
my $result = "<UL>";</font><font size=3>
</font><font size=2 face="sans-serif"><br>
my $SearchURL;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
my $statuscolor;</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
#tickets avec relation
DependsOn</font><font size=3> </font><font size=2 face="sans-serif"><br>
my $DepOn = $Ticket->DependsOn;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
if ($DepOn) {</font>
<br>
<br><font size=3>$DepOn is always true, it just can be empty.</font>
<br><font size=3> </font>
<br><font size=2 face="sans-serif">
while( my $copain = $DepOn->Next
) {</font><font size=3> </font><font size=2 face="sans-serif"><br>
$SearchURL = RT->Config->Get('WebPath')
. '/Ticket/Display.html?id=' . $copain->TargetObj->id;</font>
<br>
<br><font size=3>put repeated part out of the loop, for example:</font>
<br>
<br><font size=3>my $base_url = RT->Config->Get('WebPath') .
'/Ticket/Display.html?id=';</font>
<br>
<br><font size=3>inside loop:</font>
<br>
<br><font size=3>my $url = $base_url . $copain->TargetObj->id;</font>
<br><font size=3> </font>
<br><font size=2 face="sans-serif">
$result .= <UL>;</font>
<br>
<br><font size=3>above line is wrong :) It actually a valid perl code that
is equivalent to `$result .= undef` what is better in your case. You should
move `$result .= '<ul>';` outside of while loop. </font>
<br>
<br><font size=3> </font>
<br><font size=2 face="sans-serif">
if($copain->TargetObj->Status
=~ /^(?:new|open|stalled)$/ ) {</font><font size=3> </font><font size=2 face="sans-serif"><br>
$result
.= "<FONT COLOR=\"red\"><LI><a href=\"$SearchURL\">"
. $copain->TargetObj->Subject . "</a></LI></FONT>";}</font><font size=3>
</font>
<br>
<br><font size=3>As you return result as reference to one string scalar
then you have to escape HTML your self. With this code you added a security
hole into your RT. As solution, use array @results. Push parts into this
array. If part is valid and trusted HTML then push a reference, otherwise
push scalar. At the end return whole array. For example:</font>
<br>
<br><font size=3>push @result, \"<FONT COLOR=\"red\"><LI><a
href=\"$SearchURL\">", $copain->TargetObj->Subject,
\"html here", "text here";</font>
<br><font size=3>...</font>
<br><font size=3>return @result;</font>
<br>
<br><font size=3> </font>
<br><font size=2 face="sans-serif">
else
{</font><font size=3> </font><font size=2 face="sans-serif"><br>
$result
.= "<SPAN CLASS=\"ticket-inactive\"><LI><a
href=\"$SearchURL\">" . $copain->TargetObj->Subject
. "</a></LI></SPAN>";}</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
}</font><font size=3>
</font><font size=2 face="sans-serif"><br>
else {</font><font size=3>
</font><font size=2 face="sans-serif"><br>
$result .= 'Pas
de tickets dependants';</font>
<br>
<br><font size=3>This wouldn't work. Instead you can do the following:</font>
<br>
<br><font size=3>...</font>
<br><font size=3>my @result;</font>
<br><font size=3>while ( ... ) {</font>
<br><font size=3> ...</font>
<br><font size=3>}</font>
<br>
<br><font size=3>if ( @result ) { # found links</font>
<br><font size=3> @result = (\'<ul>', @result, '</ul>');</font>
<br><font size=3>} else {</font>
<br><font size=3> @result = ('No links');</font>
<br><font size=3>}</font>
<br><font size=3>return @result;</font>
<br><font size=3> </font>
<br><font size=2 face="sans-serif"><br>
}</font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
$result .= "</UL>";</font><font size=3>
</font><font size=2 face="sans-serif"><br>
return \$result;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
},</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Result shown as :</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
<br>
Raphaël MOUNEYRES<br>
Ingénieur Moyens Tests<br>
Avenue Paul Gellos 64990 Mouguerre<br>
Phone: +33 (0)5 59 58 41 51</font><font size=3> <br>
<br>
</font>
<p>
<table width=100%>
<tr valign=top>
<td width=41%><font size=1 face="sans-serif"><b>Ruslan Zakirov <</b></font><a href=mailto:ruz@bestpractical.com target=_blank><font size=1 color=blue face="sans-serif"><b><u>ruz@bestpractical.com</u></b></font></a><font size=1 face="sans-serif"><b>></b>
<br>
Envoyé par : </font><a href=mailto:ruslan.zakirov@gmail.com target=_blank><font size=1 color=blue face="sans-serif"><u>ruslan.zakirov@gmail.com</u></font></a><font size=3>
</font>
<p><font size=1 face="sans-serif">10/08/2011 13:06</font><font size=3>
</font>
<td width=58%>
<br>
<table width=100%>
<tr valign=top>
<td width=8%>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td width=91%><font size=1 face="sans-serif">Raphaël MOUNEYRES <</font><a href=mailto:raphael.mouneyres@sagemcom.com target=_blank><font size=1 color=blue face="sans-serif"><u>raphael.mouneyres@sagemcom.com</u></font></a><font size=1 face="sans-serif">></font><font size=3>
</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">RT Users Mailing List <</font><a href="mailto:rt-users@lists.bestpractical.com" target=_blank><font size=1 color=blue face="sans-serif"><u>rt-users@lists.bestpractical.com</u></font></a><font size=1 face="sans-serif">></font><font size=3>
</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">Re: [rt-users] adding Ticket links in
search result</font></table>
<br>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br><font size=3><br>
<br>
<br>
<br>
10.08.2011 12:58 пользователь "Raphaël MOUNEYRES"
<</font><a href=mailto:raphael.mouneyres@sagemcom.com target=_blank><font size=3 color=blue><u>raphael.mouneyres@sagemcom.com</u></font></a><font size=3>>
написал:<br>
><br>
><br>
> Hello, <br>
><br>
> thanks for the hint, but it doesn't work as expected. <br>
> In fact, in the advanced page, the fileds used are : <br>
> '__DependsOn__', <br>
> '__Children__' <br>
> each of them is, by default, creating by itself a List of clickable
ticket IDs, and i'd like to add subject and formatting. <br>
><br>
> Also, in /share/html/Elements/RT__Ticket/ColumnMap, i can see that
the 'ExtendedStatus' is doing some query for dependedon tickets, so i can
try to do something similar, but i can't find the same things for 'Children'
or 'DependsOn' <br>
><br>
> If someone can point me at the sourcecode trigered by the above fields,
i could change it to suit my needs <br>
Code for links in the same file. It's just generated with a loop. </font>
<p><font size=3>> thank you, <br>
><br>
> Raphaël MOUNEYRES<br>
><br>
><br>
><br>
><br>
> Gerard FENELON <</font><a href="mailto:gerard@eve-team.com" target=_blank><font size=3 color=blue><u>gerard@eve-team.com</u></font></a><font size=3>>
<br>
> Envoyé par : </font><a href="mailto:rt-users-bounces@lists.bestpractical.com" target=_blank><font size=3 color=blue><u>rt-users-bounces@lists.bestpractical.com</u></font></a><font size=3><br>
><br>
> 09/08/2011 12:17<br>
> A<br>
> RT Users Mailing List <</font><a href="mailto:rt-users@lists.bestpractical.com" target=_blank><font size=3 color=blue><u>rt-users@lists.bestpractical.com</u></font></a><font size=3>><br>
> cc<br>
> Objet<br>
> Re: [rt-users] adding Ticket links in search result<br>
><br>
><br>
><br>
><br>
><br>
> Hi Raphael<br>
><br>
> keep to the list.<br>
> In particular because I don't have the answer to this further question.<br>
><br>
> I have never tried anything like what you are trying.<br>
> It is possible that for this you might have to use a ColumnMap<br>
><br>
> However concerning "display the Ticket subject next to his number"<br>
> I believe that '__id__ __Subject__ ' should work.<br>
><br>
> Gerard<br>
><br>
><br>
> On 2011-08-09 11:28, Raphaël MOUNEYRES wrote: <br>
><br>
> Hi Gerard, <br>
><br>
> i've tried some but i'm not sure to be able to do conditional formatting
such as : <br>
> % my $inactive = $member->QueueObj->IsInactiveStatus($member->Status);
<br>
> <span class="<% $inactive ? 'ticket-inactive'
: '' %>"> <br>
> <%$member->Id%>: (<%$member->OwnerObj->Name%>)
<%$member->Subject%> [<% loc($member->Status) %>] <br>
> </span> <br>
><br>
> for example, if i do <br>
> ' <b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',<br>
> '<span class="ticket-inactive">__Children__</span>'
<br>
> for sure all children tickets are displayed as ticket-inactive, but
not depending on their actual status... <br>
><br>
> Also i'd like to display the Ticket subject next to his number....
<br>
> Well i'm doing more experiments now, but any other hints are welcome.
<br>
><br>
> Raphaël MOUNEYRES<br>
><br>
><br>
> Gerard FENELON <</font><a href="mailto:gerard@eve-team.com" target=_blank><font size=3 color=blue><u>gerard@eve-team.com</u></font></a><font size=3>>
<br>
> Envoyé par : </font><a href="mailto:rt-users-bounces@lists.bestpractical.com" target=_blank><font size=3 color=blue><u>rt-users-bounces@lists.bestpractical.com</u></font></a><font size=3><br>
><br>
> 09/08/2011 11:08<br>
><br>
> A<br>
> </font><a href="mailto:rt-users@lists.bestpractical.com" target=_blank><font size=3 color=blue><u>rt-users@lists.bestpractical.com</u></font></a><font size=3><br>
> cc<br>
> Objet<br>
> Re: [rt-users] adding Ticket links in search result<br>
><br>
><br>
><br>
><br>
><br>
> Hello<br>
><br>
> you can do a lot of things in the advanced tab of the search interface<br>
> such as<br>
><br>
> '<b><a href="/Ticket/Modify.html?id=__id__">__id__</a></b>/TITLE:#',<br>
> '<span class="yoyodine-status-__StatusNoLoc__">__ExtendedStatus__</span>',<br>
> '<span class="yoyodine-severity-__CustomField.{Severity}__">__CustomField.{Severity}__</span>',<br>
> '<span class="yoyodine-priority-__CustomField.{Customer priority}__">__CustomField.{Customer
priority}__</span>',<br>
><br>
> I would say, use this when you want to tweek the display.<br>
> Use ColumnMap when you have to calculate values<br>
><br>
> Gerard<br>
><br>
><br>
> On 2011-08-09 10:48, Raphaël MOUNEYRES wrote: <br>
> Hello, <br>
><br>
> i'm trying to build a search wich would have a colum displaying the
tickets links exactly the same way as is TicketDisplay page (with 3.8 install)
<br>
> I found two things : <br>
> - this code related to the above page is in /opt/rt3/share/html/Elements/ShowLinks
<br>
> - in ticket search engine, i can display children/DependsOn links,
but the result will only show ticket ids without formatting. <br>
><br>
> Should i create a new ColumnMap (as recently discussed) pasting some
code from the ShowLinks File, or any simpler way to modify the existing
colums ? <br>
> Could someone help me choose the best way to go ? <br>
><br>
> After a few month dealing with RT, i've been gaining some perl programming
experience, thanks guys ! <br>
><br>
> Raphaël MOUNEYRES <br>
><br>
> --------<br>
> 2011 Training: </font><a href=http://bestpractical.com/services/training.html target=_blank><font size=3 color=blue><u>http://bestpractical.com/services/training.html</u></font></a><font size=3>
<br>
><br>
> #<br>
> " Ce courriel et les documents qui lui sont joints peuvent contenir
des<br>
> informations confidentielles ou ayant un caractère privé. S'ils ne
vous sont<br>
> pas destinés, nous vous signalons qu'il est strictement interdit de
les<br>
> divulguer, de les reproduire ou d'en utiliser de quelque manière que
ce<br>
> soit le contenu. Si ce message vous a été transmis par erreur, merci
d'en<br>
> informer l'expéditeur et de supprimer immédiatement de votre système<br>
> informatique ce courriel ainsi que tous les documents qui y sont attachés."<br>
><br>
><br>
>
******<br>
><br>
> " This e-mail and any attached documents may contain confidential
or<br>
> proprietary information. If you are not the intended recipient, you
are<br>
> notified that any dissemination, copying of this e-mail and any attachments<br>
> thereto or use of their contents by any means whatsoever is strictly<br>
> prohibited. If you have received this e-mail in error, please advise
the<br>
> sender immediately and delete this e-mail and all attached documents<br>
> from your computer system."<br>
> #<br>
><br>
><br>
> --------<br>
> RT Training Sessions (</font><a href=http://bestpractical.com/services/training.html target=_blank><font size=3 color=blue><u>http://bestpractical.com/services/training.html</u></font></a><font size=3>)<br>
> * Chicago, IL, USA — September 26 & 27, 2011<br>
> * San Francisco, CA, USA — October 18 & 19, 2011<br>
> * Washington DC, USA — October 31 & November 1, 2011<br>
> * Melbourne VIC, Australia — November 28 & 29, 2011<br>
> * Barcelona, Spain — November 28 & 29, 2011 </font>
<p><tt><font size=3>#<br>
" Ce courriel et les documents qui lui sont joints peuvent contenir
des<br>
informations confidentielles ou ayant un caractère privé. S'ils ne vous
sont<br>
pas destinés, nous vous signalons qu'il est strictement interdit de les<br>
divulguer, de les reproduire ou d'en utiliser de quelque manière que ce<br>
soit le contenu. Si ce message vous a été transmis par erreur, merci d'en<br>
informer l'expéditeur et de supprimer immédiatement de votre système<br>
informatique ce courriel ainsi que tous les documents qui y sont attachés."<br>
<br>
<br>
******<br>
<br>
" This e-mail and any attached documents may contain confidential
or<br>
proprietary information. If you are not the intended recipient, you are<br>
notified that any dissemination, copying of this e-mail and any attachments<br>
thereto or use of their contents by any means whatsoever is strictly<br>
prohibited. If you have received this e-mail in error, please advise the<br>
sender immediately and delete this e-mail and all attached documents<br>
from your computer system."<br>
#<br>
</font></tt>
<p><font size=3><br>
--------<br>
RT Training Sessions (</font><a href=http://bestpractical.com/services/training.html target=_blank><font size=3 color=blue><u>http://bestpractical.com/services/training.html</u></font></a><font size=3>)<br>
* Chicago, IL, USA — September 26 & 27, 2011<br>
* San Francisco, CA, USA — October 18 & 19, 2011<br>
* Washington DC, USA — October 31 & November 1, 2011<br>
* Melbourne VIC, Australia — November 28 & 29, 2011<br>
* Barcelona, Spain — November 28 & 29, 2011</font>
<br><font size=3><br>
<br>
<br>
-- <br>
Best regards, Ruslan.</font>
<br><PRE>#
" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caractre priv. S'ils ne vous sont
pas destins, nous vous signalons qu'il est strictement interdit de les
divulguer, de les reproduire ou d'en utiliser de quelque manire que ce
soit le contenu. Si ce message vous a t transmis par erreur, merci d'en
informer l'expditeur et de supprimer immdiatement de votre systme
informatique ce courriel ainsi que tous les documents qui y sont attachs."
******
" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."
#
</PRE>