diff --git a/assets/default/css/theme.css b/assets/default/css/theme.css index f27deeaed27a94a465ba971d79dbf9c33ab540b4..e8435a45e27022d10ac14416b6249279cdc728a0 100644 --- a/assets/default/css/theme.css +++ b/assets/default/css/theme.css @@ -1127,28 +1127,6 @@ img.avatar { margin-left: 1px; } -.thread-entry.bccmessage .header { - background:#DDFDAC; -} -.thread-entry.avatar.bccmessage .header:before { - top: 7px; - left: -8px; - right: initial; - border-left: none; - border-right: 8px solid #CCC; -} -.thread-entry.avatar.bccmessage .header:before { - border-right-color: #CCC; -} -.thread-entry.avatar.bccmessage .header:after { - top: 7px; - left: -8px; - right: initial; - border-left: none; - border-right: 7px solid #DDFDAC; - margin-left: 1px; -} - .thread-entry .header .title { max-width: 500px; vertical-align: bottom; diff --git a/include/ajax.tasks.php b/include/ajax.tasks.php index b379382b1f363d78752519b11ff00062ae0e18c0..c92d72f239483229153d969e26221191dca087ce 100644 --- a/include/ajax.tasks.php +++ b/include/ajax.tasks.php @@ -122,15 +122,14 @@ class TasksAjaxAPI extends AjaxController { $task->getId(), $task->getNumber()); - $entryLink = sprintf('<a href="#entry-%d"><b>%d</b></a> (%s)', - $_SESSION[':form-data']['eid'], + $entryLink = sprintf('<a href="#entry-%d"><b>%s</b></a>', $_SESSION[':form-data']['eid'], Format::datetime($_SESSION[':form-data']['timestamp'])); $note = array( 'title' => __('Task Created From Thread Entry'), 'note' => __('Task ' . $taskLink . - '<br /> Thread Entry ID: ' . $entryLink) + '<br /> Thread Entry: ' . $entryLink) ); $originalTask->postNote($note, $errors, $thisstaff); diff --git a/include/ajax.thread.php b/include/ajax.thread.php index 0369548ed5deb1b855c6f2f9c3127d4eb9b4ff22..7e72aef126e2992dcba539dfb8da011a4244f0d6 100644 --- a/include/ajax.thread.php +++ b/include/ajax.thread.php @@ -107,7 +107,7 @@ class ThreadAjaxAPI extends AjaxController { array(), $errors))) { $info = array('msg' => sprintf(__('%s added as a collaborator'), Format::htmlchars($c->getName()))); - $type == 'addbcc' ? $c->setBcc() : $c->setCc(); + $c->setCc(); $c->save(); return self::_collaborators($thread, $info); } diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 5c2584f7633ed5461ffbcb31a3d327a1de230771..51c4e66973e90b94432b974ff732426548b7120e 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -1356,15 +1356,14 @@ function refer($tid, $target=null) { $task->getId(), $task->getNumber()); - $entryLink = sprintf('<a href="#entry-%d"><b>%d</b></a> (%s)', - $_SESSION[':form-data']['eid'], + $entryLink = sprintf('<a href="#entry-%d"><b>%s</b></a>', $_SESSION[':form-data']['eid'], Format::datetime($_SESSION[':form-data']['timestamp'])); $note = array( 'title' => __('Task Created From Thread Entry'), 'body' => __('Task ' . $taskLink . - '<br /> Thread Entry ID: ' . $entryLink) + '<br /> Thread Entry: ' . $entryLink) ); $ticket->logNote($note['title'], $note['body'], $thisstaff); diff --git a/include/class.collaborator.php b/include/class.collaborator.php index d6fdbbfc566baf4ea95f039db4ada378648cfb97..94e97fee65f55a37d9cff4f27707fee0934a742a 100644 --- a/include/class.collaborator.php +++ b/include/class.collaborator.php @@ -150,12 +150,6 @@ implements EmailContact, ITicketUser { $this->save(); } - public function setBcc() { - $this->setFlag(Collaborator::FLAG_ACTIVE, true); - $this->setFlag(Collaborator::FLAG_CC, false); - $this->save(); - } - function isCc() { return !!($this->flags & self::FLAG_CC); } diff --git a/include/class.template.php b/include/class.template.php index 4e73ecb32967f248d6781b6d6696036bd4ff1088..53f1caf431a542d115bcfe49a5baa5d08bdf3eb7 100644 --- a/include/class.template.php +++ b/include/class.template.php @@ -60,14 +60,6 @@ class EmailTemplateGroup { 'ticket', 'signature', 'recipient', 'staff', 'message', ), ), - 'ticket.notice.bcc'=>array( - 'group'=>'a.ticket.user', - 'name'=>/* @trans */ 'New Ticket Notice (BCC)', - 'desc'=>/* @trans */ 'Notice sent to BCCd users, if enabled, on new ticket created by an agent on behalf of a user (e.g phone calls).', - 'context' => array( - 'ticket', 'signature', 'recipient', 'staff', 'message', - ), - ), 'ticket.overlimit'=>array( 'group'=>'a.ticket.user', 'name'=>/* @trans */ 'Overlimit Notice', @@ -84,14 +76,6 @@ class EmailTemplateGroup { 'ticket', 'signature', 'response', 'staff', 'poster', 'recipient', ), ), - 'ticket.reply.bcc'=>array( - 'group'=>'a.ticket.user', - 'name'=>/* @trans */ 'Response/Reply Template (BCC)', - 'desc'=>/* @trans */ 'Template used on ticket response/reply', - 'context' => array( - 'ticket', 'signature', 'response', 'staff', 'poster', 'recipient', - ), - ), 'ticket.activity.notice'=>array( 'group'=>'a.ticket.user', 'name'=>/* @trans */ 'New Activity Notice', @@ -100,14 +84,6 @@ class EmailTemplateGroup { 'ticket', 'signature', 'message', 'poster', 'recipient', ), ), - 'ticket.activity.notice.bcc'=>array( - 'group'=>'a.ticket.user', - 'name'=>/* @trans */ 'New Activity Notice (BCC)', - 'desc'=>/* @trans */ 'Template used to notify BCCd collaborators on ticket activity', - 'context' => array( - 'ticket', 'signature', 'message', 'poster', 'recipient', - ), - ), 'ticket.alert'=>array( 'group'=>'b.ticket.staff', 'name'=>/* @trans */ 'New Ticket Alert', @@ -333,10 +309,6 @@ class EmailTemplateGroup { return $this->getMsgTemplate('ticket.notice'); } - function getNewTicketNoticeBCCMsgTemplate() { - return $this->getMsgTemplate('ticket.notice.bcc'); - } - function getNewMessageAutorepMsgTemplate() { return $this->getMsgTemplate('message.autoresp'); } @@ -353,18 +325,10 @@ class EmailTemplateGroup { return $this->getMsgTemplate('ticket.reply'); } - function getReplyBCCMsgTemplate() { - return $this->getMsgTemplate('ticket.reply.bcc'); - } - function getActivityNoticeMsgTemplate() { return $this->getMsgTemplate('ticket.activity.notice'); } - function getActivityNoticeBCCMsgTemplate() { - return $this->getMsgTemplate('ticket.activity.notice.bcc'); - } - function getOverlimitMsgTemplate() { return $this->getMsgTemplate('ticket.overlimit'); } diff --git a/include/class.thread.php b/include/class.thread.php index 353ce11b5ed6f38bf7651f974d3aa9b07b1e1c16..9ce4fa5169486b392634733caacbc35e3fa6a457 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -240,18 +240,6 @@ implements Searchable { )); } - if($vars['recipientType']) { - $combo = array_combine($vars['uid'], $vars['recipientType']); - foreach ($combo as $id => $type) { - $collab = Collaborator::lookup($id); - if(get_class($collab) == 'Collaborator') { - $type == 'Cc' ? $collab->setFlag(Collaborator::FLAG_CC, true) : - $collab->setFlag(Collaborator::FLAG_CC, false); - $collab->save(); - } - } - } - unset($this->ht['active_collaborators']); $this->_collaborators = null; @@ -454,7 +442,7 @@ implements Searchable { $body = $mailinfo['message']; - // extra handling for determining Cc and Bcc collabs + // extra handling for determining Cc collabs if ($mailinfo['email']) { $staffSenderId = Staff::getIdByEmail($mailinfo['email']); @@ -471,8 +459,6 @@ implements Searchable { if ($collaborator && ($collaborator->isCc())) $vars['thread-type'] = 'M'; - else - $vars['thread-type'] = 'N'; } } } @@ -760,6 +746,8 @@ implements TemplateVariable { const FLAG_COLLABORATOR = 0x0020; // Message from collaborator const FLAG_BALANCED = 0x0040; // HTML does not need to be balanced on ::display() const FLAG_SYSTEM = 0x0080; // Entry is a system note. + const FLAG_REPLY_ALL = 0x00100; // Agent response, reply all + const FLAG_REPLY_USER = 0x00200; // Agent response, reply to User const PERM_EDIT = 'thread.edit'; @@ -783,7 +771,6 @@ implements TemplateVariable { 'M' => 'message', 'R' => 'response', 'N' => 'note', - 'B' => 'bccmessage', ); function getTypeName() { @@ -1476,6 +1463,18 @@ implements TemplateVariable { return $entry; } + function setReplyFlag($entry, $replyType) { + switch ($replyType) { + case 'reply-all': + return $entry->flags |= ThreadEntry::FLAG_REPLY_ALL; + break; + + case 'reply-user': + return $entry->flags |= ThreadEntry::FLAG_REPLY_USER; + break; + } + } + //new entry ... we're trusting the caller to check validity of the data. static function create($vars=false) { global $cfg; @@ -1520,7 +1519,7 @@ implements TemplateVariable { $ticketUser = Ticket::objects()->filter(array('ticket_id'=>$ticket[0]))->values_flat('user_id')->first(); //User - if ($ticketUser) { + if ($ticketUser && Ticket::checkReply('user', $vars['emailreply'])) { $uEmail = UserEmailModel::objects()->filter(array('user_id'=>$ticketUser[0]))->values_flat('address')->first(); $u = array(); $u[$ticketUser[0]] = $uEmail[0]; @@ -1530,19 +1529,16 @@ implements TemplateVariable { if (Collaborator::getIdByUserId($vars['userId'], $vars['threadId'])) $entry->flags |= ThreadEntry::FLAG_COLLABORATOR; + //add reply type flag + self::setReplyFlag($entry, $vars['emailreply']); + //Cc collaborators - if($vars['ccs'] && $vars['emailcollab'] == 1) { + if ($vars['ccs'] && Ticket::checkReply('cc', $vars['emailreply'])) { $cc = Collaborator::getCollabList($vars['ccs']); $recipients['cc'] = $cc; } - //Bcc Collaborators - if($vars['bccs'] && $vars['emailcollab'] == 1) { - $bcc = Collaborator::getCollabList($vars['bccs']); - $recipients['bcc'] = $bcc; - } - - if (($vars['do'] == 'create' || $vars['emailreply'] == 1) && $recipients) + if ($vars['emailreply'] != '0' && $recipients) $entry->recipients = json_encode($recipients); if ($entry->format == 'html') diff --git a/include/class.thread_actions.php b/include/class.thread_actions.php index 5a84db9495cbe00f15b58826adbfa8f7f9cf2325..351f66370fa9fd09090f4f5bf12934cbeb961a9c 100644 --- a/include/class.thread_actions.php +++ b/include/class.thread_actions.php @@ -53,7 +53,7 @@ class TEA_ShowEmailRecipients extends ThreadEntryAction { $this->entry->getEmailHeader(), true); $recipients = array(); - foreach (array('To', 'TO', 'Cc', 'CC', 'Bcc', 'BCC') as $k) { + foreach (array('To', 'TO', 'Cc', 'CC') as $k) { if (isset($hdr[$k]) && $hdr[$k] && ($addresses=Mail_Parse::parseAddressList($hdr[$k]))) { foreach ($addresses as $addr) { diff --git a/include/class.ticket.php b/include/class.ticket.php index 008a1b29833bef9dc30362770fb9a460cffb242d..aac5be02ae07e4fa723f5046d9dcf144135f64d5 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -166,6 +166,7 @@ implements RestrictedAccess, Threadable, Searchable { var $active_collaborators; var $recipients; var $lastrespondent; + var $lastuserrespondent; function loadDynamicData($force=false) { if (!isset($this->_answers) || $force) { @@ -712,6 +713,26 @@ implements RestrictedAccess, Threadable, Searchable { return $this->lastrespondent; } + function getLastUserRespondent() { + if (!isset($this->$lastuserrespondent)) { + if (!$this->thread || !$this->thread->entries) + return $this->$lastuserrespondent = false; + $this->$lastuserrespondent = User::objects() + ->filter(array( + 'id' => $this->thread->entries + ->filter(array( + 'user_id__gt' => 0, + )) + ->values_flat('user_id') + ->order_by('-id') + ->limit(1) + )) + ->first() + ?: false; + } + return $this->$lastuserrespondent; + } + function getLastMessageDate() { return $this->thread->lastmessage; } @@ -809,34 +830,15 @@ implements RestrictedAccess, Threadable, Searchable { } //UserList of recipients (owner + collaborators) - function getRecipients($excludeBcc=false) { - if ($excludeBcc && isset($this->recipients)) { - $list = new UserList(); - - if ($collabs = $this->getThread()->getActiveCollaborators()) { - $list->add($this->getOwner()); - foreach ($collabs as $c) { - if (get_class($c) == 'Collaborator' && !$c->isCc()) //skip bcc - continue; - else - $list->add($c); - } - } - - $this->recipients = $list; - } - //I think we need to rebuild each time since it - //would be incomplete if called after an exclude bcc call - else { - $list = new UserList(); - $list->add($this->getOwner()); - if ($collabs = $this->getThread()->getActiveCollaborators()) { - foreach ($collabs as $c) { - $list->add($c); - } + function getRecipients() { + $list = new UserList(); + $list->add($this->getOwner()); + if ($collabs = $this->getThread()->getActiveCollaborators()) { + foreach ($collabs as $c) { + $list->add($c); } - $this->recipients = $list; - } + } + $this->recipients = $list; return $this->recipients; } @@ -1365,7 +1367,15 @@ implements RestrictedAccess, Threadable, Searchable { return false; } + function checkReply($userType, $replyType) { + if ($userType == 'cc' && $replyType == 'reply-all') + return true; + + if ($userType == 'user' && ($replyType == 'reply-all' || $replyType == 'reply-user')) + return true; + return false; + } function setAnsweredState($isanswered) { @@ -1564,7 +1574,6 @@ implements RestrictedAccess, Threadable, Searchable { || !($dept=$this->getDept()) || !($tpl=$dept->getTemplate()) || !($msg=$tpl->getActivityNoticeMsgTemplate()) - || !($bccmsg=$tpl->getActivityNoticeBCCMsgTemplate()) || !($email=$dept->getEmail()) ) { return; @@ -1580,13 +1589,6 @@ implements RestrictedAccess, Threadable, Searchable { } } - if($vars['bccs']) { - foreach ($vars['bccs'] as $bcc) { - $collab = Collaborator::getIdByUserId($bcc, $this->getThread()->getId()); - $recipients[] = Collaborator::lookup($collab); - } - } - $vars = array_merge($vars, array( 'message' => (string) $entry, 'poster' => $poster ?: _S('A collaborator'), @@ -1594,7 +1596,6 @@ implements RestrictedAccess, Threadable, Searchable { ); $msg = $this->replaceVars($msg->asArray(), $vars); - $bccmsg = $this->replaceVars($bccmsg->asArray(), $vars); $attachments = $cfg->emailAttachments()?$entry->getAttachments():array(); $options = array('thread' => $entry); @@ -1611,29 +1612,14 @@ implements RestrictedAccess, Threadable, Searchable { $collaborators = array(); $collabsCc = array(); - $collabsBcc = array(); foreach ($recipients as $recipient) { if(get_class($recipient) == 'Collaborator') { - if ($recipient->isCc()) { + if ($recipient->isCc()) $collabsCc[] = $recipient->getEmail()->address; - } - else - $collabsBcc[] = $recipient; } - if(get_class($recipient) == 'TicketOwner') { + if(get_class($recipient) == 'TicketOwner') $owner = $recipient; - } - } - - //send bcc messages seperately for privacy - if ($collabsBcc) { - foreach ($collabsBcc as $recipient) { - $notice = $this->replaceVars($bccmsg, array('recipient' => $recipient)); - if ($posterEmail != $recipient->getEmail()->address) - $email->send($recipient, $notice['subj'], $notice['body'], $attachments, - $options); - } } foreach ($collabsCc as $cc) { @@ -2174,7 +2160,7 @@ implements RestrictedAccess, Threadable, Searchable { function replaceVars($input, $vars = array()) { global $ost; - $recipients = $this->getRecipients(true); + $recipients = $this->getRecipients(); $vars = array_merge($vars, array('ticket' => $this)); return $ost->replaceTemplateVariables($input, $vars); @@ -2632,8 +2618,6 @@ implements RestrictedAccess, Threadable, Searchable { $isMsg = true; $c->setCc(); } - else - $c->setBcc(); } else { $c = Collaborator::lookup($existingCollab); @@ -2652,21 +2636,6 @@ implements RestrictedAccess, Threadable, Searchable { if ($vars['userId'] == $this->user_id) $isMsg = true; - //lookup user by userId. if they are bcc in thread, post internal note - if($collabs = $this->getRecipients()) { - foreach ($collabs as $collab) { - if(get_class($collab) == 'Collaborator' && $collab->user_id == $vars['userId'] && !$collab->isCc()) { - $user = User::lookup($vars['userId']); - $vars['note'] = $vars['message']; - - //post internal note - if (!$isMsg) { - return $this->postNote($vars,$errors, $user, true); - } - } - } - } - if (!($message = $this->getThread()->addMessage($vars, $errors))) return null; @@ -2884,14 +2853,6 @@ implements RestrictedAccess, Threadable, Searchable { $c2->setCc(); } } - if (isset($vars['bccs'])) { - foreach ($vars['bccs'] as $uid) { - $user = User::lookup($uid); - if (!in_array($uid, $collabIds)) - if (($c2=$ticket->getThread()->addCollaborator($user,array(), $errors))) - $c2->setBcc(); - } - } if (!$vars['poster'] && $thisstaff) $vars['poster'] = $thisstaff; @@ -2978,30 +2939,15 @@ implements RestrictedAccess, Threadable, Searchable { $attachments = $cfg->emailAttachments() ? $response->getAttachments() : array(); //Cc collaborators $collabsCc = array(); - if ($vars['ccs'] && $vars['emailcollab']) { + if ($vars['ccs'] && Ticket::checkReply('cc', $vars['emailreply'])) { $collabsCc[] = Collaborator::getCollabList($vars['ccs']); $collabsCc['cc'] = $collabsCc[0]; } - $email->send($user, $msg['subj'], $msg['body'], $attachments, - $options, $collabsCc); - - //Bcc Collaborators - if ($vars['bccs'] - && $vars['emailcollab'] - && ($bcctpl = $dept->getTemplate()) - && ($bccmsg=$bcctpl->getReplyBCCMsgTemplate())) { - foreach ($vars['bccs'] as $uid) { - if (!($recipient = User::lookup($uid))) - continue; - - $extraVars = UsersName::getNameFormats($recipient, 'recipient'); - $extraVars = array_merge($extraVars, array('recipient' => $user)); - $msg = $this->replaceVars($bccmsg->asArray(), $variables + $extraVars); + if (Ticket::checkReply('user', $vars['emailreply'])) + $email->send($user, $msg['subj'], $msg['body'], $attachments, + $options, $collabsCc); - $email->send($recipient, $msg['subj'], $msg['body'], $attachments, $options); - } - } } return $response; @@ -3914,20 +3860,19 @@ implements RestrictedAccess, Threadable, Searchable { $ticket->getId(), $ticket->getNumber()); - $entryLink = sprintf('<a href="#entry-%d"><b>%d</b></a> (%s)', - $_SESSION[':form-data']['eid'], + $entryLink = sprintf('<a href="#entry-%d"><b>%s</b></a>', $_SESSION[':form-data']['eid'], Format::datetime($_SESSION[':form-data']['timestamp'])); $ticketNote = array( 'title' => __('Ticket Created From Thread Entry'), 'body' => __('Ticket ' . $ticketLink). - '<br /> Thread Entry ID: ' . $entryLink); + '<br /> Thread Entry: ' . $entryLink); $taskNote = array( 'title' => __('Ticket Created From Thread Entry'), 'note' => __('Ticket ' . $ticketLink). - '<br /> Thread Entry ID: ' . $entryLink); + '<br /> Thread Entry: ' . $entryLink); if ($oldTicket) $oldTicket->logNote($ticketNote['title'], $ticketNote['body'], $thisstaff); @@ -4076,7 +4021,6 @@ implements RestrictedAccess, Threadable, Searchable { return false; $collabsCc = array(); - $collabsBcc = array(); if (isset($vars['ccs'])) { foreach ($vars['ccs'] as $uid) { $ccuser = User::lookup($uid); @@ -4091,19 +4035,6 @@ implements RestrictedAccess, Threadable, Searchable { $collabsCc['cc'] = $collabsCc; } - if (isset($vars['bccs'])) { - foreach ($vars['bccs'] as $uid) { - $bccuser = User::lookup($uid); - - if ($bccuser && !$existing = Collaborator::getIdByUserId($bccuser->getId(), $ticket->getThreadId())) { - $collabsBcc[] = $bccuser; - - if (($c2=$ticket->getThread()->addCollaborator($bccuser,array(), $errors))) - $c2->setBcc(); - } - } - } - $vars['msgId']=$ticket->getLastMsgId(); // Effective role for the department @@ -4128,7 +4059,6 @@ implements RestrictedAccess, Threadable, Searchable { } if (!$cfg->notifyONNewStaffTicket() - || !isset($vars['alertuser']) || !($dept=$ticket->getDept()) ) { return $ticket; //No alerts. @@ -4175,31 +4105,11 @@ implements RestrictedAccess, Threadable, Searchable { ); //ticket created on user's behalf - if($vars['emailcollab'] == 1) { - + if (Ticket::checkReply('cc', $vars['emailreply'])) { $email->send($ticket->getOwner(), $msg['subj'], $msg['body'], $attachments, $options, $collabsCc); - - if ($collabsBcc) { - foreach ($collabsBcc as $recipient) { - if (($tpl=$dept->getTemplate()) - && ($bccmsg=$tpl->getNewTicketNoticeBCCMsgTemplate()) - && ($email=$dept->getEmail()) - ) - $extraVars = UsersName::getNameFormats($recipient, 'recipient'); - $extraVars = array_merge($extraVars, array( - 'message' => $message, - 'signature' => $signature, - 'response' => ($response) ? $response->getBody() : '', - 'recipient' => $ticket->getOwner())); - $bccmsg = $ticket->replaceVars($bccmsg->asArray(), $extraVars); - - $email->send($recipient, $bccmsg['subj'], $bccmsg['body'], $attachments, - $options); - } - } } - else + elseif (Ticket::checkReply('user', $vars['emailreply'])) $email->send($ticket->getOwner(), $msg['subj'], $msg['body'], $attachments, $options); } diff --git a/include/client/templates/thread-entry.tmpl.php b/include/client/templates/thread-entry.tmpl.php index e49b3b0389bf1c9d2f7c330ebac9039b536c0fc9..d2dead396590a155ef07481af686f54280de0db3 100644 --- a/include/client/templates/thread-entry.tmpl.php +++ b/include/client/templates/thread-entry.tmpl.php @@ -11,16 +11,11 @@ if ($cfg->isAvatarsEnabled() && $user) $avatar = $user->getAvatar(); ?> <?php -$type = $entryTypes[$entry->type]; -if ($type == 'note') { - $type = 'bccmessage'; - $entry->type = 'B'; -} -?> - + $type = $entryTypes[$entry->type]; + ?> <div class="thread-entry <?php echo $type; ?> <?php if ($avatar) echo 'avatar'; ?>"> <?php if ($avatar) { ?> - <span class="<?php echo ($entry->type == 'M' || $entry->type == 'B') ? 'pull-left' : 'pull-right'; ?> avatar"> + <span class="<?php echo ($entry->type == 'M') ? 'pull-left' : 'pull-right'; ?> avatar"> <?php echo $avatar; ?> </span> <?php } ?> diff --git a/include/client/view.inc.php b/include/client/view.inc.php index fa48bdc3eaf2bb3aaf44ca37690fa64ff509eed3..59c3baff9d4e559422c6ebf5ab494fbd378d65af 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -38,14 +38,6 @@ if ($thisclient && $thisclient->isGuest() </b> <small>#<?php echo $ticket->getNumber(); ?></small> <div class="pull-right"> - <?php - if($collabs = $ticket->getRecipients()) { - foreach ($collabs as $collab) { - if(get_class($collab) == 'Collaborator' && $collab->user_id == $thisclient->getId() && !$collab->isCc()) { - $viewThreads = true; - } - } - } ?> <a class="action-button" href="tickets.php?a=print&id=<?php echo $ticket->getId(); ?>"><i class="icon-print"></i> <?php echo __('Print'); ?></a> diff --git a/include/i18n/en_US/help/tips/tickets.queue.yaml b/include/i18n/en_US/help/tips/tickets.queue.yaml index a7145541614814f5d8bcfa29557d74380ccdb70a..b59b1ae6215c2148a6921de1f829a2037747a760 100644 --- a/include/i18n/en_US/help/tips/tickets.queue.yaml +++ b/include/i18n/en_US/help/tips/tickets.queue.yaml @@ -76,3 +76,13 @@ adv_date_range: title: Search by Date Range content: > Definition here + +reply_types: + title: Reply Types + content: > + <b>Reply All:</b> + This reply is sent to the User and the Collaborators you choose to include.</br> + <b>Reply to User:</b> + This reply is sent to the User only, no Collaborators.</br> + <b>Do Not Email Reply:</b> + No email alerts are sent out, however, the Agent response is visible to <b>ALL</b> Users upon viewing the Ticket. diff --git a/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml b/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml deleted file mode 100644 index c6553869044b8901cedbfe939a38b02a212b217c..0000000000000000000000000000000000000000 --- a/include/i18n/en_US/templates/email/ticket.activity.notice.bcc.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Email template: ticket.activity.notice.bcc.yaml -# -# Notice sent to BCCd collaborators on ticket activity e.g reply or message -# ---- -notes: | - Notice sent to BCCd collaborators on ticket activity e.g reply or message. - -subject: | - Re: %{ticket.subject} [#%{ticket.number}] -body: | - <h3><strong>Dear %{recipient.name.first},</strong></h3> - <div> - <em>%{poster.name}</em> just logged a message to a ticket in which you participate. - </div> - <br> - %{message} - <br> - <br> - Ticket recipients can be seen below where the User is first and any other - names are ticket Collaborators. - <br> - <br> - Recipients: - <br> - %{ticket.recipients} - <br> - <br> - <hr> - <div style="color: rgb(127, 127, 127); font-size: small; text-align: center;"> - <em>You're getting this email because you have been BCC'd - on ticket <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" - >#%{ticket.number}</a> This means that only agents can see your responses to - this ticket. To participate, simply reply to this email - or <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" - >click here</a> for a complete archive of the ticket thread.</em> - </div> diff --git a/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml b/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml deleted file mode 100644 index b0b1799f6655f3f9e6823e8fafbbfdf82a9354ba..0000000000000000000000000000000000000000 --- a/include/i18n/en_US/templates/email/ticket.notice.bcc.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# -# Email template: ticket.notice.bcc.yaml -# -# Sent to a BCC'd user when a staff member creates a ticket on another user's behalf. -# ---- -notes: | - Sent to a BCC'd user when a staff member creates a ticket on another user's behalf. - -subject: | - %{ticket.subject} [#%{ticket.number}] -body: | - <h3><strong>Dear %{recipient.name.first},</strong></h3> - Our customer care team has created a ticket, <a - href="%{recipient.ticket_link}">#%{ticket.number}</a> on behalf of %{ticket.name}, with - the following details and summary: - <br> - <br> - Topic: <strong>%{ticket.topic.name}</strong> - <br> - Subject: <strong>%{ticket.subject}</strong> - <br> - <br> - %{message} - <br> - <br> - You have been BCC'd on this ticket. This means that only agents can see your - responses to this ticket. - <br> - <br> - You can <a href="%{recipient.ticket_link}">view this - ticket's progress online</a>. - <br> - <br> - Ticket recipients can be seen below where the User is first and any other - names are ticket Collaborators. - <br> - <br> - Recipients: - <br> - %{ticket.recipients} - <br> - <br> - <div style="color: rgb(127, 127, 127);"> - Your %{company.name} Team,<br> - %{signature}</div> - <hr> - <div style="color: rgb(127, 127, 127); font-size: small; "><em>If you - wish to provide additional comments or information regarding the issue, - please reply to this email or <a href="%{recipient.ticket_link}"><span - style="color: rgb(84, 141, 212);" >login to your account</span></a> for - a complete archive of your support requests.</em></div> diff --git a/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml b/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml deleted file mode 100644 index 4f18c78075f21551032416507bcd8ffbf42bc27e..0000000000000000000000000000000000000000 --- a/include/i18n/en_US/templates/email/ticket.reply.bcc.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Email template: ticket.reply.bcc.yaml -# -# Sent to BCC'd collaborators when a staff member makes a reply to a ticket. -# Replies are only generated by staff members. -# ---- -notes: | - Sent to BCC'd collaborators when a staff member makes a reply to their ticket. - Replies are only generated by staff members. - -subject: | - Re: %{ticket.subject} [#%{ticket.number}] -body: | - <h3><strong>Dear %{recipient.name.first},</strong></h3> - %{response} - <br> - <br> - Ticket recipients can be seen below where the User is first and any other - names are ticket Collaborators. - <br> - <br> - Recipients: - <br> - %{ticket.recipients} - <br> - <br> - <div style="color: rgb(127, 127, 127);"> - Your %{company.name} Team,<br> - %{signature} - </div> - <hr> - <div style="color: rgb(127, 127, 127); font-size: small; text-align: center;" - ><em>You are receiving this message because you have been BCC'd on a ticket. - This means that only agents can see your responses to this ticket. - To participate in this ticket, please reply to this email or - <a href="%{recipient.ticket_link}" style="color: rgb(84, 141, 212);" >login - to your account</a> for a complete archive of all your support requests - and responses.</em></div> diff --git a/include/staff/templates/collaborators.tmpl.php b/include/staff/templates/collaborators.tmpl.php index 1a50164f1f78421050098dfef38f89de93d9cf0b..d25d10a83fb72bd3c84797137503ac74d89f8f9c 100644 --- a/include/staff/templates/collaborators.tmpl.php +++ b/include/staff/templates/collaborators.tmpl.php @@ -20,7 +20,6 @@ if(($users=$thread->getCollaborators())) {?> foreach($users as $user) { $checked = $user->isActive() ? 'checked="checked"' : ''; $cc = $user->isCc() ? 'selected="selected"' : ''; - $bcc = !$user->isCc() ? 'selected="selected"' : ''; echo sprintf('<tr> <td> @@ -44,15 +43,6 @@ if(($users=$thread->getCollaborators())) {?> Format::htmlchars($user->getName()), $user->getEmail()); - if ($thread->object_type == 'T') { - echo sprintf('<td> - <select name="recipientType[]"> - <option value="Cc" %s>Cc</option> - <option value="Bcc" %s>Bcc</option> - </select> - </td>', $cc, $bcc); - } - echo sprintf('<td width="10"> <input type="hidden" name="del[]" id="d%d" value=""> <a class="remove" href="#d%d"> diff --git a/include/staff/templates/thread-entry.tmpl.php b/include/staff/templates/thread-entry.tmpl.php index 5781db359fb9fe1383bd8f2235f536bb2f910774..3407e534b966dd6d9a588e45367e70a3731c789f 100644 --- a/include/staff/templates/thread-entry.tmpl.php +++ b/include/staff/templates/thread-entry.tmpl.php @@ -7,17 +7,13 @@ if ($thisstaff && !strcasecmp($thisstaff->datetime_format, 'relative')) { }; } -$entryTypes = array('M'=>'message', 'R'=>'response', 'N'=>'note','B' => 'bccmessage'); +$entryTypes = array('M'=>'message', 'R'=>'response', 'N'=>'note'); $user = $entry->getUser() ?: $entry->getStaff(); $name = $user ? $user->getName() : $entry->poster; $avatar = ''; if ($user && $cfg->isAvatarsEnabled()) $avatar = $user->getAvatar(); -if ($entry->flags & ThreadEntry::FLAG_COLLABORATOR && $entry->type == 'N') { - $entryTypes[$entry->type] = 'bccmessage'; - $entry->type = 'B'; -} ?> <div class="thread-entry <?php echo $entry->isSystem() ? 'system' : $entryTypes[$entry->type]; ?> <?php if ($avatar) echo 'avatar'; ?>"> @@ -58,8 +54,11 @@ if ($entry->flags & ThreadEntry::FLAG_COLLABORATOR && $entry->type == 'N') { if ($entry->flags & ThreadEntry::FLAG_RESENT) { ?> <span class="label label-bare"><?php echo __('Resent'); ?></span> <?php } - if ($entry->flags & ThreadEntry::FLAG_COLLABORATOR && $entry->type == 'B') { ?> - <span class="label label-bare"><?php echo __('Bcc Collaborator'); ?></span> + if ($entry->flags & ThreadEntry::FLAG_REPLY_ALL) { ?> + <span class="label label-bare"><?php echo __('Reply All'); ?></span> +<?php } + if ($entry->flags & ThreadEntry::FLAG_REPLY_USER) { ?> + <span class="label label-bare"><?php echo __('Reply to User'); ?></span> <?php } if ($entry->flags & ThreadEntry::FLAG_COLLABORATOR && $entry->type == 'M') { ?> <span class="label label-bare"><?php echo __('Cc Collaborator'); ?></span> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 923e19b41f195132edb739c15f841f6a13129727..daaa18a38ec823c22ca406e3e9b00161caa25e50 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -75,113 +75,106 @@ if ($_POST) <tbody> <tr> <th colspan="2"> - <em><strong><?php echo __('Recipient Information'); ?></strong>: </em> + <em><strong><?php echo __('User and Collaborators'); ?></strong>: </em> <div class="error"><?php echo $errors['user']; ?></div> </th> </tr> - <?php - if ($user) { ?> - <tr><td><?php echo __('User'); ?>:</td><td> - <div id="user-info"> - <input type="hidden" name="uid" id="uid" value="<?php echo $user->getId(); ?>" /> - <a href="#" onclick="javascript: - $.userLookup('ajax.php/users/<?php echo $user->getId(); ?>/edit', - function (user) { - $('#user-name').text(user.name); - $('#user-email').text(user.email); - }); - return false; - "><i class="icon-user"></i> - <span id="user-name"><?php echo Format::htmlchars($user->getName()); ?></span> - <<span id="user-email"><?php echo $user->getEmail(); ?></span>> - </a> - <a class="inline button" style="overflow:inherit" href="#" + <tr> + <td> + <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2"> + <?php + if ($user) { ?> + <tr><td><?php echo __('User'); ?>:</td><td> + <div id="user-info"> + <input type="hidden" name="uid" id="uid" value="<?php echo $user->getId(); ?>" /> + <a href="#" onclick="javascript: + $.userLookup('ajax.php/users/<?php echo $user->getId(); ?>/edit', + function (user) { + $('#user-name').text(user.name); + $('#user-email').text(user.email); + }); + return false; + "><i class="icon-user"></i> + <span id="user-name"><?php echo Format::htmlchars($user->getName()); ?></span> + <<span id="user-email"><?php echo $user->getEmail(); ?></span>> + </a> + <a class="inline button" style="overflow:inherit" href="#" onclick="javascript: - $.userLookup('ajax.php/users/select/'+$('input#uid').val(), - function(user) { - $('input#uid').val(user.id); - $('#user-name').text(user.name); - $('#user-email').text('<'+user.email+'>'); - }); - return false; + $.userLookup('ajax.php/users/select/'+$('input#uid').val(), + function(user) { + $('input#uid').val(user.id); + $('#user-name').text(user.name); + $('#user-email').text('<'+user.email+'>'); + }); + return false; "><i class="icon-retweet"></i> <?php echo __('Change'); ?></a> - </div> - </td></tr> - <?php - } else { //Fallback: Just ask for email and name - ?> - <tr> - <td width="160" class="required"> <?php echo __('Email Address'); ?>: </td> - <td> - <div class="attached input"> - <input type="text" size=45 name="email" id="user-email" class="attached" - autocomplete="off" autocorrect="off" value="<?php echo $info['email']; ?>" /> </span> - <a href="?a=open&uid={id}" data-dialog="ajax.php/users/lookup/form" - class="attached button"><i class="icon-search"></i></a> - </div> + </div> + </td> + </tr> + <?php + } else { //Fallback: Just ask for email and name + ?> + <tr id="userRow"> + <td width="120"><?php echo __('User'); ?>:</td> + <td> + <span> + <select class="userSelection" name="name" id="user-name" + data-placeholder="<?php echo __('Select User'); ?>"> + </select> + </span> + + <a class="inline button" style="overflow:inherit" href="#" + onclick="javascript: + $.userLookup('ajax.php/users/lookup/form', function (user) { + var newUser = new Option(user.email + ' - ' + user.name, user.id, true, true); + return $("#user-name").append(newUser).trigger('change'); + }); + "><i class="icon-plus"></i> <?php echo __('Add New'); ?></a> + <span class="error">*</span> - <div class="error"><?php echo $errors['email']; ?></div> - </td> - </tr> - <tr> - <td width="160" class="required"> <?php echo __('Full Name'); ?>: </td> + <br/><span class="error"><?php echo $errors['name']; ?></span> + </td> + <div> + <input type="hidden" size=45 name="email" id="user-email" class="attached" + placeholder="<?php echo __('User Email'); ?>" + autocomplete="off" autocorrect="off" value="<?php echo $info['email']; ?>" /> + </div> + </tr> + <?php + } ?> + <tr id="ccRow"> + <td width="160"><?php echo __('Cc'); ?>:</td> <td> - <span style="display:inline-block;"> - <input type="text" size=45 name="name" id="user-name" value="<?php echo $info['name']; ?>" /> </span> - <span class="error">*</span> - <div class="error"><?php echo $errors['name']; ?></div> - </td> - </tr> - <?php - } ?> + <span> + <select class="collabSelections" name="ccs[]" id="cc_users_open" multiple="multiple" + ref="tags" data-placeholder="<?php echo __('Select Contacts'); ?>"> + </select> + </span> - <?php - if($cfg->notifyONNewStaffTicket()) { ?> - <tr> - <td width="160"><?php echo __('Ticket Notice'); ?>:</td> - <td> - <input type="checkbox" name="alertuser" <?php echo (!$errors || $info['alertuser'])? 'checked="checked"': ''; ?>><?php - echo __('Send alert to user.'); ?> - </td> - </tr> - <?php - } ?> - <tr> - <td> - <table border="0"> - <tr class="no_border"> - <td width="120"> - <label><strong><?php echo __('Collaborators'); ?>:</strong></label> - </td> - <td> - <input type='checkbox' value='1' name="emailcollab" - id="emailcollab" - <?php echo ((!$info['emailcollab'] && !$errors) || isset($info['emailcollab']))?'checked="checked"':''; ?> + <a class="inline button" style="overflow:inherit" href="#" + onclick="javascript: + $.userLookup('ajax.php/users/lookup/form', function (user) { + var newUser = new Option(user.name, user.id, true, true); + return $("#cc_users_open").append(newUser).trigger('change'); + }); + "><i class="icon-plus"></i> <?php echo __('Add New'); ?></a> - > - <?php - ?> - </td> - </tr> - <tr class="no_border" id="ccRow"> - <td width="160"><?php echo __('Cc'); ?>:</td> - <td> - <select class="collabSelections" name="ccs[]" id="cc_users_open" multiple="multiple" - data-placeholder="<?php echo __('Select Contacts'); ?>"> - </select> - <br/><span class="error"><?php echo $errors['ccs']; ?></span> - </td> - </tr> - <tr class="no_border" id="bccRow"> - <td width="160"><?php echo __('Bcc'); ?>:</td> - <td> - <select class="collabSelections" name="bccs[]" id="bcc_users_open" multiple="multiple" - data-placeholder="<?php echo __('Select Contacts'); ?>"> - </select> - <br/><span class="error"><?php echo $errors['ccs']; ?></span> - </td> - </tr> - </table> + <br/><span class="error"><?php echo $errors['ccs']; ?></span> + </td> + </tr> + <tr class="no_border"> + <td> + <?php echo __('Ticket Notice');?>: + </td> + <td> + <select id="emailreply" name="emailreply"> + <option value="reply-all"><?php echo __('Alert All'); ?></option> + <option value="reply-user"><?php echo __('Alert to User'); ?></option> + <option value="0">— <?php echo __('Do Not Send Alert'); ?> —</option> + </select> + </td> + </tr> + </table> </td> </tr> </tbody> @@ -529,8 +522,8 @@ $(function() { return false; }); - $('.collabSelections').select2({ - width: '350px', + $('.userSelection').select2({ + width: '450px', minimumInputLength: 3, ajax: { url: "ajax.php/users/local", @@ -544,40 +537,54 @@ $(function() { return { results: $.map(data, function (item) { return { - text: item.name, + text: item.email + ' - ' + item.name, slug: item.slug, + email: item.email, id: item.id } }) }; + $('#user-email').val(item.name); } } }); - }); + $('.userSelection').on('select2:select', function (e) { + var data = e.params.data; + $('#user-email').val(data.email); + }); -$(document).ready(function () { - $('#emailcollab').on('change', function(){ - var value = $("#cc_users_open").val(); - if ($(this).prop('checked')) { - $('#ccRow').show(); - $('#bccRow').show(); - } - else { - $('#ccRow').hide(); - $('#bccRow').hide(); + $('.userSelection').on("change", function (e) { + var data = $('.userSelection').select2('data'); + var data = data[0].text; + var email = data.substr(0,data.indexOf(' ')); + $('#user-email').val(data.substr(0,data.indexOf(' '))); + }); + + $('.collabSelections').select2({ + width: '450px', + minimumInputLength: 3, + ajax: { + url: "ajax.php/users/local", + dataType: 'json', + data: function (params) { + return { + q: params.term, + }; + }, + processResults: function (data) { + return { + results: $.map(data, function (item) { + return { + text: item.name, + slug: item.slug, + id: item.id + } + }) + }; } + } }); -}); -$("form").submit(function(event) { - var value = $("#emailcollab").val(); - if ($("#emailcollab").prop('checked')) { - //do nothing - } - else { - $("#cc_users_open").val(null).change(); - $("#bcc_users_open").val(null).change(); - } -}); + }); </script> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 471721eba47a8aa4272b4fe1ed86128cb97628a5..65636d0fbb8aac188a2b941c742b6edac2f737f2 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -738,21 +738,32 @@ if ($errors['err'] && isset($_POST['a'])) { <?php } ?> <tr> <td width="120"> - <label><strong><?php echo __('To'); ?>:</strong></label> + <label><strong><?php echo __('Reply To'); ?>:</strong></label> </td> <td> <?php - # XXX: Add user-to-name and user-to-email HTML ID#s - $to =sprintf('%s <%s>', - Format::htmlchars($ticket->getName()), - $ticket->getReplyToEmail()); - $emailReply = (!isset($info['emailreply']) || $info['emailreply']); + //see who sent the last message and decide which option to select. + $lastUser = $ticket->getLastUserRespondent(); + + if ($ticket->getOwnerId() == $lastUser->getId()) + $ticketUser = true; + else { + $collabs = $ticket->getThread()->getCollaborators(); + foreach ($collabs as $collab) { + if ($collab->getUserId() == $lastUser->getId() && $collab->isCc()) + $ccUser = true; + } + } + if ($ticketUser || $ccUser) + $emailReply = true; ?> <select id="emailreply" name="emailreply"> - <option value="1" <?php echo $emailReply ? 'selected="selected"' : ''; ?>><?php echo $to; ?></option> + <option value="reply-all"><?php echo __('Reply All'); ?></option> + <option value="reply-user"><?php echo __('Reply to User'); ?></option> <option value="0" <?php echo !$emailReply ? 'selected="selected"' : ''; ?> >— <?php echo __('Do Not Email Reply'); ?> —</option> </select> + <i class="help-tip icon-question-sign" href="#reply_types"></i> </td> </tr> </tbody> @@ -761,69 +772,51 @@ if ($errors['err'] && isset($_POST['a'])) { ?> <tbody id="cc_sec" style="display:<?php echo $emailReply? 'table-row-group':'none'; ?>;"> - <tr> - <td width="120"> - <label><strong><?php echo __('Collaborators'); ?>:</strong></label> + <tr id="user-row"> + <td width="120" style="padding-left:20px;"> + <label><?php echo __('User'); ?></label> </td> <td> - <input type='checkbox' value='1' name="emailcollab" - id="t<?php echo $ticket->getThreadId(); ?>-emailcollab" - <?php echo ((!$info['emailcollab'] && !$errors) || isset($info['emailcollab']))?'checked="checked"':''; ?> - style="display:<?php echo $ticket->getThread()->getNumCollaborators() ? 'inline-block': 'none'; ?>;" - > - <?php - ?> + <label><?php echo User::lookup($ticket->user_id); ?></label> </td> </tr> <?php $collaborators = $ticket->getThread()->getCollaborators(); $cc_cids = array(); - $bcc_cids = array(); foreach ($collaborators as $c) { if ($c->flags & Collaborator::FLAG_CC && $c->flags & Collaborator::FLAG_ACTIVE) $cc_cids[] = $c->user_id; - elseif (!($c->flags & Collaborator::FLAG_CC) && $c->flags & Collaborator::FLAG_ACTIVE) { - $bcc_cids[] = $c->user_id; - } } ?> - <tr> - <td width="160"><b><?php echo __('Cc'); ?>:</b></td> + <tr id="cc-row"> + <td width="160" style="padding-left:20px;"><?php echo __('Cc'); ?></td> <td> - <select class="collabSelections" name="ccs[]" id="cc_users" multiple="multiple" - data-placeholder="<?php echo __('Select Contacts'); ?>"> - <?php - foreach ($cc_cids as $u) { - if($u != $ticket->user_id && !in_array($u, $bcc_cids)) { - ?> - <option value="<?php echo $u; ?>" <?php - if (in_array($u, $cc_cids)) - echo 'selected="selected"'; ?>><?php echo User::lookup($u); ?> - </option> - <?php } } ?> - ?> - </select> + <span> + <select class="collabSelections" name="ccs[]" id="cc_users" multiple="multiple" + data-placeholder="<?php echo __('Select Contacts'); ?>"> + <?php + foreach ($cc_cids as $u) { + if($u != $ticket->user_id) { + ?> + <option value="<?php echo $u; ?>" <?php + if (in_array($u, $cc_cids)) + echo 'selected="selected"'; ?>><?php echo User::lookup($u); ?> + </option> + <?php } } ?> + ?> + </select> + </span> + + <a class="inline button" style="overflow:inherit" href="#" + onclick="javascript: + $.userLookup('ajax.php/users/lookup/form', function (user) { + var newUser = new Option(user.name, user.id, true, true); + return $("#cc_users").append(newUser).trigger('change'); + }); + "><i class="icon-plus"></i> <?php echo __('Add New'); ?></a> + <br/><span class="error"><?php echo $errors['ccs']; ?></span> </td> </tr> - <tr> - <td width="160"><b><?php echo __('Bcc'); ?>:</b></td> - <td> - <select class="collabSelections" name="bccs[]" id="bcc_users" multiple="multiple" - data-placeholder="<?php echo __('Select Contacts'); ?>"> - <?php - foreach ($bcc_cids as $u) { - if($u != $ticket->user_id && !in_array($u, $cc_cids)) { - ?> - <option value="<?php echo $u; ?>" <?php - if (in_array($u, $bcc_cids)) - echo 'selected="selected"'; ?>><?php echo User::lookup($u); ?> - </option> - <?php } } ?> - ?> - </select> - <br/><span class="error"><?php echo $errors['bccs']; ?></span> - </td> - </tr> </tbody> <?php } ?> @@ -1162,6 +1155,10 @@ $(function() { }); }); + $("#emailreply").ready(function(){ + checkReply(); + }); + // Post Reply or Note action buttons. $('a.post-response').click(function (e) { var $r = $('ul.tabs > li > a'+$(this).attr('href')+'-tab'); @@ -1186,34 +1183,30 @@ $(function() { return false; }); -}); - -$(function() { - $('.collabSelections').on("select2:select", function(e) { - var el = $(this); - var tid = <?php echo $ticket->getThreadId(); ?>; - var target = e.currentTarget.id; - var addTo = (target == 'cc_users') ? 'addcc' : 'addbcc'; - - if(el.val().indexOf("NEW") > -1) { - $("li[title='— Add New —']").remove(); - var url = 'ajax.php/thread/' + tid + '/add-collaborator/' + addTo ; - $.userLookup(url, function(user) { - e.preventDefault(); - if($('.dialog#confirm-action').length) { - $('.dialog#confirm-action #action').val(addTo); - $('#confirm-form').append('<input type=hidden name=user_id value='+user.id+' />'); - $('#overlay').show(); - } - }); - var arr = el.val(); - var removeStr = "NEW"; + $('#emailreply').on('change', function(){ + checkReply(); + }); - arr.splice($.inArray(removeStr, arr),1); - $(this).val(arr); + function checkReply() { + var value = $("#emailreply").val(); + switch (value) { + case "reply-all": + $('#user-row').show(); + $('#cc-row').show(); + break; + case "reply-user": + $('#user-row').show(); + $('#cc-row').hide(); + break; + default: + $('#user-row').show(); + $('#cc-row').show(); + break; + } } - }); +}); +$(function() { $('.collabSelections').on("select2:unselecting", function(e) { var el = $(this); var target = '#' + e.currentTarget.id; @@ -1242,7 +1235,6 @@ $(function() { }; }, processResults: function (data) { - data[0] = {name: "\u2014 Add New \u2014", id: "NEW"}; return { results: $.map(data, function (item) { return { diff --git a/include/upgrader/streams/core/ad9d0a5f-0ca85857.patch.sql b/include/upgrader/streams/core/ad9d0a5f-0ca85857.patch.sql index ee61ea4e15c9a0365f55770ce2901fc73339622a..d3563164b5f092a2168efe3246a281b34e507b21 100644 --- a/include/upgrader/streams/core/ad9d0a5f-0ca85857.patch.sql +++ b/include/upgrader/streams/core/ad9d0a5f-0ca85857.patch.sql @@ -8,8 +8,7 @@ * an email was involved (agent or user generated) * * It also adds a flags field to the thread_collaborator table which - * tracks whether a collaborator is a CC or BCC collaborator as well as - * storing whether or not the collaborator is active. As a result, we can + * tracks whether or not the collaborator is active. As a result, we can * remove the isactive field */ diff --git a/scp/css/scp.css b/scp/css/scp.css index bfd36840bf5c32c52da2fb88794f577851c7f2cb..47f0e655fef9d66dbe1a353d0aa977c7baafe618 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1588,27 +1588,6 @@ img.avatar { position: relative; } -.thread-entry.bccmessage .header { - background:#DDFDAC; -} - -.thread-entry.avatar.bccmessage .header:before { - top: 7px; - left: -8px; - right: initial; - border-left: none; - border-right: 8px solid #CCC; -} - -.thread-entry.avatar.bccmessage .header:after { - top: 7px; - left: -8px; - right: initial; - border-left: none; - border-right: 7px solid #DDFDAC; - margin-left: 1px; -} - .thread-entry.message .header { background:#C3D9FF; } diff --git a/scp/tickets.php b/scp/tickets.php index 2d04b89efc48ccedab6099f58bee837d72ac2b9d..95720d202fe230a8e8ca1019c5fd0358adb57891 100644 --- a/scp/tickets.php +++ b/scp/tickets.php @@ -379,19 +379,6 @@ if($_POST && !$errors): $errors['err'] = sprintf('%s %s', __('Unable to add collaborator.'), __('Please try again!')); } break; - case 'addbcc': - if (!$role->hasPerm(Ticket::PERM_EDIT)) { - $errors['err']=__('Permission Denied. You are not allowed to add collaborators'); - } elseif (!$_POST['user_id'] || !($user=User::lookup($_POST['user_id']))) { - $errors['err'] = __('Unknown user selected'); - } elseif ($c2 = $ticket->addCollaborator($user, array(), $errors)) { - $msg = sprintf(__('Collaborator %s added'), - Format::htmlchars($user->getName())); - } - else { - $errors['err'] = sprintf('%s %s', __('Unable to add collaborator.'), __('Please try again!')); - } - break; default: $errors['err']=__('You must select action to perform'); endswitch;