Exemplo n.º 1
0
 private function mainTreeRender(Tree &$tree, $selectedKey)
 {
     $li = new Li();
     $mainDiv = new Div();
     $mainDiv->addStyleClasses(["expand", "text_non_select", "tree_text_node", "input_hover"]);
     $table = new Table();
     $tr = new Tr();
     $nodeIcon = new Td();
     $nodeText = new Td();
     $nodeText->addStyleClass("tree_text");
     $nodeSearchCount = new Td();
     $nodeSearchCount->addStyleClass("tree_search_count");
     if (count($tree->childrens) > 0) {
         $nodeIcon->addStyleClasses(["tree_btn"]);
         $icon = new Img();
         $icon->addAttribute("style", "top: 2px; position: relative; margin: 0 5px;");
         $icon->addAttribute("src", $this->treeLevel <= $this->DEFAULT_TREE_LEVEL_TO_SHOW || $tree->show ? "images/arrow90.png" : "images/arrow00.png");
         $nodeIcon->addChild($icon);
     } else {
         $nodeIcon->addStyleClass("tree_empty");
     }
     $link = new A();
     $link->addAttribute("href", URLBuilder::getCatalogLinkForTree($tree->key));
     $link->addChild($tree->value);
     $link->addStyleClass("input_hover");
     $nodeSelected = new Div();
     $nodeSelected->addStyleClass($tree->key == $selectedKey ? 'selected' : 'tree_empty');
     $link->addChild($nodeSelected);
     $nodeText->addChild($link);
     return $li->addChild($mainDiv->addChild($table->addChild($tr->addChildList([$nodeIcon, $nodeText, $nodeSearchCount]))));
 }
Exemplo n.º 2
0
 function createUiContainers()
 {
     $subtypesMap = $this->subtypes();
     $subtypes = array_values($subtypesMap);
     if (isset($subtypesMap[$this->values["subtype"]])) {
         $subtypeIndex = array_search($subtypesMap[$this->values["subtype"]], $subtypes);
         $customSubtype = "";
     } else {
         $subtypeIndex = count($subtypes) - 1;
         $customSubtype = $this->values["subtype"];
     }
     $isCustomSubtype = $subtypeIndex == count($subtypes) - 1 ? "checked" : "";
     $subtypeComboBox = new ExtendedSelectItem($this->pn("subtype"));
     $subtypeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("subtypediv") . "',state);\"");
     $subtypeComboBox->setElements(array_values($subtypes));
     $subtypeComboBox->setElementsVal(array_keys($subtypes));
     $t1 = new Table();
     $t1->add($this->_createNameElement(_T("Owner name"), true, "/(@|[a-z0-9][a-z0-9-_.]*[a-z0-9]\$)/"), array("value" => $this->hostname, "required" => True));
     $t1->add(new TrFormElement(_T("Subtype"), $subtypeComboBox), array("value" => $subtypeIndex));
     $subtypeDiv = new Div(array("id" => $this->pn("subtypediv")));
     $subtypeDiv->setVisibility($isCustomSubtype);
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Custom subtype"), new InputTpl($this->pn("customsubtype"), '/^([0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])$/'), array("tooltip" => _T("Custom subtype ranges from 0 to 65535"))), array("value" => $customSubtype));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Domain name of a host that has a server for the cell named by the owner name"), new InputTpl($this->pn("ownernamehost")), $this->_dnRulesTooltip()), array("value" => $this->values["ownernamehost"], "required" => True));
     return array($this->stackedUi($t1), $this->stackedUi($subtypeDiv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3));
 }
Exemplo n.º 3
0
 public function get3Dots()
 {
     $mainTag = new Div();
     $mainTag->addStyleClasses(["three_dots_style", "f-15"]);
     $mainTag->addChild("...");
     return $mainTag;
 }
Exemplo n.º 4
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _sshlpk_baseEdit($FH, $mode)
{
    // default value
    $show = false;
    if ($mode == 'edit' && hasSshKeyObjectClass($FH->getArrayOrPostValue("uid"))) {
        $show = true;
    } else {
        if ($FH->getValue("showsshkey") == "on") {
            $show = true;
        }
    }
    $f = new DivForModule(_T("Public SSH keys management", "sshlpk"), "#DDF");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Enable SSH keys management", "sshlpk"), new CheckboxTpl("showsshkey")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'sshkeydiv\');"'));
    $f->pop();
    $sshkeydiv = new Div(array("id" => "sshkeydiv"));
    $sshkeydiv->setVisibility($show);
    $f->push($sshkeydiv);
    $sshkeylist = array();
    if ($FH->getArrayOrPostValue("uid")) {
        if ($show && $mode == "edit") {
            $sshkeylist = getAllSshKey($FH->getArrayOrPostValue("uid"));
        }
    }
    if (count($sshkeylist) == 0) {
        $sshkeylist = array("0" => "");
    }
    $f->add(new TrFormElement('', new MultipleInputTpl("sshkeylist", _T("Public SSH Key", "sshlpk"))), $sshkeylist);
    $f->pop();
    return $f;
}
Exemplo n.º 5
0
 private function getMap()
 {
     $mainTag = new Div();
     $mainTag->addStyleClass("map_viewport");
     $map = new Div();
     $map->updateId("google_map");
     return $mainTag->addChild($map);
 }
