*/ require_once 'modules/imaging/includes/includes.php'; require_once 'modules/imaging/includes/xmlrpc.inc.php'; require_once 'modules/imaging/includes/web_def.inc.php'; $location = getCurrentLocation(); if (isset($_POST["bconfirm"])) { $params = getParams(); $item_uuid = $_POST['itemid']; $label = urldecode($_POST['itemlabel']); $ret = xmlrpc_delServiceToLocation($item_uuid, $location, $params); // goto images list if ($ret[0] and !isXMLRPCError()) { $str = sprintf(_T("Service <strong>%s</strong> removed from default boot menu", "imaging"), $label); new NotifyWidgetSuccess($str); // Synchronize boot menu $ret = xmlrpc_synchroLocation($location); if (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s", "imaging"), implode(', ', $ret[1]))); } header("Location: " . urlStrRedirect("imaging/manage/service", $params)); exit; } elseif ($ret[0]) { header("Location: " . urlStrRedirect("imaging/manage/service", $params)); exit; } else { new NotifyWidgetFailure($ret[1]); } } $params = getParams(); $item_uuid = $_GET['itemid']; $label = urldecode($_GET['itemlabel']);
$sidemenu->setBackgroundImage("modules/imaging/graph/images/section_large.png"); $p->setSideMenu($sidemenu); $p->display(); # synchronization of locations global $SYNCHROSTATE_UNKNOWN; global $SYNCHROSTATE_TODO; global $SYNCHROSTATE_SYNCHRO; global $SYNCHROSTATE_RUNNING; global $SYNCHROSTATE_INIT_ERROR; $location = getCurrentLocation(); if (isset($_POST['bsync'])) { $params['bsync'] = '1'; $ret = xmlrpc_synchroLocation($_POST['location_uuid']); // goto images list if ((is_array($ret) and $ret[0] or !is_array($ret) and $ret) and !isXMLRPCError()) { /* insert notification code here if needed */ } elseif (!$ret[0] and !isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s<br /><br />Check /var/log/mmc/pulse2-package-server.log", "imaging"), implode(', ', $ret[1]))); } elseif (isXMLRPCError()) { new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for package server: %s<br /><br />Check /var/log/mmc/pulse2-package-server.log", "imaging"), implode(', ', $ret[1]))); } } # needed in the case we have to go back to the good list. $params['from'] = $_GET['action']; $params['module'] = $_GET['module']; $params['submod'] = $_GET['submod'];
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) { if (isset($_GET['gid'])) { if (xmlrpc_isProfileRegistered($_GET['gid'])) { // Get Current Location $location = xmlrpc_getProfileLocation($_GET['gid']); xmlrpc_synchroLocation($location); } } else { $ret = xmlrpc_synchroComputer($params['uuid']); } } // goto menu boot list if ($type == '') { header("Location: " . urlStrRedirect("base/computers/" . $type . "imgtabs", $params)); } else { header("Location: " . urlStrRedirect("imaging/manage/" . $type . "imgtabs", $params)); } exit; } }
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 (isset($_POST['uuid']) and isset($_POST['hostname'])) { // Come from a computer page $params = array('uuid' => $_POST['uuid'], 'hostname' => $_POST['hostname']); header("Location: " . urlStrRedirect("base/computers/" . $type . "imgtabs/" . $type . "tabimages", $params)); exit; } else { // Come from an imaging server page header("Location: " . urlStrRedirect("imaging/manage/master")); exit; } }
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]))); } } if (isset($_POST['uuid']) and isset($_POST['hostname'])) { // Come from a computer page $params = array('uuid' => $_POST['uuid'], 'hostname' => $_POST['hostname']); header("Location: " . urlStrRedirect("base/computers/" . $type . "imgtabs/" . $type . "tabservices", $params)); exit; } else { // Come from an imaging server page header("Location: " . urlStrRedirect("imaging/manage/service")); exit; } }