Bootstrapped checkboxes (#10749)

This commit is contained in:
SourceDoctor
2019-11-05 00:02:49 +01:00
committed by PipoCanaja
parent 75c27ed425
commit dfb4317d38
5 changed files with 27 additions and 15 deletions

View File

@@ -55,9 +55,9 @@ $disable_notify = get_dev_attrib($device, 'disable_notify');
<?php echo csrf_field() ?>
<input type="hidden" name="editing" value="yes">
<div class="form-group">
<label for="override_sysContact" class="col-sm-3 control-label">Override sysContact:</label>
<label for="override_sysContact" class="col-sm-3 control-label">Override sysContact</label>
<div class="col-sm-6">
<input onclick="edit.sysContact.disabled=!edit.override_sysContact.checked" type="checkbox" id="override_sysContact" name="override_sysContact"
<input onChange="edit.sysContact.disabled=!edit.override_sysContact.checked" type="checkbox" id="override_sysContact" name="override_sysContact" data-size="small"
<?php
if ($override_sysContact_bool) {
echo ' checked="1"';
@@ -80,9 +80,9 @@ if (!$override_sysContact_bool) {
</div>
</div>
<div class="form-group">
<label for="disable_notify" class="col-sm-3 control-label">Disable all alerting for this host: </label>
<label for="disable_notify" class="col-sm-3 control-label">Disable all alerting for this host</label>
<div class="col-sm-6">
<input id="disable_notify" type="checkbox" name="disable_notify"
<input id="disable_notify" type="checkbox" name="disable_notify" data-size="small"
<?php
if ($disable_notify) {
echo ' checked="1"';
@@ -107,3 +107,6 @@ require_once 'includes/html/modal/new_alert_rule.inc.php';
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#create-alert" data-device_id="<?php echo $device['device_id']; ?>"><i class="fa fa-plus"></i> Create new alert rule</button>
</div>
</div>
<script>
$('[type="checkbox"]').bootstrapSwitch();
</script>

View File

@@ -133,7 +133,7 @@ if ($_POST['editing']) {
<div class="form-group">
<label for="sysLocation" class="col-sm-2 control-label">Override sysLocation:</label>
<div class="col-sm-6">
<input onclick="edit.sysLocation.disabled=!edit.override_sysLocation.checked; edit.sysLocation.select()" type="checkbox" name="override_sysLocation"
<input onChange="edit.sysLocation.disabled=!edit.override_sysLocation.checked; edit.sysLocation.select()" type="checkbox" name="override_sysLocation" data-size="small"
<?php
if ($device_model->override_sysLocation) {
echo(' checked="1"');
@@ -182,7 +182,7 @@ if ($_POST['editing']) {
<div class="form-group">
<label for="disabled" class="col-sm-2 control-label">Disable:</label>
<div class="col-sm-6">
<input name="disabled" type="checkbox" id="disabled" value="1"
<input name="disabled" type="checkbox" id="disabled" value="1" data-size="small"
<?php
if ($device_model->disabled) {
echo("checked=checked");
@@ -193,7 +193,7 @@ if ($_POST['editing']) {
<div class="form-group">
<label for="ignore" class="col-sm-2 control-label">Ignore</label>
<div class="col-sm-6">
<input name="ignore" type="checkbox" id="ignore" value="1"
<input name="ignore" type="checkbox" id="ignore" value="1" data-size="small"
<?php
if ($device_model->ignore) {
echo("checked=checked");
@@ -209,6 +209,8 @@ if ($_POST['editing']) {
</form>
<br />
<script>
$('[type="checkbox"]').bootstrapSwitch();
$("#rediscover").click(function() {
var device_id = $(this).data("device_id");
$.ajax({

View File

@@ -126,11 +126,17 @@
// select all disable buttons
event.preventDefault();
$('.disable-check').prop('checked', true);
//TODO: find a better solution for 'select-all' button refresh
$('.disable-check').trigger('click');
$('.disable-check').trigger('click');
});
$('#ignore-select').click(function (event) {
// select all ignore buttons
event.preventDefault();
$('.ignore-check').prop('checked', true);
//TODO: find a better solution for 'select-all' button refresh
$('.ignore-check').trigger('click');
$('.ignore-check').trigger('click');
});
$('#down-select').click(function (event) {
// select ignore buttons for all ports which are down
@@ -201,6 +207,7 @@
},
url: "ajax_table.php"
}).on("loaded.rs.jquery.bootgrid", function() {
$("[type='checkbox']").bootstrapSwitch();
$("[name='override_config']").bootstrapSwitch('offColor','danger');
$('input[name="override_config"]').on('switchChange.bootstrapSwitch', function(event, state) {
override_config(event,state,$(this));

View File

@@ -277,13 +277,11 @@ echo " </select>
</div>";
?>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<div class="checkbox">
<label>
<input type="checkbox" name="no_checks" id="no_checks"> Don't perform ICMP or SNMP checks?
</label>
</div>
<label for="no_checks" class="control-label col-sm-2">Don't perform ICMP or SNMP checks</label>
<div class="col-sm-9">
<input type="checkbox" name="no_checks" id="no_checks" data-size="small">
</div>
</div>
</div>
@@ -326,6 +324,8 @@ echo '
?>
<script>
$('[name="no_checks"]').bootstrapSwitch();
function changeForm() {
snmpVersion = $("#snmpver").val();
if(snmpVersion == 'v1' || snmpVersion == 'v2c') {