diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css index 3f1cb699c0c6d477b45bec4a4e08b2626b75ade4..88c4898a80b62ae5be6ede550948a3e217fd3a8a 100644 --- a/assets/default/css/theme.css +++ b/assets/default/css/theme.css @@ -708,6 +708,13 @@ a.refresh { font-size: 12px; padding: 5px; } + +#ticketThread table th span { + font-weight:normal; + color:#888; + padding-left:20px; +} + #ticketThread table td { padding: 5px; } diff --git a/include/class.config.php b/include/class.config.php index e4183779f4db2da35eea349b252512df97af2baf..626e11c9a0e3eb466046f3539b9ed16ecb7c0c7e 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -168,6 +168,10 @@ class Config { function showRelatedTickets() { return $this->config['show_related_tickets']; } + + function showNotesInline(){ + return $this->config['show_notes_inline']; + } function getClientTimeout() { return $this->getClientSessionTimeout(); @@ -675,6 +679,7 @@ class Config { ',show_assigned_tickets='.db_input(isset($vars['show_assigned_tickets'])?1:0). ',show_answered_tickets='.db_input(isset($vars['show_answered_tickets'])?1:0). ',show_related_tickets='.db_input(isset($vars['show_related_tickets'])?1:0). + ',show_notes_inline='.db_input(isset($vars['show_notes_inline'])?1:0). ',hide_staff_name='.db_input(isset($vars['hide_staff_name'])?1:0); return (db_query($sql)); diff --git a/include/client/view.inc.php b/include/client/view.inc.php index f67e6d94bd3a4456e30b17797254dff49204b960..debddc4ed4713aeb3dec50b48e1fcb5bfe2f9ccc 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -59,46 +59,25 @@ if(!$dept || !$dept->isPublic()) <span class="Icon thread">Ticket Thread</span> <div id="ticketThread"> <?php -if($ticket->getThreadCount() && ($messages = $ticket->getMessages())) { - - foreach($messages as $message) {?> - - <table class="message" cellspacing="0" cellpadding="1" width="800" border="0"> - - <tr><th><?php echo Format::db_datetime($message['created']); ?></th></tr> - - <tr><td><?php echo Format::display($message['body']); ?></td></tr> - +if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) { + $threadType=array('M' => 'message', 'R' => 'response'); + foreach($thread as $entry) { + //Making sure internal notes are not displayed due to backend MISTAKES! + if(!$threadType[$entry['thread_type']]) continue; + $poster = $entry['poster']; + if($entry['thread_type']=='R' && $cfg->hideStaffName()) + $poster = ' '; + ?> + <table class="<?php echo $threadType[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="800" border="0"> + <tr><th><?php echo Format::db_datetime($entry['created']); ?> <span><?php echo $poster; ?></span></th></tr> + <tr><td><?php echo Format::display($entry['body']); ?></td></tr> <?php - - if($message['attachments'] && ($links=$ticket->getAttachmentsLinks($message['id'],'M'))) { ?> - + if($entry['attachments'] && ($links=$ticket->getAttachmentsLinks($entry['id'], $entry['thread_type']))) { ?> <tr><td class="info"><?php echo $links; ?></td></tr> - <?php - } ?> - </table> - <?php - if($message['responses'] && ($responses=$ticket->getResponses($message['id']))) { - foreach($responses as $resp) { - $staff=$cfg->hideStaffName()?'staff':Format::htmlchars($resp['staff_name']); - ?> - <table class="response" cellspacing="0" cellpadding="1" width="100%" border="0"> - <tr> - <th><?php echo Format::db_datetime($resp['created']);?> - <?php echo $staff; ?></th> - </tr> - <tr><td><?php echo Format::display($resp['body']); ?></td></tr> - <?php - if($resp['attachments'] && ($links=$ticket->getAttachmentsLinks($resp['id'],'R'))) {?> - <tr><td class="info"><?php echo $links; ?></td></tr> - <?php - }?> - </table> - <? - } - } + <?php } } ?> diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php index bcf7347a74cf6d5bf5e9c60cfbe1b28729bbaffd..5ada80f48bca4edfb7221e6916aa5e46efb85d94 100644 --- a/include/staff/settings-tickets.inc.php +++ b/include/staff/settings-tickets.inc.php @@ -1,140 +1,148 @@ -<form action="settings.php?t=tickets" method="post" id="save"> -<input type="hidden" name="t" value="tickets" > -<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2"> - <thead> - <tr> - <th colspan="2"> - <h4>Ticket Settings and Options</h4> - <em>Global ticket settings and options.</em> - </th> - </tr> - </thead> - <tbody> - <tr><td width="220" class="required">Ticket IDs:</td> - <td> - <input type="radio" name="random_ticket_ids" value="0" <?php echo !$config['random_ticket_ids']?'checked="checked"':''; ?> /> - Sequential - <input type="radio" name="random_ticket_ids" value="1" <?php echo $config['random_ticket_ids']?'checked="checked"':''; ?> /> - Random <em>(highly recommended)</em> - </td> - </tr> - - <tr> - <td width="180" class="required"> - Default SLA: - </td> - <td> - <select name="default_sla_id"> - <option value="0">— None —</option> - <?php - $sql='SELECT id,name FROM '.SLA_TABLE.' sla ORDER by name'; - if(($res=db_query($sql)) && db_num_rows($res)){ - while(list($id,$name)=db_fetch_row($res)){ - $selected=($config['default_sla_id'] && $id==$config['default_sla_id'])?'selected="selected"':''; - echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name); - } - } - ?> - </select> - <span class="error">* <?php echo $errors['default_sla_id']; ?></span> - </td> - </tr> - <tr> - <td width="180" class="required">Default Priority:</td> - <td> - <select name="default_priority_id"> +<form action="settings.php?t=tickets" method="post" id="save"> +<input type="hidden" name="t" value="tickets" > +<table class="form_table settings_table" width="940" border="0" cellspacing="0" cellpadding="2"> + <thead> + <tr> + <th colspan="2"> + <h4>Ticket Settings and Options</h4> + <em>Global ticket settings and options.</em> + </th> + </tr> + </thead> + <tbody> + <tr><td width="220" class="required">Ticket IDs:</td> + <td> + <input type="radio" name="random_ticket_ids" value="0" <?php echo !$config['random_ticket_ids']?'checked="checked"':''; ?> /> + Sequential + <input type="radio" name="random_ticket_ids" value="1" <?php echo $config['random_ticket_ids']?'checked="checked"':''; ?> /> + Random <em>(highly recommended)</em> + </td> + </tr> + + <tr> + <td width="180" class="required"> + Default SLA: + </td> + <td> + <select name="default_sla_id"> + <option value="0">— None —</option> <?php - $priorities= db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE); - while (list($id,$tag) = db_fetch_row($priorities)){ ?> - <option value="<?php echo $id; ?>"<?php echo ($config['default_priority_id']==$id)?'selected':''; ?>><?php echo $tag; ?></option> + $sql='SELECT id,name FROM '.SLA_TABLE.' sla ORDER by name'; + if(($res=db_query($sql)) && db_num_rows($res)){ + while(list($id,$name)=db_fetch_row($res)){ + $selected=($config['default_sla_id'] && $id==$config['default_sla_id'])?'selected="selected"':''; + echo sprintf('<option value="%d" %s>%s</option>',$id,$selected,$name); + } + } + ?> + </select> + <span class="error">* <?php echo $errors['default_sla_id']; ?></span> + </td> + </tr> + <tr> + <td width="180" class="required">Default Priority:</td> + <td> + <select name="default_priority_id"> <?php - } ?> - </select> - <span class="error">* <?php echo $errors['default_priority_id']; ?></span> - </td> - </tr> - <tr> - <td width="180">Web Tickets Priority</td> - <td> - <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>> - <em>(Allow user to overwrite/set priority)</em> - </td> - </tr> - <tr> - <td width="180">Emailed Tickets Priority</td> - <td> - <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> > - <em>(Use email priority when available)</em> - </td> - </tr> - <tr> - <td width="180">Show Related Tickets</td> - <td> - <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> > - <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em> - </td> - </tr> - <tr> - <td>Human Verification:</td> - <td> - <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>> - Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> <font class="error"> <?php echo $errors['enable_captcha']; ?></font><br/> - </td> - </tr> - <tr> - <td>Maximum <b>Open</b> Tickets:</td> - <td> - <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>"> - per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em> - </td> - </tr> - <tr> - <td>Ticket Auto-lock Time:</td> - <td> - <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>"> - <font class="error"><?php echo $errors['autolock_minutes']; ?></font> - <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em> - </td> - </tr> - <tr> - <td>Reopened Tickets:</td> - <td> - <input type="checkbox" name="auto_assign_reopened_tickets" <?php echo $config['auto_assign_reopened_tickets']?'checked="checked"':''; ?>> - Auto-assign reopened tickets to the last available respondent. - </td> - </tr> - <tr> - <td>Assigned Tickets:</td> - <td> - <input type="checkbox" name="show_assigned_tickets" <?php echo $config['show_assigned_tickets']?'checked="checked"':''; ?>> - Show assigned tickets on open queue. - </td> - </tr> - <tr> - <td>Answered Tickets:</td> - <td> - <input type="checkbox" name="show_answered_tickets" <?php echo $config['show_answered_tickets']?'checked="checked"':''; ?>> - Show answered tickets on open queue. - </td> - </tr> - <tr> - <td>Ticket Activity Log:</td> - <td> - <input type="checkbox" name="log_ticket_activity" <?php echo $config['log_ticket_activity']?'checked="checked"':''; ?>> - Log ticket activity as internal notes. - </td> - </tr> - <tr> - <td>Staff Identity Masking:</td> - <td> - <input type="checkbox" name="hide_staff_name" <?php echo $config['hide_staff_name']?'checked="checked"':''; ?>> - Hide staff's name on responses. - </td> - </tr> - </tbody> -</table> -<p style="padding-left:250px;"> - <input class="button" type="submit" name="submit" value="Save Changes"> - <input class="button" type="reset" name="reset" value="Reset Changes"> -</p> -</form> + $priorities= db_query('SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE); + while (list($id,$tag) = db_fetch_row($priorities)){ ?> + <option value="<?php echo $id; ?>"<?php echo ($config['default_priority_id']==$id)?'selected':''; ?>><?php echo $tag; ?></option> + <?php + } ?> + </select> + <span class="error">* <?php echo $errors['default_priority_id']; ?></span> + </td> + </tr> + <tr> + <td width="180">Web Tickets Priority</td> + <td> + <input type="checkbox" name="allow_priority_change" value="1" <?php echo $config['allow_priority_change'] ?'checked="checked"':''; ?>> + <em>(Allow user to overwrite/set priority)</em> + </td> + </tr> + <tr> + <td width="180">Emailed Tickets Priority</td> + <td> + <input type="checkbox" name="use_email_priority" value="1" <?php echo $config['use_email_priority'] ?'checked="checked"':''; ?> > + <em>(Use email priority when available)</em> + </td> + </tr> + <tr> + <td width="180">Show Related Tickets</td> + <td> + <input type="checkbox" name="show_related_tickets" value="1" <?php echo $config['show_related_tickets'] ?'checked="checked"':''; ?> > + <em>(Show all related tickets on user login - otherwise access is restricted to one ticket view per login)</em> + </td> + </tr> + <tr> + <td width="180">Show Notes Inline</td> + <td> + <input type="checkbox" name="show_notes_inline" value="1" <?php echo $config['show_notes_inline'] ?'checked="checked"':''; ?> > + <em>(Show internal notes inline)</em> + </td> + </tr> + <tr> + <td>Human Verification:</td> + <td> + <input type="checkbox" name="enable_captcha" <?php echo $config['enable_captcha']?'checked="checked"':''; ?>> + Enable CAPTCHA on new web tickets.<em>(requires GDLib)</em> <font class="error"> <?php echo $errors['enable_captcha']; ?></font><br/> + </td> + </tr> + <tr> + <td>Maximum <b>Open</b> Tickets:</td> + <td> + <input type="text" name="max_open_tickets" size=4 value="<?php echo $config['max_open_tickets']; ?>"> + per email/user. <em>(Helps with spam and email flood control - enter 0 for unlimited)</em> + </td> + </tr> + <tr> + <td>Ticket Auto-lock Time:</td> + <td> + <input type="text" name="autolock_minutes" size=4 value="<?php echo $config['autolock_minutes']; ?>"> + <font class="error"><?php echo $errors['autolock_minutes']; ?></font> + <em>(Minutes to lock a ticket on activity - enter 0 to disable locking)</em> + </td> + </tr> + <tr> + <td>Reopened Tickets:</td> + <td> + <input type="checkbox" name="auto_assign_reopened_tickets" <?php echo $config['auto_assign_reopened_tickets']?'checked="checked"':''; ?>> + Auto-assign reopened tickets to the last available respondent. + </td> + </tr> + <tr> + <td>Assigned Tickets:</td> + <td> + <input type="checkbox" name="show_assigned_tickets" <?php echo $config['show_assigned_tickets']?'checked="checked"':''; ?>> + Show assigned tickets on open queue. + </td> + </tr> + <tr> + <td>Answered Tickets:</td> + <td> + <input type="checkbox" name="show_answered_tickets" <?php echo $config['show_answered_tickets']?'checked="checked"':''; ?>> + Show answered tickets on open queue. + </td> + </tr> + <tr> + <td>Ticket Activity Log:</td> + <td> + <input type="checkbox" name="log_ticket_activity" <?php echo $config['log_ticket_activity']?'checked="checked"':''; ?>> + Log ticket activity as internal notes. + </td> + </tr> + <tr> + <td>Staff Identity Masking:</td> + <td> + <input type="checkbox" name="hide_staff_name" <?php echo $config['hide_staff_name']?'checked="checked"':''; ?>> + Hide staff's name on responses. + </td> + </tr> + </tbody> +</table> +<p style="padding-left:250px;"> + <input class="button" type="submit" name="submit" value="Save Changes"> + <input class="button" type="reset" name="reset" value="Reset Changes"> +</p> +</form> + diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index faac0f86ef791a8726c266a8121a980860ddc267..ff46ace13e8c13f37e51317429409d3244f9932b 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -171,11 +171,21 @@ if($ticket->isOverdue()) </tr> </table> <div class="clear" style="padding-bottom:10px;"></div> +<?php +$tcount = $ticket->getThreadCount(); +if($cfg->showNotesInline()) + $tcount+= $ticket->getNumNotes(); +?> <ul id="threads"> - <li><a class="active" id="toggle_ticket_thread" href="#">Ticket Thread (<?php echo $ticket->getThreadCount(); ?>)</a></li> + <li><a class="active" id="toggle_ticket_thread" href="#">Ticket Thread (<?php echo $tcount; ?>)</a></li> + <?php + if(!$cfg->showNotesInline()) {?> <li><a id="toggle_notes" href="#">Internal Notes (<?php echo $ticket->getNumNotes(); ?>)</a></li> + <?php + }?> </ul> - +<?php +if(!$cfg->showNotesInline()) { ?> <div id="ticket_notes"> <?php /* Internal Notes */ @@ -189,14 +199,14 @@ if($ticket->isOverdue()) <?php echo sprintf('%s <em>posted by <b>%s</b></em>', Format::htmlchars($note['title']), - Format::htmlchars($note['source'])); + Format::htmlchars($note['poster'])); ?> </th> <th class="date" width="300"><?php echo Format::db_datetime($note['created']); ?></th> </tr> <tr> <td colspan="2"> - <?php echo Format::htmlchars($note['body']); ?> + <?php echo Format::display($note['body']); ?> </td> </tr> <?php @@ -213,45 +223,32 @@ if($ticket->isOverdue()) echo "<p>No internal notes found.</p>"; }?> </div> +<?php +} ?> <div id="ticket_thread"> <?php - /* -------- Messages & Responses -------------*/ - if($ticket->getThreadCount() && ($messages = $ticket->getMessages())) { - foreach($messages as $message) {?> - <table class="message" cellspacing="0" cellpadding="1" width="940" border="0"> - <tr><th><?php echo Format::db_datetime($message['created']); ?></th></tr> - <tr><td><?php echo Format::display($message['body']); ?></td></tr> + $threadTypes=array('M'=>'message','R'=>'response', 'N'=>'note'); + /* -------- Messages & Responses & Notes (if inline)-------------*/ + if(($thread=$ticket->getThread($cfg->showNotesInline()))) { + foreach($thread as $entry) { + ?> + <table class="<?php echo $threadTypes[$entry['thread_type']]; ?>" cellspacing="0" cellpadding="1" width="940" border="0"> + <tr><th width="640"><?php echo Format::db_datetime($entry['created']);?> + <span><?php echo Format::htmlchars($entry['title']); ?></span> + </th> + <th width="300" class="tmeta"><?php echo Format::htmlchars($entry['poster']); ?></th></tr> + <tr><td colspan=2><?php echo Format::display($entry['body']); ?></td></tr> <?php - if($message['attachments'] && ($links=$ticket->getAttachmentsLinks($message['id'],'M'))) {?> + if($entry['attachments'] && ($links=$ticket->getAttachmentsLinks($entry['id'], $entry['thread_type']))) {?> <tr> - <td class="info"><?php echo $links; ?></td> + <td class="info" colspan=2><?php echo $links; ?></td> </tr> <?php }?> </table> <?php - /* --------- Responses ------------ */ - if($message['responses'] && ($responses=$ticket->getResponses($message['id']))) { - foreach($responses as $resp) {?> - <table class="response" cellspacing="0" cellpadding="1" width="100%" border="0"> - <tr> - <th><?php echo Format::db_datetime($resp['created']); ?> - <?php echo Format::htmlchars($resp['staff_name']); ?></th> - </tr> - <tr> - <td><?php echo Format::display($resp['body']); ?></td> - </tr> - <?php - if($resp['attachments'] && ($links=$ticket->getAttachmentsLinks($resp['id'],'R'))) {?> - <tr> - <td class="info"><?php echo $links; ?></td> - </tr> - <?php - }?> - </table> - <?php - } - } - $msgId=$message['id']; + if($entry['thread_type']=='M') + $msgId=$entry['id']; } } else { echo '<p>Error fetching ticket thread - get technical help.</p>';