summaryrefslogtreecommitdiffstats
path: root/application/forms
diff options
context:
space:
mode:
authorBjörn Geiger2011-03-10 21:48:48 +0100
committerBjörn Geiger2011-03-10 21:48:48 +0100
commitd70f09da9fe5e0eaadde22433761ed696a558fe9 (patch)
tree096476b8074a6cb12da0b05bee1589ab9aa15f8f /application/forms
parentbei Verknüpfungstabellen zusammengesetzter primary key erzeugt, Zend braucht... (diff)
parentMerge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff)
downloadpbs2-d70f09da9fe5e0eaadde22433761ed696a558fe9.tar.gz
pbs2-d70f09da9fe5e0eaadde22433761ed696a558fe9.tar.xz
pbs2-d70f09da9fe5e0eaadde22433761ed696a558fe9.zip
Merge branch 'master' of ssh://git.openslx.org/lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'application/forms')
-rw-r--r--application/forms/BootmenuEntriesAdd.php22
-rw-r--r--application/forms/BootmenuEntriesEdit.php21
-rw-r--r--application/forms/BootosCreate.php2
-rw-r--r--application/forms/BootosEdit.php2
-rw-r--r--application/forms/FilterAdd.php24
-rw-r--r--application/forms/FilterEvaluate.php123
-rw-r--r--application/forms/Session.php71
7 files changed, 220 insertions, 45 deletions
diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php
index 0f2109e..6981619 100644
--- a/application/forms/BootmenuEntriesAdd.php
+++ b/application/forms/BootmenuEntriesAdd.php
@@ -8,7 +8,6 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form
public function setBootoslist($bootoslist){
$this->bootoslist = $bootoslist;
-
}
public function setMaxorder($maxorder){
@@ -21,9 +20,15 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form
}
-
+
public function init()
{
+
+ if(!isset($_POST['bootosID'])){
+ $firstbootos = array_slice($this->bootoslist,0,1);
+ $_POST['bootosID'] = $firstbootos[0]->getID();
+ }
+
$this->setName("BootMenuEntryAdd");
$this->setMethod('post');
@@ -38,6 +43,7 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form
$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){
@@ -45,6 +51,7 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form
}
}
$bootosfield->setRegisterInArrayValidator(false);
+
$this->addElement($bootosfield);
$this->addElement('textarea', 'kcl', array(
@@ -52,21 +59,26 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form
'validators' => array(
array('StringLength', false, array(0, 50)),
),
- 'required' => true,
+ 'required' => false,
'cols' => 50,
'rows' => 5,
'label' => 'KCL:',
+ 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
));
+ $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
$configfield = $this->createElement('select','configID');
- $configfield ->setLabel('Config:');
+ $configfield->setLabel('Config:');
+ $configfield->addMultiOption($defaultconfigid, 'default');
if(count($this->configlist)>0){
foreach($this->configlist as $config => $c){
- $configfield->addMultiOption($c->getID(), $c->getTitle());
+ if($c->getID() != $defaultconfigid)
+ $configfield->addMultiOption($c->getID(), $c->getTitle());
}
}
+
$configfield->setRegisterInArrayValidator(false);
$this->addElement($configfield);
diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php
index 7fd97fe..6dc1aab 100644
--- a/application/forms/BootmenuEntriesEdit.php
+++ b/application/forms/BootmenuEntriesEdit.php
@@ -24,6 +24,12 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form
public function init()
{
+
+ if(!isset($_POST['bootosID'])){
+ $firstbootos = array_slice($this->bootoslist,0,1);
+ $_POST['bootosID'] = $firstbootos[0]->getID();
+ }
+
$this->setName("BootMenuEntryAdd");
$this->setMethod('post');
@@ -37,7 +43,9 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form
));
$bootosfield = $this->createElement('select','bootosID');
- $bootosfield ->setLabel('BootOs:');
+ $bootosfield->setLabel('BootOs:');
+ $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();");
+
if(count($this->bootoslist)>0){
foreach($this->bootoslist as $bootos => $b){
@@ -52,18 +60,23 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form
'validators' => array(
array('StringLength', false, array(0, 50)),
),
- 'required' => true,
+ 'required' => false,
'cols' => 50,
'rows' => 5,
'label' => 'KCL:',
+ 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl()
));
+ $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID();
$configfield = $this->createElement('select','configID');
- $configfield ->setLabel('Config:');
+ $configfield->setLabel('Config:');
+ $configfield->addMultiOption($defaultconfigid, 'default');
+
if(count($this->configlist)>0){
foreach($this->configlist as $config => $c){
- $configfield->addMultiOption($c->getID(), $c->getTitle());
+ if($c->getID() != $defaultconfigid)
+ $configfield->addMultiOption($c->getID(), $c->getTitle());
}
}
$configfield->setRegisterInArrayValidator(false);
diff --git a/application/forms/BootosCreate.php b/application/forms/BootosCreate.php
index a6d74c6..8f699ce 100644
--- a/application/forms/BootosCreate.php
+++ b/application/forms/BootosCreate.php
@@ -78,7 +78,7 @@ class Application_Form_BootosCreate extends Zend_Form
'validators' => array(
array('StringLength', false, array(0, 50)),
),
- 'required' => true,
+ 'required' => false,
'rows' => 5,
'cols' => 50,
'label' => 'Default-KCL:',
diff --git a/application/forms/BootosEdit.php b/application/forms/BootosEdit.php
index 572e712..641429d 100644
--- a/application/forms/BootosEdit.php
+++ b/application/forms/BootosEdit.php
@@ -86,7 +86,7 @@ class Application_Form_BootosEdit extends Zend_Form
'validators' => array(
array('StringLength', false, array(0, 50)),
),
- 'required' => true,
+ 'required' => false,
'rows' => 5,
'cols' => 50,
'label' => 'Default-KCL:',
diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php
index af4f9b2..091eb37 100644
--- a/application/forms/FilterAdd.php
+++ b/application/forms/FilterAdd.php
@@ -2,6 +2,7 @@
class Application_Form_FilterAdd extends Zend_Form
{
+ private $bootmenus;
public function init()
{
@@ -22,14 +23,16 @@ class Application_Form_FilterAdd extends Zend_Form
'label' => 'Description:',
));
- $this->addElement('text', 'bootmenuID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'bootmenuID:',
- ));
+ $bootmenufield = $this->createElement('select','bootmenuID');
+ $bootmenufield ->setLabel('Bootmenu:');
+
+ if(count($this->bootmenus)>0){
+ foreach($this->bootmenus as $id => $g){
+ $bootmenufield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootmenufield->setRegisterInArrayValidator(false);
+ $this->addElement($bootmenufield);
$this->addElement('text', 'priority', array(
'filters' => array('StringTrim'),
@@ -45,7 +48,10 @@ class Application_Form_FilterAdd extends Zend_Form
'label' => 'Save',
));
}
-
+ function setBootmenus($val){
+ $this->bootmenus = $val;
+ return;
+ }
}
diff --git a/application/forms/FilterEvaluate.php b/application/forms/FilterEvaluate.php
new file mode 100644
index 0000000..2c93aef
--- /dev/null
+++ b/application/forms/FilterEvaluate.php
@@ -0,0 +1,123 @@
+<?php
+
+class Application_Form_FilterEvaluate extends Zend_Form
+{
+ private $pools;
+ private $bootisos;
+ private $memberships;
+ private $groups;
+ private $clients;
+
+ public function init()
+ {
+ $this->setName("Test Filter");
+ $this->setMethod('post');
+ $this->setAction('/filter/evaluate');
+
+ $this->addElement('text', 'ip', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'IP:',
+ ));
+ ######################################
+ $this->addElement('text', 'mac', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Mac:',
+ ));
+ ######################################
+ $poolfield = $this->createElement('select','poolID');
+ $poolfield ->setLabel('Pool:');
+ $poolfield->addMultiOption('','');
+ if(count($this->pools)>0){
+ foreach($this->pools as $id => $g){
+ $poolfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $poolfield->setRegisterInArrayValidator(false);
+ $this->addElement($poolfield);
+ ######################################
+ $bootisofield = $this->createElement('select','bootisoID');
+ $bootisofield ->setLabel('BootIso:');
+ $bootisofield->addMultiOption('','');
+ if(count($this->bootisos)>0){
+ foreach($this->bootisos as $id => $g){
+ $bootisofield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootisofield->setRegisterInArrayValidator(false);
+ $this->addElement($bootisofield);
+ ######################################
+ $membershipfield = $this->createElement('select','membershipID');
+ $membershipfield ->setLabel('Membership:');
+ $membershipfield->addMultiOption('','');
+ if(count($this->memberships)>0){
+ foreach($this->memberships as $id => $g){
+ $membershipfield->addMultiOption($g->getID(), $g->getPersonID());
+ }
+ }
+ $membershipfield->setRegisterInArrayValidator(false);
+ $this->addElement($membershipfield);
+ ######################################
+ $groupfield = $this->createElement('select','groupID');
+ $groupfield ->setLabel('Group:');
+ $groupfield->addMultiOption('','');
+ if(count($this->groups)>0){
+ foreach($this->groups as $id => $g){
+ $groupfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $groupfield->setRegisterInArrayValidator(false);
+ $this->addElement($groupfield);
+ ######################################
+ $this->addElement('text', 'time', array(
+ 'filters' => array('StringTrim'),
+ 'validators' => array(
+ array('StringLength', false, array(0, 50)),
+ ),
+ 'required' => false,
+ 'label' => 'Time:',
+ ));
+ ######################################
+ $clientfield = $this->createElement('select','clientID');
+ $clientfield ->setLabel('Client:');
+ $clientfield->addMultiOption('','');
+ if(count($this->clients)>0){
+ foreach($this->clients as $id => $g){
+ $clientfield->addMultiOption($g->getID(), $g->getMacadress());
+ }
+ }
+ $clientfield->setRegisterInArrayValidator(false);
+ $this->addElement($clientfield);
+
+ $this->addElement('submit', 'submit', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Get It On!',
+ ));
+ }
+ function setPools($v){
+ $this->pools = $v;
+ }
+ function setBootisos($v){
+ $this->bootisos = $v;
+ }
+ function setMemberships($v){
+ $this->memberships = $v;
+ }
+ function setGroups($v){
+ $this->groups = $v;
+ }
+ function setClients($v){
+ $this->clients = $v;
+ }
+
+
+}
+
diff --git a/application/forms/Session.php b/application/forms/Session.php
index f094676..30aefda 100644
--- a/application/forms/Session.php
+++ b/application/forms/Session.php
@@ -3,36 +3,48 @@
class Application_Form_Session extends Zend_Form
{
+ private $clients;
+ private $bootos;
+ private $bootisos;
+
public function init()
{
$this->setName("session");
$this->setMethod('post');
- $this->addElement('text', 'clientID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'clientID:',
- ));
+ $clientfield = $this->createElement('select','clientID');
+ $clientfield ->setLabel('Client:');
+ $clientfield->addMultiOption('','');
+ if(count($this->clients)>0){
+ foreach($this->clients as $id => $g){
+ $clientfield->addMultiOption($g->getID(), $g->getMacadress());
+ }
+ }
+ $clientfield->setRegisterInArrayValidator(false);
+ $this->addElement($clientfield);
+
+
+ $bootosfield = $this->createElement('select','bootosID');
+ $bootosfield ->setLabel('BootOs:');
+ $bootosfield->addMultiOption('','');
+ if(count($this->bootos)>0){
+ foreach($this->bootos as $id => $g){
+ $bootosfield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootosfield->setRegisterInArrayValidator(false);
+ $this->addElement($bootosfield);
+
+ $bootisofield = $this->createElement('select','bootisoID');
+ $bootisofield ->setLabel('BootIso:');
+ if(count($this->bootisos)>0){
+ foreach($this->bootisos as $id => $g){
+ $bootisofield->addMultiOption($g->getID(), $g->getTitle());
+ }
+ }
+ $bootisofield->setRegisterInArrayValidator(false);
+ $this->addElement($bootisofield);
- $this->addElement('text', 'bootosID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'bootosID:',
- ));
-$this->addElement('text', 'bootisoID', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'bootisoID:',
- ));
$this->addElement('text', 'time', array(
'filters' => array('StringTrim'),
'validators' => array(
@@ -64,7 +76,16 @@ $this->addElement('text', 'ip6', array(
'label' => 'Save',
));
}
-
+ function setClients($v){
+ $this->clients = $v;
+ }
+ function setBootos($v){
+ $this->bootos = $v;
+ }
+ function setBootisos($v){
+ $this->bootisos = $v;
+ }
+
}