Example #1
0
if (isset($_GET['gid']) && $_GET['gid'] != '') {
    $type = 'group';
    $target_uuid = isset($_GET['gid']) ? $_GET['gid'] : "";
    $target_name = isset($_GET['groupname']) ? $_GET['groupname'] : "";
} else {
    $type = '';
    $target_uuid = isset($_GET['uuid']) ? $_GET['uuid'] : "";
    if (isset($_GET['hostname'])) {
        $target_name = $_GET['hostname'];
    } elseif (isset($_GET['target_name'])) {
        $target_name = $_GET['target_name'];
    } else {
        $target_name = '';
    }
}
if ($type == '' && (xmlrpc_isComputerRegistered($target_uuid) || xmlrpc_isComputerInProfileRegistered($target_uuid)) || $type == 'group' && xmlrpc_isProfileRegistered($target_uuid)) {
    if (isset($_GET['mod'])) {
        $mod = $_GET['mod'];
    } else {
        $mod = "none";
    }
    switch ($mod) {
        case 'details':
            log_details();
            break;
        default:
            log_list();
            break;
    }
} else {
    # register the target (computer or profile)
Example #2
0
require_once "modules/dyngroup/includes/includes.php";
$gid = quickGet('gid');
$group = new Group($gid, true);
$machine = quickGet('hostname');
$uuid = quickGet('objectUUID');
if (quickGet('valid')) {
    if (in_array("imaging", $_SESSION["modulesList"])) {
        include 'modules/imaging/includes/xmlrpc.inc.php';
        if (xmlrpc_isProfileRegistered($gid)) {
            // Get Current Location
            $location = xmlrpc_getProfileLocation($gid);
        }
    }
    $group->delMember(array("{$uuid}" => array("uuid" => $uuid)));
    if (in_array("imaging", $_SESSION["modulesList"])) {
        if (xmlrpc_isProfileRegistered($gid)) {
            // Synchro Location
            xmlrpc_synchroLocation($location);
        }
    }
    header("Location: " . urlStrRedirect("base/computers/display", array('gid' => $gid)));
    exit;
}
?>
 <h2><?php 
echo _T("Remove a computer", "dyngroup");
?>
</h2> <?php 
?>

<form action="<?php 
Example #3
0
 /*
  * type: 'group' for a profile, '' for a single computer
  */
 $type = $_GET["type"];
 $target_uuid = $_GET['target_uuid'];
 $target_name = $_GET['target_name'];
 $f = new ValidatingForm();
 // Set title
 if ($type == '') {
     // Computer
     if (!xmlrpc_isComputerRegistered($target_uuid) && !xmlrpc_isComputerInProfileRegistered($target_uuid)) {
         $f->add(new TitleElement(sprintf(_T("Register computer '%s'", "imaging"), $target_name)));
     }
 } else {
     // Profile
     if (!xmlrpc_isProfileRegistered($target_uuid)) {
         $f->add(new TitleElement(sprintf(_T("Imaging activation for group '%s'", "imaging"), $target_name)));
     }
 }
 // Get boot menu
 if ($type == '') {
     // Computer
     $ret = xmlrpc_getMyMenuComputer($target_uuid);
 } else {
     // Profile
     $ret = xmlrpc_getMyMenuProfile($target_uuid);
 }
 if (!$ret[0] && $ret[1] == 'ERROR') {
     $err_msg = getPulse2ErrorString($ret[2], $ret[3]);
 } else {
     list($whose, $menu) = $ret;
Example #4
0
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;
    }
}