Пример #1
0
    function display($arrParam)
    {
        parent::display($arrParam);
        $zone = $arrParam["zone"];
        $ajaxurl = $arrParam["ajaxurl"];
        if (empty($arrParam["subnet"])) {
            $subnet = '';
        } else {
            $subnet = $arrParam["subnet"];
        }
        print '

<script type="text/javascript">

function setZoneFreeAddress(t) {
    $("ipaddress").value = t.responseText;
    if (! ($("ipaddress").validate()) ) $("ipaddress").value = "";
    new Effect.Highlight("ipaddress",
    { duration: 1.0 });
}

</script>

<input type="button" class="btnPrimary" onclick="new Ajax.Request(\'main.php?module=network&submod=network&action=' . $ajaxurl . '\', {method: \'get\', parameters: \'zone=' . $zone . '&subnet=' . $subnet . '&current=\' + $F(\'ipaddress\'), onSuccess:setZoneFreeAddress});" value="' . _T("Get next free IP address") . '">
';
    }
Пример #2
0
 function display($arrParam = array())
 {
     list($start, $end) = $this->parseParams($arrParam);
     print '<p ';
     displayErrorCss($this->name . '_start');
     print '>' . _T('Start : ');
     $pool_elem = new HiddenTpl($this->name);
     $pool_elem->display(array('value' => $arrParam['value'], 'hide' => True));
     $start_elem = new IPInputTpl($this->name . '_start');
     $start_elem->display(array('value' => $start, 'onchange' => 'updateRange(this);'));
     print '&nbsp;' . _T('End : ');
     $end_elem = new IPInputTpl($this->name . '_end');
     $end_elem->display(array('value' => $end, 'onchange' => 'updateRange(this);'));
     print '<button type="button" class="btn btn-small" onclick="delRange(this); return false;">' . _('Delete') . '</button>';
     print '</p>';
 }
Пример #3
0
    function display($arrParam) {
	//print '<div id="div'.$this->name.'">';
        //print '<table cellspacing="0">';
        $i = 0;

        foreach (array("start"=>_T('IP range start: ',"network"),
    		       "end"=>_T('IP range end: ',"network")
    		       ) as $elemName=>$elemText) {
    	    $elem = new IPInputTpl($this->name."_".$elemName);
    	    $elem->setSize(12);
	    if (!isset($arrParam["value"][$elemName]))
		$arrParam["value"][$elemName]="";


	    print $elemText;
	    print "&nbsp;";
            $elem->display(array('value'=>$arrParam["value"][$elemName], 'onchange'=>'
                var elem = document.getElementById("'.$this->name.'");
                var range = elem.value;
                var part = '.$i.';
                var value = document.getElementById("'.$this->name.'_'.$elemName.'").value;
                var newrange = changeRangePart(range, part, value);
                elem.value = newrange;
            '));
            print "&nbsp;&nbsp;";
            $i += 1;
        }

        print '<input name="'.$this->name.'" id="'.$this->name.'" type="hidden" value="'.$this->stringValue($arrParam["value"]).'"/>';
        //print '</table>';
        //print '</div>';

        print '<script type="text/javascript">
                function changeRangePart(range, part, value) {
                    var re = new RegExp(" ", "g");
                    var arange = range.split(re);
                    arange[part] = value;
                    return arange[0] + " " + arange[1];
                }
               </script>';

    }