$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(); }
$f->addCancelButton("bback"); $f->display(); } ### /Advanced actions handling ### /* single target: form display */ if (!isset($_GET['badvanced']) && $_GET['uuid'] && !isset($_POST['launchAction'])) { $machine = new Machine(array('uuid' => $_GET['uuid'], 'hostname' => array('0' => $_GET['hostname']), 'displayName' => $_GET['hostname'])); if (strlen(web_probe_order()) > 0) { $msc_host = new RenderedMSCHost($machine, web_probe_order()); $msc_host->ajaxDisplay(); } else { // nothing set : do not probe if (!isset($_POST["bprobe"])) { $fprobe = new ValidatingForm(); $fprobe->addButton("bprobe", _T("Probe status", "msc")); $fprobe->display(); print "<br/>"; } else { $msc_host = new RenderedMSCHost($machine, web_probe_order_on_demand()); $msc_host->ajaxDisplay(); } } $msc_actions = new RenderedMSCActions(msc_script_list_file(), $machine->hostname, array('uuid' => $_GET['uuid'])); $msc_actions->display(); $ajax = new AjaxFilter(urlStrRedirect("base/computers/ajaxPackageFilter"), "container", array("uuid" => $machine->uuid, "hostname" => $machine->hostname)); $ajax->display(); $ajax->displayDivToUpdate(); } /* group display */ if (!isset($_GET['badvanced']) && isset($_GET['gid']) && !isset($_POST['launchAction']) && !isset($_GET['uuid'])) { $group = new Group($_GET['gid'], true);
// 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 ?> <script type="text/javascript">
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; } }
$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();