more updates

This commit is contained in:
laf
2015-08-30 19:51:25 +00:00
parent 3ae4372e68
commit 3757bae5c2
2 changed files with 11 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ foreach (dbFetchRows($sql, $param) as $port) {
<input type="hidden" name="olddis_'.$port['port_id'].'" value="'.($port['disabled'] ? 1 : 0).'"">',
'ignore' => '<input type="checkbox" class="ignore-check" name="ignore_'.$port['port_id'].'"'.($port['ignore'] ? 'checked' : '').'>
<input type="hidden" name="oldign_'.$port['port_id'].'" value="'.($port['ignore'] ? 1 : 0).'"">',
'ifAlias' => '<input class="form-control input-sm if-alias" id="if-alias" name="if-alias" data-ifIndex="'.$port['ifIndex'].'" data-ifName="'.$port['ifname'].'" value="'.$port['ifAlias'].'">'
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" id="if-alias" name="if-alias" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.$port['ifAlias'].'"><span class="glyphicon form-control-feedback" aria-hidden="true"></span></div>'
);
}//end foreach

View File

@@ -5,7 +5,8 @@
<input type='hidden' name='ignoreport' value='yes'>
<input type='hidden' name='type' value='update-ports'>
<input type='hidden' name='device' value='<?php echo $device['device_id'];?>'>
<table id='edit-ports' class='table table-condensed table-responsive table-striped'>
<div class='table-responsibe'>
<table id='edit-ports' class='table table-striped'>
<thead>
<tr>
<th data-column-id='ifIndex'>Index</th>
@@ -18,19 +19,23 @@
</tr>
</thead>
</table>
</div>
</form>
<script>
$(document).on('blur', "[name='if-alias']", function (){
var $this = $(this);
var ifIndex = $this.data('ifIndex');
var descr = $this.val();
var device_id = $this.data('device_id');
var port_id = $this.data('port_id');
var ifName = $this.data('ifName');
$.ajax({
type: 'POST',
url: 'ajax_form.php',
data: {type: "update-ifalias", ifIndex: ifIndex, ifName: ifName},
data: {type: "update-ifalias", descr: descr, ifName: ifName, port_id: port_id},
dataType: "json",
success: function (data) {
alert(data.status);
if (data.status == 'ok') {
$this.closest('.form-group').addClass('has-success');
$this.next().addClass('glyphicon-ok');
@@ -38,6 +43,8 @@
$this.closest('.form-group').removeClass('has-success');
$this.next().removeClass('glyphicon-ok');
}, 2000);
} else if (data.status == 'na') {
} else {
$(this).closest('.form-group').addClass('has-error');
$this.next().addClass('glyphicon-remove');