示例#1
0
 function display_options($f)
 {
     // $start_date is now()
     $start_date = date("Y-m-d H:i:s");
     // $end_date = now() + 24h by default (set in web_def_coh_life_time msc ini value)
     $end_date = date("Y-m-d H:i:s", time() + web_def_coh_life_time() * 60 * 60);
     $f->add(new HiddenTpl("lmembers"), array("value" => base64_encode(serialize($this->members)), "hide" => True));
     $f->add(new TrFormElement(_T('Bundle title', 'msc'), new InputTpl('bundle_title')), array("value" => $_POST['bundle_title']));
     $f->add(new TrFormElement(_T('Wake on lan', 'msc'), new CheckboxTpl("do_wol")), array("value" => $_POST['do_wol'] == 'on' ? 'checked' : ''));
     $f->add(new TrFormElement(_T('Start the script', 'msc'), new CheckboxTpl("start_script")), array("value" => 'checked'));
     $f->add(new TrFormElement(_T('Delete files after a successful execution', 'msc'), new CheckboxTpl("clean_on_success")), array("value" => 'checked'));
     $f->add(new TrFormElement(_T('Start inventory', 'msc'), new CheckboxTpl("do_inventory")), array("value" => $_POST['do_inventory'] == 'on' ? 'checked' : ''));
     $f->add(new TrFormElement(_T('Halt client after', 'msc'), new CheckboxTpl("issue_halt_to_done")), array("value" => $_POST['issue_halt_to_done'] == 'on' ? 'checked' : ''));
     /*$f->add(new TrFormElement('',                                                       new CheckboxTpl("issue_halt_to_failed", _T("failed", "msc"))), array("value" => $_POST['issue_halt_to_failed'] == 'on' ? 'checked' : ''));
       $f->add(new TrFormElement('',                                                       new CheckboxTpl("issue_halt_to_over_time", _T("over time", "msc"))), array("value" => $_POST['issue_halt_to_over_time'] == 'on' ? 'checked' : ''));
       $f->add(new TrFormElement('',                                                       new CheckboxTpl("issue_halt_to_out_of_interval", _T("out of interval", "msc"))), array("value" => $_POST['issue_halt_to_out_of_interval'] == 'on' ? 'checked' : ''));*/
     $f->add(new TrFormElement(_T('Command parameters', 'msc'), new InputTpl('parameters')), array("value" => ''));
     $f->add(new TrFormElement(_T('Beginning of validity', 'msc'), new DateTimeTpl('start_date')), array('value' => $start_date, 'ask_for_now' => 0));
     $f->add(new TrFormElement(_T('End of validity', 'msc'), new DateTimeTpl('end_date')), array('value' => $end_date, 'ask_for_never' => 0));
     $f->add(new TrFormElement(_T('Deployment interval', 'msc'), new InputTpl('deployment_intervals')), array("value" => $_POST['deployment_intervals']));
     $f->add(new TrFormElement(_T('Max bandwidth (kbits/s)', 'msc'), new NumericInputTpl('maxbw')), array("value" => web_def_maxbw()));
     $f->add(new HiddenTpl("create_directory"), array("value" => 'on', "hide" => True));
     if (web_force_mode()) {
         $f->add(new HiddenTpl("copy_mode"), array("value" => web_def_mode(), "hide" => True));
     } else {
         $rb = new RadioTpl("copy_mode");
         $rb->setChoices(array(_T('push', 'msc'), _T('push / pull', 'msc')));
         $rb->setvalues(array('push', 'push_pull'));
         $rb->setSelected($_POST['copy_mode']);
         $f->add(new TrFormElement(_T('Copy Mode', 'msc'), $rb));
     }
     /* Only display local proxy button on a group and if allowed */
     if (isset($_GET['gid']) && strlen($_GET['gid']) && web_allow_local_proxy()) {
         $f->add(new TrFormElement(_T('Deploy using a local proxy', 'msc'), new CheckboxTpl("local_proxy")), array("value" => ''));
     }
 }
示例#2
0
        }
        $deployment_fields = array(new InputTpl('deployment_intervals'), new TextTpl(sprintf('<i style="color: #999999">%s</i>', _T('Example for lunch and night (24h format): 12-14,20-8', 'msc'))));
        $deployment_values = array("value" => array(quick_get('deployment_intervals'), ''));
        $f->add(new TrFormElement(_T('Deployment interval', 'msc'), new multifieldTpl($deployment_fields)), $deployment_values);
        $f->add(new TrFormElement(_T('Max bandwidth (kbits/s)', 'msc'), new NumericInputTpl('maxbw')), array("value" => $max_bw, "required" => true));
        if (web_force_mode()) {
            $f->add(new HiddenTpl("copy_mode"), array("value" => web_def_mode(), "hide" => True));
        } else {
            $rb = new RadioTpl("copy_mode");
            $rb->setChoices(array(_T('push', 'msc'), _T('push / pull', 'msc')));
            $rb->setvalues(array('push', 'push_pull'));
            $rb->setSelected($_GET['copy_mode']);
            $f->add(new TrFormElement(_T('Copy Mode', 'msc'), $rb));
        }
        /* Only display local proxy button on a group and if allowed */
        if (isset($_GET['gid']) && strlen($_GET['gid']) && web_allow_local_proxy()) {
            $f->add(new TrFormElement(_T('Deploy using a local proxy', 'msc'), new CheckboxTpl("local_proxy")), array("value" => ''));
        }
    }
    $f->pop();
    $f->addValidateButton("bconfirm");
    $f->addCancelButton("bback");
    $f->display();
}
### /Advanced actions handling ###
/* single target: form display */
if (!isset($_GET['badvanced']) && $_GET['uuid'] && !isset($_POST['launchAction'])) {
    $machine = new Machine(array('uuid' => $_GET['uuid'], 'hostname' => array('0' => $_GET['hostname']), 'displayName' => $_GET['hostname']));
    if (strlen(web_probe_order()) > 0) {
        $msc_host = new RenderedMSCHost($machine, web_probe_order());
        $msc_host->ajaxDisplay();