* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "localSidebar.php"; require "graph/navbar.inc.php"; require_once 'modules/imaging/includes/includes.php'; require_once 'modules/imaging/includes/xmlrpc.inc.php'; $params = getParams(); $location = getCurrentLocation(); $item_uuid = $_GET['itemid']; $label = urldecode($_GET['itemlabel']); $item = xmlrpc_getMenuItemByUUID($item_uuid); $is_image = False; if (isset($item['image'])) { $is_image = True; } if (count($_POST) == 0) { $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 = '';
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; } }