|
@@ -66,7 +66,7 @@ if (isset($_REQUEST['prev_checked'])) {
|
|
|
$rz = (isset($_REQUEST['reztp'])) ? $_REQUEST['reztp'] : array();
|
|
|
foreach ($pc as $swsn => $value) {
|
|
|
$curr_del = (isset($d[$swsn])) ? $d[$swsn] : 0;
|
|
|
- $curr_rz = (isset($rz[$swsn])) ? $rz[$swsn] : 0;
|
|
|
+ $curr_rz = (isset($rz[$swsn])) ? $rz[$swsn] : 0;
|
|
|
if ($curr_del == 1) {
|
|
|
$sql = "DELETE FROM DEVICE_MAP WHERE serial_number=:sn";
|
|
|
try {
|
|
@@ -79,17 +79,17 @@ if (isset($_REQUEST['prev_checked'])) {
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
- if ($curr_rz == 1) {
|
|
|
- $sql = "UPDATE DEVICE_MAP SET should_re_ztp=:rz WHERE serial_number=:sn";
|
|
|
- try {
|
|
|
- $sth = $dbh->prepare($sql);
|
|
|
- $sth->execute(['sn' => $swsn, 'rz' => 2]);
|
|
|
- $sth->closeCursor();
|
|
|
- $logger->info("User {$ruser} set physical switch {$swsn} to re-ZTP");
|
|
|
- } catch (PDOException $e) {
|
|
|
- array_push($errors, "Failed to set switch {$swsn} to re-ZTP: {$e->getMessage()}");
|
|
|
- }
|
|
|
- }
|
|
|
+ if ($curr_rz == 1) {
|
|
|
+ $sql = "UPDATE DEVICE_MAP SET should_re_ztp=:rz WHERE serial_number=:sn";
|
|
|
+ try {
|
|
|
+ $sth = $dbh->prepare($sql);
|
|
|
+ $sth->execute(['sn' => $swsn, 'rz' => 2]);
|
|
|
+ $sth->closeCursor();
|
|
|
+ $logger->info("User {$ruser} set physical switch {$swsn} to re-ZTP");
|
|
|
+ } catch (PDOException $e) {
|
|
|
+ array_push($errors, "Failed to set switch {$swsn} to re-ZTP: {$e->getMessage()}");
|
|
|
+ }
|
|
|
+ }
|
|
|
$curr_checked = (isset($c[$swsn])) ? $c[$swsn] : 0;
|
|
|
if ($value != $curr_checked || $pas[$swsn] != $as[$swsn]) {
|
|
|
$nc = $curr_checked;
|
|
@@ -415,7 +415,6 @@ foreach ($pids as $lsp => $value) {
|
|
|
$selected = ($filt == "pid:$lsp") ? 'selected' : ''; ?>
|
|
|
<option value="<?=$_SERVER['PHP_SELF']?>?filter=pid:<?=$lsp?>" <?=$selected?>><?=$lsp?></option>
|
|
|
<?php
|
|
|
-
|
|
|
}
|
|
|
?>
|
|
|
</select></td>
|
|
@@ -435,13 +434,11 @@ foreach ($pids as $lsp => $value) {
|
|
|
?>
|
|
|
<a href="#" onClick="window.open('<?=$base?>/export.php')">Export to Prime / DNS</a> |
|
|
|
<?php
|
|
|
-
|
|
|
}
|
|
|
if (EXPORT_DEADMAN === true) {
|
|
|
?>
|
|
|
<a href="#" onClick="window.open('<?=$base?>/export_deadman.php')">Export To Ansible</a> |
|
|
|
<?php
|
|
|
-
|
|
|
} ?>
|
|
|
<a href="<?=$base?>/logicsw.php">Logical Switches</a></td>
|
|
|
</tr>
|
|
@@ -454,7 +451,6 @@ foreach ($pids as $lsp => $value) {
|
|
|
?>
|
|
|
<input type="hidden" name="<?=$name?>" value="<?=$value?>">
|
|
|
<?php
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
?>
|
|
@@ -473,7 +469,6 @@ foreach ($errors as $error) {
|
|
|
?>
|
|
|
<p class="error"><?=$error?></p>
|
|
|
<?php
|
|
|
-
|
|
|
}
|
|
|
?>
|
|
|
</div>
|
|
@@ -505,9 +500,8 @@ foreach ($switches as $row) {
|
|
|
}
|
|
|
|
|
|
if ($row['should_re_ztp'] > 0) {
|
|
|
- $will_rz = true;
|
|
|
- }
|
|
|
-?>
|
|
|
+ $will_rz = true;
|
|
|
+ } ?>
|
|
|
<tr>
|
|
|
<td><?=$i + 1?>.</td>
|
|
|
<td><input type="checkbox" name="delete[<?=$sn?>]" value="1" onClick="if (this.checked == true) { deletes++; } else { deletes--; }"></td>
|
|
@@ -530,19 +524,16 @@ foreach ($switches as $row) {
|
|
|
?>
|
|
|
<option value="__BOGUS__" <?=$selected?>>--Please Select--</option>
|
|
|
<?php
|
|
|
-
|
|
|
} else {
|
|
|
$has_avail = true; ?>
|
|
|
<option value="<?=$lsw?>" <?=$selected?>><?=$lsw?></option>
|
|
|
<?php
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
if (!$has_avail) {
|
|
|
?>
|
|
|
<option value="__BOGUS__" <?=$selected?>>--Please Select--</option>
|
|
|
<?php
|
|
|
-
|
|
|
} ?>
|
|
|
</select>
|
|
|
<a href="#" onClick='var lsw = document.getElementById("asw<?=$i?>"); if (lsw.value == "__BOGUS__") { alert("There is no logical switch associated to this device."); return false; } else { window.open("<?=$base?>/logicsw.php?switch_name=" + lsw.value, "Logical switch " + lsw.value, "height=480,width=1048"); return false; }'><img src="/images/switch.gif" border="0" title="View logical switch"></a> <a href="#" onClick='var pros = document.getElementById("pros<?=$row['serial_number']?>"); var lsw = document.getElementById("asw<?=$i?>"); if (pros.value < PROVISION_FAIL) { alert("This switch config has not yet been generated."); return false; } else { window.open("<?=$base?>/show_config.php?cfg=" + lsw.value + "-config.txt&dname=" + lsw.value, "Config for switch " + lsw.value, "height=650,width=980"); return false; }'><img src="/images/mag.gif" border="0" title="View switch config"></a>
|