Esempio n. 1
0
$bs_uuid = $item['boot_service']['imaging_uuid'];
$im_uuid = $item['image']['imaging_uuid'];

if(isset($_GET['gid'])) {
    $type = 'group';
    $target_uuid = $_GET['gid'];
} else {
    $type = '';
    $target_uuid = $_GET['uuid'];
}

if (quickGet('valid')) {
    if (isset($bs_uuid)) {
        $ret = xmlrpc_delServiceToTarget($bs_uuid, $target_uuid, $type);
    } else {
        $ret = xmlrpc_delImageToTarget($im_uuid, $target_uuid, $type);
    }
    if ($ret[0] and !isXMLRPCError()) {
        /* insert notification code here if needed */

        // Synchronize boot menu
        $ret = xmlrpc_synchroComputer($target_uuid);
        if (isXMLRPCError()) {
            new NotifyWidgetFailure(sprintf(_T("Boot menu generation failed for computer: %s", "imaging"), implode(', ', $ret[1])));
        }
    } elseif (!$ret[0]) {
        new NotifyWidgetFailure($ret[1]);
    }
    $params['mod'] = 'remove_success';
    $params['tab'] = $type.$params['from'];
    header("Location: " . urlStrRedirect("base/computers/".$type."imgtabs", $params));
Esempio n. 2
0
         $location = substr($key, 13);
         if (isset($_POST['imaging_checkbox_' . $location]) and $_POST['imaging_checkbox_' . $location] == 'on') {
             list($count, $masters) = xmlrpc_getLocationImages($location);
             $menu_item_id = '';
             foreach ($masters as $master) {
                 if ($master['imaging_uuid'] == $_POST['imaging_uuid_' . $location]) {
                     $menu_item_id = $master['menu_item']['id'];
                     break;
                 }
             }
             $imagesToDelFromLocation[] = array('menu_item_id' => $menu_item_id, 'location' => $location);
         }
     }
 }
 foreach ($imagesToDelFromTarget as $image) {
     $ret = xmlrpc_delImageToTarget($image['uuid'], $image['target_uuid'], $image['type']);
     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