public function init() { $this->setDecorators([['ViewScript', ['viewScript' => 'virtual-interface/forms/virtual-interface.phtml']]]); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $this->getElement('custid')->setAttrib('class', 'chzn-select span8'); $name = $this->createElement('text', 'name'); $name->addValidator('stringLength', false, array(0, 255, 'UTF-8'))->setRequired(false)->setLabel('Virtual Interface Name')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($name); $descr = $this->createElement('text', 'description'); $descr->setLabel('Description')->addValidator('stringLength', false, array(0, 255, 'UTF-8'))->setRequired(false)->addFilter(new OSS_Filter_StripSlashes())->addFilter('StringTrim'); $this->addElement($descr); $channel = $this->createElement('text', 'channelgroup'); $channel->addValidator('int')->setLabel('Channel Group Number')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($channel); $mtu = $this->createElement('text', 'mtu'); $mtu->addValidator('int')->setLabel('MTU')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($mtu); $trunk = $this->createElement('checkbox', 'trunk'); $trunk->setLabel('Is 802.1q Trunk?')->setCheckedValue('1'); $this->addElement($trunk); $this->addDisplayGroup(['custid', 'name', 'description', 'channelgroup', 'mtu', 'trunk'], 'virtualInterfaceDisplayGroup'); $this->getDisplayGroup('virtualInterfaceDisplayGroup')->setLegend('Customer Connection Details'); $this->addElement(self::createSubmitElement('submit', _('Add'))); $this->addElement($this->createCancelElement()); }
public function init() { $description = $this->createElement('text', 'description'); $description->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setRequired(true)->setAttrib('class', 'span3')->setLabel('Description')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($description); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $this->addElement(IXP_Form_Switch::getPopulatedSelect('switchid', \Entities\Switcher::TYPE_CONSOLESERVER)); $port = $this->createElement('text', 'port'); $port->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setRequired(true)->setLabel('Port')->setAttrib('class', 'span3')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($port); $speed = $this->createElement('text', 'speed'); $speed->addValidator('int')->setLabel('Speed')->addFilter('StringTrim')->setAttrib('class', 'span3')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($speed); $parity = $this->createElement('text', 'parity'); $parity->addValidator('int')->setLabel('Parity')->setAttrib('class', 'span3')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($parity); $stopbits = $this->createElement('text', 'stopbits'); $stopbits->addValidator('int')->setLabel('Stopbits')->setAttrib('class', 'span3')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($stopbits); $flowcontrol = $this->createElement('text', 'flowcontrol'); $flowcontrol->addValidator('int')->setLabel('Flow Control')->setAttrib('class', 'span3')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($flowcontrol); $autobaud = $this->createElement('text', 'autobaud'); $autobaud->addValidator('int')->setAttrib('class', 'span3')->setLabel('Autobaud')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($autobaud); $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()); }
public function init() { //////////////////////////////////////////////// // Create and configure elements //////////////////////////////////////////////// // let's capture the user's name and add them to the contact table also $name = $this->createElement('text', 'name'); $name->addValidator('stringLength', false, array(2, 64, 'UTF-8'))->setRequired(true)->setAttrib('size', 50)->setAttrib('class', 'span3')->setLabel('Name')->addFilter('StringTrim')->addFilter('StripTags')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($name); $username = OSS_Form_Auth::createUsernameElement(); $username->addValidator('stringLength', false, array(2, 30, 'UTF-8'))->addValidator('regex', true, array('/^[a-zA-Z0-9\\-_\\.]+$/')); $this->addElement($username); $password = $this->createElement('text', 'password'); $password->addValidator('stringLength', false, array(8, 30, 'UTF-8'))->setRequired(true)->setAttrib('class', 'span3')->setLabel('Password')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($password); $privileges = $this->createElement('select', 'privs'); $privileges->setMultiOptions(\Entities\User::$PRIVILEGES_TEXT)->setRegisterInArrayValidator(true)->setLabel('Privileges')->setAttrib('class', 'span3 chzn-select')->setErrorMessages(array('Please select the users privilege level')); $this->addElement($privileges); $this->addElement(OSS_Form_User::createEmailElement()); $this->addElement(self::createMobileElement('authorisedMobile')); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $disabled = $this->createElement('checkbox', 'disabled'); $disabled->setLabel('Disabled?')->setCheckedValue('1'); $this->addElement($disabled); $this->addElement(self::createSubmitElement('submit', _('Add'))); $this->addElement($this->createCancelElement()); }
public function init() { $this->setDecorators([['ViewScript', ['viewScript' => 'contact/forms/edit.phtml']]]); $name = $this->createElement('text', 'name'); $name->addValidator('stringLength', false, array(1, 255, 'UTF-8'))->setRequired(true)->setLabel('Name')->addFilter('StringTrim')->addFilter('StripTags')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($name); $position = $this->createElement('text', 'position'); $position->addValidator('stringLength', false, array(1, 50, 'UTF-8'))->setRequired(false)->setLabel('Position')->addFilter('StringTrim')->addFilter('StripTags')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($position); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $this->getElement('custid')->setAttrib('class', "chzn-select"); $this->addElement(OSS_Form_User::createEmailElement('email')); $this->getElement('email')->setRequired(false)->setAttrib('class', ""); $phone = $this->createElement('text', 'phone'); $phone->addValidator('stringLength', false, array(1, 32, 'UTF-8'))->setLabel(_('Phone'))->addFilter('StringTrim')->addFilter('StripTags')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($phone); $mobile = $this->createElement('text', 'mobile'); $mobile->addValidator('stringLength', false, array(1, 32, 'UTF-8'))->setLabel(_('Mobile'))->addFilter('StringTrim')->addFilter('StripTags')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($mobile); $notes = $this->createElement('textarea', 'notes'); $notes->setLabel('Notes')->setRequired(false)->setAttrib('style', 'width: 80%;')->addFilter(new OSS_Filter_StripSlashes())->addFilter('StripTags')->setAttrib('cols', 60)->setAttrib('rows', 5); $this->addElement($notes); $facilityaccess = $this->createElement('checkbox', 'facilityaccess'); $facilityaccess->setLabel('Facility Access')->addValidator('InArray', false, array(array(0, 1)))->addFilter('Int')->setValue(1); $this->addElement($facilityaccess); $mayauthorize = $this->createElement('checkbox', 'mayauthorize'); $mayauthorize->setLabel('May Authorize')->addValidator('InArray', false, array(array(0, 1)))->addFilter('Int')->setValue(1); $this->addElement($mayauthorize); $this->addElement(self::createSubmitElement('submit', _('Add'))); $this->addElement($this->createCancelElement()); $role = $this->createElement('hidden', 'role'); $role->setRequired(false); $this->addElement($role); $group = $this->createElement('hidden', 'group'); $group->setRequired(false); $this->addElement($group); $login = $this->createElement('checkbox', 'login'); $login->setLabel('can login to portal')->addValidator('InArray', false, array(array(0, 1)))->addFilter('Int'); $this->addElement($login); $username = OSS_Form_Auth::createUsernameElement(); $username->addValidator('stringLength', false, array(2, 30, 'UTF-8'))->addValidator('regex', true, array('/^[a-zA-Z0-9\\-_\\.]+$/'))->setRequired(false)->setAttrib('class', ''); $this->addElement($username); $password = $this->createElement('text', 'password'); $password->addValidator('stringLength', false, array(8, 30, 'UTF-8'))->setRequired(false)->setLabel('Password')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($password); $privileges = $this->createElement('select', 'privs'); $privileges->setMultiOptions(\Entities\User::$PRIVILEGES_TEXT)->setRegisterInArrayValidator(true)->setRequired(false)->setLabel('Privileges')->setAttrib('class', 'chzn-select')->setAttrib('chzn-fix-width', '1')->setErrorMessages(array('Please select the users privilege level')); $this->addElement($privileges); $disabled = $this->createElement('checkbox', 'disabled'); $disabled->setLabel('Disabled?')->addValidator('InArray', false, array(array(0, 1)))->addFilter('Int'); $this->addElement($disabled); }
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); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $this->addElement(IXP_Form_Cabinet::getPopulatedSelect('cabinetid')); $descr = $this->createElement('textarea', 'descr'); $descr->setLabel(_('Description'))->setRequired(false)->addFilter(new OSS_Filter_StripSlashes())->setAttrib('cols', 60)->setAttrib('class', 'span3')->setAttrib('rows', 5); $this->addElement($descr); $this->addElement(self::createSubmitElement('submit', _('Add'))); $this->addElement($this->createCancelElement()); }
/** * * @param IXP_Form_Customer $form The Send form object * @param \Entities\Customer $object The Doctrine2 entity (being edited or blank for add) * @param bool $isEdit True if we are editing, otherwise false * @return bool If false, the form is not processed */ protected function addPreFlush($form, $object, $isEdit) { if (!$object->getDatejoin() instanceof DateTime) { $object->setDatejoin(new DateTime($form->getValue('datejoin'))); } if (!$object->getDateleave() instanceof DateTime) { if (!$form->getValue('dateleave')) { $object->setDateleave(null); } else { $object->setDateleave(new DateTime($form->getValue('dateleave'))); } } return true; }
public function init() { $this->setDecorators([['ViewScript', ['viewScript' => 'virtual-interface/forms/add-wizard.phtml']]]); $this->addElement(IXP_Form_Customer::getPopulatedSelect('custid')); $this->getElement('custid')->setAttrib('class', 'chzn-select span12'); //////////////////////////////////////////////////////////////////////////////////////////////////// // VIRTUAL INTERFACE DETAILS $name = $this->createElement('text', 'name'); $name->addValidator('stringLength', false, array(0, 255, 'UTF-8'))->setRequired(false)->setLabel('Virtual Interface Name')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($name); $descr = $this->createElement('text', 'description'); $descr->setLabel('Description')->addValidator('stringLength', false, array(0, 255, 'UTF-8'))->setRequired(false)->addFilter(new OSS_Filter_StripSlashes())->addFilter('StringTrim'); $this->addElement($descr); $channel = $this->createElement('text', 'channelgroup'); $channel->addValidator('int')->setLabel('Channel Group Number')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($channel); $mtu = $this->createElement('text', 'mtu'); $mtu->addValidator('int')->setLabel('MTU')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($mtu); $trunk = $this->createElement('checkbox', 'trunk'); $trunk->setLabel('Is 802.1q Trunk?')->setCheckedValue('1'); $this->addElement($trunk); $this->addDisplayGroup(array('name', 'description', 'channelgroup', 'mtu', 'trunk'), 'virtualInterfaceDisplayGroup'); $this->getDisplayGroup('virtualInterfaceDisplayGroup')->setLegend('Virtual Interface Details'); ///////////////////////////////////////////////////////////////////////////////////////////////////// // PHYSICAL INTERFACE DETAILS $this->addElement(IXP_Form_Switch::getPopulatedSelect('switchid')); $this->getElement('switchid')->setAttrib('class', 'chzn-select span12'); $switchPorts = $this->createElement('select', 'switchportid'); $switchPorts->setRequired(true)->setRegisterInArrayValidator(false)->setLabel('Port')->setAttrib('class', 'chzn-select span12')->addValidator('greaterThan', false, array('min' => 1))->setErrorMessages(array('Please select a switch port')); $this->addElement($switchPorts); $status = $this->createElement('select', 'status'); $status->setMultiOptions(\Entities\PhysicalInterface::$STATES)->setRegisterInArrayValidator(true)->setAttrib('class', 'chzn-select span12')->setLabel('Status')->setErrorMessages(array('Please set the status')); $this->addElement($status); $speed = $this->createElement('select', 'speed'); $speed->setMultiOptions(\Entities\PhysicalInterface::$SPEED)->setRegisterInArrayValidator(true)->setAttrib('class', 'chzn-select span12')->setLabel('Speed')->setErrorMessages(array('Please set the speed')); $this->addElement($speed); $duplex = $this->createElement('select', 'duplex'); $duplex->setMultiOptions(\Entities\PhysicalInterface::$DUPLEX)->setRegisterInArrayValidator(true)->setAttrib('class', 'chzn-select span12')->setLabel('Duplex')->setErrorMessages(array('Please set the duplex')); $this->addElement($duplex); $this->addDisplayGroup(['switchid', 'switchportid', 'status', 'speed', 'duplex'], 'physicalInterfaceDisplayGroup'); $this->getDisplayGroup('physicalInterfaceDisplayGroup')->setLegend('Physical Interface Details'); ////////////////////////////////////////////////////////////////////////// // VLAN INTERFACE DETAILS $this->addElement(IXP_Form_Vlan::getPopulatedSelect('vlanid')); $this->getElement('vlanid')->setAttrib('class', 'chzn-select span12'); $ipv4enabled = $this->createElement('checkbox', 'ipv4enabled'); $ipv4enabled->setLabel('IPv4 Enabled')->setCheckedValue('1'); $this->addElement($ipv4enabled); $ipv4addressid = new OSS_Form_Element_DatabaseDropdown('ipv4addressid'); $ipv4addressid->setRequired(false)->setChosenOptions(["0" => ""])->setLabel('IPv4 Address')->addFilter('StringTrim')->setErrorMessages(array('Please select or enter a IPv4 address')); $this->addElement($ipv4addressid); $ipv4hostname = $this->createElement('text', 'ipv4hostname'); $ipv4hostname->addValidator('stringLength', false, array(1, 64, 'UTF-8'))->addValidator('hostname', false, ['allow' => Zend_Validate_Hostname::ALLOW_DNS])->setLabel('IPv4 Hostname')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($ipv4hostname); $ipv4bgpmd5secret = $this->createElement('text', 'ipv4bgpmd5secret'); $ipv4bgpmd5secret->addValidator('stringLength', false, array(1, 64, 'UTF-8'))->setLabel('IPv4 BGP MD5 Secret')->setAttrib('class', 'span10')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($ipv4bgpmd5secret); $ipv4canping = $this->createElement('checkbox', 'ipv4canping'); $ipv4canping->setLabel('IPv4 Can Ping')->setCheckedValue('1'); $this->addElement($ipv4canping); $ipv4monitorrcbgp = $this->createElement('checkbox', 'ipv4monitorrcbgp'); $ipv4monitorrcbgp->setLabel('IPv4 Monitor RC BGP')->setCheckedValue('1'); $this->addElement($ipv4monitorrcbgp); $this->addDisplayGroup(['ipv4addressid', 'ipv4hostname', 'ipv4bgpmd5secret', 'ipv4canping', 'ipv4monitorrcbgp'], 'ipv4DisplayGroup'); $this->getDisplayGroup('ipv4DisplayGroup')->setLegend('IPv4 Details'); $ipv6enabled = $this->createElement('checkbox', 'ipv6enabled'); $ipv6enabled->setLabel('IPv6 Enabled')->setCheckedValue('1'); $this->addElement($ipv6enabled); $ipv6addressid = new OSS_Form_Element_DatabaseDropdown('ipv6addressid'); $ipv6addressid->setRequired(false)->setLabel('IPv6 Address')->setChosenOptions(["0" => ""])->addFilter('StringTrim')->setErrorMessages(array('Please select or enter a IPv6 address')); $this->addElement($ipv6addressid); $ipv6hostname = $this->createElement('text', 'ipv6hostname'); $ipv6hostname->addValidator('stringLength', false, array(1, 64, 'UTF-8'))->addValidator('hostname', false, ['allow' => Zend_Validate_Hostname::ALLOW_DNS])->setLabel('IPv6 Hostname')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($ipv6hostname); $ipv6bgpmd5secret = $this->createElement('text', 'ipv6bgpmd5secret'); $ipv6bgpmd5secret->addValidator('stringLength', false, array(1, 64, 'UTF-8'))->setLabel('IPv6 BGP MD5 Secret')->setAttrib('class', 'span10')->addFilter('StringTrim')->addFilter(new OSS_Filter_StripSlashes()); $this->addElement($ipv6bgpmd5secret); $ipv6canping = $this->createElement('checkbox', 'ipv6canping'); $ipv6canping->setLabel('IPv6 Can Ping')->setCheckedValue('1'); $this->addElement($ipv6canping); $ipv6monitorrcbgp = $this->createElement('checkbox', 'ipv6monitorrcbgp'); $ipv6monitorrcbgp->setLabel('IPv6 Monitor RC BGP')->setCheckedValue('1'); $this->addElement($ipv6monitorrcbgp); $this->addDisplayGroup(['ipv6addressid', 'ipv6hostname', 'ipv6bgpmd5secret', 'ipv6canping', 'ipv6monitorrcbgp'], 'ipv6DisplayGroup'); $this->getDisplayGroup('ipv6DisplayGroup')->setLegend('IPv6 Details'); $irrdbfilter = $this->createElement('checkbox', 'irrdbfilter'); $irrdbfilter->setLabel('Apply IRRDB Filtering')->setValue('1')->setCheckedValue('1'); $this->addElement($irrdbfilter); $mcastenabled = $this->createElement('checkbox', 'mcastenabled'); $mcastenabled->setLabel('Multicast Enabled')->setCheckedValue('1'); $this->addElement($mcastenabled); $maxbgpprefix = $this->createElement('text', 'maxbgpprefix'); $maxbgpprefix->addValidator('int')->addValidator('greaterThan', false, array(-1))->setRequired(false)->setLabel('Max BGP Prefixes'); $this->addElement($maxbgpprefix); $rsclient = $this->createElement('checkbox', 'rsclient'); $rsclient->setLabel('Route Server Client')->setCheckedValue('1'); $this->addElement($rsclient); $as112client = $this->createElement('checkbox', 'as112client'); $as112client->setLabel('AS112 Client')->setCheckedValue('1'); $this->addElement($as112client); $busyhost = $this->createElement('checkbox', 'busyhost'); $busyhost->setLabel('Busy host')->setCheckedValue('1'); $this->addElement($busyhost); $this->addDisplayGroup(['irrdbfilter', 'mcastenabled', 'maxbgpprefix', 'rsclient', 'as112client', 'busyhost'], 'vlanInterfaceDisplayGroup'); $this->getDisplayGroup('vlanInterfaceDisplayGroup')->setLegend('Other VLAN Interface Settings'); $this->addElement(self::createSubmitElement('submit', _('Add'))); $this->addElement($this->createCancelElement()); $preselectIPv4Address = $this->createElement('hidden', 'preselectIPv4Address'); $this->addElement($preselectIPv4Address); $preselectIPv6Address = $this->createElement('hidden', 'preselectIPv6Address'); $this->addElement($preselectIPv6Address); $preselectVlanInterface = $this->createElement('hidden', 'preselectVlanInterface'); $this->addElement($preselectVlanInterface); $preselectSwitchPort = $this->createElement('hidden', 'preselectSwitchPort'); $this->addElement($preselectSwitchPort); $preselectPhysicalInterface = $this->createElement('hidden', 'preselectPhysicalInterface'); $this->addElement($preselectPhysicalInterface); }