$objprocess = array(); $scriptmulticast = 'multicast.sh'; $path = "/tmp/"; $objprocess['location'] = $location; $objprocess['process'] = $path . $scriptmulticast; if (xmlrpc_check_process_multicast($objprocess)) { $msg = _T("The bootmenus cannot be generated as a multicast deployment is currently running.", "imaging"); new NotifyWidgetFailure($msg); header("Location: " . urlStrRedirect("imaging/manage/index")); exit; } else { $ret = xmlrpc_synchroProfile($target_uuid); xmlrpc_clear_script_multicast($objprocess); } } else { $ret = xmlrpc_synchroComputer($target_uuid); } if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for computer: %s", "imaging"), implode(', ', $ret[1]))); } if ($type == 'group') { // Imaging group header("Location: " . urlStrRedirect("imaging/manage/" . $type . "imgtabs/" . $type . "tabimages", $params)); } else { header("Location: " . urlStrRedirect("base/computers/" . $type . "imgtabs/" . $type . "tabimages", $params)); } exit; } elseif ($ret[0]) { if ($type == 'group') { // Imaging group header("Location: " . urlStrRedirect("imaging/manage/" . $type . "imgtabs/" . $type . "tabimages", $params));
$hostname = $params['hostname']; global $SYNCHROSTATE_UNKNOWN; global $SYNCHROSTATE_TODO; global $SYNCHROSTATE_SYNCHRO; global $SYNCHROSTATE_RUNNING; global $SYNCHROSTATE_INIT_ERROR; /* * Display right top shortcuts menu */ right_top_shortcuts_display(); if (isset($_POST['bsync'])) { if (isset($params['uuid'])) { $ret = xmlrpc_synchroComputer($params['uuid']); } else { $ret = xmlrpc_synchroProfile($params['gid']); } // goto images list if ($ret[0] and !isXMLRPCError()) { /* insert notification code here if needed */ } elseif (!$ret[0] and !isXMLRPCError()) { unset($_SESSION["imaging.isComputerInProfileRegistered_".$params['uuid']]); unset($_SESSION["imaging.isComputerRegistered_".$params['uuid']]); if (!xmlrpc_isComputerInProfileRegistered($params['uuid']) && !xmlrpc_isComputerRegistered($params['uuid'])) { new NotifyWidgetFailure(sprintf(_T("This computer is no longer registered : %s", "imaging"), $params['uuid'])); header("Location: ".urlStrRedirect("base/computers/index", $params)); exit; } else { new NotifyWidgetFailure(sprintf(_T("Boot Menu Generation failed for : %s", "imaging"), implode(', ', $ret[1])));
function item_edit() { $params = getParams(); $item_uuid = $_GET['itemid']; $label = urldecode($_GET['itemlabel']); $item = xmlrpc_getMenuItemByUUID($item_uuid); if(count($_POST) == 0) { $name = (isset($item['boot_service']) ? $item['boot_service']['default_name'] : $item['image']['default_name']); printf("<h3>"._T("Edition of item", "imaging")." : <em>%s</em></h3>", $name); $is_selected = ''; $is_displayed = 'CHECKED'; $is_wol_selected = ''; $is_wol_displayed = 'CHECKED'; // get current values if($item['default'] == true) $is_selected = 'CHECKED'; if($item['hidden'] == true) $is_displayed = ''; if($item['default_WOL'] == true) $is_wol_selected = 'CHECKED'; if($item['hidden_WOL'] == true) $is_wol_displayed = ''; $f = new ValidatingForm(); $f->push(new Table()); $f->add(new HiddenTpl("itemid"), array("value" => $item_uuid, "hide" => True)); $f->add(new HiddenTpl("itemlabel"), array("value" => $label, "hide" => True)); $f->add(new HiddenTpl("gid"), array("value" => $_GET['gid'], "hide" => True)); $f->add(new HiddenTpl("uuid"), array("value" => $_GET['uuid'], "hide" => True)); $f->add(new HiddenTpl("default_name"), array("value" => $name, "hide" => True)); $f->add( new TrFormElement(_T("Selected by default", "imaging"), new CheckboxTpl("default")), array("value" => $is_selected) ); $f->add( new TrFormElement(_T("Displayed", "imaging"), new CheckboxTpl("displayed")), array("value" => $is_displayed) ); $f->add( new TrFormElement(_T("Selected by default on WOL", "imaging"), new CheckboxTpl("default_WOL")), array("value" => $is_wol_selected) ); $f->add( new TrFormElement(_T("Displayed on WOL", "imaging"), new CheckboxTpl("displayed_WOL")), array("value" => $is_wol_displayed) ); $f->pop(); $f->addButton("bvalid", _T("Validate")); $f->pop(); $f->display(); } else { // set new values if(isset($_GET['gid'])) { $type = 'group'; $target_uuid = $_GET['gid']; } else { $type = ''; $target_uuid = $_GET['uuid']; } $bs_uuid = $item['boot_service']['imaging_uuid']; $im_uuid = $item['image']['imaging_uuid']; $params['default'] = ($_POST['default'] == 'on'?True:False); $params['default_WOL'] = ($_POST['default_WOL'] == 'on'?True:False); $params['hidden'] = ($_POST['displayed'] == 'on'?False:True); $params['hidden_WOL'] = ($_POST['displayed_WOL'] == 'on'?False:True); $params['default_name'] = $_POST['default_name']; if (isset($bs_uuid) && $bs_uuid != '') { $ret = xmlrpc_editServiceToTarget($bs_uuid, $target_uuid, $params, $type); } else { $ret = xmlrpc_editImageToTarget($im_uuid, $target_uuid, $params, $type); } if ($ret) { // generate menu $ret = xmlrpc_synchroComputer($target_uuid); } // goto menu boot list header("Location: " . urlStrRedirect("base/computers/".$type."imgtabs", $params)); exit; } }
if ($master['imaging_uuid'] == $_POST['imaging_uuid_' . $location]) { $menu_item_id = $master['menu_item']['id']; break; } } $imagesToDelFromLocation[] = array('menu_item_id' => $menu_item_id, 'location' => $location); } } } foreach ($imagesToDelFromTarget as $image) { $ret = xmlrpc_delImageToTarget($image['uuid'], $image['target_uuid'], $image['type']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Removal of master failed", "imaging"))); } // Synchronize boot menu $ret = xmlrpc_synchroComputer($image['target_uuid']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for computer: %s", "imaging"), implode(', ', $ret[1]))); } } foreach ($imagesToDelFromLocation as $image) { $ret = xmlrpc_delImageToLocation($image['menu_item_id'], $image['location']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Removal of master failed", "imaging"))); } // Synchronize boot menu $ret = xmlrpc_synchroLocation($image['location']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s", "imaging"), implode(', ', $ret[1]))); } }
} if (substr($key, 0, 13) == 'imaging_uuid_') { $location = substr($key, 13); $target_uuid = substr($key, 13); if (isset($_POST['imaging_checkbox_' . $location]) and $_POST['imaging_checkbox_' . $location] == 'on') { $bootServicesToDelFromLocation[] = array('bs_uuid' => $_POST['imaging_uuid_' . $target_uuid], 'location' => $location); } } } foreach ($bootServicesToDelFromTarget as $boot_service) { $ret = xmlrpc_delServiceToTarget($boot_service['bs_uuid'], $boot_service['target_uuid'], $boot_service['type']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Removal of boot service failed", "imaging"))); } // Synchronize boot menu $ret = xmlrpc_synchroComputer($boot_service['target_uuid']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for computer: %s", "imaging"), implode(', ', $ret[1]))); } } foreach ($bootServicesToDelFromLocation as $boot_service) { $ret = xmlrpc_delServiceToLocation($boot_service['bs_uuid'], $boot_service['location']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Removal of boot service failed", "imaging"))); } // Synchronize boot menu $ret = xmlrpc_synchroLocation($boot_service['location']); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s", "imaging"), implode(', ', $ret[1]))); } }