} // Return all the ports for the device then eval just the MT and CC $dp = isset($_POST['power']) ? new PowerPorts() : new DevicePorts(); $dp->DeviceID = $_POST['devid']; header('Content-Type: application/json'); $ports = array('mt' => MediaTypes::GetMediaTypeList(), 'cc' => ColorCoding::GetCodeList(), 'ports' => $dp->getPorts()); echo json_encode($ports); exit; } if (isset($_POST['fp'])) { $dev->DeviceID = $_POST['devid']; $dev->GetDevice(); if ($dev->Rights == "Write") { if ($_POST['fp'] == '') { // querying possible first ports $portCandidates = SwitchInfo::findFirstPort($dev->DeviceID); if (count($portCandidates) > 0) { foreach ($portCandidates as $id => $portdesc) { $checked = $id == $dev->FirstPortNum ? ' checked' : ''; print '<input type="radio" name="FirstPortNum" id="fp' . $id . '" value="' . $id . '"' . $checked . '><label for="fp' . $id . '">' . $portdesc . '</label><br>'; } } else { print __("ERROR: No ports found"); } } else { // setting first port $dev->FirstPortNum = $_POST['fp']; if ($dev->UpdateDevice()) { echo 'Updated'; } else { echo 'Failure';