示例#1
0
function addQuerySection($Form, $p)
{
    /* ================= BEGIN QUERY ===================== */
    $span = new SpanElement(_T("Query", "pkgs"), "pkgs-title");
    $Form->add(new TrFormElement("", $span), array());
    $check = '';
    $style = 'display:none';
    if ($p['associateinventory'] == 1) {
        $check = 'checked';
        $style = '';
    }
    $Form->add(new TrFormElement(_T('Associate inventory', 'pkgs'), new CheckboxTpl('associateinventory')), array("value" => $check));
    $Qfields = getQFields();
    addQuery($Form, array('Qvendor', _T('Vendor', 'pkgs')), $p, $Qfields['Qvendor'], 3, '', $style);
    addQuery($Form, array('Qsoftware', _T('Software', 'pkgs')), $p, $Qfields['Qsoftware'], 3, 'Qvendor', $style);
    addQuery($Form, array('Qversion', _T('Version', 'pkgs')), $p, $Qfields['Qversion'], 2, 'Qsoftware', $style);
    $Bool = new TrFormElement(_T('Bool', 'pkgs'), new InputTpl('boolcnd'));
    $Bool->setStyle("display:none");
    $Form->add($Bool, array("value" => $p['boolcnd']));
    /* ================= END QUERY ===================== */
    /* =================   BEGIN LICENSE   ===================== */
    $Form->add(new TrFormElement(_T('Number of licenses', 'pkgs'), new InputTpl('licenses'), array('class' => 'associateinventory', 'style' => $style)), array("value" => $p['licenses']));
    /* ==================   END LICENSE   ====================== */
}
示例#2
0
    $f->add($tr, array("value" => $zones[0][0]));
}
$f->add(new TrFormElement(_T("Source IP(s)"), new InputTpl("src_ip"), array("tooltip" => _T("Allow connection from IP(s) address(es) (separate IPs with ',')."))), array("value" => ""));
$zones = getZonesInterfaces($dst);
if (count($zones) > 1) {
    $destinations = array();
    $destinationsVals = array();
    foreach ($zones as $zone) {
        $destinations[] = sprintf("%s (%s)", $zone[0], $zone[1]);
        $destinationsVals[] = $zone[0];
    }
    $destinationsTpl = new SelectItem("destination");
    $destinationsTpl->setElements($destinations);
    $destinationsTpl->setElementsVal($destinationsVals);
    $f->add(new TrFormElement(_T("Destination zone"), $destinationsTpl));
} else {
    $tr = new TrFormElement(_T("Destination zone"), new HiddenTpl("destination"));
    $tr->setStyle("display: none");
    $f->add($tr, array("value" => $zones[0][0]));
}
$f->add(new TrFormElement(_T("Destination IP"), new InputTpl("dest_ip"), array("tooltip" => _T("The computer IP in the internal network where the request will be transfered."))), array("value" => "", "required" => true));
$f->add(new TrFormElement(_T("Destination port(s)"), new InputTpl("dest_port", "/^[0-9]+\$/"), array("tooltip" => _T("If not specified, destination port(s) will be the same as the incoming port(s)"))), array("value" => ""));
$f->pop();
$f->addButton("brule", _T("Add rule"));
$f->display();
if (!servicesModuleEnabled()) {
    echo '<br/>';
    $f = new ValidatingForm(array("id" => "service"));
    $f->addButton("brestart", _T("Restart service"));
    $f->display();
}