Exemplo n.º 6
0
 public function getItemsTable($pageNumber, $num, $response, $key, $valueToSearch)
 {
     $mainTag = new Div();
     $tdNum = 3;
     $tdNumTotal = $tdNum * 2 - 1;
     $indOnPage = 0;
     $items = 0;
     $td = 0;
     $item = new Item();
     $rowIndex = 1;
     $tdHeight = Utils::isSquareViewMode() ? 300 : 30;
     $highLightId = Utils::getFromGET(UrlParameters::HIGH_LIGHT_ELEMENT);
     $isMetro = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "metro" || !array_key_exists(UrlParameters::VIEW_MODE, $_GET);
     $isCompact = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "compact";
     $isExtend = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "extend";
     $isList = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "list";
     $rowViewClass = $isCompact ? 'compact' : ($isMetro ? "metro" : ($isExtend ? "extend" : ($isList ? "list" : "list")));
     if ($response != 0) {
         $mainTag->addStyleClass("items_table");
         $rowView = new Div();
         $mainTag->addChild($rowView);
         while ($row = mysql_fetch_array($response)) {
             $items++;
             $indOnPage++;
             $td++;
             if (ceil(fmod($indOnPage, $tdNum)) == 1) {
                 $rowIndex++;
                 $indOnPage = 1;
                 $td = 1;
             } elseif (Utils::isEven($td)) {
                 $td++;
             }
             $rowView->addStyleClass($rowViewClass);
             $cellView = new Div();
             $rowView->addChild($cellView);
             $keyItem = $row["key_item"];
             $images = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH . DIRECTORY_SEPARATOR . $keyItem . DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, 'jpg');
             if (count($images) == 0) {
                 $capImage = FileUtils::getCapImage(Labels::CAP_IMAGE_FOR_CLOTHING);
                 $images = [$capImage];
             }
             $item = null;
             if ($isMetro) {
                 $item = Item::getMetroItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isCompact) {
                 //$name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement
                 $item = Item::getCompactItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isExtend) {
                 $item = Item::getSquareItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]));
             } elseif ($isList) {
                 $item = Item::getLineItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::trimFormatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             }
             $cellView->addChild($item);
             $cellView->addStyleClass("catalog_good_item");
         }
     }
     return $mainTag;
 }
Exemplo n.º 7
0
 public function getPaginationLinks($pageNumber, $num, $totalCount, $topBottom)
 {
     $mainTag = new Div();
     $catalogLink = new CatalogLink();
     $dots = false;
     $topBottomStyle = $topBottom == 'bottom' ? 'link_next_prev_bottom' : '';
     if ($totalCount != 0) {
         $amountPages = ceil($totalCount / $num);
         if ($pageNumber > 0 && $pageNumber <= $amountPages) {
             $mainTag->addStyleClasses(["pagination_bar", "right_top_bar", $topBottomStyle]);
             $brokerTag = new Div();
             $mainTag->addChild($brokerTag);
             $tagCenterContainer = new Span();
             if ($pageNumber != 1) {
                 $tagPrevious = new A();
                 $tagPrevious->addStyleClasses(["f-16", "text_non_select", "link_style", "link_next_prev", "input_hover", "prev_link"]);
                 $tagPrevious->addAttribute("href", URLBuilder::getCatalogLinkPrev($pageNumber, $num));
                 $text = new Div();
                 $text->addStyleClass("text");
                 $text->addChild("назад");
                 $arrow = new Div();
                 $arrow->addStyleClass("arrow");
                 $tagCenterContainer->addChild($tagPrevious->addChildList([$arrow, $text]));
             }
             $brokerTag->addChild($tagCenterContainer);
             $tagCenterContainer->addStyleClasses(["numeric_links", "f-15"]);
             for ($currentRenderPage = 1; $currentRenderPage <= $amountPages; $currentRenderPage++) {
                 if ($currentRenderPage < 2 || $currentRenderPage > $pageNumber - $this->linksGroupCount && $currentRenderPage < $pageNumber + $this->linksGroupCount || $currentRenderPage > $amountPages - 1) {
                     $dots = false;
                     if ($currentRenderPage != $pageNumber) {
                         $tagCenterContainer->addChild($catalogLink->getLink($currentRenderPage, $num));
                     } else {
                         $emptyLinkView = $catalogLink->getEmptyLink($pageNumber);
                         $emptyLinkView->addStyleClass("f-16");
                         $tagCenterContainer->addChild($emptyLinkView);
                     }
                 } else {
                     if (!$dots) {
                         $dots = true;
                         $tagCenterContainer->addChild($catalogLink->get3dots());
                     }
                 }
             }
             if ($pageNumber != $amountPages) {
                 $tagNext = new A();
                 $tagNext->addStyleClasses(["f-16", "text_non_select", "link_style", "input_hover", "link_next_prev", "next_link"]);
                 $tagNext->addAttribute("href", URLBuilder::getCatalogLinkNext($pageNumber, $num));
                 $text = new Div();
                 $text->addStyleClass("text");
                 $text->addChild("вперед");
                 $arrow = new Div();
                 $arrow->addStyleClass("arrow");
                 $tagCenterContainer->addChild($tagNext->addChildList([$text, $arrow]));
             }
         }
     }
     return $mainTag;
 }
