mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 00:34:46 +02:00
Merge remote-tracking branch 'origin/develop' into ent-5719-9894-2fa-forzar-habilitado-y-no-poder-ser-desactivado-por-el-usuario
This commit is contained in:
commit
06475d21ce
@ -55,7 +55,11 @@ if (isset($_POST['create'])) {
|
||||
'expire_timestamp' => $expire_timestamp,
|
||||
];
|
||||
|
||||
$id_link = db_process_sql_insert('tnews', $values);
|
||||
if ($subject === '') {
|
||||
$id_link = false;
|
||||
} else {
|
||||
$id_link = db_process_sql_insert('tnews', $values);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$id_link,
|
||||
@ -92,7 +96,11 @@ if (isset($_POST['update'])) {
|
||||
'expire_timestamp' => $expire_timestamp,
|
||||
];
|
||||
|
||||
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
|
||||
if ($subject === '') {
|
||||
$result = false;
|
||||
} else {
|
||||
$result = db_process_sql_update('tnews', $values, ['id_news' => $id_news]);
|
||||
}
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
@ -173,7 +181,7 @@ if ((isset($_GET['form_add'])) || (isset($_GET['form_edit']))) {
|
||||
|
||||
$data = [];
|
||||
$data[0] = __('Subject').'<br>';
|
||||
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'">';
|
||||
$data[0] .= '<input type="text" name="subject" size="35" value="'.$subject.'" >';
|
||||
|
||||
$data[1] = __('Group').'<br>';
|
||||
$data[1] .= '<div class="w250px">';
|
||||
|
71
pandora_console/include/javascript/dynamic_service.js
Normal file
71
pandora_console/include/javascript/dynamic_service.js
Normal file
@ -0,0 +1,71 @@
|
||||
function updateSmartValue(event) {
|
||||
var eventType = event.type;
|
||||
var inputElement = $("#" + event.target.id);
|
||||
var inputValue = inputElement.val();
|
||||
var valueType = event.target.id.split("-");
|
||||
|
||||
if (eventType === "focus") {
|
||||
inputElement.val(parseInt(inputValue));
|
||||
} else if (eventType === "blur") {
|
||||
change_mode();
|
||||
} else {
|
||||
var keyPressed = event.keyCode;
|
||||
if (
|
||||
(keyPressed <= 48 && keyPressed >= 57) ||
|
||||
(inputElement.val() < 0 || inputElement.val() > 100)
|
||||
) {
|
||||
event.preventDefault();
|
||||
} else {
|
||||
$("#text-" + valueType[0]).val(inputElement.val());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function change_mode(alt) {
|
||||
var modeStatus = $("#mode").val();
|
||||
var serviceMode = $("#hidden-service_mode_smart").val();
|
||||
if (modeStatus == serviceMode) {
|
||||
$(".smart_thresholds").css("display", "inline-flex");
|
||||
|
||||
var crit = parseFloat($("#text-critical").val());
|
||||
var warn = parseFloat($("#text-warning").val());
|
||||
|
||||
if (crit < warn) {
|
||||
$("#text-critical").val($("#text-warning").val());
|
||||
}
|
||||
|
||||
$("#critical-val-d").val($("#text-critical").val() + " %");
|
||||
$("#warning-val-d").val($("#text-warning").val() + " %");
|
||||
|
||||
if (alt != 1) {
|
||||
$("#text-critical")
|
||||
.prop("type", "range")
|
||||
.prop("step", "0.01")
|
||||
.prop("min", "0")
|
||||
.prop("max", "100")
|
||||
.on("input", function() {
|
||||
change_mode(1);
|
||||
});
|
||||
|
||||
$("#text-warning")
|
||||
.prop("type", "range")
|
||||
.prop("step", "0.01")
|
||||
.prop("min", "0")
|
||||
.prop("max", "100")
|
||||
.on("input", function() {
|
||||
change_mode(1);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$(".smart_thresholds").css("display", "none");
|
||||
|
||||
$("#text-critical")
|
||||
.prop("type", "number")
|
||||
.on("input", function() {})
|
||||
.show();
|
||||
$("#text-warning")
|
||||
.prop("type", "number")
|
||||
.on("input", function() {})
|
||||
.show();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user