Esempio n. 1
0
$params["uuid"] = $uuid;
$params["gid"] = $gid;
$params["from"] = $from;
$params["pid"] = $pid;
$params["ltitle"] = get_def_package_label($name, $version);
$params["create_directory"] = 'on';
$params["start_script"] = 'on';
$params["clean_on_success"] = 'on';
$params["do_reboot"] = getPackageHasToReboot($p_api, $_GET["pid"]) == 1 ? 'on' : '';
$params["do_wol"] = web_def_awake() == 1 ? 'on' : '';
$params["do_inventory"] = web_def_inventory() == 1 ? 'on' : '';
$params["next_connection_delay"] = web_def_delay();
$params["max_connection_attempt"] = web_def_attempts();
$params["maxbw"] = web_def_maxbw();
$params["copy_mode"] = web_def_mode();
$params["deployment_intervals"] = web_def_deployment_intervals();
$halt = web_def_issue_halt_to();
foreach ($halt as $h) {
    $params["issue_halt_to_" . $h] = 'on';
}
$prefix = '';
if (strlen($_POST["gid"])) {
    $prefix = 'group';
}
$params['tab'] = $prefix . 'tablaunch';
$params['badvanced'] = True;
header("Location: " . urlStrRedirect("{$module}/{$submod}/{$page}", $params));
exit;
?>

Esempio n. 2
0
 function display_options($f)
 {
     $f->add(new HiddenTpl("lmembers"), array("value" => base64_encode(serialize($this->members)), "hide" => True));
     $f->add(new HiddenTpl("create_directory"), array("value" => 'on', "hide" => True));
     $f->add(new HiddenTpl("start_script"), array("value" => 'on', "hide" => True));
     $f->add(new HiddenTpl("clean_on_success"), array("value" => 'on', "hide" => True));
     $f->add(new HiddenTpl("do_reboot"), array("value" => web_def_reboot() ? "on" : ""));
     $f->add(new HiddenTpl("bundle_title"), array("value" => get_new_bundle_title(count($this->members)), "hide" => True));
     $f->add(new HiddenTpl("maxbw"), array("value" => web_def_maxbw(), "hide" => True));
     $f->add(new HiddenTpl("copy_mode"), array("value" => web_def_mode(), "hide" => True));
     $f->add(new HiddenTpl("deployment_intervals"), array("value" => web_def_deployment_intervals(), "hide" => True));
     $halt = web_def_issue_halt_to();
     foreach ($halt as $h) {
         $f->add(new HiddenTpl("issue_halt_to_" . $h), array("value" => 'on', "hide" => True));
     }
     $check = new TrFormElement(_T('awake', 'msc'), new CheckboxTpl("do_wol"));
     $f->add($check, array("value" => web_def_awake() ? "checked" : ""));
     $check = new TrFormElement(_T('invent.', 'msc'), new CheckboxTpl("do_inventory"));
     $f->add($check, array("value" => web_def_inventory() ? "checked" : ""));
 }
Esempio n. 3
0
function action($action, $target, $is_advanced) {
    $from = $_GET['from'];
    $path =  explode('|', $from);
    $module = $path[0];
    $submod = $path[1];
    $page = $path[2];
    $tab = $path[3];

    /* Handle posting of quick actions */
    if ($_SESSION["lang"] == "C") {
        $current_lang = "";
    } else {
        $current_lang = substr($_SESSION["lang"], 0, 2);
    }
    if (count($_GET["gid"]) > 0) {
        $type = 'group';
    } else {
        $type = '';
    }

    if ($is_advanced) {
        $params = array('from'=> 'base|computers|msctabs|tablaunch');
        foreach (array('gid', 'uuid', 'hostname') as $param) {
            $params[$param] = $_GET[$param];
        }

        $qa = msc_script_detailled_info($action);
        if ($qa[0]) {
            $qa = $qa[1];

            $params['badvanced'] = True;
            if (isset($qa['title'.$current_lang])) {
                $params['ltitle'] = trim('[QA] '.$qa['title'.$current_lang]);
            } else {
                $params['ltitle'] = trim('[QA] '.$qa['title']);
            }

            if ($action == '007wake_on_lan.msc') {
                # this is a very special case for WOL, it's not a command as we usualy understand it...
                $params['failure'] = '1';
                $params['create_directory'] = 'off';
                $params['start_script'] = 'off';
                $params['clean_on_success'] = 'off';
                $params['do_reboot'] = 'off';
                $params['do_wol'] = 'on';
                $params['do_inventory'] = 'off';
                $params['issue_halt'] = 'off';
                $params['next_connection_delay'] = 0;
                $params['max_connection_attempt'] = 1;
                $params['attempts_left'] = 1;
                foreach (array('create_directory', 'start_script', 'clean_on_success', 'do_reboot', 'do_wol', 'next_connection_delay', 'max_connection_attempt', 'do_inventory', 'copy_mode', 'deployment_intervals', 'issue_halt', 'parameters', 'local_proxy', 'maxbw') as $p) {
                     $params['hide_'.$p] = True;
                }
            } else {
                $params['do_reboot'] = '';
                $params["next_connection_delay"]  = web_def_delay();
                $params["max_connection_attempt"] = web_def_attempts();
                $params["maxbw"]                  = web_def_maxbw();
                $params["copy_mode"]              = web_def_mode();
                $params["deployment_intervals"]   = web_def_deployment_intervals();
                $halt = web_def_issue_halt_to();
                foreach ($halt as $h) {
                    $params["issue_halt_to_".$h] = 'on';
                }
            }
            $params['launchAction'] = $action;

            header("Location: ".urlStrRedirect("base/computers/".$type."msctabs", $params));
            exit;
        } else {
            new NotifyWidgetFailure(_T('Failed to retrieve this quick action.', 'msc'));
        }
    } else {
        $id = add_command_quick_with_id($action, $target, $current_lang, $_GET["gid"]);
        if ($id != -1) {
            scheduler_start_these_commands("", array($id));
            // if on a single computer
            if (count($_GET["gid"]) > 0) {
                $actionpage = 'groupmsctabs';
                $tab = 'grouptablogs';
            } else {
                $actionpage = 'msctabs';
                $tab = 'tablogs';
            }
            header("Location: ".urlStrRedirect("base/computers/$actionpage", array('tab'=>$tab, 'uuid'=>$_GET['uuid'], 'hostname'=>$_GET['hostname'], 'cmd_id'=>$id, 'gid'=>$_GET['gid'])));
            exit;
        }
    }
}