Exemplo n.º 8
0
 private function createGeneralContentForEmptyResult($valueToSearch)
 {
     $mainTag = new Div();
     $mainTag->addStyleClass("empty_search_result");
     $emptySearchResultLabel = new Div();
     $emptySearchResultLabel->addStyleClasses(["empty_search_result_label", "f-16"]);
     $mainTag->addChild($emptySearchResultLabel->addChild(Labels::prefillMessage([$valueToSearch], Labels::EMPTY_SEARCH_RESULT)));
     TagUtils::createShadow($mainTag);
     return $mainTag;
 }
 public function testRenderWithSingleContainerUnordered()
 {
     $list = ListElement::createUnordered()->addItem(ListItem::create()->appendText(Paragraph::create()->appendText('Item 1')))->addItem(ListItem::create()->appendText(Div::create()->appendText('Item 2')))->addItem(ListItem::create()->appendText(Span::create()->appendText('Item 3')));
     $expected = '<ul>' . '<li><p>Item 1</p></li>' . '<li><div>Item 2</div></li>' . '<li><span>Item 3</span></li>' . '</ul>';
     $rendered = $list->render();
     $this->assertEquals($expected, $rendered);
 }
Exemplo n.º 10
0
    /**
     * Test rendering a div with HTML tidy.
     * @depends testRender_withSubdivs
     */
    public function testRender_tidy()
    {
        if (!class_exists('tidy')) {
            $this->markTestSkipped("Tidy extension not available");
        }
        $html = <<<HTML
<div>
  <div>
    Test
  </div>
  <div class="subdiv">
    <div>
      Child
    </div>
    <p>
      foobar
    </p>
  </div>
</div>
HTML;
        $this->div->setOption('tidy', array('indent' => true));
        $this->div->add('<div>Test</div>');
        $child = new Div(array('class' => 'subdiv'));
        $child->add('<div>Child</div>');
        $this->div->add($child);
        $element = $this->getMockBuilder('Jasny\\FormBuilder\\Element')->getMockForAbstractClass();
        $element->expects($this->once())->method('render')->will($this->returnValue('<p>foobar</p>'));
        $child->add($element);
        $this->assertSame($html, (string) $this->div);
    }
Exemplo n.º 11
0
 public static function createNote($text, $link)
 {
     $note = new A();
     $note->addStyleClass("note");
     $textWrapper01 = new Div();
     $textWrapper = new Span();
     $textWrapper->addChild($text);
     $textWrapper01->addChild($textWrapper);
     $note->addChild($textWrapper01);
     if (strlen($link) > 0) {
         $note->addAttribute("href", $link);
         $note->addStyleClasses(["hover_text_underline"]);
     } else {
         $note->addStyleClasses(["cursor_default"]);
     }
     return $note;
 }
Exemplo n.º 12
0
 /**
  * Render the HTML element in the provided context
  *
  * @param array $context
  *
  * @return string The HTML string output
  */
 public function render($context = [])
 {
     if ($element = $this->getElement()) {
         $class = $element->getAttribute('class', false);
         $class .= $class ? ' form-control' : 'form-control';
         $this->getElement()->setAttribute('class', $class);
     }
     return parent::render($context);
 }
Exemplo n.º 13
0
/**
 * Form on user edit page
 * @param $FH FormHandler of the page
 * @param $mode add or edit mode
 */
