Ejemplo n.º 1
0
 public function init()
 {
     $name = $this->createElement('text', 'name');
     $name->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setRequired(true)->setLabel('Name')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($name);
     $hostname = $this->createElement('text', 'hostname');
     $hostname->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setRequired(true)->setLabel('Hostname')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($hostname);
     $switchtype = $this->createElement('select', 'switchtype');
     $switchtype->setMultiOptions(\Entities\Switcher::$TYPES)->setAttrib('class', 'span3 chzn-select')->setRegisterInArrayValidator(true)->addValidator('greaterThan', true, array(0))->setLabel('Type')->setErrorMessages(array('Please set the switch type'));
     $this->addElement($switchtype);
     $this->addElement(IXP_Form_Cabinet::getPopulatedSelect('cabinetid'));
     $infrastructure = IXP_Form_Infrastructure::getPopulatedSelect('infrastructure');
     $this->addElement($infrastructure);
     $snmppasswd = $this->createElement('text', 'snmppasswd');
     $snmppasswd->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setAttrib('class', 'span3')->setLabel('SNMP Community')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($snmppasswd);
     $active = $this->createElement('checkbox', 'active');
     $active->setLabel('Active?')->setCheckedValue('1')->setUncheckedValue('0')->setValue('1');
     $this->addElement($active);
     $this->addElement(self::createSubmitElement('submit', _('Next')));
     $this->addElement($this->createCancelElement('cancel', OSS_Utils::genUrl('switch', 'list')));
     $manualAdd = new OSS_Form_Element_Buttonlink('manualAdd');
     $manualAdd->setAttrib('href', OSS_Utils::genUrl('switch', 'add'))->setAttrib('label', _('Manual / Non-SNMP Add'));
     $this->addElement($manualAdd);
 }
Ejemplo n.º 2
0
 public function init()
 {
     $name = $this->createElement('text', 'name');
     $name->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setRequired(true)->setLabel('Name')->setAttrib('class', 'span3')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($name);
     $number = $this->createElement('text', 'number');
     $number->addValidator('int')->addValidator('between', false, array(1, 4096))->setRequired(true)->setLabel('Tag')->setAttrib('class', 'span3')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($number);
     $infrastructure = IXP_Form_Infrastructure::getPopulatedSelect('infrastructure')->setRequired(true);
     $infrastructure->addValidator('between', false, array(1, $infrastructure->getAttrib('data-maxId')))->setAttrib('class', 'chzn-select');
     $this->addElement($infrastructure);
     $rcvrfname = $this->createElement('text', 'rcvrfname');
     $rcvrfname->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setLabel('RC VRF Name')->addFilter('StringTrim')->setAttrib('class', 'span3')->addFilter(new OSS_Filter_StripSlashes());
     $this->addElement($rcvrfname);
     $private = $this->createElement('checkbox', 'private');
     $private->setLabel('Private VLAN between a subset of members')->setCheckedValue('1');
     $this->addElement($private);
     $peering_matrix = $this->createElement('checkbox', 'peering_matrix');
     $peering_matrix->setLabel('Include VLAN in the peering matrix (see notes below)')->setCheckedValue('1');
     $this->addElement($peering_matrix);
     $peering_manager = $this->createElement('checkbox', 'peering_manager');
     $peering_manager->setLabel('Include VLAN in the peering manager (see notes below)')->setCheckedValue('1');
     $this->addElement($peering_manager);
     $notes = $this->createElement('textarea', 'notes');
     $notes->setLabel('Notes')->setRequired(false)->addFilter(new OSS_Filter_StripSlashes())->setAttrib('cols', 60)->setAttrib('class', 'span3')->setAttrib('rows', 5);
     $this->addElement($notes);
     $this->addElement(self::createSubmitElement('submit', _('Add')));
     $this->addElement($this->createCancelElement());
 }