mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added {calc} operation to produce inline calculations in templates
This commit is contained in:
12
alerts.php
12
alerts.php
@@ -390,6 +390,10 @@ function FormatAlertTpl($obj) {
|
||||
$pos = $x;
|
||||
$for = true;
|
||||
}
|
||||
else if ($buff == '{calc') {
|
||||
$pos = $x;
|
||||
$calc = true;
|
||||
}
|
||||
|
||||
if ($pos != -1 && $msg[$x] == '}') {
|
||||
$orig = $buff;
|
||||
@@ -411,6 +415,14 @@ function FormatAlertTpl($obj) {
|
||||
' as $key=>$value) { $ret .= "',
|
||||
);
|
||||
}
|
||||
else if ($calc) {
|
||||
$calc = false;
|
||||
$o = 5;
|
||||
$native = array(
|
||||
'"; $ret .= (float) (0+(',
|
||||
')); $ret .= "',
|
||||
);
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user