function _radius_baseEdit($FH, $mode)
{
    // default value
    $show = false;
    if ($mode == 'edit' && hasRadiusObjectClass($FH->getArrayOrPostValue("uid"))) {
        $show = true;
    } else {
        if ($FH->getValue("showradius") == "on") {
            $show = true;
        }
    }
    $f = new DivForModule(_T("Radius management", "radius"), "#E0FFDF");
    $f->push(new Table());
    $f->add(new TrFormElement(_T("Enable Radius management", "radius"), new CheckboxTpl("showradius")), array("value" => $show ? "checked" : "", "extraArg" => 'onclick="toggleVisibility(\'radiusdiv\');"'));
    $f->pop();
    $radiusdiv = new Div(array("id" => "radiusdiv"));
    $radiusdiv->setVisibility($show);
    $f->push($radiusdiv);
    $radiusCallingStationId = $FH->getArrayOrPostValue('radiusCallingStationId', 'array');
    $f->add(new TrFormElement('', new MultipleInputTpl("radiusCallingStationId", _T("Calling Station ID", "radius"))), $radiusCallingStationId);
    $f->pop();
    return $f;
}
Exemplo n.º 14
0
 function createUiContainers()
 {
     $isDefaultType = $this->values["type"] == "1" ? "checked" : "";
     $algorithmsMap = $this->algorithms();
     $algorithms = array_values($algorithmsMap);
     if (isset($algorithmsMap[$this->values["algorithm"]])) {
         $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
         $customAlgorithm = "";
     } else {
         $algorithmIndex = count($algorithms) - 1;
         $customAlgorithm = $this->values["algorithm"];
     }
     $isCustomAlgorithm = $algorithmIndex == count($algorithms) - 1 ? "checked" : "";
     $algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
     $algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv") . "',state);\"");
     $algorithmComboBox->setElements(array_values($algorithms));
     $algorithmComboBox->setElementsVal(array_keys($algorithms));
     $fingerprintTextarea = new TextareaTpl($this->pn("fingerprint"));
     $fingerprintTextarea->setCols(43);
     $t1 = new Table();
     $t1->add($this->_createNameElement(_T("Domain name")), array("value" => $this->hostname, "required" => True));
     $t1->add(new TrFormElement(_T("SHA-1 fingerprint"), new CheckboxTpl($this->pn("isdefaulttype"))), array("value" => $isDefaultType, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("typediv") . '\');"'));
     $typeDiv = new Div(array("id" => $this->pn("typediv")));
     $typeDiv->setVisibility($isDefaultType ? "" : "checked");
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Custom fingerprint type"), new InputTpl($this->pn("customtype"), '/^\\d+$/'), array("tooltip" => _T("Fingerprint type ranges from 0 to 255"))), array("value" => $this->values["type"]));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox), array("value" => $algorithmIndex));
     $algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
     $algorithmDiv->setVisibility($isCustomAlgorithm);
     $t4 = new Table();
     $t4->add(new TrFormElement(_T("Custom algorithm"), new InputTpl($this->pn("customalgorithm"), '/^([01]?\\d?\\d|2[0-4]\\d|25[0-5])$/'), array("tooltip" => _T("Algorithm ranges from 0 to 255"))), array("value" => $customAlgorithm));
     $t5 = new Table();
     $t5->add(new TrFormElement(_T("Fingerprint"), $fingerprintTextarea, array("tooltip" => _T("The Fingerprint MUST be represented as a sequence of case-insensitive hexadecimal digits"))), array("value" => $this->values["fingerprint"]));
     return array($this->stackedUi($t1), $this->stackedUi($typeDiv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3), $this->stackedUi($algorithmDiv, 0), $this->stackedUi($t4, 2), $this->stackedUi($t5));
 }
 function getMobileSwitch()
 {
     $tbl = new Table(array("", "", "", ""));
     $tbl->setAlignments(array("center", "left", "left", "right"));
     $tbl->setColSizes(array(60, "", 170, 150));
     $tbl->setBorder(0);
     $rowTtl = $tbl->createRow();
     $rowTtl->setVAlign("middle");
     $txtAn = new Text("AN", 7, true);
     $txtAus = new Text("AUS", 7, true);
     $divAn = new Div();
     $divAn->add($txtAn);
     $divAn->setWidth(150);
     $divAn->setHeight(50);
     $divAn->setAlign("center");
     $divAn->setVAlign("middle");
     $divAn->setStyle("line-height", "50px");
     $divAn->setBorder(1);
     $divAn->setBackgroundColor("green");
     $divAus = new Div();
     $divAus->setWidth(150);
     $divAus->setHeight(50);
     $divAus->setAlign("center");
     $divAus->setVAlign("middle");
     $divAus->setStyle("line-height", "50px");
     $divAus->add($txtAus);
     $divAus->setBorder(1);
     $divAus->setBackgroundColor("red");
     $txtName = new Text($this->OBJNAME, 6, true);
     $img = $this->getControlArtIcon(false);
     $lnkAn = new Link("http://" . $this->IP . "?schalte=on", $divAn, false, "arduinoSwitch");
     $lnkAus = new Link("http://" . $this->IP . "?schalte=-" . $this->FUNK_ID, $divAus, false, "arduinoSwitch");
     $rowTtl->setAttribute(0, $img);
     $rowTtl->setAttribute(1, $txtName);
     $rowTtl->setAttribute(2, $lnkAn);
     $rowTtl->setAttribute(3, $lnkAus);
     $tbl->addRow($rowTtl);
     return $tbl;
 }
Exemplo n.º 16
0
 /**
  * Takes information from the Field and uses it in this display
  * 
  * @param DisplayDataSourceInterface $field
  */
 public function informAboutStructure(\Feeld\Display\DisplayDataSourceInterface $field)
 {
     parent::informAboutStructure($field);
     if (!$field instanceof \Feeld\Interview\ErrorContainer) {
         throw new \Wellid\Exception\DataType('field', 'ErrorContainer', $field);
     }
     $errorMessages = $errorMessagesLi = array();
     foreach ($field->getErrorMessages() as $entry) {
         $errorMessages[] = htmlspecialchars($entry);
         $errorMessagesLi[] = '<li>' . htmlspecialchars($entry) . '</li>';
     }
     if (count($errorMessages) === 0) {
         $this->setInvisible();
         return;
     }
     $this->setVisible();
     if (count($errorMessages) === 1) {
         $innerWrapper = (new Element('span'))->setContent($errorMessages[0]);
     } else {
         $innerWrapper = (new Element('ul'))->setContent(implode('', $errorMessagesLi));
     }
     $this->appendChild($innerWrapper->addCssClass('bg-danger error'));
 }
