Ask not what osTicket community can do for you - ask what you can do for osTicket community

Go Back   osTicket Forums > osTicket 1.6.x > Mods and Customizations

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-22-2011, 06:02 PM
slhendrix slhendrix is offline
Junior Member
 
Join Date: Oct 2011
Posts: 4
Default Expand Individual Notes

Hello and Thank you for this forum. I have used it a lot to get me going, but I have not found a post for what I would like to do now.

In viewticket.inc.php how can I modify it so that each Internal Note is expandable?

I have tried to do this by re-using the code to toggle all notes (i.e., Internal Notes) but I can't get it just right.

Example of what I'm looking for:

Internal Notes (2)

Sat, Oct 22 2011 1:32pm - posted by Admin Admin
Sat, Oct 20 2011 4:20pm - posted by Admin Admin

// user clicks on the first url and sees...

Sat, Oct 22 2011 1:32pm - posted by Admin Admin
- Ticket assigned to Billy Bob
- This is some useful stuff right here.

Sat, Oct 20 2011 4:20pm - posted by Admin Admin

Thanks for any direction you can provide!!!

Last edited by slhendrix; 10-22-2011 at 06:03 PM. Reason: To make more sense...
Reply With Quote
  #2  
Old 10-23-2011, 07:30 AM
tomt tomt is offline
Member
 
Join Date: Oct 2008
Posts: 76
Default

Hi
Try this..
( make a backup up first... I won't be held responsible if it all goes wrong )
I've only quickly tested it, but it seems OK and should help you on your way !!

In viewticket.inc.php Find Line 27 & 28 and ADD this BETWEEN 27 & 28

LINE 27
Code:
?>
ADD
Code:
<script language="javascript">
<!--

var state = 'none';

function showhide(layer_ref) {

if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}
//-->
</script>
LINE 28
Code:
<table width="100%" cellpadding="2" cellspacing="0" border="0">

Find this around LINE 211:
Code:
<div align="left">
    <a class="Icon note" href="#" onClick="toggleLayer('ticketnotes'); return false;">Internal Notes (<?=$notes?>)</a><br><br>
    <div id='ticketnotes' style="display:<?=$display?>;text-align:center;"> 
        <?
        while($row=db_fetch_array($resp)) {?>
        <table align="center" class="note" cellspacing="0" cellpadding="1" width="100%" border=0>
            <tr><th><?=Format::db_daydatetime($row['created'])?>&nbsp;-&nbsp; posted by <?=$row['source']?></th></tr>
            <? if($row['title']) {?>
            <tr class="header"><td><?=Format::display($row['title'])?></td></tr>
            <?} ?>
            <tr><td><?=Format::display($row['note'])?></td></tr>
        </table>
     <?} ?>
   </div>
</div>

AND REPLACE WITH :
Code:
<div align="left">
    <h3>Internal Notes (<?=$notes?>)</h3>
    <div id='ticketnotes' style="display:<?=$display?>;text-align:left;"> 
        <?
        while($row=db_fetch_array($resp)) {?>
        
            <tr><th><a href="#" onclick="showhide('<?=$row['note_id']?>');"><?=Format::db_daydatetime($row['created'])?>&nbsp;-&nbsp; posted by <?=$row['source']?></a></th></tr>
            <div id="<?=$row['note_id']?>" style="display: none;" align="left">
            <table align="center" class="note" cellspacing="0" cellpadding="1" width="100%" border=0>
            <? if($row['title']) {?>
            <tr class="header"><td><?=Format::display($row['title'])?></td></tr>
            <?} ?>
            <tr><td><?=Format::display($row['note'])?></td></tr>
        	</table>
        	</div><br/>
     <?} ?>
   </div>
</div>
You may want to add a <br/> to this line just to make the layout a little nicer: AROUND LINE 257
Code:
<br/><a class="Icon thread" href="#" onClick="toggleLayer('ticketthread'); return false;">Ticket Thread</a>
Reply With Quote
  #3  
Old 10-23-2011, 01:36 PM
slhendrix slhendrix is offline
Junior Member
 
Join Date: Oct 2011
Posts: 4
Default

I will get started on this right away and let you know the results. Thank you for the quick response!!
Reply With Quote
  #4  
Old 10-23-2011, 03:10 PM
slhendrix slhendrix is offline
Junior Member
 
Join Date: Oct 2011
Posts: 4
Default

Hi tomt,

The new code is working great in Chrome, but not in IE9. Any ideas?

Also, when I click on a note, the page pops back up to the top. My steps to re-create this are:

1) View the ticket.
2) Scroll down some on the page until Internal Notes is midway on the screen.
3) Click on the first note.
4) The page pops back to the top.

** in Chrome, the note does expand as explained above, but the page does still return to the top.

Thanks again for all your help!
Reply With Quote
  #5  
Old 10-23-2011, 03:23 PM
slhendrix slhendrix is offline
Junior Member
 
Join Date: Oct 2011
Posts: 4
Default

UPDATE:

I was able to get this to work in IE9 by changing the "showhide" to "toggleLayer". I also added "return false" and it fixed the page popping back to the top when clicking on the note. See below...

"<a href="#" onclick="toggleLayer('<?=$row['note_id']?>'); return false;"><?=Format::db_daydatetime($row['created'])?>&nbsp;-&nbsp; posted by <?=$row['source']?></a>"

Please let me know if you see any compatability issues with this.

Thanks again!!
Reply With Quote
  #6  
Old 10-24-2011, 04:12 AM
tomt tomt is offline
Member
 
Join Date: Oct 2008
Posts: 76
Default

Glad you got it sorted.
I should have mentioned I'd only tested it on firefox !!
Reply With Quote
Reply

Bookmarks

Tags
expandable, mod, notes

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:40 AM.