diff --git a/include/ajax.content.php b/include/ajax.content.php index 8737473570d93aae7ba826f156deb66a031e3941..536b4d48fe2b423d78bb7b93f0b033436d39cb42 100644 --- a/include/ajax.content.php +++ b/include/ajax.content.php @@ -208,12 +208,18 @@ class ContentAjaxAPI extends AjaxController { if (!$_GET['root']) Http::response(400, '`root` is required parameter'); - // Get the template for this template - $tpl_info = EmailTemplateGroup::getTemplateDescription($_GET['root']); - if (!$tpl_info) - Http::response(422, 'No such context'); + switch ($_GET['root']) { + case 'cannedresponse': + $roots = array('ticket'); + break; - $global = osTicket::getVarScope(); + default: + // Get the template for this template + $tpl_info = EmailTemplateGroup::getTemplateDescription($_GET['root']); + if (!$tpl_info) + Http::response(422, 'No such context'); + $roots = $tpl_info['context']; + } $contextTypes = array( 'assignee' => array('class' => 'Staff', 'desc' => 'Newly assigned agent'), @@ -229,9 +235,10 @@ class ContentAjaxAPI extends AjaxController { 'ticket' => array('class' => 'Ticket', 'desc' => 'The ticket'), ); $context = array(); - foreach ($tpl_info['context'] as $C) { + foreach ($roots as $C) { $context[$C] = $contextTypes[$C]; } + $global = osTicket::getVarScope(); $items = VariableReplacer::compileScope($context + $global); header('Content-Type: application/json'); diff --git a/include/class.staff.php b/include/class.staff.php index c2765915de5a401e0f297d42da121b149a047ce1..47bda2352b3aa5183c8388d76055e7af5b12fbfb 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -80,10 +80,15 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { static function getVarScope() { return array( + 'dept' => array('class' => 'Dept', 'desc' => 'Department'), + 'email' => 'Email address', 'name' => array( 'class' => 'PersonsName', 'desc' => 'Name of the agent', ), + 'phone' => 'Phone number', 'signature' => "Agent's signature", + 'timezone' => "Agent's configured timezone", + 'username' => 'Access username', ); } diff --git a/include/staff/cannedresponse.inc.php b/include/staff/cannedresponse.inc.php index 407c5ba89466beb080c2356f7aa8113546bce33b..8e407d25319dae991eaa3ba51e7e849e7abaf8c3 100644 --- a/include/staff/cannedresponse.inc.php +++ b/include/staff/cannedresponse.inc.php @@ -80,13 +80,13 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); <font class="error">* <?php echo $errors['response']; ?></font> (<a class="tip" href="#ticket_variables"><?php echo __('Supported Variables'); ?></a>) </div> - <textarea name="response" class="richtext draft draft-delete" cols="21" rows="12" - style="width:98%;" class="richtext draft" <?php + <textarea name="response" cols="21" rows="12" + data-root-context="cannedresponse" + style="width:98%;" class="richtext draft draft-delete" <?php list($draft, $attrs) = Draft::getDraftAndDataAttrs('canned', is_object($canned) ? $canned->getId() : false, $info['response']); echo $attrs; ?>><?php echo $draft ?: $info['response']; ?></textarea> - <br><br> <div><h3><?php echo __('Canned Attachments'); ?> <?php echo __('(optional)'); ?> <i class="help-tip icon-question-sign" href="#canned_attachments"></i></h3> <div class="error"><?php echo $errors['files']; ?></div>