sparky Posted May 16, 2009 Share Posted May 16, 2009 (edited) Been a few requests to show the clientarea tickets in the reverse order (newest at the top) Make a Backup of your original viewticket.tpl Replace viewticket.tpl with this code {if $error} <p>{$LANG.supportticketinvalid}</p> {else} {literal} <script language="javascript"> $(document).ready(function(){ $("#addfileupload").click(function () { $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"50\"><br />"); return false; }); }); function rating_hover(id) { var selrating=id.split('_'); for(var i=1; i<=5; i++){ if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)"; if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_leave(id){ for(var i=1; i<=5; i++){ document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_select(id){ {/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal} } </script> {/literal} <h2>{$LANG.supportticketsviewticket} #{$tid}</h2> {if $errormessage} <div class="errorbox">{$errormessage}</div> <br /> {/if} <table width="100%" border="0" cellpadding="10" cellspacing="0" class="data"> <tr> <th>{$LANG.supportticketsdepartment}</th> <th>{$LANG.supportticketsdate}</th> <th>{$LANG.supportticketssubject}</th> <th>{$LANG.supportticketsstatus}</th> <th>{$LANG.supportticketsticketurgency}</th> {foreach key=num item=customfield from=$customfields}<th>{$customfield.name}</th>{/foreach} </tr> <tr> <td>{$department}</td> <td>{$date}</td> <td>{$subject}</td> <td>{$status}</td> <td>{$urgency}</td> {foreach key=num item=customfield from=$customfields}<td>{$customfield.value}</td>{/foreach} </tr> </table> <br /> {php} $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); {/php} {foreach key=num item=reply from=$replies} <div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"> <table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td>{$reply.user|replace:"<br /> ":" || "}</td> <td align="right">{$reply.date}</td> </tr> </table> </div> <div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$reply.attachments key=num item=attachment} <img src="images/article.gif" class="absmiddle" border="0" alt="{$attachment}" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} {if $reply.admin && $ratingenabled}{if $reply.rating} <table align="right" cellspacing="0" cellpadding="0"> <tr height="16"> <td>{$LANG.ticketreatinggiven} </td> <td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td> </tr> </table> {else} <table align="right" cellspacing="0" cellpadding="0"> <tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;"> <td>{$LANG.ticketratingquestion} </td> <td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td> <td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td> </tr> </table> {/if}<br /> <br /> <br /> {/if}</div> <br /> {/foreach} <div class="clientticketreplyheader"> <table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td>{$user|replace:"<br /> ":" || "}</td> <td align="right">{$date}</td> </tr> </table> </div> <div class="clientticketreply">{$message}{if $attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$attachments key=num item=attachment} <img src="images/article.gif" class="absmiddle" border="0" alt="{$attachment}" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} </div> {if $showclosebutton} <p align="center"> <input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&closeticket=true'" /> </p> {/if} <h3>{$LANG.supportticketsreply}</h3> <form method="post" action="{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data"> <table width="100%" cellspacing="0" cellpadding="0" class="frame"> <tr> <td><table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td> <td>{if $loggedin}{$clientname}{else} <input type="text" name="replyname" size=30 value="{$replyname}" /> {/if}</td> </tr> <tr> <td class="fieldarea">{$LANG.supportticketsclientemail}</td> <td>{if $loggedin}{$email}{else} <input type="text" name="replyemail" size=50 value="{$replyemail}" /> {/if}</td> </tr> <tr> <td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td> </tr> <tr> <td class="fieldarea">{$LANG.supportticketsticketattachments}</td> <td><input type="file" name="attachments[]" size="50" /> <a href="#" id="addfileupload"><img src="images/add.gif" class="absmiddle" alt="Add More" border="0" /> Add More</a><br /> <div id="fileuploads"></div> ({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td> </tr> </table></td> </tr> </table> <p align="center"> <input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /> </p> </form> {/if}<br /> Edited May 16, 2009 by sparky 0 Quote Link to comment Share on other sites More sharing options...
Impact-John Posted May 16, 2009 Share Posted May 16, 2009 very nice one again sparky it works great 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted May 16, 2009 Author Share Posted May 16, 2009 The above code is using the portal template This one is for the default template (same instructions as above) {if $error} <p>{$LANG.supportticketinvalid}</p> {else} {literal}<script language="javascript"> $(document).ready(function(){ $("#addfileupload").click(function () { $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"75\"><br />"); return false; }); }); function rating_hover(id) { var selrating=id.split('_'); for(var i=1; i<=5; i++){ if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)"; if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_leave(id){ for(var i=1; i<=5; i++){ document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_select(id){ {/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal} } </script>{/literal} <p class="heading2">{$LANG.supportticketsviewticket} #{$tid}</p> {if $errormessage}<div class="errorbox">{$errormessage|replace:'<li>':' # '} # </div><br />{/if} <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="100" class="fieldarea">{$LANG.supportticketsdepartment}:</td><td>{$department}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsdate}:</td><td>{$date}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketssubject}:</td><td>{$subject}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsstatus}:</td><td>{$status}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketurgency}:</td><td>{$urgency}</td></tr> {foreach key=num item=customfield from=$customfields} <tr><td class="fieldarea">{$customfield.name}:</td><td>{$customfield.value}</td></tr> {/foreach} </table> </td></tr></table> <br /> {php} $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); {/php} {foreach key=num item=reply from=$replies} <div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$reply.user|replace:"<br />":" || "}</td><td align="right">{$reply.date}</td></tr></table></div> <div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$reply.attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} {if $reply.admin && $ratingenabled}{if $reply.rating}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16"> <td>{$LANG.ticketreatinggiven} </td> <td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td> </tr></table>{else}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;"> <td>{$LANG.ticketratingquestion} </td> <td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td> <td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td> </tr></table>{/if}<br /><br /><br />{/if}</div> {/foreach} <div class="clientticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$user|replace:"<br />":" || "}</td><td align="right">{$date}</td></tr></table></div> <div class="clientticketreply">{$message}{if $attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if}</div> {if $showclosebutton} <p align="center"><input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&closeticket=true'" class="closeticket" /></p> {/if} <p><strong> » {$LANG.supportticketsreply}</strong></p> <form method="post" action="{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data"> <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td><td>{if $loggedin}{$clientname}{else}<input type="text" name="replyname" size=30 value="{$replyname}" />{/if}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsclientemail}</td><td>{if $loggedin}{$email}{else}<input type="text" name="replyemail" size=50 value="{$replyemail}" />{/if}</td></tr> <tr><td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketattachments}:</td><td><input type="file" name="attachments[]" size="75" /> <a href="#" id="addfileupload"><img src="images/add.gif" align="absmiddle" border="0" /> Add More</a><br /> <div id="fileuploads"></div> ({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td></tr> </table> </td></tr></table> <p align="center"><input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /></p> </form> {/if} 0 Quote Link to comment Share on other sites More sharing options...
Impact-John Posted May 16, 2009 Share Posted May 16, 2009 (edited) nice again one small adjustment i made was to move the reply box above the newest reply as well so the client does not have to scroll all the way through as well this is for default template as well. Sparky has full credit for the reversal of the order of replies i just moved the reply box to the top before the newest reply Your Choice on which one you want to use it all depends on where you want the reply box to be. MAKE A BACKUP OF YOUR viewticket.tpl replace all the code in your viewticket.tpl file with the following code {if $error} <p>{$LANG.supportticketinvalid}</p> {else} {literal}<script language="javascript"> $(document).ready(function(){ $("#addfileupload").click(function () { $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"75\"><br />"); return false; }); }); function rating_hover(id) { var selrating=id.split('_'); for(var i=1; i<=5; i++){ if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)"; if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_leave(id){ for(var i=1; i<=5; i++){ document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_select(id){ {/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal} } </script>{/literal} <p class="heading2">{$LANG.supportticketsviewticket} #{$tid}</p> {if $errormessage}<div class="errorbox">{$errormessage|replace:'<li>':' # '} # </div><br />{/if} <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="100" class="fieldarea">{$LANG.supportticketsdepartment}:</td><td>{$department}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsdate}:</td><td>{$date}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketssubject}:</td><td>{$subject}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsstatus}:</td><td>{$status}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketurgency}:</td><td>{$urgency}</td></tr> {foreach key=num item=customfield from=$customfields} <tr><td class="fieldarea">{$customfield.name}:</td><td>{$customfield.value}</td></tr> {/foreach} </table> </td></tr></table> <br /> {php} $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); {/php} <p><strong> » {$LANG.supportticketsreply}</strong></p> <form method="post" action="{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data"> <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td><td>{if $loggedin}{$clientname}{else}<input type="text" name="replyname" size=30 value="{$replyname}" />{/if}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsclientemail}</td><td>{if $loggedin}{$email}{else}<input type="text" name="replyemail" size=50 value="{$replyemail}" />{/if}</td></tr> <tr><td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketattachments}:</td><td><input type="file" name="attachments[]" size="75" /> <a href="#" id="addfileupload"><img src="images/add.gif" align="absmiddle" border="0" /> Add More</a><br /> <div id="fileuploads"></div> ({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td></tr> </table> </td></tr></table> <p align="center"><input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /></p> </form> <br /> {if $showclosebutton} <p align="center"><input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&closeticket=true'" class="closeticket" /></p> {/if} {foreach key=num item=reply from=$replies} <div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$reply.user|replace:"<br />":" || "}</td><td align="right">{$reply.date}</td></tr></table></div> <div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$reply.attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} {if $reply.admin && $ratingenabled}{if $reply.rating}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16"> <td>{$LANG.ticketreatinggiven} </td> <td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td> </tr></table>{else}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;"> <td>{$LANG.ticketratingquestion} </td> <td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td> <td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td> </tr></table>{/if}<br /><br /><br />{/if}</div> {/foreach} <div class="clientticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$user|replace:"<br />":" || "}</td><td align="right">{$date}</td></tr></table></div> <div class="clientticketreply">{$message}{if $attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if}</div> {/if} Edited May 16, 2009 by Impact-John 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted May 22, 2009 Author Share Posted May 22, 2009 I found a little error so you will need to make a small change Find {php} $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); {/php} and replace it with this{php}if (is_array($this->_tpl_vars['replies'])) { $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); } {/php} 0 Quote Link to comment Share on other sites More sharing options...
WebWorker Posted June 6, 2009 Share Posted June 6, 2009 Nice mod.. Does anyone know how to make this happen in the admin area? I tried replacing a few templates and it doesn't seem to effect the admin support ticket area. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted June 6, 2009 Author Share Posted June 6, 2009 Admin -> General Settings -> Support tab Ticket Reply List Order 0 Quote Link to comment Share on other sites More sharing options...
WebWorker Posted June 6, 2009 Share Posted June 6, 2009 Perfect, thank you! 0 Quote Link to comment Share on other sites More sharing options...
tommyquang Posted December 9, 2009 Share Posted December 9, 2009 Do you know how can I make this adjustment for portal template? nice again one small adjustment i made was to move the reply box above the newest reply as well so the client does not have to scroll all the way through as well this is for default template as well. Sparky has full credit for the reversal of the order of replies i just moved the reply box to the top before the newest reply Your Choice on which one you want to use it all depends on where you want the reply box to be. MAKE A BACKUP OF YOUR viewticket.tpl replace all the code in your viewticket.tpl file with the following code {if $error} <p>{$LANG.supportticketinvalid}</p> {else} {literal}<script language="javascript"> $(document).ready(function(){ $("#addfileupload").click(function () { $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"75\"><br />"); return false; }); }); function rating_hover(id) { var selrating=id.split('_'); for(var i=1; i<=5; i++){ if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)"; if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_leave(id){ for(var i=1; i<=5; i++){ document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_select(id){ {/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal} } </script>{/literal} <p class="heading2">{$LANG.supportticketsviewticket} #{$tid}</p> {if $errormessage}<div class="errorbox">{$errormessage|replace:'<li>':' # '} # </div><br />{/if} <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="100" class="fieldarea">{$LANG.supportticketsdepartment}:</td><td>{$department}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsdate}:</td><td>{$date}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketssubject}:</td><td>{$subject}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsstatus}:</td><td>{$status}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketurgency}:</td><td>{$urgency}</td></tr> {foreach key=num item=customfield from=$customfields} <tr><td class="fieldarea">{$customfield.name}:</td><td>{$customfield.value}</td></tr> {/foreach} </table> </td></tr></table> <br /> {php} $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); {/php} <p><strong> » {$LANG.supportticketsreply}</strong></p> <form method="post" action="{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data"> <table cellspacing="1" cellpadding="0" class="frame"><tr><td> <table width="100%" cellpadding="2"> <tr><td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td><td>{if $loggedin}{$clientname}{else}<input type="text" name="replyname" size=30 value="{$replyname}" />{/if}</td></tr> <tr><td class="fieldarea">{$LANG.supportticketsclientemail}</td><td>{if $loggedin}{$email}{else}<input type="text" name="replyemail" size=50 value="{$replyemail}" />{/if}</td></tr> <tr><td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td></tr> <tr><td class="fieldarea">{$LANG.supportticketsticketattachments}:</td><td><input type="file" name="attachments[]" size="75" /> <a href="#" id="addfileupload"><img src="images/add.gif" align="absmiddle" border="0" /> Add More</a><br /> <div id="fileuploads"></div> ({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td></tr> </table> </td></tr></table> <p align="center"><input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /></p> </form> <br /> {if $showclosebutton} <p align="center"><input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&closeticket=true'" class="closeticket" /></p> {/if} {foreach key=num item=reply from=$replies} <div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$reply.user|replace:"<br />":" || "}</td><td align="right">{$reply.date}</td></tr></table></div> <div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$reply.attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} {if $reply.admin && $ratingenabled}{if $reply.rating}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16"> <td>{$LANG.ticketreatinggiven} </td> <td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td> </tr></table>{else}<table align="right" cellspacing="0" cellpadding="0"> <tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;"> <td>{$LANG.ticketratingquestion} </td> <td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td> <td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td> </tr></table>{/if}<br /><br /><br />{/if}</div> {/foreach} <div class="clientticketreplyheader"><table width="100%" cellspacing="0" cellpadding="0"><tr><td>{$user|replace:"<br />":" || "}</td><td align="right">{$date}</td></tr></table></div> <div class="clientticketreply">{$message}{if $attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$attachments key=num item=attachment} <img src="images/article.gif" align="middle" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if}</div> {/if} 0 Quote Link to comment Share on other sites More sharing options...
b.ahmed Posted June 12, 2010 Share Posted June 12, 2010 Reverse ticket replies in client area. Last reply will be on the top of the page. Thanks Sparky for the original code. I just did some modification according to latest version of WHMCS. Hope it may be useful to anyone, it took 3 hours to do this as I'm not a PHP programmer {if $error} <p>{$LANG.supportticketinvalid}</p> {else} {literal} <script language="javascript"> $(document).ready(function(){ $("#addfileupload").click(function () { $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"50\"><br />"); return false; }); }); function rating_hover(id) { var selrating=id.split('_'); for(var i=1; i<=5; i++){ if(i<=selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_pos.png)"; if(i>selrating[1]) document.getElementById(selrating[0]+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_leave(id){ for(var i=1; i<=5; i++){ document.getElementById(id+'_'+i).style.background="url(images/rating_neg.png)"; } } function rating_select(id){ {/literal}window.location='viewticket.php?tid={$tid}&c={$c}&rating='+id;{literal} } </script> {/literal} <h2>{$LANG.supportticketsviewticket} #{$tid}</h2> {if $errormessage} <div class="errorbox">{$errormessage}</div> <br /> {/if} <table width="100%" border="0" cellpadding="10" cellspacing="0" class="data"> <tr> <th>{$LANG.supportticketsdepartment}</th> <th>{$LANG.supportticketsdate}</th> <th>{$LANG.supportticketssubject}</th> <th>{$LANG.supportticketsstatus}</th> <th>{$LANG.supportticketsticketurgency}</th> </tr> <tr> <td>{$department}</td> <td>{$date}</td> <td>{$subject}</td> <td>{$status}</td> <td>{$urgency}</td> </tr> </table> <br /> {if $customfields} <table width="100%" cellspacing="0" cellpadding="0" class="frame"> <tr> <td><table width="100%" border="0" cellpadding="10" cellspacing="0"> {foreach key=num item=customfield from=$customfields} <tr> <td width="150" class="fieldarea">{$customfield.name}:</td> <td>{$customfield.value} </td> </tr> {/foreach} </table></td> </tr> </table> <br /> {/if} {php} if (is_array($this->_tpl_vars['replies'])) { $this->assign(replies,array_reverse($this->_tpl_vars['replies'],true)); } {/php} {foreach key=num item=reply from=$replies} <div class="{if $reply.admin}admin{else}client{/if}ticketreplyheader"> <table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td>{$reply.user|replace:"<br /> ":" || "} </td> <td align="right">{$reply.date}</td> </tr> </table> </div> <div class="{if $reply.admin}admin{else}client{/if}ticketreply">{$reply.message}{if $reply.attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$reply.attachments key=num item=attachment} <img src="images/article.gif" class="absmiddle" border="0" alt="{$attachment}" /> <a href="dl.php?type=ar&id={$reply.id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if} {if $reply.admin && $ratingenabled}{if $reply.rating} <table align="right" cellspacing="0" cellpadding="0"> <tr height="16"> <td>{$LANG.ticketreatinggiven} </td> <td width="16" background="images/rating_{if $reply.rating>=1}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=2}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=3}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=4}pos{else}neg{/if}.png"></td> <td width="16" background="images/rating_{if $reply.rating>=5}pos{else}neg{/if}.png"></td> </tr> </table> {else} <table align="right" cellspacing="0" cellpadding="0"> <tr height="16" onmouseout="rating_leave('rate{$reply.id}')" style="cursor: pointer; cursor: hand;"> <td>{$LANG.ticketratingquestion} </td> <td onmouseover="rating_hover('rate{$reply.id}_1')" onclick="rating_select('rate{$reply.id}_1')"><b>{$LANG.ticketratingpoor} </td> <td width="16" id="rate{$reply.id}_1" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_2" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_3" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_4" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td width="16" id="rate{$reply.id}_5" onmouseover="rating_hover(this.id)" onclick="rating_select(this.id)" background="images/rating_neg.png"></td> <td onmouseover="rating_hover('rate{$reply.id}_5')" onclick="rating_select('rate{$reply.id}_5')"><b> {$LANG.ticketratingexcellent}</td> </tr> </table> {/if}<br /> <br /> <br /> {/if}</div> <br /> {/foreach} <div class="clientticketreplyheader"> <table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td>{$user|replace:"<br /> ":" || "}</td> <td align="right">{$date}</td> </tr> </table> </div> <div class="clientticketreply">{$message}{if $attachments}<br /> <br /> <b>{$LANG.supportticketsticketattachments}</b><br /> {foreach from=$attachments key=num item=attachment} <img src="images/article.gif" class="absmiddle" border="0" alt="{$attachment}" /> <a href="dl.php?type=a&id={$id}&i={$num}">{$attachment}</a><br /> {/foreach}{/if}</div> {if $showclosebutton} <p align="center"> <input type="button" value="{$LANG.supportticketsstatuscloseticket}" onclick="window.location='{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&closeticket=true'" /> </p> {/if} <h3>{$LANG.supportticketsreply}</h3> <form method="post" action="{$smarty.server.PHP_SELF}?tid={$tid}&c={$c}&postreply=true" enctype="multipart/form-data"> <table width="100%" cellspacing="0" cellpadding="0" class="frame"> <tr> <td><table width="100%" border="0" cellpadding="10" cellspacing="0"> <tr> <td width="120" class="fieldarea">{$LANG.supportticketsclientname}</td> <td>{if $loggedin}{$clientname}{else} <input type="text" name="replyname" size=30 value="{$replyname}" /> {/if}</td> </tr> <tr> <td class="fieldarea">{$LANG.supportticketsclientemail}</td> <td>{if $loggedin}{$email}{else} <input type="text" name="replyemail" size=50 value="{$replyemail}" /> {/if}</td> </tr> <tr> <td colspan="2" class="fieldarea"><textarea name="replymessage" rows="12" cols="60" style="width:100%">{$replymessage}</textarea></td> </tr> <tr> <td class="fieldarea">{$LANG.supportticketsticketattachments}</td> <td><input type="file" name="attachments[]" size="50" /> <a href="#" id="addfileupload"><img src="images/add.gif" class="absmiddle" alt="" border="0" /> {$LANG.addmore}</a><br /> <div id="fileuploads"></div> ({$LANG.supportticketsallowedextensions}: {$allowedfiletypes})</td> </tr> </table></td> </tr> </table> <p align="center"> <input type="submit" value="{$LANG.supportticketsticketsubmit}" class="button" /> </p> </form> {/if}<br /> Thanks Bilal Ahmed 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.