Skip to content
Snippets Groups Projects
Commit ec9c0ee4 authored by Peter Rotich's avatar Peter Rotich
Browse files

Add ticket status preview

This is important to show custom statuses with properties.
parent 55ac9626
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,9 @@ interface CustomListItem { ...@@ -68,6 +68,9 @@ interface CustomListItem {
function getAbbrev(); function getAbbrev();
function getSortOrder(); function getSortOrder();
function getList();
function getListId();
function getConfiguration(); function getConfiguration();
function hasProperties(); function hasProperties();
...@@ -673,6 +676,10 @@ class DynamicListItem extends VerySimpleModel implements CustomListItem { ...@@ -673,6 +676,10 @@ class DynamicListItem extends VerySimpleModel implements CustomListItem {
return $this->get('id'); return $this->get('id');
} }
function getList() {
return $this->list;
}
function getListId() { function getListId() {
return $this->get('list_id'); return $this->get('list_id');
} }
...@@ -1272,6 +1279,11 @@ implements CustomListItem, TemplateVariable { ...@@ -1272,6 +1279,11 @@ implements CustomListItem, TemplateVariable {
return $this->_list; return $this->_list;
} }
function getListId() {
if (($list = $this->getList()))
return $list->getId();
}
function getConfigurationForm($source=null) { function getConfigurationForm($source=null) {
if (!$this->_form) { if (!$this->_form) {
$config = $this->getConfiguration(); $config = $this->getConfiguration();
...@@ -1301,6 +1313,10 @@ implements CustomListItem, TemplateVariable { ...@@ -1301,6 +1313,10 @@ implements CustomListItem, TemplateVariable {
return $this->_form; return $this->_form;
} }
function getFields() {
return $this->getConfigurationForm()->getFields();
}
function getConfiguration() { function getConfiguration() {
if (!$this->_settings) { if (!$this->_settings) {
...@@ -1385,6 +1401,15 @@ implements CustomListItem, TemplateVariable { ...@@ -1385,6 +1401,15 @@ implements CustomListItem, TemplateVariable {
return count($errors) === 0; return count($errors) === 0;
} }
function display() {
return sprintf('<a class="preview" href="#"
data-preview="#list/%d/items/%d/preview">%s</a>',
$this->getListId(),
$this->getId(),
$this->getLocalName()
);
}
function update($vars, &$errors) { function update($vars, &$errors) {
$fields = array('name', 'sort'); $fields = array('name', 'sort');
foreach($fields as $k) { foreach($fields as $k) {
......
...@@ -13,6 +13,7 @@ if ($item->hasProperties()) { ?> ...@@ -13,6 +13,7 @@ if ($item->hasProperties()) { ?>
<table class="custom-info" width="100%"> <table class="custom-info" width="100%">
<?php <?php
foreach ($item->getFields() as $f) { foreach ($item->getFields() as $f) {
if (!$f->isVisible()) continue;
?> ?>
<tr><td style="width:30%;"><?php echo <tr><td style="width:30%;"><?php echo
Format::htmlchars($f->get('label')); ?>:</td> Format::htmlchars($f->get('label')); ?>:</td>
......
...@@ -239,7 +239,7 @@ if($ticket->isOverdue()) ...@@ -239,7 +239,7 @@ if($ticket->isOverdue())
<table border="0" cellspacing="" cellpadding="4" width="100%"> <table border="0" cellspacing="" cellpadding="4" width="100%">
<tr> <tr>
<th width="100"><?php echo __('Status');?>:</th> <th width="100"><?php echo __('Status');?>:</th>
<td><?php echo ($S = $ticket->getStatus()) ? $S->getLocalName() : ''; ?></td> <td><?php echo ($S = $ticket->getStatus()) ? $S->display() : ''; ?></td>
</tr> </tr>
<tr> <tr>
<th><?php echo __('Priority');?>:</th> <th><?php echo __('Priority');?>:</th>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment