$f->add(new HiddenTpl("target_uuid"), array("value" => $target_uuid, "hide" => True)); $f->add(new HiddenTpl("target_name"), array("value" => $target_name, "hide" => True)); $f->add(new HiddenTpl("type"), array("value" => $type, "hide" => True)); $f->pop(); $f->addButton("bunregister2", _T("Unregister this computer", 'imaging')); $f->addButton("cancel", _T("Cancel", "imaging"), 'btnSecondary'); $f->display(); } else { if (isset($_POST["bunregister2"])) { $type = $_POST["type"]; $target_uuid = $_POST['target_uuid']; $target_name = $_POST['target_name']; $params['target_uuid'] = $target_uuid; $params['target_name'] = $target_name; $params['backup'] = $_POST['backup']; $ret = xmlrpc_delComputersImaging(array($target_uuid), $params['backup'] ? true : false); if ($ret[0] and !isXMLRPCError()) { new NotifyWidgetSuccess(sprintf(_T("The computer %s has correctly been unregistered from imaging", 'imaging'), $target_name)); unset($_SESSION["imaging.isComputerRegistered_" . $target_uuid]); header("Location: " . urlStrRedirect("base/computers/register_target", $params)); exit; } else { new NotifyWidgetFailure(sprintf(_T("Failed to unregister the computer %s", 'imaging'), $target_name)); } $is_unregistering = True; } else { /* * type: 'group' for a profile, '' for a single computer */ $type = $_GET["type"]; $target_uuid = $_GET['target_uuid'];
foreach ($listOfMachines as $machine) { $machines[$machine['cn'] . "##" . $machine['objectUUID']] = $machine['cn']; } } elseif (isset($_POST["baddmachine_x"])) { if (isset($_POST["machines"])) { foreach ($_POST["machines"] as $machine) { $ma = preg_split("/##/", $machine); $members[$machine] = $ma[0]; $listOfMembers[$ma[1]] = array('hostname' => $ma[0], 'uuid' => $ma[1]); } } } elseif (isset($_POST["bconfirm"]) and $name != '' and ($type == 0 and !xmlrpc_group_name_exists($name, $id) or $type == 1 and !xmlrpc_profile_name_exists($name, $id))) { if ($type == 1) { $willBeUnregistered = unserialize(base64_decode($_POST["willBeUnregistered"])); if (count($willBeUnregistered) > 0) { xmlrpc_delComputersImaging($willBeUnregistered, False); } } $listOfCurMembers = $group->members(); $curmem = array(); foreach ($listOfCurMembers as $member) { $curmem[$member['hostname'] . "##" . $member['uuid']] = $member['hostname']; } if (!$curmem) { $curmem = array(); } if (!$listOfCurMembers) { $listOfCurMembers = array(); } // If we're editing an existing imaging group, // check if target has more than one ethernet card