mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Pushover fix sounds (#9519)
* Pushover fix sounds * fix editing issue with duplicate field ids
This commit is contained in:
@@ -50,7 +50,7 @@ class Pushover extends Transport
|
||||
unset($pushover_opts['options']);
|
||||
foreach (explode(PHP_EOL, $this->config['options']) as $option) {
|
||||
list($k,$v) = explode('=', $option);
|
||||
$pushover_opts['options'][$k] = $v;
|
||||
$pushover_opts['options'][$k] = trim($v);
|
||||
}
|
||||
return $this->contactPushover($obj, $pushover_opts);
|
||||
}
|
||||
@@ -74,22 +74,22 @@ class Pushover extends Transport
|
||||
switch ($obj['severity']) {
|
||||
case "critical":
|
||||
$data['priority'] = 1;
|
||||
if (!empty($api['sound_critical'])) {
|
||||
$data['sound'] = $api['sound_critical'];
|
||||
if (!empty($api['options']['sound_critical'])) {
|
||||
$data['sound'] = $api['options']['sound_critical'];
|
||||
}
|
||||
break;
|
||||
case "warning":
|
||||
$data['priority'] = 1;
|
||||
if (!empty($api['sound_warning'])) {
|
||||
$data['sound'] = $api['sound_warning'];
|
||||
if (!empty($api['options']['sound_warning'])) {
|
||||
$data['sound'] = $api['options']['sound_warning'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch ($obj['state']) {
|
||||
case 0:
|
||||
$data['priority'] = 0;
|
||||
if (!empty($api['sound_ok'])) {
|
||||
$data['sound'] = $api['sound_ok'];
|
||||
if (!empty($api['options']['sound_ok'])) {
|
||||
$data['sound'] = $api['options']['sound_ok'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -235,15 +235,18 @@ foreach (scandir($transport_dir) as $transport) {
|
||||
});
|
||||
|
||||
function loadTransport(transport) {
|
||||
var form_id = transport.type+"-form";
|
||||
var transport_form = $("#" + form_id);
|
||||
|
||||
$("#name").val(transport.name);
|
||||
$("#transport-choice").val(transport.type+"-form");
|
||||
$("#transport-choice").val(form_id);
|
||||
$("#is_default").bootstrapSwitch('state', transport.is_default);
|
||||
$(".transport").hide();
|
||||
$("#" + $("#transport-choice").val()).show().find("input:text").val("");
|
||||
transport_form.show().find("input:text").val("");
|
||||
|
||||
// Populate the field values
|
||||
transport.details.forEach(function(config) {
|
||||
var $field = $("#" + config.name);
|
||||
var $field = transport_form.find("#" + config.name);
|
||||
if ($field.prop('type') == 'checkbox') {
|
||||
$field.bootstrapSwitch('state', config.value);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user