Beispiel #1
0
    function createUiContainers(){
	$t = new Table();
	$t->add($this->_createNameElement(_T("Zone name"),false),
		array("value" => $this->hostname, "required" => True));
	$t->add(new TrFormElement(	_T("Name server"), 
					new InputTpl($this->pn("dnsserver")), 
					$this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN)
					),
		array("value" => $this->values["dnsserver"], "required" => True));
	$t->add(new TrFormElement(	_T("Responsible person e-mail"), 
					new InputTpl($this->pn("mail")),
					$this->_dnRulesTooltip(AllowedDn::RELATIVE|AllowedDn::FQDN)
					),
		array("value"=>$this->values["mail"], "required" => True));
	$t->add(new TrFormElement(_T("Time interval before the zone should be refreshed"), new BindRemainingTimeTpl($this->pn("refresh"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["refresh"])));
	$t->add(new TrFormElement(_T("Time interval that should elapse before a failed refresh should be retried"), new BindRemainingTimeTpl($this->pn("retry"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["retry"])));
	$t->add(new TrFormElement(_T("Expiry time"), new BindRemainingTimeTpl($this->pn("expiry"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["expiry"])));
	$t->add(new TrFormElement(_T("Minimum TTL"), new BindRemainingTimeTpl($this->pn("minttl"))),
		array("value"=>BindRemainingTimeTpl::valueFromBindTimeString($this->values["minttl"])));
	$t->add(new TrFormElement(_T("Serial number"), new HiddenTpl($this->pn("serial"))),
		array("value"=>$this->values["serial"], "required" => True));
	return array($this->stackedUi($t));
    }
Beispiel #2
0
 static function descriptionForBindTimeString($str)
 {
     $result = "";
     $val = BindRemainingTimeTpl::valueFromBindTimeString($str);
     $weeks = intval($val["days"] / 7);
     if ($weeks) {
         $result .= $weeks . " " . _T("week(s)") . " ";
     }
     $days = intval($val["days"] % 7);
     if ($days) {
         $result .= $days . " " . _T("day(s)") . " ";
     }
     if ($val["hours"]) {
         $result .= $val["hours"] . " " . _T("hr") . " ";
     }
     if ($val["minutes"]) {
         $result .= $val["minutes"] . " " . _T("min") . " ";
     }
     if ($val["seconds"]) {
         $result .= $val["seconds"] . " " . _T("sec") . " ";
     }
     return rtrim($result);
 }
Beispiel #3
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));
	
    }