Exemple #1
0
function _userquota_baseGroupEdit($ldapArr, $postArr)
{
    $FH = new FormHandler("editGroupQuota", $postArr);
    $FH->setArr($ldapArr);
    $components = getActiveComponents();
    if ($components["disk"]) {
        $f = new DivForModule(_T("Quota plugin - Filesystem", "userquota"), "#FDD");
        $f->push(new Table());
        $f = addDiskQuotas($f, $FH);
        $f->add(new TrCommentElement(_T("Quota's applied here affect all members of the group", "userquota")));
        $overwrite = new RadioTpl("diskoverwrite");
        $overwrite->setChoices(array(_T("Overwrite all existing quotas", "userquota"), _T("Current quota is smaller than the new quota, or does not exist", "userquota"), _T("Current quota is larger than the new quota, or does not exist", "userquota"), _T("Don't overwrite any existing quotas", "userquota")));
        $overwrite->setValues(array("all", "smaller", "larger", "none"));
        $overwrite->setSelected("none");
        $f->add(new TrFormElement(_T("Overwrite mode for existing quotas", "userquota"), $overwrite));
        $f->pop();
        $f->display();
    }
    if ($components["network"]) {
        $f = new DivForModule(_T("Quota plugin - Network", "userquota"), "#FFD");
        $f->push(new Table());
        $f = addNetworkQuotas($f, $FH);
        $f->add(new TrCommentElement(_T("Quota's applied here affect all members of the group", "userquota")));
        $overwrite = new RadioTpl("networkoverwrite");
        $overwrite->setChoices(array(_T("Overwrite all existing quotas", "userquota"), _T("Current quota is smaller than the new quota, or does not exist", "userquota"), _T("Current quota is larger than the new quota, or does not exist", "userquota"), _T("Don't overwrite any existing quotas", "userquota")));
        $overwrite->setValues(array("all", "smaller", "larger", "none"));
        $overwrite->setSelected("none");
        $f->add(new TrFormElement(_T("Overwrite mode for existing quotas", "userquota"), $overwrite));
        $f->pop();
        $f->display();
    }
}
Exemple #2
0
    _T('nfs', 'imaging');
    _T('mtftp', 'imaging');
    foreach ($possible_protocols as $p) {
        if ($p['label']) {
            if ($p['label'] == $default_menu['protocol']) {
                $rest_selected = $p['imaging_uuid'];
            }
            if ($p['label'] == $default_protocol) {
                $p['label'] = _T($p['label'], 'imaging').' '._T('(default)', 'imaging');
            }
            $protocols_choices[$p['imaging_uuid']] = $p['label'];
            $protocols_values[$p['imaging_uuid']] = $p['imaging_uuid'];
        }
    }

    $rest_type = new RadioTpl("rest_type");

    $rest_type->setChoices($protocols_choices);
    $rest_type->setValues($protocols_values);
    $rest_type->setSelected($rest_selected);
    $f->add(
        new TrFormElement(_T("Restoration type", "imaging"), $rest_type)
    );
    $f->add(
        new TrFormElement(_T("Restoration: MTFTP maximum waiting (in sec)", "imaging"),
        new InputTpl("rest_wait")), array("value" => $default_menu['mtftp_restore_timeout'])
    );
    $f->pop();

    $f->add(new TitleElement(_T("Boot options", "imaging")));
    $f->push(new Table());
 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" => ''));
     }
 }
Exemple #4
0
 }
 foreach ($res as $mirror) {
     $list_val[$mirror['uuid']] = $mirror['uuid'];
     $list[$mirror['uuid']] = $mirror['mountpoint'];
     $_SESSION['PACKAGEAPI'][$mirror['uuid']] = $mirror;
 }
 $span = new SpanElement(_T("Choose package source", "pkgs"), "pkgs-title");
 $selectpapi = new SelectItem('p_api');
 $selectpapi->setElements($list);
 $selectpapi->setElementsVal($list_val);
 $_SESSION['pkgs_selected'] = array_values($list_val)[0];
 $f = new ValidatingForm();
 $f->push(new Table());
 // Step title
 $f->add(new TrFormElement("", $span), array());
 $r = new RadioTpl("package-method");
 $vals = array("package", "upload", "empty");
 $keys = array(_T("Already uploaded on the server", "pkgs"), _T("Upload from this web page", "pkgs"), _T("Make an empty package", "pkgs"));
 $r->setValues($vals);
 $r->setChoices($keys);
 // Package API
 $f->add(new TrFormElement("<div id=\"p_api_label\">" . _T("Package API", "pkgs") . "</div>", $selectpapi), array("value" => $p_api_id, "required" => True));
 $f->add(new TrFormElement(_T("Package source", "pkgs"), $r), array());
 $f->add(new TrFormElement("<div id='directory-label'>" . _T("Files directory", "pkgs") . "</div>", new Div(array("id" => "package-temp-directory"))), array());
 $f->add(new HiddenTpl("mode"), array("value" => "creation", "hide" => True));
 $span = new SpanElement(_T("Package Creation", "pkgs"), "pkgs-title");
 $f->add(new TrFormElement("", $span), array());
 // fields
 $fields = array(array("label", _T("Name", "pkgs"), array("required" => True, 'placeholder' => _T('<fill_package_name>', 'pkgs'))), array("version", _T("Version", "pkgs"), array("required" => True)), array('description', _T("Description", "pkgs"), array()));
 $command = _T('Command:', 'pkgs') . '<br /><br />';
 $commandHelper = '<span>' . _T('Pulse will try to figure out how to install the uploaded files.\\n\\n
Exemple #5
0
            $f->add(new HiddenTpl('end_date'), array("value" => $end_date, "hide" => True));
        } else {
            $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();
}
Exemple #6
0
    }
    /* all computers of the group */
    $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
