(kinda done)
Here is code that will add a tab to the bottom portion of include/staff/viewticket.inc.php that will display all attachments for said ticket separated into staff and user sections. Links don't quite work yet. I'll update this post as it becomes more complete.
http://i64.photobucket.com/albums/h186/teryai/attacherz-4.jpg(http://i64.photobucket.com/albums/h186/teryai/attacherz-4.jpg)
Find first this line of code...
<div class="tabber">
Directly BELOW that add this code...
<? $sqlz = "SELECT * FROM `ost_ticket_attachment` ORDER BY file_name ASC";
$resultz=mysql_query($sqlz);
$numz=mysql_numrows($resultz);
$iz=0;
while ($iz < $numz) {
$filez=mysql_result($resultz,$iz,"file_name");
$key=mysql_result($resultz,$iz,"file_key");
$idz=mysql_result($resultz,$iz,"ticket_id");
$tikid=mysql_result($resultz,$iz,"attach_id");
$iz++;
}
?>
<div id="attachments" class="tabbertab">
<h2>Attachments</h2>
<center>
<fieldset style="
padding: 0.2em 0.5em 0.5em 0.5em;
border solid #369;
font-size%;
text-align;
font-weight;
background-color: #c3d9ff;">
<legend >All attachments for this ticket</legend>
<br />
Now lets seperate the client attachments from the staff attachments
CLIENT ATTACHMENTS 'M'
<fieldset style="
padding: 0.2em 0.5em;
border solid #369;
font-size%;
color:#369;
font-weight;
text-align;
background-color: #FFF;">
<legend >Client</legend>
<? $sqlz = "SELECT * FROM `ost_ticket_attachment` WHERE ref_type = 'M' ORDER BY file_name ASC";
$resultz=mysql_query($sqlz);
$numz=mysql_numrows($resultz);
$iz=0;
while ($iz < $numz) {
$filez=mysql_result($resultz,$iz,"file_name");
$idz=mysql_result($resultz,$iz,"ticket_id");
$key=mysql_result($resultz,$iz,"file_key");
$tikid=mysql_result($resultz,$iz,"attach_id");
if ($idz == $id) {
echo "<img target=\'_blank\' src=\"/support/images/icons/attachment.gif\" width=\"16\" height=\"15\" alt=\"tickets woot\" /> <a href=\"http://www.yourwebsite.com/support/scp/attachment.php?id=$tikid&ref=$key\">$filez</a> <br /></b>";
$iz++;
}
?>
</fieldset>
<br />
CLIENT ATTACHMENTS 'R'
<fieldset style="
padding: 0.2em 0.5em;
border solid #369;
font-size%;
text-align;
font-weight;
color:#369;
background-color: #FFF;
margin-bottom: 20px;">
<legend >Staff</legend>
<? $sqlz = "SELECT * FROM `ost_ticket_attachment` WHERE ref_type = 'R' ORDER BY file_name ASC";
$resultz=mysql_query($sqlz);
$numz=mysql_numrows($resultz);
$iz=0;
while ($iz < $numz) {
$filez=mysql_result($resultz,$iz,"file_name");
$idz=mysql_result($resultz,$iz,"ticket_id");
$key=mysql_result($resultz,$iz,"file_key");
$tikid=mysql_result($resultz,$iz,"attach_id");
if ($idz == $id) {
echo "<img target=\'_blank\' src=\"/support/images/icons/attachment.gif\" width=\"16\" height=\"15\" alt=\"tickets woot\" /> <a href=\"http://www.yourwebsite.com/support/scp/attachment.php?id=$tikid&ref=$key\">$filez</a> <br /></b>";
}
$iz++;
}
?>
</fieldset>
</fieldset>
</center>
</div>
<? } ?>
You can move the position of the tab by placing the whole block of code between any of the other tabs divs, as long as its between the original tabber div.
And we have a new tab with all attachments, separated by client and staff, in alphabetical order.
There is, however, a problem with the links. I cannot seem to get them to work as they return an 'access denied' message. There is probably a method I am not using instead of building the links manually.
I'll try and figure it out later on...sleepy time. ;)