From 2dd4004af95ab7e11813281c19a7e32aa0119e5a Mon Sep 17 00:00:00 2001 From: michael pereira Date: Fri, 1 Apr 2011 13:56:29 +0200 Subject: bootmenu --- application/modules/user/forms/Bootmenu.php | 59 ++++++++ application/modules/user/forms/BootmenuEntries.php | 158 +++++++++++++++++++++ 2 files changed, 217 insertions(+) create mode 100644 application/modules/user/forms/Bootmenu.php create mode 100644 application/modules/user/forms/BootmenuEntries.php (limited to 'application/modules/user/forms') diff --git a/application/modules/user/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php new file mode 100644 index 0000000..67c76d8 --- /dev/null +++ b/application/modules/user/forms/Bootmenu.php @@ -0,0 +1,59 @@ +rights = $rights; + } + public function setAction($action){ + $this->action = $action; + + } + + public function setGrouplist($grouplist){ + $this->grouplist = $grouplist; + + } + + public function init() + { + $this->setName($this->action); + $this->setMethod('post'); + + if ($this->rights == "meta") + $meta = true; + else + $meta = null; + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + if($this->action == "createbootmenu") + $label = "Create Bootmenu"; + else + $label = "Edit Bootmenu"; + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/bootmenu"' + )); + + } + + +} + diff --git a/application/modules/user/forms/BootmenuEntries.php b/application/modules/user/forms/BootmenuEntries.php new file mode 100644 index 0000000..c7463f0 --- /dev/null +++ b/application/modules/user/forms/BootmenuEntries.php @@ -0,0 +1,158 @@ +rights = $rights; + } + public function setAction($action){ + $this->action = $action; + + } + + public function setBootoslist($bootoslist){ + $this->bootoslist = $bootoslist; + } + + public function setMaxorder($maxorder){ + $this->maxorder = $maxorder; + + } + + public function setConfiglist($configlist){ + $this->configlist = $configlist; + + } + + + public function init() + { + + if(!isset($_POST['bootosID'])){ + $firstbootos = array_slice($this->bootoslist,0,1); + $_POST['bootosID'] = $firstbootos[0]->getID(); + $_POST['kclactive'] = true; + } + + $this->setName($this->action); + $this->setMethod('post'); + + if ($this->rights == "meta") + $meta = true; + else + $meta = null; + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $bootosfield = $this->createElement('select','bootosID'); + $bootosfield ->setLabel('BootOs:'); + $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();"); + + if(count($this->bootoslist)>0){ + foreach($this->bootoslist as $bootos => $b){ + $bootosfield->addMultiOption($b->getID(), $b->getTitle()); + } + } + $bootosfield->setRegisterInArrayValidator(false); + + $this->addElement($bootosfield); + + $kclactive = $this->createElement('checkbox','kclactive'); + $kclactive->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();"); + $kclactive->setLabel('Use default KCL:'); + $kclactive->setValue(true); + $this->addElement($kclactive); + + + if($_POST['kclactive']){ + $this->addElement('textarea', 'kcl', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'cols' => 50, + 'rows' => 5, + 'label' => 'KCL:', + 'readOnly' => true, + 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl() + + )); + } + + if($_POST['kclactive']) + $kcllength = 175 - strlen($this->bootoslist[$_POST['bootosID']]->getDefaultkcl()); + else + $kcllength = 175; + + $this->addElement('textarea', 'kclappend', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, $kcllength)), + ), + 'required' => false, + 'cols' => 50, + 'rows' => 5, + 'label' => 'KCL-Append:', + 'description' => 'Chars left: ' . $kcllength + )); + + $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID(); + $configfield = $this->createElement('select','configID'); + $configfield->setLabel('Config:'); + $configfield->addMultiOption($defaultconfigid, 'default'); + + if(count($this->configlist)>0){ + foreach($this->configlist as $config => $c){ + if($c->getID() != $defaultconfigid) + $configfield->addMultiOption($c->getID(), $c->getTitle()); + } + } + + $configfield->setRegisterInArrayValidator(false); + $this->addElement($configfield); + + $orderfield = $this->createElement('select','order'); + $orderfield ->setLabel('Position:'); + + for ($i = 0; $i <= $this->maxorder; $i++) { + $orderfield->addMultiOption($i, $i+1); + } + $orderfield->setRegisterInArrayValidator(false); + $this->addElement($orderfield); + + if($this->action == "createbootmenuentry") + $label = "Create Bootmenuentry"; + else + $label = "Edit Bootmenuentry"; + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/bootmenu"' + )); + + } + + + + +} + -- cgit v1.2.3-55-g7522