Exemplo n.º 17
0
    function createUiContainers(){
                                                                                         
	$recordTypes = supportedRecordsTypes("all");
	$typeIndex = array_search(strtoupper($this->values["type"]),$recordTypes);
	if ($typeIndex === false){
    	    $typeIndex = count($recordTypes)-1;
            $customType = $this->values["type"];
        } else {
            $customType = "";
            //$typeIndex = 0;
        }
	$isCustomType = ($typeIndex == (count($recordTypes) - 1)) ? "checked" : ""; 
	
	$algorithmsMap = $this->algorithms();
	$algorithms = array_values($algorithmsMap);
	if (isset($algorithmsMap[$this->values["algorithm"]])){
	    $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
	    $customAlgorithm = "";
	} else {
	    $algorithmIndex = count($algorithms) - 1;
	    $customAlgorithm = $this->values["algorithm"];
	}
	$isCustomAlgorithm = ($algorithmIndex == (count($algorithms) - 1)) ? "checked" : ""; 

	
        $typeComboBox = new ExtendedSelectItem($this->pn("type"));
 	$typeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("typediv"). "',state);\"");
	$typeComboBox->setElements(array_values($recordTypes));
	$typeComboBox->setElementsVal(array_keys($recordTypes));
	
	$algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
 	$algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv"). "',state);\"");
	$algorithmComboBox->setElements(array_values($algorithms));
	$algorithmComboBox->setElementsVal(array_keys($algorithms));
		
	$signatureTextarea = new TextareaTpl($this->pn("signature"));
	$signatureTextarea->setCols(43);
	
	
	$t1 = new Table();
	$t1->add($this->_createNameElement(_T("Domain name")),
		array("value" => $this->hostname, "required" => True));
	$t1->add(new TrFormElement(	_T("Domain name of the signer, generating this SIG"), 
					new InputTpl($this->pn("signer")), 
					$this->_dnRulesTooltip()),
		array("value" => $this->values["signer"], "required" => True));
	$t1->add(new TrFormElement(_T("Record type covered by this SIG"), $typeComboBox),
		array("value"=>$typeIndex));
	
	$typeDiv = new Div(array("id" => $this->pn("typediv")));
        $typeDiv->setVisibility($isCustomType);
	
	$t2 = new Table();
	$t2->add(new TrFormElement(_T("Custom record type"), new InputTpl($this->pn("customtype"),'/\w+/')),
		array("value"=>$customType));
		
	$t3 = new Table();
			
	$t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox),
		array("value"=>$algorithmIndex));
		
	$algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
        $algorithmDiv->setVisibility($isCustomAlgorithm);
	
	$t4 = new Table();
	$t4->add(new TrFormElement(
		    _T("Custom algorithm"), 
		    new InputTpl($this->pn("customalgorithm"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'), 
		    array("tooltip" => _T("Algorithm ranges from 0 to 255"))
		    ),
		 array("value"=>$customAlgorithm));
	
	$t5 = new Table();
	$t5->add(new TrFormElement(
		    _T("Labels"), 
		    new InputTpl($this->pn("labels"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'),
		    array("tooltip" => _T("Define an unsigned count of how many labels there are in the original SIG record owner name not counting the null label for root and not counting any initial \"*\" for a wildcard.") . "<br>" .
   	        		       _T("Labels count ranges from 0 to 255"))
		    ),
		array("value" => $this->values["labels"], "required" => True));
		
	$t5->add(new TrFormElement(_T("Original TTL"), new BindRemainingTimeTpl($this->pn("ttl"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["ttl"])));
	$t5->add(new TrFormElement(_T("Signature inception time"), new ExtendedDateTpl($this->pn("inception"))),
		array("value"=>$this->bindTimeToDateTplTime($this->values["inception"])));
	$t5->add(new TrFormElement(_T("Signature expiration time"), new ExtendedDateTpl($this->pn("expiration"))),
		array("value"=>$this->bindTimeToDateTplTime($this->values["expiration"])));
	$t5->add(new TrFormElement(
		    _T("Key tag"), 
		    new InputTpl($this->pn("keytag"), '/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
		    array("tooltip" => _T("Key tag is a decimal number that ranges from 0 to 65535"))
		    ),
		array("value" => $this->values["keytag"], "required" => True));
	$t5->add(new TrFormElement(_T("Signature"), $signatureTextarea),
		array("value" => $this->values["signature"]));
		
	
	return array($this->stackedUi($t1), $this->stackedUi($typeDiv,0), $this->stackedUi($t2,2),
		     $this->stackedUi($t3), $this->stackedUi($algorithmDiv,0), $this->stackedUi($t4,2),
		     $this->stackedUi($t5));
	
    }
Exemplo n.º 18
0
$transfer_marker_img = "mm_20_orange.png";
$start_marker_img = "mm_20_green.png";
$end_marker_img = "mm_20_red.png";
$WALKING_SPEED = 2 / 3600;
$debug = false;
$logging = false;
$current_url = $_SERVER['PHP_SELF'];
$slogan = getSlogan();
$linksTable = new Table("linkstable");
$homeCell = new Cell("link", new Link("/", "home"));
$aboutCell = new Cell("link", new Link("/about.php", "about"));
$linksRow = new Row();
$linksRow->addCell($homeCell);
$linksRow->addCell($aboutCell);
$linksTable->addRow($linksRow);
$linksDiv = new Div("about", "noselect", null, $linksTable);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta name="Description" content="<?php 
echo $description;
?>
" />
    <meta name="Keywords" content="<?php 
echo $keywords;
?>
" />
    <meta name="save" content="history" />
    <link rel="stylesheet" type="text/css" media="screen" href="/css/map.css" />
    <script type="text/javascript" src="/js/map.js"></script>
Exemplo n.º 19
0
 private function getItemInfo($name, $description)
 {
     $mainTag = new Div();
     $itemTitle = new Div();
     $itemTitle->addStyleClasses(["title", "font_arial"]);
     $itemTitle->addChild($name);
     $itemDescription = new Div();
     $itemDescription->addStyleClasses(["title", "font_arial"]);
     $itemDescription->addChild($description);
     return $mainTag->addChildList([$itemTitle, $itemDescription]);
 }
Exemplo n.º 20
0
    function createUiContainers(){
                                                                                         
	$typesMap = $this->types();
	$types = array_values($typesMap);
	if (isset($typesMap[$this->values["type"]])){
	    $typeIndex = array_search($typesMap[$this->values["type"]], $types);
	    $customType = "";
	} else {
	    $typeIndex = count($types) - 1;
	    $customType = $this->values["type"];
	}
	$isCustomType = ($typeIndex == (count($types) - 1)) ? "checked" : ""; 
	
	$algorithmsMap = $this->algorithms();
	$algorithms = array_values($algorithmsMap);
	if (isset($algorithmsMap[$this->values["algorithm"]])){
	    $algorithmIndex = array_search($algorithmsMap[$this->values["algorithm"]], $algorithms);
	    $customAlgorithm = "";
	} else {
	    $algorithmIndex = count($algorithms) - 1;
	    $customAlgorithm = $this->values["algorithm"];
	}
	$isCustomAlgorithm = ($algorithmIndex == (count($algorithms) - 1)) ? "checked" : ""; 

	
        $typeComboBox = new ExtendedSelectItem($this->pn("type"));
 	$typeComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("typediv"). "',state);\"");
	$typeComboBox->setElements(array_values($types));
	$typeComboBox->setElementsVal(array_keys($types));
	
	$algorithmComboBox = new ExtendedSelectItem($this->pn("algorithm"));
 	$algorithmComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("algorithmdiv"). "',state);\"");
	$algorithmComboBox->setElements(array_values($algorithms));
	$algorithmComboBox->setElementsVal(array_keys($algorithms));
		
	$certificateTextarea = new TextareaTpl($this->pn("certificate"));
	$certificateTextarea->setCols(43);
	
	
	$t1 = new Table();
	$t1->add($this->_createNameElement(_T("Domain name")),
		array("value" => $this->hostname, "required" => True));
	$t1->add(new TrFormElement(_T("Type"), $typeComboBox),
		array("value"=>$typeIndex));
	
	$typeDiv = new Div(array("id" => $this->pn("typediv")));
        $typeDiv->setVisibility($isCustomType);
	
	$t2 = new Table();
	$t2->add(new TrFormElement(
		    _T("Custom type"), 
		    new InputTpl($this->pn("customtype"),'/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
		    array("tooltip" => _T("Type ranges from 0 to 65535"))
		    ),
		array("value"=>$customType));
		
	$t3 = new Table();
			
	$t3->add(new TrFormElement(_T("Algorithm"), $algorithmComboBox),
		array("value"=>$algorithmIndex));
		
	$algorithmDiv = new Div(array("id" => $this->pn("algorithmdiv")));
        $algorithmDiv->setVisibility($isCustomAlgorithm);
	
	$t4 = new Table();
	$t4->add(new TrFormElement(
		    _T("Custom algorithm"), 
		    new InputTpl($this->pn("customalgorithm"), '/^([01]?\d?\d|2[0-4]\d|25[0-5])$/'), 
		    array("tooltip" => _T("Algorithm ranges from 0 to 255"))
		    ),
		 array("value"=>$customAlgorithm));
	
	$t5 = new Table();
	
	 $t5->add(new TrFormElement(
	                 _T("Key tag"), 
	                 new InputTpl($this->pn("keytag"), '/^([0-5]?\d?\d?\d?\d|6[0-4]\d\d\d|65[0-4]\d\d|655[0-2]\d|6553[0-5])$/'),
	                 array("tooltip" => _T("Key tag is a decimal number that ranges from 0 to 65535"))
	                ),
	        array("value" => $this->values["keytag"], "required" => True));
	                                                                                                 
	
	$t5->add(new TrFormElement(_T("Certificate"), $certificateTextarea),
		array("value" => $this->values["certificate"]));
		
	
	return array($this->stackedUi($t1), $this->stackedUi($typeDiv,0), $this->stackedUi($t2,2),
		     $this->stackedUi($t3), $this->stackedUi($algorithmDiv,0), $this->stackedUi($t4,2),
		     $this->stackedUi($t5));
	
    }
Exemplo n.º 21
0
Arquivo: index.php Projeto: psyray/mmc
#$f->add(
#        new TrFormElement(_T("This server is a WINS server"),new CheckboxTpl("wins support")),
#        array("value" => getCheckedState($smb, "wins support"))
#);
$value = "";
#if ($smb["hashomes"]) $value = "checked";
$f->add(new TrFormElement(_T("Share user's homes"), new CheckboxTpl("hashomes")), array("value" => $value));
$value = "";
$hasProfiles = false;
// if ($smb['logon path']) {
//     $value = "checked";
//     $hasProfiles = true;
// }
$f->add(new TrFormElement(_T("Use network profiles for users"), new CheckboxTpl("hasprofiles"), array("tooltip" => _T("Activate roaming profiles for all users.", "samba"))), array("value" => $value, "extraArg" => 'onclick=toggleVisibility("profilespath")'));
$f->pop();
$pathdiv = new Div(array("id" => "profilespath"));
$pathdiv->setVisibility($hasProfiles);
$f->push($pathdiv);
$f->push(new Table());
# default value for profile path
$value = "\\\\%N\\profiles\\%U";
if ($hasProfiles) {
    $value = $smb['logon path'];
}
$f->add(new TrFormElement(_T("Network path for profiles"), new InputTpl("logon path"), array("tooltip" => _T("The share must exist and be world-writable.", "samba"))), array("value" => $value));
$f->pop();
$f->pop();
$f->push(new DivExpertMode());
$f->push(new Table());
$syncTpl = new SelectItem("ldap passwd sync");
$labels = array(_T('Yes'), _T('No'), _T('Only (for smbk5pwd)'));
Exemplo n.º 22
0
 private static function getDOMForViewMode($type)
 {
     $mainDom = new Div();
     $mainDom->addStyleClass($type);
     $mainDom->addAttribute("view_type", $type);
     switch ($type) {
         case "compact":
             $mainDom->addChildList([new Div(), new Div(), new Div(), new Div(), new Div(), new Div()]);
             break;
         case "extend":
             $mainDom->addChildList([new Div(), new Div(), new Div()]);
             break;
         case "metro":
             $mainDom->addChildList([new Div(), new Div()]);
             break;
         default:
             $mainDom->addChildList([new Div(), new Div(), new Div(), new Div(), new Div(), new Div()]);
     }
     return $mainDom;
 }
Exemplo n.º 23
0
 function createUiContainers($editMode = false)
 {
     if (preg_match("/_?(.*)\\._(.*)/", $this->hostname, $vals)) {
         $service = $vals[1];
         $protoIndex = array_search(strtoupper($vals[2]), $this->protocols());
         if ($protoIndex === false) {
             $protoIndex = count($this->protocols()) - 1;
             $customProto = $vals[2];
         }
     } else {
         $service = "";
         $protoIndex = 0;
     }
     $isAnyService = "";
     if ($service == "*") {
         $service = "";
         $isAnyService = "checked";
     }
     $hasTarget = "checked";
     if ($this->values["target"] == ".") {
         $hasTarget = "";
         $this->values["target"] = "";
     }
     $isCustomProto = $protoIndex == count($this->protocols()) - 1 ? "checked" : "";
     $protoComboBox = new ExtendedSelectItem($this->pn("proto"));
     $protoComboBox->setAdditionalParams("onkeyup=\"this.blur();this.focus();\" onchange=\"var state = (this.selectedIndex == this.length - 1) ? 'inline' : 'none'; changeObjectDisplay('" . $this->pn("protodiv") . "',state);\"");
     $protoComboBox->setElements(array_values($this->protocols()));
     $protoComboBox->setElementsVal(array_keys($this->protocols()));
     $t1 = new Table();
     $t1->add(new TrFormElement(_T("It can be an any service, if checked"), new CheckboxTpl($this->pn("isAnyService"))), array("value" => $isAnyService, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("servicediv") . '\');"'));
     $servicediv = new Div(array("id" => $this->pn("servicediv")));
     $servicediv->setVisibility(!$isAnyService);
     $t2 = new Table();
     $t2->add(new TrFormElement(_T("Service"), new InputTpl($this->pn("service"))), array("value" => $service));
     $t3 = new Table();
     $t3->add(new TrFormElement(_T("Protocol"), $protoComboBox), array("value" => $protoIndex));
     $protodiv = new Div(array("id" => $this->pn("protodiv")));
     $protodiv->setVisibility($isCustomProto);
     $t4 = new Table();
     $t4->add(new TrFormElement(_T("Custom protocol name"), new InputTpl($this->pn("customProto"))), array("value" => $customProto));
     $t5 = new Table();
     $t5->add(new TrFormElement(_T("There is a host that will provide this service, if checked"), new CheckboxTpl($this->pn("hasTarget"))), array("value" => $hasTarget, "extraArg" => 'onclick="toggleVisibility(\'' . $this->pn("targetdiv") . '\');"'));
     $targetdiv = new Div(array("id" => $this->pn("targetdiv")));
     $targetdiv->setVisibility($hasTarget);
     $t6 = new Table();
     $t6->add(new TrFormElement(_T("Host that will provide this service"), new InputTpl($this->pn("target"))), array("value" => $this->values["target"]));
     $t7 = new Table();
     $t7->add(new TrFormElement(_T("Port"), new InputTpl($this->pn("port"), '/\\d+/')), array("value" => $this->values["port"], "required" => True));
     $t7->add(new TrFormElement(_T("Priority"), new InputTpl($this->pn("priority"), '/\\d+/')), array("value" => $this->values["priority"], "required" => True));
     $t7->add(new TrFormElement(_T("Weight"), new InputTpl($this->pn("weight"), '/\\d+/')), array("value" => $this->values["weight"], "required" => True));
     return array($this->stackedUi($t1), $this->stackedUi($servicediv, 0), $this->stackedUi($t2, 2), $this->stackedUi($t3), $this->stackedUi($protodiv, 0), $this->stackedUi($t4, 2), $this->stackedUi($t5), $this->stackedUi($targetdiv, 0), $this->stackedUi($t6, 2), $this->stackedUi($t7));
 }
Exemplo n.º 24
0
    $cont = new DivByInclude("mobile_" . $_SESSION['mainpage'], false);
} else {
    $cont = new DivByInclude($_SESSION['mainpage'], false);
}
$cont->setWidth("800");
$cont->setStyle("padding-left", "4px");
$cont->setStyle("padding-right", "4px");
$MainPanel->add($cont);
$contentLayoutRow = $layoutTable->createRow();
$contentLayoutRow->setAttribute(0, $MainPanel);
$layoutTable->addRow($contentLayoutRow);
/* --------------------------------- */
/* ------------------------------------
     FUSS-MENU 
   ------------------------------------ */
$footMenuDiv = new Div();
$footMenuDiv->setWidth(810);
$footMenuDiv->setBorder(0);
$footMenuDiv->setAlign("center");
$footMenu = new DbMenu("Fussmenue");
$footMenu->setHeight(14);
$footMenu->setMenuType("horizontal");
$footMenu->setAlign("center");
$footMenu->setFontsize(1);
$footMenuDiv->add($footMenu);
$fussLayoutRow = $layoutTable->createRow();
$fussLayoutRow->setAttribute(0, $footMenuDiv);
$layoutTable->addRow($fussLayoutRow);
/* --------------------------------- */
$layoutTable->show();
$arduinoFrame = new IFrame($_SESSION['config'], "arduinoSwitch", -1, -1, 1, 1, 0);
Exemplo n.º 25
0
 protected function createGeneralContent()
 {
     $mainTag = new Div();
     $mainTag->addAttribute("style", "margin: 1px 0px 0px 3px;");
     $items = new Items();
     $catalogLinks = new CatalogLinks();
     if (array_key_exists(UrlParameters::PAGE_NAME, $_GET)) {
         $pageNumber = Constants::DEFAULT_PAGE_NUMBER;
         $itemsCount = Labels::VIEW_MODE_NUMERIC_DEF;
         if (array_key_exists(UrlParameters::PAGE_NUM, $_GET)) {
             $pageNumber = Utils::getFromGET(UrlParameters::PAGE_NUM);
         }
         if (array_key_exists(UrlParameters::ITEMS_COUNT, $_GET)) {
             $itemsCount = Utils::getFromGET(UrlParameters::ITEMS_COUNT);
         }
         if (array_key_exists(UrlParameters::SEARCH_VALUE, $_GET)) {
             $itemsType = new CatalogLoader();
             $searchValue = Utils::getFromGET(UrlParameters::SEARCH_VALUE);
             $itemsType->getItemSearchData($pageNumber, $itemsCount, $searchValue);
             if ($itemsType->dataTotalCount == 0) {
                 return "";
             }
             $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
             $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, '', $searchValue));
             $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
         } else {
             if (array_key_exists(UrlParameters::KEY, $_GET)) {
                 $itemsType = new CatalogLoader();
                 $keyValue = Utils::getFromGET(UrlParameters::KEY);
                 $itemsType->getItemsMenuData($pageNumber, $itemsCount, $keyValue);
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
                 $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, $keyValue, ''));
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
             } else {
                 $itemsType = new CatalogLoader();
                 $itemsType->getItemsMainData($pageNumber, $itemsCount);
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
                 $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, '', ''));
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
             }
         }
     }
     return $mainTag;
 }
