if (isset($_POST['gid']) && $_POST['gid'] != '') { $type = 'group'; $target_uuid = $_POST['gid']; } else { $type = ''; $target_uuid = $_POST['uuid']; } $item_uuid = $_POST['itemid']; $label = urldecode($_POST['itemlabel']); $params['name'] = $_POST['default_mi_label']; $params['hidden'] = $_POST['do_display'] != 'on'; $params['hidden_WOL'] = $_POST['do_display_WOL'] != 'on'; $params['default'] = $_POST['do_default'] == 'on'; $params['default_WOL'] = $_POST['do_default_WOL'] == 'on'; $ret = xmlrpc_addServiceToTarget($item_uuid, $target_uuid, $params, $type); $ret = xmlrpc_editServiceToTarget($item_uuid, $target_uuid, $params, $type); // goto images list if ($ret[0] and !isXMLRPCError()) { /* insert notification code here if needed */ // Synchronize boot menu if ($type == 'group') { $location = getCurrentLocation(); if ($location == "UUID1") { $location_name = _T("root", "pulse2"); } else { $location_name = xmlrpc_getLocationName($location); } $objprocess = array(); $scriptmulticast = 'multicast.sh'; $path = "/tmp/"; $objprocess['location'] = $location;
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; } }