diff --git a/include/class.list.php b/include/class.list.php index d578b73c2d520d4c3d76d2928f481fc27731b63c..69106502be674220c0f2c36c2293932554245471 100644 --- a/include/class.list.php +++ b/include/class.list.php @@ -68,6 +68,9 @@ interface CustomListItem { function getAbbrev(); function getSortOrder(); + function getList(); + function getListId(); + function getConfiguration(); function hasProperties(); @@ -673,6 +676,10 @@ class DynamicListItem extends VerySimpleModel implements CustomListItem { return $this->get('id'); } + function getList() { + return $this->list; + } + function getListId() { return $this->get('list_id'); } @@ -1272,6 +1279,11 @@ implements CustomListItem, TemplateVariable { return $this->_list; } + function getListId() { + if (($list = $this->getList())) + return $list->getId(); + } + function getConfigurationForm($source=null) { if (!$this->_form) { $config = $this->getConfiguration(); @@ -1301,6 +1313,10 @@ implements CustomListItem, TemplateVariable { return $this->_form; } + function getFields() { + return $this->getConfigurationForm()->getFields(); + } + function getConfiguration() { if (!$this->_settings) { @@ -1385,6 +1401,15 @@ implements CustomListItem, TemplateVariable { 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) { $fields = array('name', 'sort'); foreach($fields as $k) { diff --git a/include/staff/templates/list-item-preview.tmpl.php b/include/staff/templates/list-item-preview.tmpl.php index db9b87f8c2d1b7a0857f83356900b87d71eefe49..3ffcd1998faf69ef71af61c492f049c93d57ece3 100644 --- a/include/staff/templates/list-item-preview.tmpl.php +++ b/include/staff/templates/list-item-preview.tmpl.php @@ -13,6 +13,7 @@ if ($item->hasProperties()) { ?> <table class="custom-info" width="100%"> <?php foreach ($item->getFields() as $f) { + if (!$f->isVisible()) continue; ?> <tr><td style="width:30%;"><?php echo Format::htmlchars($f->get('label')); ?>:</td> diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 36c1d34ef922b6606fa3df26c61f73a3cd4893b1..202a2b2748a70f3f2af1db88699002106e04da83 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -239,7 +239,7 @@ if($ticket->isOverdue()) <table border="0" cellspacing="" cellpadding="4" width="100%"> <tr> <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> <th><?php echo __('Priority');?>:</th>