summaryrefslogtreecommitdiffstats
path: root/application/modules/dev/forms/BootmenuEntriesAdd.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/dev/forms/BootmenuEntriesAdd.php')
-rw-r--r--application/modules/dev/forms/BootmenuEntriesAdd.php272
1 files changed, 135 insertions, 137 deletions
diff --git a/application/modules/dev/forms/BootmenuEntriesAdd.php b/application/modules/dev/forms/BootmenuEntriesAdd.php
index 9b17c3a..0d33916 100644
--- a/application/modules/dev/forms/BootmenuEntriesAdd.php
+++ b/application/modules/dev/forms/BootmenuEntriesAdd.php
@@ -1,147 +1,145 @@
-<?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 dev_Form_BootmenuEntriesAdd extends Zend_Form
-{
- private $bootoslist;
- private $configlist;
- private $maxorder;
-
- public function setBootoslist($bootoslist){
- $this->bootoslist = $bootoslist;
+* 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 dev_Form_BootmenuEntriesAdd extends Zend_Form {
+ private $bootoslist;
+ private $configlist;
+ private $maxorder;
+
+ 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;
}
-
- public function setMaxorder($maxorder){
- $this->maxorder = $maxorder;
-
+
+ $this->setName("BootMenuEntryAdd");
+ $this->setMethod('post');
+
+ $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()
+
+ ));
}
-
- public function setConfiglist($configlist){
- $this->configlist = $configlist;
-
+
+ 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()); }
+ }
}
-
-
- public function init()
- {
-
- if(!isset($_POST['bootosID'])){
- $firstbootos = array_slice($this->bootoslist,0,1);
- $_POST['bootosID'] = $firstbootos[0]->getID();
- $_POST['kclactive'] = true;
- }
-
- $this->setName("BootMenuEntryAdd");
- $this->setMethod('post');
-
- $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);
-
- $this->addElement('submit', 'addbootmenuentry', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Add Bootmenuentry',
- ));
-
- $this->addElement('button', 'Cancel', array(
- 'onclick' => 'self.location="/dev/bootmenu"'
- ));
+ $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);
+
+ $this->addElement('submit', 'addbootmenuentry', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Add Bootmenuentry',
+ ));
+
+ $this->addElement('button', 'Cancel', array(
+ 'onclick' => 'self.location="/dev/bootmenu"'
+ ));
+
+ }
+
+
}