예제 #1
0
 $f->add(new HiddenTpl("from"), array("value" => $from, "hide" => True));
 $action = quick_get('launchAction');
 if (isset($action) && $action != '') {
     $f->add(new HiddenTpl('launchAction'), array("value" => quick_get('launchAction'), "hide" => True));
 }
 $start_script = quick_get('start_script', True);
 $clean_on_success = quick_get('clean_on_success', True);
 $max_bw = quick_get('maxbw');
 if (!isset($max_bw) || $max_bw == '') {
     $max_bw = web_def_maxbw();
 }
 // $start_date is now()
 $start_date = quick_get('start_date') ? quick_get('start_date') : date("Y-m-d H:i:s");
 // $end_date = now() + 1h by default (set in web_def_coh_life_time msc ini value)
 // $coh_life_time is set to 24h for convergence commands
 $coh_life_time = quick_get('convergence') ? 24 : web_def_coh_life_time();
 $end_date = quick_get('end_date') ? quick_get('end_date') : date("Y-m-d H:i:s", time() + $coh_life_time * 60 * 60);
 if (quick_get('launchAction')) {
     // Advanced Quick Action
     $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));
     $f->add(new HiddenTpl('ltitle'), array("value" => $name, "hide" => True));
     $f->add(new HiddenTpl('parameters'), array("value" => quick_get('parameters'), "hide" => True));
     $f->add(new HiddenTpl('do_wol'), array("value" => quick_get('do_wol', True) == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('start_script'), array("value" => $start_script == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('clean_on_success'), array("value" => $clean_on_success == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('do_inventory'), array("value" => quick_get('do_inventory', True) == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('do_reboot'), array("value" => quick_get('do_reboot', True) == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('issue_halt_to_done'), array("value" => quick_get('issue_halt_to_done', True) == 'on' ? 'checked' : '', "hide" => True));
     $f->add(new HiddenTpl('maxbw'), array("value" => $max_bw, "hide" => True));
 } else {
예제 #2
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" => ''));
     }
 }
예제 #3
0
require_once 'modules/msc/includes/scheduler_xmlrpc.php';
require_once 'modules/msc/includes/commands_xmlrpc.inc.php';
require_once "modules/msc/includes/mscoptions_xmlrpc.php";
if (isset($_POST["bconfirm"])) {
    //
    $cmd_id = $_POST['cmd_id'];
    $start_date = $_POST['start_date'];
    $end_date = $_POST['end_date'];
    extend_command($cmd_id, $start_date, $end_date);
    return;
}
/* Form displaying */
$f = new PopupForm(_T('Reschedule this command', 'msc'), 'reschedulePopupForm');
$f->add(new HiddenTpl("cmd_id"), array("value" => $_GET['cmd_id'], "hide" => True));
$f->add(new TrFormElement(_T('Start date', 'msc'), new DateTimeTpl('start_date')), array('value' => date("Y-m-d H:i:s")));
$f->add(new TrFormElement(_T('<br/>End date', 'msc'), new DateTimeTpl('end_date')), array('value' => date("Y-m-d H:i:s", time() + web_def_coh_life_time() * 60 * 60)));
$f->addValidateButton("bconfirm");
$f->addCancelButton("bback");
$f->display();
?>
<script type="text/javascript">
    jQuery(function() {
        var $ = jQuery;
        $('form#reschedulePopupForm').submit(function() {
            $.ajax($(this).attr('action'), {
                type: $(this).attr('method'),
                data: $(this).serialize() + '&bconfirm=1'
            }).success(function() {
                window.location.reload();
            });
            return false;