$t->display(); $ajax->displayDivToUpdate(); // Add rule form print '<script type="text/javascript" src="modules/shorewall/includes/functions.js"></script><br />'; $t = new TitleElement(_T("Add port forwarding rule"), 2); $t->display(); $f = new ValidatingForm(array("id" => "rule")); $f->push(new Table()); $macros = getServices(); $services = array("", _T("Custom...")) + $macros; $servicesVals = array("", "custom") + $macros; $serviceTpl = new SelectItem("service", "toggleCustom"); $serviceTpl->setElements($services); $serviceTpl->setElementsVal($servicesVals); $f->add(new TrFormElement(_T("Service"), $serviceTpl)); $f->pop(); $customDiv = new Div(array("id" => "custom")); $customDiv->setVisibility(false); $f->push($customDiv); $f->push(new Table()); $protoTpl = new SelectItem("proto"); $protoTpl->setElements(array("", "TCP", "UDP")); $protoTpl->setElementsVal(array("", "tcp", "udp")); $f->add(new TrFormElement(_T("Protocol"), $protoTpl)); $f->add(new TrFormElement(_T("Port(s)"), new InputTpl("port", "/^[0-9:,]+\$/"), array("tooltip" => _T("You can specify multiple ports using ',' as separator (eg: 22,34,56). Port ranges can be defined with ':' (eg: 3400:3500 - from port 3400 to port 3500)."))), array("value" => "")); $f->pop(); $f->pop(); $f->push(new Table()); $zones = getZonesInterfaces($src); if (count($zones) > 1) { $sources = array();
function item_edit() { $params = getParams(); $item_uuid = $_GET['itemid']; $label = urldecode($_GET['itemlabel']); $item = xmlrpc_getMenuItemByUUID($item_uuid); if(count($_POST) == 0) { $name = (isset($item['boot_service']) ? $item['boot_service']['default_name'] : $item['image']['default_name']); printf("<h3>"._T("Edition of item", "imaging")." : <em>%s</em></h3>", $name); $is_selected = ''; $is_displayed = 'CHECKED'; $is_wol_selected = ''; $is_wol_displayed = 'CHECKED'; // get current values if($item['default'] == true) $is_selected = 'CHECKED'; if($item['hidden'] == true) $is_displayed = ''; if($item['default_WOL'] == true) $is_wol_selected = 'CHECKED'; if($item['hidden_WOL'] == true) $is_wol_displayed = ''; $f = new ValidatingForm(); $f->push(new Table()); $f->add(new HiddenTpl("itemid"), array("value" => $item_uuid, "hide" => True)); $f->add(new HiddenTpl("itemlabel"), array("value" => $label, "hide" => True)); $f->add(new HiddenTpl("gid"), array("value" => $_GET['gid'], "hide" => True)); $f->add(new HiddenTpl("uuid"), array("value" => $_GET['uuid'], "hide" => True)); $f->add(new HiddenTpl("default_name"), array("value" => $name, "hide" => True)); $f->add( new TrFormElement(_T("Selected by default", "imaging"), new CheckboxTpl("default")), array("value" => $is_selected) ); $f->add( new TrFormElement(_T("Displayed", "imaging"), new CheckboxTpl("displayed")), array("value" => $is_displayed) ); $f->add( new TrFormElement(_T("Selected by default on WOL", "imaging"), new CheckboxTpl("default_WOL")), array("value" => $is_wol_selected) ); $f->add( new TrFormElement(_T("Displayed on WOL", "imaging"), new CheckboxTpl("displayed_WOL")), array("value" => $is_wol_displayed) ); $f->pop(); $f->addButton("bvalid", _T("Validate")); $f->pop(); $f->display(); } else { // set new values if(isset($_GET['gid'])) { $type = 'group'; $target_uuid = $_GET['gid']; } else { $type = ''; $target_uuid = $_GET['uuid']; } $bs_uuid = $item['boot_service']['imaging_uuid']; $im_uuid = $item['image']['imaging_uuid']; $params['default'] = ($_POST['default'] == 'on'?True:False); $params['default_WOL'] = ($_POST['default_WOL'] == 'on'?True:False); $params['hidden'] = ($_POST['displayed'] == 'on'?False:True); $params['hidden_WOL'] = ($_POST['displayed_WOL'] == 'on'?False:True); $params['default_name'] = $_POST['default_name']; if (isset($bs_uuid) && $bs_uuid != '') { $ret = xmlrpc_editServiceToTarget($bs_uuid, $target_uuid, $params, $type); } else { $ret = xmlrpc_editImageToTarget($im_uuid, $target_uuid, $params, $type); } if ($ret) { // generate menu $ret = xmlrpc_synchroComputer($target_uuid); } // goto menu boot list header("Location: " . urlStrRedirect("base/computers/".$type."imgtabs", $params)); exit; } }
$lang_values[$l['imaging_uuid']] = $l['imaging_uuid']; $lang_id2uuid[$l['id']] = $l['imaging_uuid']; } $language = new SelectItem("language"); $language->setElements($lang_choices); $language->setElementsVal($lang_values); if ($imaging_server['fk_language']) { $language->setSelected($lang_id2uuid[$imaging_server['fk_language']]); } $f->push(new Table()); $f->add( new TrFormElement(_T("Menu language", "imaging"), $language) ); $f->pop(); $f->push(new DivExpertMode()); $f->add(new TitleElement(_T("Default menu parameters", "imaging"))); $f->push(new Table()); $f->add( new TrFormElement(_T('Default menu label', 'imaging'), new InputTpl("default_m_label")), array("value" => $default_menu['default_name']) ); $f->add( new TrFormElement(_T('Default menu timeout', 'imaging'), new InputTpl("default_m_timeout")),
$listbox->setSelected(7); // must match with the default value in ajaxIncoming.php (7 for a week here) // Put the element in a Tr elemet to align it $listboxTr = new TrFormElement(_T("Period"), $listbox); // Create a checkbox element $checkbox = new CheckboxTpl("only_new", null, "validateForm"); $checkboxTr = new TrFormElement(_T("Only new computers"), $checkbox, array("tooltip"=>_T("Load only the computers which were new when the inventory was made"))); $form->add($listboxTr); $form->add($checkboxTr, array("value" => $checked)); $form->pop(); // Display the form $form->display(); // Create the Ajax filter $ajax = new AjaxFilter(urlStrRedirect("inventory/inventory/ajaxIncoming"), "container", $params); // Call this Ajax updater every 10sec //$ajax->setRefresh(10000); // Display the AjaxFilter $ajax->display(); // Display the DIV container that will be updated $ajax->displayDivToUpdate(); // Insert a script to valid the form with javascript on change
function create_form($is_image, $image, $target_uuid, $label, $desc) { if ($is_image) { printf("<h3>"._T("Edition of image", "imaging")." : <em>%s</em></h3>", $label); } else { printf("<h3>"._T("Edition of master", "imaging")." : <em>%s</em></h3>", $label); } $f = new ValidatingForm(); $f->add(new HiddenTpl('target_uuid'), array("value" => $target_uuid, "hide" => True)); $f->add(new HiddenTpl("itemlabel"), array("value" => $label, "hide" => True)); $f->add(new HiddenTpl('target_uuid'), array("value" => $target_uuid, "hide" => True)); $f->push(new Table()); $f->add( new TrFormElement(_T("Label", "imaging"), new InputTpl("image_label")), array("value" => $label) ); $f->add( new TrFormElement(_T("Description", "imaging"), new InputTpl("image_description")), array("value" => $desc) ); $f->pop(); if (!$is_image) { list($a, $post_installs) = xmlrpc_getAllTargetPostInstallScript($target_uuid); $f = get_post_install_scripts($f, $image['post_install_scripts'], $post_installs); } return $f; }
$disk = $disk + 1; $msg = sprintf(_T("Hard disk number: %d", "imaging"), $disk); $inputvar = "check_disk[$disk][0]"; if (isset($parts["exclude"])) { $value = ""; unset($parts["exclude"]); } else { $value = "CHECKED"; } $divid = "disk_div$disk"; $f->push(new DivForModule($msg, "#FFF")); $f->push(new Table()); $f->add(new TrFormElement(_T("Select this hard disk", "imaging"), new CheckboxTpl($inputvar)), array("value" => $value, "extraArg"=>'onclick="toggleVisibility(\''. $divid .'\');"')); $f->pop(); $diskdiv = new Div(array("id" => $divid)); $diskdiv->setVisibility($value == "CHECKED"); $f->push($diskdiv); $f->push(new Table()); ksort($parts); foreach($parts as $part) { $partnum = $part['num'] + 1; $ptype = $parttype[$part['type']]; $length = humanSize($part['length'] * 512); $msg = sprintf(_T("Partition number: %d", "imaging"), $partnum); $inputvar = "check_disk[$disk][$partnum]"; $text = "$ptype $length"; if (isset($part["exclude"])) { $value = "";
$f->add(new TrFormElement(_("Plugin"), new HiddenTpl("plugin")), array("value" => $auditManager->getCode($log[0]["plugin"]))); $f->add(new TrFormElement(_("Client"), new HiddenTpl("interface")), array("value" => $log[0]["client-type"])); $f->add(new TrFormElement(_("Client hostname"), new HiddenTpl("hostname")), array("value" => $log[0]["client-host"])); $f->add(new TrFormElement(_("Agent hostname"), new HiddenTpl("ahostname")), array("value" => $log[0]["agent-host"])); $i = 1; foreach ($log[0]["objects"] as $obj) { $f->add(new TrFormElement(_("Object"), new HiddenTpl("obj" . $i)), array("value" => $obj["object"])); $f->add(new TrFormElement(_("Object type"), new HiddenTpl("type" . $i)), array("value" => $auditManager->getCode($obj["type"]))); if (isset($obj["current"])) { foreach ($obj["current"] as $current) { if ($current) { $current_val = trim($current); } else { $current_val = "(empty)"; } $f->add(new TrFormElement(_("Value"), new HiddenTpl("current")), array("value" => $current_val)); } } $i++; } $f->pop(); $f->display(); $g = new ValidatingForm(); $g->push(new DivExpertMode()); $g->push(new Table()); foreach ($log[0]["parameters"] as $param => $paramvalue) { $g->add(new TrFormElement($param, new HiddenTpl("param" + $param)), array("value" => $paramvalue)); } $g->pop(); $g->pop(); $g->display();
new TrFormElement(_T("DHCP subnet address"), $formElt), array("value" => $subnet, "required" => True) ); $f->add( new TrFormElement(_T("Netmask"),new NetmaskInputTpl("netmask")), array("value" => $netmask, "required" => True, "extra" => _T("(e.g. 24 for a /24 network)")) ); $f->add( new TrFormElement(_T("Description"),new IA5InputTpl("description")), array("value" => $description) ); $f->add( new TrFormElement(_T("Authoritative"),new CheckboxTpl("authoritative")), array("value" => $authoritative) ); $f->pop(); $f->push(new Table()); $f->add(new TrFormElement(_T("DHCP options related to clients network parameters"), new HiddenTpl(""))); $f->add( new TrFormElement(_T("Broadcast address"), new IPInputTpl("broadcast-address")), array("value"=>$options["broadcast-address"]) ); $f->add( new TrFormElement(_T("Domain name"), new IA5InputTpl("domain-name"), array( "tooltip" => _T("Domain name that will be appended to the client's hostname to form a fully-qualified domain-name (FQDN).") . "<br/>" . _T("If the domain name is a registered DNS domain, the subnet will be associated to the DNS domain.") . "<br/>" . _T("You can set more than one domain, separated by spaces. They will be added to the DHCP client DNS domain search path.") ) ),