Title: Gmail Style Reply Collapse
Version: 0.94
Author: Erik van Dijk (tsjaar)
Demo: I'm sorry, no demo
Download: See instructions below
Website:
Short description:
Collapse the reply's to an ticket and just see the last ticket reply.
Tested on IE7 and FF 2.0
*************************************/
If you have a long list of reply's you have to scroll all the way down to see the last reply. This mod collapses all the reply's but the last one. This way, you will directly see the last reply.
The 2 lines with the date and name will be visible, and there will show up an icon next to the date, if there is an attachement in this reply. A click on this part of the reply will open the reply (the mouse will become a pointer / hand if you hover). Click again, and the reply will be collapsed again.
Just edit the code in the 2 files: admin_ticket.php and ticket.php
Replace the php code that looks like:
Code: Select all
<?php
$i=1;
while ($reply = hesk_dbFetchAssoc($result))
//....all the way up to the end of the script part...
}
?>
Code: Select all
<?php
$i=1;
$replyNum=0; //number of reply we are in
while ($reply = hesk_dbFetchAssoc($result))
{
if ($i) {$color=''; $i=0;}
else {$color='class="white"'; $i=1;}
$replyNum++;
$hideReply = "";
//hide all reply's, but the last one
if($replyNum != $replies){
$hideReply = 'style="display:none;"';
}
$hasAtt = ""; //if this reply has an attribute, add an image next to the date
if ($hesk_settings['attachments']['use'] && !empty($reply['attachments'])) {
$hasAtt = '<img src="img/clip.gif" />';
}
echo <<<EOC
<tr>
<td $color onclick="hesk_toggleLayerDisplay('reply_$replyNum');" style="cursor:pointer;">
<table border="0" cellspacing="1">
<tr>
<td $color>$replyNum. $hesklang[date]:</td>
<td $color>$reply[dt] $hasAtt</td>
</tr>
<tr>
<td $color>$hesklang[name]:</td>
<td $color>$reply[name]</td>
</tr>
</table>
<span id="reply_$replyNum" $hideReply>
<p><b>$hesklang[message]:</b></p>
<p>$reply[message]</p>
EOC;
if ($hesk_settings['attachments']['use'] && !empty($reply['attachments'])) {
echo '<p><b>'.$hesklang['attachments'].':</b><br>';
$att=explode('#####',substr($reply['attachments'], 0, -5));
foreach ($att as $myatt) {
echo '<img src="img/clip.gif" width="20" height="20"><a href="'.$myatt.'" target="_blank">'.substr(strstr($myatt, $trackingID),16).'</a><br>';
}
echo '</p>';
}
echo '</span></td></tr>';
}
?>
[edit]
One (small) disadvantage: when you click on a link, the reply will collapse. I don't know (yet) how to solve this. I still want to click anywhere in the reply to collapse/show the reply. If you have an idea, I would like to hear it.
[/edit]