Exemplo n.º 26
0
 function display($editMode = False)
 {
     $uics = $this->createUiContainers($editMode);
     $cnt = new Div();
     foreach ($uics as $uic) {
         if ($uic[2]) {
             $cnt->add($uic[0][0], $uic[0][1]);
             continue;
         }
         $cnt->push($uic[0]);
         for ($i = 0; $i < $uic[1]; $i++) {
             $cnt->pop();
         }
     }
     $cnt->display();
 }
Exemplo n.º 27
0
$tooltip = _T("Trivial File Transfer Protocol server name from which the client is booting.");
$tooltip .= "%s";
$tooltip .= _T("(DHCP option number 66)");
$tooltip = sprintf($tooltip, "<br/>");
$f->add(new TrFormElement(_T("TFTP server name"), new IA5InputTpl("tftp-server-name"), array("tooltip" => $tooltip)), array("value" => $options["tftp-server-name"]));
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("DHCP client lease time (in seconds)"), new HiddenTpl("")));
$f->add(new TrFormElement(_T("Minimum lease time"), new NumericInputTpl("min-lease-time"), array("tooltip" => _T("Minimum length in seconds that will be assigned to a lease."))), array("value" => $statements["min-lease-time"]));
$f->add(new TrFormElement(_T("Default lease time"), new NumericInputTpl("default-lease-time"), array("tooltip" => _T("Lengh in seconds that will be assigned to a lease if the client requesting the lease does not ask for a specific expiration time."))), array("value" => $statements["default-lease-time"]));
$f->add(new TrFormElement(_T("Maximum lease time"), new NumericInputTpl("max-lease-time"), array("tooltip" => _T("Maximum length in seconds that will be assigned to a lease."))), array("value" => $statements["max-lease-time"]));
$f->pop();
$f->push(new Table());
$f->add(new TrFormElement(_T("Dynamic pool(s) for non-registered DHCP clients", "network"), new CheckboxTpl("hassubnetpools")), array("value" => $hasSubnetPools, "extraArg" => 'onclick="toggleVisibility(\'poolsdiv\');"'));
$f->pop();
$poolsdiv = new Div(array("id" => "poolsdiv"));
$poolsdiv->setVisibility($hasSubnetPools);
$f->push($poolsdiv);
$f->push(new Table());
$f->add(new TrFormElement(_T("Dynamic pools"), new MultipleRangeInputTpl("subnetpools")), array("value" => $poolsRanges));
$f->pop();
// pop table
$f->pop();
// pop div
$f->pop();
// pop the form
if ($_GET["action"] == "subnetadd") {
    $f->addButton("badd", _("Create"));
} else {
    $f->addButton("bedit", _("Confirm"));
}
Exemplo n.º 28
0
 foreach ($inventory as $disk => $parts) {
     $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="jQuery(\'' . $divid . '\').toggle();"'));
     $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 = "";
             unset($part["exclude"]);
         } else {
Exemplo n.º 29
0
$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();
    $sourcesVals = array();
Exemplo n.º 30
0
 function begin()
 {
     print parent::begin();
     print "<h3>" . $this->title . "</h3>";
 }