Example #1
0
$ids = array();
$name = array();
$type = array();
$show = array();
$action_delete = array();
if ($is_gp != 1) {
    // Simple Group
    $delete = new ActionPopupItem(_T("Delete this group", 'dyngroup'), "delete_group", "delete", "id", "base", "computers");
} else {
    // Imaging group
    $delete = new ActionPopupItem(_T("Delete this imaging group", 'dyngroup'), "delete_group", "delete", "id", "imaging", "manage");
}
$empty = new EmptyActionItem();
foreach ($list as $group) {
    if ($is_gp == 1) {
        $profile = xmlrpc_getProfileLocation($group->id);
        $ids[] = array("id" => $group->id, "gid" => $group->id, "groupname" => $group->name, 'type' => $is_gp, 'profile' => $profile);
    } else {
        $ids[] = array("id" => $group->id, "gid" => $group->id, "groupname" => $group->name, 'type' => $is_gp);
    }
    $name[] = $group->getName();
    if ($group->isDyn()) {
        $type[] = !$group->isRequest() ? sprintf(_T('result (%s)', 'dyngroup'), $group->countResult()) : _T('query', 'dyngroup');
    } else {
        $type[] = _T('static group', 'dyngroup');
    }
    $show[] = $group->canShow() ? _T('Yes', 'dyngroup') : _T('No', 'dyngroup');
    if ($group->is_owner == 1) {
        $action_delete[] = $delete;
    } else {
        $action_delete[] = $empty;
Example #2
0
    $delete = _T("Delete imaging group", "dyngroup");
} else {
    // Simple group
    $stype = '';
    $ltype = 'group';
    $title = _T("Delete group", "dyngroup");
    $popup = _T("Are you sure you want to delete group <b>%s</b>?<br/> (it can be used in an other group).", "dyngroup");
    $delete = _T("Delete group", "dyngroup");
}
if (quickGet('valid')) {
    if ($type == 1) {
        // Imaging group
        if (in_array("imaging", $_SESSION["modulesList"])) {
            // Get Current Location
            include 'modules/imaging/includes/xmlrpc.inc.php';
            $location = xmlrpc_getProfileLocation($id);
        }
    }
    $group->delete();
    if ($type == 1) {
        // Imaging group
        if (in_array("imaging", $_SESSION["modulesList"])) {
            // Synchro Location
            xmlrpc_synchroLocation($location);
        }
        header("Location: " . urlStrRedirect("imaging/manage/list{$stype}"));
        new NotifyWidgetSuccess(sprintf(_T("Imaging group %s was successfully deleted", "imaging"), $group->getName()));
    } else {
        // simple group
        header("Location: " . urlStrRedirect("base/computers/list{$stype}"));
        new NotifyWidgetSuccess(sprintf(_T("Group %s was successfully deleted", "imaging"), $group->getName()));
Example #3
0
 } else {
     // Profile
     $ret = xmlrpc_setMyMenuProfile($target_uuid, $params);
     $params['gid'] = $target_uuid;
 }
 # remove some useless
 unset($params['message']);
 unset($params['default_name']);
 unset($params['background_uri']);
 $params['hostname'] = $params['target_name'];
 // Go to images list
 if ($ret[0] and !isXMLRPCError()) {
     if ($type == 'group') {
         // Imaging group
         // Synchronize location
         $location = xmlrpc_getProfileLocation($target_uuid);
         xmlrpc_synchroLocation($location);
     }
     if ($is_registering) {
         $str = sprintf(_T("Boot menu is created for <strong>%s</strong>.", "imaging"), $target_name);
     } else {
         $str = sprintf(_T("Boot menu modified for <strong>%s</strong>.", "imaging"), $target_name);
     }
     new NotifyWidgetSuccess($str);
     if ($is_registering) {
         if ($type == 'group') {
             // Imaging group
             header("Location: " . urlStrRedirect("imaging/manage/" . $type . "imgtabs/" . $type . "tabbootmenu", $params));
         } else {
             header("Location: " . urlStrRedirect("base/computers/" . $type . "imgtabs/" . $type . "tabbootmenu", $params));
         }
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;
    }
}