Commit c63d1f5d authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(argonaut): Target in argonaut queue are now links to systems

This adds a link to the system in the target column of the argonaut
 queue.
This allows to go check logs and other informations of the system.

issue #5735
Showing with 31 additions and 2 deletions
+31 -2
...@@ -35,6 +35,8 @@ class argonautQueue extends simpleManagement ...@@ -35,6 +35,8 @@ class argonautQueue extends simpleManagement
var $acl_base; var $acl_base;
protected $aclCategory = 'argonautQueue/'; protected $aclCategory = 'argonautQueue/';
static protected $macInfos = array();
static function plInfo() static function plInfo()
{ {
return array( return array(
...@@ -301,10 +303,37 @@ class argonautQueue extends simpleManagement ...@@ -301,10 +303,37 @@ class argonautQueue extends simpleManagement
static function filterHostName($mac, $name = '') static function filterHostName($mac, $name = '')
{ {
if (!isset(static::$macInfos[$mac[0]])) {
$types = array('workstation','server','terminal');
$dn = NULL;
foreach ($types as $type) {
$objects = objects::ls($type, array('dn' => 'raw'), NULL, '(macAddress='.$mac[0].')');
if (count($objects) > 1) {
trigger_error('Duplicated mac address '.$mac[0].' in LDAP');
}
if (count($objects) > 0) {
$dn = reset($objects);
break;
}
}
if (!empty($dn)) {
static::$macInfos[$mac[0]] = array(
'dn' => $dn,
'type' => $type
);
}
}
$text = '';
if (isset($name[0]) && $name[0] != 'none') { if (isset($name[0]) && $name[0] != 'none') {
return htmlentities($name[0].' ('.$mac[0].')', ENT_COMPAT, 'UTF-8'); $text = $name[0].' ('.$mac[0].')';
} else {
$text = $mac[0];
}
if (isset(static::$macInfos[$mac[0]])) {
return objects::link(static::$macInfos[$mac[0]]['dn'], static::$macInfos[$mac[0]]['type'], '', $text, TRUE);
} else {
return htmlentities($text, ENT_COMPAT, 'UTF-8');
} }
return htmlentities($mac[0], ENT_COMPAT, 'UTF-8');
} }
static function filterTask($tag, $progress) static function filterTask($tag, $progress)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment