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