$f->add(new TrFormElement(_T('The command must start after', 'msc'), new DateTimeTpl('start_date')), array("value" => $start_date, "ask_for_now" => 0)); $f->add(new TrFormElement(_T('The command must stop before', 'msc'), new DateTimeTpl('end_date')), array("value" => $end_date, "ask_for_never" => 0)); } if (quick_get('editConvergence')) { $f->add(new HiddenTpl('editConvergence'), array("value" => quick_get('editConvergence'), "hide" => True)); } $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 */
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" => '')); } }
$machines = array(); foreach ($list as $machine) { $machines[$machine['hostname'] . "##" . $machine['uuid']] = $machine['hostname']; } $right = array(); } reset($right); ksort($machines); $left = array_diff_assoc($machines, $right); natcasesort($left); $f = new ValidatingForm(); $f->push(new Table()); $trOptions = array('firstColWidth' => '200px'); $rb = new RadioTpl("proxy_mode"); $rb->setChoices(array(_T('Single with fallback', 'msc'), _T('Multiple', 'msc'))); $rb->setvalues(array('single', 'multiple')); if (!empty($_POST["proxy_mode"])) { $proxy_mode = $_POST["proxy_mode"]; unset($_POST["proxy_mode"]); // to prevent hidden field setting below } else { $proxy_mode = web_local_proxy_mode(); } $rb->setSelected($proxy_mode); $f->add(new TrFormElement(_T('Local Proxy Mode', 'msc'), $rb, $trOptions)); if (!empty($_POST["max_clients_per_proxy"])) { $max_clients_per_proxy_value = $_POST["max_clients_per_proxy"]; unset($_POST["max_clients_per_proxy"]); // to prevent hidden field setting below } else { $max_clients_per_proxy_value = web_max_clients_per_proxy();