diff options
Diffstat (limited to 'application/modules/user/forms/BootmenuEntries.php')
| -rw-r--r-- | application/modules/user/forms/BootmenuEntries.php | 328 |
1 files changed, 163 insertions, 165 deletions
diff --git a/application/modules/user/forms/BootmenuEntries.php b/application/modules/user/forms/BootmenuEntries.php index 93e3206..8c92cb1 100644 --- a/application/modules/user/forms/BootmenuEntries.php +++ b/application/modules/user/forms/BootmenuEntries.php @@ -1,176 +1,174 @@ -<?php +<? php /* * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg - * This program is free software distributed under the GPL version 2. - * See http://gpl.openslx.org/ - * - * If you have any feedback please consult http://feedback.openslx.org/ and - * send your suggestions, praise, or complaints to feedback@openslx.org - * - * General information about OpenSLX can be found at http://openslx.org/ - */ - -class user_Form_BootmenuEntries extends Zend_Form -{ - private $bootoslist; - private $bootosanzeige; - private $configlist; - private $maxorder; - private $action; - private $page; - private $type; - - public function setAction($action){ - $this->action = $action; - - } +* This program is free software distributed under the GPL version 2. +* See http://gpl.openslx.org/ +* +* If you have any feedback please consult http://feedback.openslx.org/ and +* send your suggestions, praise, or complaints to feedback@openslx.org +* +* General information about OpenSLX can be found at http://openslx.org/ +*/ + +class user_Form_BootmenuEntries extends Zend_Form { + private $bootoslist; + private $bootosanzeige; + private $configlist; + private $maxorder; + private $action; + private $page; + private $type; + + public function setAction($action) { + $this->action = $action; + + } + + public function setBootoslist($bootoslist) { + $this->bootoslist = $bootoslist; + } + public function setBootosanzeige($bootosanzeige) { + $this->bootosanzeige = $bootosanzeige; + } + + public function setMaxorder($maxorder) { + $this->maxorder = $maxorder; + + } + + public function setConfiglist($configlist) { + $this->configlist = $configlist; + } + + public function setType($type) { + $this->type = $type; + } + + public function setPage($page) { + $this->page = $page; + } + + + public function init() { + + if(!isset($_POST['bootosID'])) { + list($key) = array_keys($this->bootoslist); + $firstbootos = $this->bootoslist[$key]; + $_POST['bootosID'] = $firstbootos->getID(); - public function setBootoslist($bootoslist){ - $this->bootoslist = $bootoslist; - } - public function setBootosanzeige($bootosanzeige){ - $this->bootosanzeige = $bootosanzeige; } - - public function setMaxorder($maxorder){ - $this->maxorder = $maxorder; - + + $this->setName($this->action); + $this->setMethod('post'); + + if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenuentry') + { $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('".$this->action."').submit();"); + $bootosfield->setAttrib('readOnly', $meta); + $bootosfield->addMultiOptions($this->bootosanzeige); + $bootosfield->setRegisterInArrayValidator(false); + $this->addElement($bootosfield); + + $kclactive = $this->createElement('checkbox', 'kcl'); + $kclactive->setAttrib('onChange', "document.getElementById('".$this->action."').submit();"); + $kclactive->setLabel('Use default KCL:'); + $kclactive->setValue($_POST['kcl']); + $this->addElement($kclactive); + + + if($_POST['kcl']) { + $this->addElement('textarea', 'defaultkcl', 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() + + )); } - - public function setConfiglist($configlist){ - $this->configlist = $configlist; + + if($_POST['kcl']) + { $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:', + 'readOnly' => $meta, + 'description' => 'Chars left: ' . $kcllength + )); + + $configfield = $this->createElement('select', 'configID'); + $configfield->setLabel('Config:'); + $configfield->setAttrib('readOnly', $meta); + + $options = array('Preset' => array(), 'Custom' => array()); + + if(count($this->configlist) > 0) { + foreach($this->configlist as $k => $v) { + foreach($v[$_POST['bootosID']] as $c) + $options[$k][$c->getID()] = $c->getTitle(); + } } - - public function setType($type){ - $this->type = $type; - } - - public function setPage($page){ - $this->page = $page; - } - - - public function init() - { - - if(!isset($_POST['bootosID'])){ - list($key) = array_keys($this->bootoslist); - $firstbootos = $this->bootoslist[$key]; - $_POST['bootosID'] = $firstbootos->getID(); - - } - - $this->setName($this->action); - $this->setMethod('post'); - - if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenuentry') - $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('".$this->action."').submit();"); - $bootosfield->setAttrib('readOnly', $meta); - $bootosfield->addMultiOptions($this->bootosanzeige); - $bootosfield->setRegisterInArrayValidator(false); - $this->addElement($bootosfield); - - $kclactive = $this->createElement('checkbox','kcl'); - $kclactive->setAttrib('onChange', "document.getElementById('".$this->action."').submit();"); - $kclactive->setLabel('Use default KCL:'); - $kclactive->setValue($_POST['kcl']); - $this->addElement($kclactive); - - - if($_POST['kcl']){ - $this->addElement('textarea', 'defaultkcl', 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['kcl']) - $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:', - 'readOnly' => $meta, - 'description' => 'Chars left: ' . $kcllength - )); - - $configfield = $this->createElement('select','configID'); - $configfield->setLabel('Config:'); - $configfield->setAttrib('readOnly', $meta); - - $options = array('Preset' => array(), 'Custom' => array()); - - if(count($this->configlist)>0){ - foreach($this->configlist as $k => $v){ - foreach($v[$_POST['bootosID']] as $c) - $options[$k][$c->getID()] = $c->getTitle(); - } - } - $configfield->addMultiOptions($options); - $configfield->setRegisterInArrayValidator(false); - $this->addElement($configfield); - - $orderfield = $this->createElement('select','order'); - $orderfield ->setLabel('Position:'); - $orderfield->setAttrib('readOnly', $meta); - - for ($i = 0; $i <= $this->maxorder; $i++) { - $orderfield->addMultiOption($i, $i+1); - } - $orderfield->setRegisterInArrayValidator(false); - $this->addElement($orderfield); - - - if($this->action == "addbootmenuentry") - $label = "Add 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/index/type/'.$this->type.'/page/'.$this->page.'"' - )); + $configfield->addMultiOptions($options); + $configfield->setRegisterInArrayValidator(false); + $this->addElement($configfield); + $orderfield = $this->createElement('select', 'order'); + $orderfield ->setLabel('Position:'); + $orderfield->setAttrib('readOnly', $meta); + + for ($i = 0; $i <= $this->maxorder; $i++) { + $orderfield->addMultiOption($i, $i + 1); } - - + $orderfield->setRegisterInArrayValidator(false); + $this->addElement($orderfield); + + + if($this->action == "addbootmenuentry") + { $label = "Add 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/index/type/'.$this->type.'/page/'.$this->page.'"' + )); + + } + + } |