Exemple #7
0
function expertModeDisplay($f, $has_profile, $type, $menu, $opts, $target, $real_target)
{
    if (!$has_profile) {
        $f->add(new TitleElement(sprintf(_T("%s menu parameters", "imaging"), $type == '' ? _T('Computer', 'imaging') : _T('Profile', 'imaging'))));
        $f->push(new Table());
        $f->add(new TrFormElement(_T('Default menu label', 'imaging'), new InputTpl("default_m_label")), array("value" => $menu['default_name']));
        $f->add(new TrFormElement(_T('Menu timeout', 'imaging'), new InputTpl("default_m_timeout")), array("value" => $menu['timeout']));
        foreach ($opts as $key => $str) {
            if ($menu[$key]) {
                $value = 'CHECKED';
            } else {
                $value = '';
            }
            $f->add(new TrFormElement($str, new CheckBoxTpl($key)), array("value" => $value));
        }
        $f->pop();
        $f->add(new TitleElement(_T("Restoration options", "imaging")));
        $f->push(new Table());
        $possible_protocols = web_def_possible_protocols();
        $default_protocol = web_def_default_protocol();
        $protocols_choices = array();
        $protocols_values = array();
        /* translate possibles protocols */
        _T('nfs', 'imaging');
        _T('tftp', 'imaging');
        _T('mtftp', 'imaging');
        foreach ($possible_protocols as $p) {
            if ($p['label']) {
                if ($p['label'] == $menu['protocol']) {
                    $rest_selected = $p['imaging_uuid'];
                }
                if ($p['label'] == $default_protocol) {
                    $p['label'] = _T($p['label'], 'imaging') . ' ' . _T('(default)', 'imaging');
                }
                $protocols_choices[$p['imaging_uuid']] = $p['label'];
                $protocols_values[$p['imaging_uuid']] = $p['imaging_uuid'];
            }
        }
        $rest_type = new RadioTpl("rest_type");
        $rest_type->setChoices($protocols_choices);
        $rest_type->setValues($protocols_values);
        $rest_type->setSelected($rest_selected);
        $f->add(new TrFormElement(_T("Restoration type", "imaging"), $rest_type));
        $f->add(new TrFormElement(_T("Restoration: MTFTP maximum waiting (in sec)", "imaging"), new InputTpl("rest_wait")), array("value" => $menu['mtftp_restore_timeout']));
        $f->pop();
        $f->add(new TitleElement(_T("Boot options", "imaging")));
        $f->push(new Table());
        $f->add(new TrFormElement(_T("Full path to the XPM displayed at boot", "imaging"), new InputTpl("boot_xpm")), array("value" => $menu['background_uri']));
        $f->add(new TrFormElement(_T("Message displayed during backup/restoration", "imaging"), new TextareaTpl("boot_msg")), array("value" => $menu['message']));
        /* $f->add(
               new TrFormElement(_T("Keyboard mapping (empty/fr)", "imaging"),
               new InputTpl("boot_keyboard")), array("value" => "")
           ); */
        $f->pop();
    } else {
        $f->add(new HiddenTpl("default_m_label"), array("value" => $menu['default_name'], "hide" => True));
        $f->add(new HiddenTpl("default_m_timeout"), array("value" => $menu['timeout'], "hide" => True));
        $possible_protocols = web_def_possible_protocols();
        foreach ($possible_protocols as $p) {
            if ($p['label'] && $p['label'] == $menu['protocol']) {
                $rest_selected = $p['imaging_uuid'];
                continue;
            }
        }
        $f->add(new HiddenTpl("rest_type"), array("value" => $rest_selected, "hide" => True));
        $f->add(new HiddenTpl("rest_wait"), array("value" => $menu['timeout'], "hide" => True));
        $f->add(new HiddenTpl("boot_xpm"), array("value" => $menu['background_uri'], "hide" => True));
        $f->add(new HiddenTpl("boot_msg"), array("value" => $menu['message'], "hide" => True));
        foreach ($opts as $key => $str) {
            if ($menu[$key]) {
                $value = 'CHECKED';
            } else {
                $value = '';
            }
            $f->add(new HiddenTpl($str), array("value" => $value, "hide" => True));
        }
    }
    /* $f->add(new TitleElement(_T("Administration options", "imaging")));
       $f->push(new Table());
       $f->add(
           new TrFormElement(_T("Password for adding a new client", "imaging"),
           new InputTpl("misc_passwd")), array("value" => "")
       );
       $f->pop();*/
    if ($type == '') {
        $f->add(new TitleElement(_T("Target options", "imaging")));
        $f->push(new Table());
        $local_kernel_parameters = web_def_kernel_parameters();
        $local_image_parameters = web_def_image_parameters();
        if (isset($real_target)) {
            if ($real_target != null) {
                $local_kernel_parameters = $real_target['kernel_parameters'];
                $local_image_parameters = $real_target['image_parameters'];
            }
            /* Make checkbox to force raw backup mode */
            if ($real_target != null && !empty($real_target['raw_mode'])) {
                $rawmode = "CHECKED";
            } else {
                $rawmode = "";
            }
        } else {
            if ($target != null) {
                $local_kernel_parameters = $target['kernel_parameters'];
                $local_image_parameters = $target['image_parameters'];
            }
            /* Make checkbox to force raw backup mode */
            if ($target != null && !empty($target['raw_mode'])) {
                $rawmode = "CHECKED";
            } else {
                $rawmode = "";
            }
        }
        $f->add(new TrFormElement(_T("Kernel parameters", "imaging"), new InputTpl("target_opt_kernel")), array("value" => $local_kernel_parameters));
        $f->add(new TrFormElement(_T("Image parameters", "imaging"), new InputTpl("target_opt_image")), array("value" => $local_image_parameters));
        $f->add(new TrFormElement(_T("Force raw backup mode", "imaging"), new CheckboxTpl("target_opt_raw_mode")), array("value" => $rawmode));
    } else {
        $f->add(new HiddenTpl('target_opt_kernel'), array("value" => $target != null ? $target['kernel_parameters'] : web_def_kernel_parameters(), "hide" => True));
        $f->add(new HiddenTpl('target_opt_image'), array("value" => $target != null ? $target['image_parameters'] : web_def_image_parameters(), "hide" => True));
        $f->add(new HiddenTpl('target_opt_raw_mode'), array("value" => $target != null ? $target['raw_mode'] : '', "hide" => True));
    }
}
Exemple #8
0
    $group->importMembers($elementare, $content);
    new NotifyWidgetSuccess(_T("Group successfully created", "dyngroup"));
    header("Location: " . urlStrRedirect("base/computers/display", array('gid' => $group->id)));
    exit;
} elseif (xmlrpc_group_name_exists($groupname)) {
    new NotifyWidgetFailure(sprintf(_T("A group already exists with name '%s'", "dyngroup"), $groupname));
}
$f = new ValidatingForm(array('enctype' => "multipart/form-data"));
$f->push(new Table());
$f->add(new TrFormElement(_T("Group name", "dyngroup"), new InputTpl("groupname")), array("required" => True, "value" => $groupname));
$r = new RadioTpl('visible');
$r->setChoices(array(_T('Yes', 'dyngroup'), _T('No', 'dyngroup')));
$r->setValues(array('visible', 'hidden'));
$r->setSelected($visibility);
$f->add(new TrFormElement(_T("Add shortcut", "dyngroup"), $r), array("required" => True));
$f->add(new TrFormElement(_T("Select the file you want to import", "dyngroup"), new FileTpl('importfile')), array("required" => True));
$a = getPossiblesCriterionsInMainModule();
$r = new RadioTpl('elementare');
$r->setChoices($a);
$r->setValues($a);
if (!isset($elementare) || $elementare == '') {
    $elementare = $a[0];
}
$r->setSelected($elementare);
$f->add(new TrFormElement(_T("Select what is inside the file", "dyngroup"), $r), array("required" => True));
$f->pop();
$f->addValidateButton("bimport");
$f->display();
?>