diff options
author | Sebastian Schmelzer | 2012-01-11 14:36:35 +0100 |
---|---|---|
committer | Sebastian Schmelzer | 2012-01-11 14:36:35 +0100 |
commit | fca04a6dab252eb9e8c0a92ce3b7e14b32e68d1e (patch) | |
tree | 6e6aaf749f34db8c7c7153c23ef85c57187430bb /application/modules/user/forms | |
parent | API: mit addBootos kann man nun auch editieren (diff) | |
download | pbs2-fca04a6dab252eb9e8c0a92ce3b7e14b32e68d1e.tar.gz pbs2-fca04a6dab252eb9e8c0a92ce3b7e14b32e68d1e.tar.xz pbs2-fca04a6dab252eb9e8c0a92ce3b7e14b32e68d1e.zip |
format source files
Diffstat (limited to 'application/modules/user/forms')
26 files changed, 2421 insertions, 2471 deletions
diff --git a/application/modules/user/forms/Bootiso.php b/application/modules/user/forms/Bootiso.php index 091f448..1797e2d 100644 --- a/application/modules/user/forms/Bootiso.php +++ b/application/modules/user/forms/Bootiso.php @@ -1,161 +1,160 @@ -<?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_Bootiso extends Zend_Form -{ - - private $prebootlist; - private $groupdepth; - private $action; - private $page; - - public function setAction($action){ - $this->action = $action; - } - public function setPrebootlist($prebootlist){ - $this->prebootlist = $prebootlist; +* 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_Bootiso extends Zend_Form { + + private $prebootlist; + private $groupdepth; + private $action; + private $page; + + public function setAction($action) { + $this->action = $action; + } + public function setPrebootlist($prebootlist) { + $this->prebootlist = $prebootlist; + } + public function setGroupdepth($groupdepth) { + $this->groupdepth = $groupdepth; + } + public function setPage($p) { + $this->page = $p; + } + + public function init() { + $this->setName($this->action); + $this->setMethod('post'); + + if (!Pbs_Acl::checkRight('be') && $this->action == 'editbootiso') + { $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:', + )); + + + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'rows' => 5, + 'cols' => 50, + 'label' => 'Description:', + )); + + $prebootfield = $this->createElement('select', 'prebootID'); + $prebootfield->setLabel('Preboot:'); + $prebootfield->setAttrib('readOnly', $meta); + + if(count($this->prebootlist) > 0) { + foreach($this->prebootlist as $preboot => $p) { + $prebootfield->addMultiOption($p->getID(), $p->getTitle()); + } } - public function setGroupdepth($groupdepth){ - $this->groupdepth = $groupdepth; + $prebootfield->setRegisterInArrayValidator(false); + $this->addElement($prebootfield); + + $serial = time(); + for($i = 2; $i < 14; $i += 3) + { $serial = substr($serial, 0, $i) .'-'. substr($serial, $i, strlen($serial)); } + + $this->addElement('text', 'serialnumber', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'size' => 50, + 'label' => 'Serialnumber:', + 'readOnly' => $meta, + 'value' => $serial + )); + + $date = new DateTime(); + $date->add(new DateInterval('P1Y')); + $this->addElement('text', 'expires', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'Expires:', + 'readOnly' => $meta, + 'value' => $date->format('Y-m-d'), + )); + + $publicfield = $this->createElement('select', 'public'); + $publicfield->setLabel('Public:'); + $publicfield->addMultiOption(-1, 'X. Not Visible'); + $publicfield->addMultiOption(0, '0. Eigene Gruppe'); + $publicfield->setAttrib('readOnly', $meta); + $publicfield->setAttrib('id', 'depth'); + $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();"); + + for($i = 1; $i < $this->groupdepth; $i++) { + $publicfield->addMultiOption($i, "$i. Untergruppe"); } - public function setPage($p){ - $this->page = $p; - } - - public function init() - { - $this->setName($this->action); - $this->setMethod('post'); - - if (!Pbs_Acl::checkRight('be') && $this->action == 'editbootiso') - $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:', - )); - - - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'rows' => 5, - 'cols' => 50, - 'label' => 'Description:', - )); - - $prebootfield = $this->createElement('select','prebootID'); - $prebootfield->setLabel('Preboot:'); - $prebootfield->setAttrib('readOnly', $meta); - - if(count($this->prebootlist)>0){ - foreach($this->prebootlist as $preboot => $p){ - $prebootfield->addMultiOption($p->getID(), $p->getTitle()); - } - } - $prebootfield->setRegisterInArrayValidator(false); - $this->addElement($prebootfield); - - $serial = time(); - for($i=2; $i<14; $i+=3) - $serial = substr($serial,0,$i) .'-'. substr($serial,$i,strlen($serial)); - - $this->addElement('text', 'serialnumber', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'size' => 50, - 'label' => 'Serialnumber:', - 'readOnly' => $meta, - 'value' => $serial - )); - - $date = new DateTime(); - $date->add(new DateInterval('P1Y')); - $this->addElement('text', 'expires', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'label' => 'Expires:', - 'readOnly' => $meta, - 'value' => $date->format('Y-m-d'), - )); - - $publicfield = $this->createElement('select','public'); - $publicfield->setLabel('Public:'); - $publicfield->addMultiOption(-1, 'X. Not Visible'); - $publicfield->addMultiOption(0, '0. Eigene Gruppe'); - $publicfield->setAttrib('readOnly', $meta); - $publicfield->setAttrib('id', 'depth'); - $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();"); - - for($i=1; $i<$this->groupdepth; $i++){ - $publicfield->addMultiOption($i, "$i. Untergruppe"); - } - - $publicfield->setRegisterInArrayValidator(false); - $this->addElement($publicfield); - - if($this->action == "createbootiso") - $label = "Create BootMedium"; - else - $label = "Edit BootMedium"; - - $this->addElement('submit', $this->action, array( - 'required' => false, - 'ignore' => true, - 'label' => $label, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/bootiso/index/page/'.$this->page.'"' - )); - ?> - - <script type="text/javascript"> - $(document).ready(function(){ - changeDepth(); - $('#groups .v1').show(); - }); - function changeDepth(){ - i = $("#depth option:selected").val(); - $('#depthimg').attr('src','/stats/graphgroup/level/' + i); - } - </script> - - <div id='groups' style='text-align: center;'> - <div class='v1'> - <img alt='Please select a public level' id='depthimg' src='/stats/graphgroup/level/0' /> - </div> - </div> - - - -<?php + + $publicfield->setRegisterInArrayValidator(false); + $this->addElement($publicfield); + + if($this->action == "createbootiso") + { $label = "Create BootMedium"; } + else + { $label = "Edit BootMedium"; } + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/bootiso/index/page/'.$this->page.'"' + )); + ? > + + < script type = "text/javascript" > + $(document).ready(function() { + changeDepth(); + $('#groups .v1').show(); + }); + function changeDepth() { + i = $("#depth option:selected").val(); + $('#depthimg').attr('src', '/stats/graphgroup/level/' + i); } + < / script > + + < div id = 'groups' style = 'text-align: center;' > + < div class = 'v1' > + < img alt = 'Please select a public level' id = 'depthimg' + src = '/stats/graphgroup/level/0' / > + < / div > + < / div > + + + + <? php + } + - } -?> + ? > diff --git a/application/modules/user/forms/Bootmenu.php b/application/modules/user/forms/Bootmenu.php index 0a827d9..5a47313 100644 --- a/application/modules/user/forms/Bootmenu.php +++ b/application/modules/user/forms/Bootmenu.php @@ -1,80 +1,78 @@ -<?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/ - */ +* 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_Bootmenu extends Zend_Form -{ - private $action; - private $page; - private $type; - - public function setAction($action){ - $this->action = $action; - - } - - public function setGrouplist($grouplist){ - $this->grouplist = $grouplist; - } - - public function setPage($page){ - $this->page = $page; - } - public function setType($type){ - $this->type = $type; - } - - public function init() - { - $this->setName($this->action); - $this->setMethod('post'); - - if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenu') - $meta = true; - else - $meta = null; +class user_Form_Bootmenu extends Zend_Form { + private $action; + private $page; + private $type; - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); - $this->addElement('text', 'startcounter', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('Int'), - ), - 'required' => true, - 'label' => 'Startcounter:', - )); - - 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/index/type/'.$this->type.'/page/'.$this->page.'"' - )); + public function setAction($action) { + $this->action = $action; - } + } + + public function setGrouplist($grouplist) { + $this->grouplist = $grouplist; + } + + public function setPage($page) { + $this->page = $page; + } + public function setType($type) { + $this->type = $type; + } + + public function init() { + $this->setName($this->action); + $this->setMethod('post'); + + if (!Pbs_Acl::checkRight('booee') && $this->action == 'editbootmenu') + { $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:', + )); + $this->addElement('text', 'startcounter', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('Int'), + ), + 'required' => true, + 'label' => 'Startcounter:', + )); + + 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/index/type/'.$this->type.'/page/'.$this->page.'"' + )); + + } } 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.'"' + )); + + } + + } diff --git a/application/modules/user/forms/Bootos.php b/application/modules/user/forms/Bootos.php index 432f0c7..02d865b 100644 --- a/application/modules/user/forms/Bootos.php +++ b/application/modules/user/forms/Bootos.php @@ -1,207 +1,205 @@ -<?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_Bootos extends Zend_Form -{ - - private $configlist; - private $action; - private $groupdepth; - private $page; - - public function setAction($action){ - $this->action = $action; - - } - public function setConfiglist($configlist){ - $this->configlist = $configlist; - - } - public function setGroupdepth($groupdepth){ - $this->groupdepth = $groupdepth; - } - public function setPage($page){ - $this->page = $page; - } - - public function init() - { - $this->setName("BootOsCreate"); - $this->setMethod('post'); - $this->setEnctype("multipart/form-data"); - - if (!Pbs_Acl::checkRight('boe') && $this->action == 'editbootos') - $meta = true; - else - $meta = null; - - if($this->action == 'editbootos') - $filereq = false; - else - $filereq = true; - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); - - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'rows' => 5, - 'cols' => 50, - 'label' => 'Description:', - )); - - $this->addElement('textarea', 'defaultkcl', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 175)), - ), - 'required' => false, - 'rows' => 5, - 'cols' => 50, - 'readOnly' => $meta, - 'label' => 'Default-KCL:', - )); - - $this->addElement('text', 'distro', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'readOnly' => $meta, - 'label' => 'Distro:', - )); - - $this->addElement('text', 'distroversion', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'readOnly' => $meta, - 'label' => 'Distroversion:', - )); - - $this->addElement('text', 'shortname', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'readOnly' => $meta, - 'label' => 'Shortname:', - )); - - $this->addElement('text', 'share', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'readOnly' => $meta, - 'label' => 'Share:', - )); - - $this->addElement('file', 'kernel', array( - 'readOnly' => $meta, - 'label' => 'Kernel:', - )); - - $this->addElement('file', 'init', array( - 'readOnly' => $meta, - 'label' => 'Initramfs:', - )); - - $this->addElement('file', 'config', array( - 'validators' => array(array('Extension', false, array('tgz'))), - 'readOnly' => $meta, - 'label' => 'Config:', - )); - - $date = new DateTime(); - $date->add(new DateInterval('P1Y')); - $this->addElement('text', 'expires', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'label' => 'Expires:', - 'readOnly' => $meta, - 'value' => $date->format('Y-m-d'), - )); - - $publicfield = $this->createElement('select','public'); - $publicfield->setLabel('Public:'); - $publicfield->addMultiOption(-1, 'X. Not Visible'); - $publicfield->addMultiOption(0, '0. Own Group'); - $publicfield->setAttrib('readOnly', $meta); - $publicfield->setAttrib('id', 'depth'); - $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();"); - - for($i=1; $i<$this->groupdepth; $i++){ - $publicfield->addMultiOption($i, "$i. Untergruppe"); - } - - $publicfield->setRegisterInArrayValidator(false); - $this->addElement($publicfield); - - if($this->action == "createbootos") - $label = "Create Bootos"; - else - $label = "Edit Bootos"; - - $this->addElement('submit', $this->action, array( - 'required' => false, - 'ignore' => true, - 'label' => $label, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'"' - )); - - ?> - - <script type="text/javascript"> - $(document).ready(function(){ - changeDepth(); - $('#groups .v1').show(); - }); - function changeDepth(){ - i = $("#depth option:selected").val(); - $('#depthimg').attr('src','/stats/graphgroup/level/' + i); - }</script> - - <div id='groups' style='text-align: center;'> - <div class='v1' > - <img id=depthimg src='/stats/graphgroup/'/> - </div> - </div> - -<?php +* 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_Bootos extends Zend_Form { + + private $configlist; + private $action; + private $groupdepth; + private $page; + + public function setAction($action) { + $this->action = $action; + + } + public function setConfiglist($configlist) { + $this->configlist = $configlist; + + } + public function setGroupdepth($groupdepth) { + $this->groupdepth = $groupdepth; + } + public function setPage($page) { + $this->page = $page; + } + + public function init() { + $this->setName("BootOsCreate"); + $this->setMethod('post'); + $this->setEnctype("multipart/form-data"); + + if (!Pbs_Acl::checkRight('boe') && $this->action == 'editbootos') + { $meta = true; } + else + { $meta = null; } + + if($this->action == 'editbootos') + { $filereq = false; } + else + { $filereq = true; } + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'rows' => 5, + 'cols' => 50, + 'label' => 'Description:', + )); + + $this->addElement('textarea', 'defaultkcl', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 175)), + ), + 'required' => false, + 'rows' => 5, + 'cols' => 50, + 'readOnly' => $meta, + 'label' => 'Default-KCL:', + )); + + $this->addElement('text', 'distro', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'readOnly' => $meta, + 'label' => 'Distro:', + )); + + $this->addElement('text', 'distroversion', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'readOnly' => $meta, + 'label' => 'Distroversion:', + )); + + $this->addElement('text', 'shortname', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'readOnly' => $meta, + 'label' => 'Shortname:', + )); + + $this->addElement('text', 'share', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'readOnly' => $meta, + 'label' => 'Share:', + )); + + $this->addElement('file', 'kernel', array( + 'readOnly' => $meta, + 'label' => 'Kernel:', + )); + + $this->addElement('file', 'init', array( + 'readOnly' => $meta, + 'label' => 'Initramfs:', + )); + + $this->addElement('file', 'config', array( + 'validators' => array(array('Extension', false, array('tgz'))), + 'readOnly' => $meta, + 'label' => 'Config:', + )); + + $date = new DateTime(); + $date->add(new DateInterval('P1Y')); + $this->addElement('text', 'expires', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'Expires:', + 'readOnly' => $meta, + 'value' => $date->format('Y-m-d'), + )); + + $publicfield = $this->createElement('select', 'public'); + $publicfield->setLabel('Public:'); + $publicfield->addMultiOption(-1, 'X. Not Visible'); + $publicfield->addMultiOption(0, '0. Own Group'); + $publicfield->setAttrib('readOnly', $meta); + $publicfield->setAttrib('id', 'depth'); + $publicfield->setAttrib('onchange', "$('#groups .v1').show();changeDepth();"); + + for($i = 1; $i < $this->groupdepth; $i++) { + $publicfield->addMultiOption($i, "$i. Untergruppe"); } - + $publicfield->setRegisterInArrayValidator(false); + $this->addElement($publicfield); + + if($this->action == "createbootos") + { $label = "Create Bootos"; } + else + { $label = "Edit Bootos"; } + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'"' + )); + + ? > + + < script type = "text/javascript" > + $(document).ready(function() { + changeDepth(); + $('#groups .v1').show(); + }); + function changeDepth() { + i = $("#depth option:selected").val(); + $('#depthimg').attr('src', '/stats/graphgroup/level/' + i); + } < / script > + + < div id = 'groups' style = 'text-align: center;' > + < div class = 'v1' > + < img id = depthimg src = '/stats/graphgroup/' / > + < / div > + < / div > + + <? php + } + + } -?> + ? > diff --git a/application/modules/user/forms/BootosUser.php b/application/modules/user/forms/BootosUser.php index d5700d5..e986104 100644 --- a/application/modules/user/forms/BootosUser.php +++ b/application/modules/user/forms/BootosUser.php @@ -1,161 +1,161 @@ - <?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_BootosUser extends Zend_Form -{ - - private $action; - private $type; - private $configID; - private $hometype; - - public function setAction($action){ - $this->action = $action; - } - public function setType($type){ - $this->type = $type; - } - public function setConfigID($configID){ - $this->configID = $configID; - } - public function setHometype($hometype){ - $this->hometype = $hometype; - } - - - public function init() - { - $this->setName($this->action); - $this->setMethod('post'); - - if (!Pbs_Acl::checkRight('ce') && $this->action == 'editbootosuser') - $meta = true; - else - $meta = null; - - if(!isset($_POST['hometypeID'])){ - $_POST['hometypeID'] = '0'; - } - - $this->addElement('text', 'login', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Login-Name:', - 'value' => $_POST['login'], - 'description' => 'Tip: Use %username% as a Wildcard' - )); - - $this->addElement('password', 'password', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(6)), - ), - 'required' => true, - 'label' => 'Password:', - 'errorMessages' => array('Please enter a password with more than 6 characters') - )); - - $this->addElement('password', 'repeat_password', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(6)), - ), - 'required' => true, - 'label' => 'Repeat Password:', - 'errorMessages' => array('Please repeat the password correctly'), - 'description' => 'Tip: Use %password% as a Wildcard' - )); - - - - $hometypefield = $this->createElement('select','hometypeID'); - $hometypefield->setLabel('Hometype:'); - $hometypefield->setAttrib('readOnly', $meta); - $hometypefield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();"); - $hometypefield->setValue($_POST['hometypeID']); - foreach($this->hometype as $k => $ht){ - $hometypefield->addMultiOption($ht->getID(), $ht->getName()); - } - - $this->addElement($hometypefield); - - if($_POST['hometypeID'] == 0){ - $this->addElement('text', 'homepath', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Home-Path:', - 'size' => '30', - 'readOnly' => true, - 'value' => '/home/%login-name%' - )); - }elseif($_POST['hometypeID'] == 1){ - $this->addElement('text', 'homepath', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Home-Path:', - 'size' => '30', - 'readOnly' => true, - 'value' => 'usbstick://home/%login-name%' - )); - }else{ - $this->addElement('text', 'homepath', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'size' => '30', - 'required' => true, - 'label' => 'Home-Path:', - 'readOnly' => $meta - )); - } - - if($this->action == "addbootosuser") - $label = "Add User"; - else - $label = "Edit User"; - - $this->addElement('submit', $this->action, array( - 'required' => false, - 'ignore' => true, - 'label' => $label - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/config/showconfig/type/'.$this->type.'/configID/'.$this->configID.'"' - )); - - - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('Use <b>%username%</b> and <b>%password%</b> as Wildcards for Login and Password.','info'); +* 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_BootosUser extends Zend_Form { + + private $action; + private $type; + private $configID; + private $hometype; + + public function setAction($action) { + $this->action = $action; + } + public function setType($type) { + $this->type = $type; + } + public function setConfigID($configID) { + $this->configID = $configID; + } + public function setHometype($hometype) { + $this->hometype = $hometype; + } + + + public function init() { + $this->setName($this->action); + $this->setMethod('post'); + + if (!Pbs_Acl::checkRight('ce') && $this->action == 'editbootosuser') + { $meta = true; } + else + { $meta = null; } + + if(!isset($_POST['hometypeID'])) { + $_POST['hometypeID'] = '0'; + } + + $this->addElement('text', 'login', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Login-Name:', + 'value' => $_POST['login'], + 'description' => 'Tip: Use %username% as a Wildcard' + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(6)), + ), + 'required' => true, + 'label' => 'Password:', + 'errorMessages' => array('Please enter a password with more than 6 characters') + )); + + $this->addElement('password', 'repeat_password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(6)), + ), + 'required' => true, + 'label' => 'Repeat Password:', + 'errorMessages' => array('Please repeat the password correctly'), + 'description' => 'Tip: Use %password% as a Wildcard' + )); + + + + $hometypefield = $this->createElement('select', 'hometypeID'); + $hometypefield->setLabel('Hometype:'); + $hometypefield->setAttrib('readOnly', $meta); + $hometypefield->setAttrib('onChange', "document.getElementById('".$this->action."').submit();"); + $hometypefield->setValue($_POST['hometypeID']); + foreach($this->hometype as $k => $ht) { + $hometypefield->addMultiOption($ht->getID(), $ht->getName()); + } + + $this->addElement($hometypefield); + + if($_POST['hometypeID'] == 0) { + $this->addElement('text', 'homepath', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Home-Path:', + 'size' => '30', + 'readOnly' => true, + 'value' => '/home/%login-name%' + )); + } + elseif($_POST['hometypeID'] == 1) { + $this->addElement('text', 'homepath', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Home-Path:', + 'size' => '30', + 'readOnly' => true, + 'value' => 'usbstick://home/%login-name%' + )); + } + else { + $this->addElement('text', 'homepath', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'size' => '30', + 'required' => true, + 'label' => 'Home-Path:', + 'readOnly' => $meta + )); } - - public function isValid($data) - { + + if($this->action == "addbootosuser") + { $label = "Add User"; } + else + { $label = "Edit User"; } + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/config/showconfig/type/'.$this->type.'/configID/'.$this->configID.'"' + )); + + + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('Use <b>%username%</b> and <b>%password%</b> as Wildcards for Login and Password.', 'info'); + } + + public function isValid($data) { $this->getElement('repeat_password')-> - addValidator(new Zend_Validate_Identical($data['password'])); - + addValidator(new Zend_Validate_Identical($data['password'])); + return parent::isValid($data); } } -?> +? > diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php index 33a6cf1..8e37d94 100644 --- a/application/modules/user/forms/Client.php +++ b/application/modules/user/forms/Client.php @@ -1,74 +1,72 @@ -<?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/ - */ +* 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_Client extends Zend_Form -{ +class user_Form_Client extends Zend_Form { - private $buttontext = 'Save'; - private $groups; - private $page; - - public function setButtontext($v){ - $this->buttontext = $v; - } - public function setPage($page){ - $this->page = $page; - } - - public function init() - { - $this->setName("pool"); - $this->setMethod('post'); - - $mac = $this->createElement('text', 'macadress', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array( - 'regex', - false, - array( - '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", - Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'label' => 'MacAdress:', - )); - $this->addElement($mac); - - - $this->addElement('text', 'hardwarehash', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(32, 32)), - ), - 'required' => true, - 'label' => 'Hardwarehash:', - )); + private $buttontext = 'Save'; + private $groups; + private $page; - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => $this->buttontext, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/client/index/page/'.$this->page.'"' - )); - - } + public function setButtontext($v) { + $this->buttontext = $v; + } + public function setPage($page) { + $this->page = $page; + } + + public function init() { + $this->setName("pool"); + $this->setMethod('post'); + + $mac = $this->createElement('text', 'macadress', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array( + 'regex', + false, + array( + '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", + Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'label' => 'MacAdress:', + )); + $this->addElement($mac); + + + $this->addElement('text', 'hardwarehash', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(32, 32)), + ), + 'required' => true, + 'label' => 'Hardwarehash:', + )); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/client/index/page/'.$this->page.'"' + )); + + } } diff --git a/application/modules/user/forms/Config.php b/application/modules/user/forms/Config.php index 3b961b9..1d07e5a 100644 --- a/application/modules/user/forms/Config.php +++ b/application/modules/user/forms/Config.php @@ -1,86 +1,85 @@ - <?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/ - */ +* 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_Config extends Zend_Form -{ +class user_Form_Config extends Zend_Form { - private $action; - private $page; - private $type; - - public function setAction($action){ - $this->action = $action; - } - public function setPage($p){ - $this->page = $p; - } - public function setType($type){ - $this->type = $type; - } - - public function init() - { - $this->setName($this->action); - $this->setMethod('post'); - - if (!Pbs_Acl::checkRight('ce') && $this->action == 'editconfig') - $meta = true; - else - $meta = null; + private $action; + private $page; + private $type; + + public function setAction($action) { + $this->action = $action; + } + public function setPage($p) { + $this->page = $p; + } + public function setType($type) { + $this->type = $type; + } + + public function init() { + $this->setName($this->action); + $this->setMethod('post'); + + if (!Pbs_Acl::checkRight('ce') && $this->action == 'editconfig') + { $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:', - )); - - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'rows' => 5, - 'cols' => 50, - 'label' => 'Description:', - )); - - if($this->type == 'group'){ - $visible = $this->createElement('checkbox','visible'); - $visible->setLabel('Visible:'); - $visible->setAttrib('readOnly', $meta); - $this->addElement($visible); - } - - if($this->action == "createconfig") - $label = "Create Config"; - else - $label = "Edit Config"; - - $this->addElement('submit', $this->action, array( - 'required' => false, - 'ignore' => true, - 'label' => $label - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/config/index/type/'.$this->type.'/page/'.$this->page.'"' - )); + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'rows' => 5, + 'cols' => 50, + 'label' => 'Description:', + )); + + if($this->type == 'group') { + $visible = $this->createElement('checkbox', 'visible'); + $visible->setLabel('Visible:'); + $visible->setAttrib('readOnly', $meta); + $this->addElement($visible); } + if($this->action == "createconfig") + { $label = "Create Config"; } + else + { $label = "Edit Config"; } + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/config/index/type/'.$this->type.'/page/'.$this->page.'"' + )); + + } + } -?> +? > diff --git a/application/modules/user/forms/ConfirmDeleteAccount.php b/application/modules/user/forms/ConfirmDeleteAccount.php index 70b261c..5fd3e82 100644 --- a/application/modules/user/forms/ConfirmDeleteAccount.php +++ b/application/modules/user/forms/ConfirmDeleteAccount.php @@ -1,36 +1,34 @@ -<?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/ - */ +* 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_ConfirmDeleteAccount extends Zend_Form -{ +class user_Form_ConfirmDeleteAccount extends Zend_Form { - public function init() - { - $this->setName("ConfirmDeleteAccount"); - $this->setMethod('post'); - - $this->addElement('submit', 'confirmdelete', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Confirm', - )); + public function init() { + $this->setName("ConfirmDeleteAccount"); + $this->setMethod('post'); - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } + $this->addElement('submit', 'confirmdelete', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Confirm', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php index 5eabd60..f535cf1 100644 --- a/application/modules/user/forms/Filter.php +++ b/application/modules/user/forms/Filter.php @@ -1,98 +1,94 @@ -<?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_Filter extends Zend_Form -{ - - private $bootmenus; - - public function init() - { - $this->setName("Add Filter"); - $this->setMethod('post'); - - if(stristr($_SERVER['REQUEST_URI'],'addfilter')){ - $edit = null; - } - else{ - if(!Pbs_Acl::checkRight('fe') && Pbs_Acl::checkRight('fefp') ){ - $edit = 'true'; - } - else{ - $edit = null; - } - } - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'readOnly' => $edit, - 'label' => 'Title:', - )); - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'required' => false, - 'readOnly' => $edit, - 'label' => 'Description:', - )); - - $bootmenufield = $this->createElement('select','bootmenuID'); - $bootmenufield->setLabel('Bootmenu:'); - $bootmenufield->setAttrib('readOnly', $edit); - - if(count($this->bootmenus)>0){ - foreach($this->bootmenus as $g){ - $bootmenufield->addMultiOption($g->getID(), $g->getTitle()); - - } - } - - $bootmenufield->setRegisterInArrayValidator(false); - $this->addElement($bootmenufield); - - $this->addElement('text', 'priority', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Priority:', - )); - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => $this->buttontext, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' - )); - - $this->addElement('hidden', 'created', array( - 'required' => false, - 'ignore' => true - )); +* 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_Filter extends Zend_Form { + + private $bootmenus; + + public function init() { + $this->setName("Add Filter"); + $this->setMethod('post'); + + if(stristr($_SERVER['REQUEST_URI'], 'addfilter')) { + $edit = null; + } else { + if(!Pbs_Acl::checkRight('fe') && Pbs_Acl::checkRight('fefp') ) { + $edit = 'true'; + } else { + $edit = null; + } } - function setBootmenus($val){ - $this->bootmenus = $val; - return; - } - private $buttontext = 'Save'; - function setButtontext($v){ - $this->buttontext = $v; - } + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'readOnly' => $edit, + 'label' => 'Title:', + )); + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'required' => false, + 'readOnly' => $edit, + 'label' => 'Description:', + )); + + $bootmenufield = $this->createElement('select', 'bootmenuID'); + $bootmenufield->setLabel('Bootmenu:'); + $bootmenufield->setAttrib('readOnly', $edit); + + if(count($this->bootmenus) > 0) { + foreach($this->bootmenus as $g) { + $bootmenufield->addMultiOption($g->getID(), $g->getTitle()); + + } + } + + $bootmenufield->setRegisterInArrayValidator(false); + $this->addElement($bootmenufield); + + $this->addElement('text', 'priority', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Priority:', + )); + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' + )); + + $this->addElement('hidden', 'created', array( + 'required' => false, + 'ignore' => true + )); + } + function setBootmenus($val) { + $this->bootmenus = $val; + return; + } + private $buttontext = 'Save'; + function setButtontext($v) { + $this->buttontext = $v; + } diff --git a/application/modules/user/forms/FilterEntry.php b/application/modules/user/forms/FilterEntry.php index 12fd00c..bdadf59 100644 --- a/application/modules/user/forms/FilterEntry.php +++ b/application/modules/user/forms/FilterEntry.php @@ -1,424 +1,422 @@ -<?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/ - */ +* 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_FilterEntry extends Zend_Form -{ +class user_Form_FilterEntry extends Zend_Form { - private $filterID = 0; - private $data ; - private $buttontext = 'Save'; - private $selectData; - private $page; + private $filterID = 0; + private $data ; + private $buttontext = 'Save'; + private $selectData; + private $page; - public function setButtontext($v){ - $this->buttontext = $v; - } - public function setData($v){ - $this->data = $v; - } - public function setFilterID($v){ - $this->filterID = $v; - } - public function setSelectData($v){ - $this->selectData = $v; - } - public function setPage($page){ - $this->page = $page; - } + public function setButtontext($v) { + $this->buttontext = $v; + } + public function setData($v) { + $this->data = $v; + } + public function setFilterID($v) { + $this->filterID = $v; + } + public function setSelectData($v) { + $this->selectData = $v; + } + public function setPage($page) { + $this->page = $page; + } - public function init() - { - $this->setName("Add Filterentry"); - $this->setMethod('post'); - $this->setAttrib('id','filterentryform'); - #print_a($this->data); - #print_a($this->selectData); - try{ - $filtertypemapper = new Application_Model_FilterTypeMapper(); - $filtertype = $filtertypemapper->fetchAll(); - - $filtertypes = $this->createElement('select','filtertypeID'); - $filtertypes ->setLabel('Type:'); - $filtertypes ->setAttrib('id','filtertype'); - $filtertypes->addMultiOption('',''); - foreach($filtertype as $f){ - $filtertypes->addMultiOption($f->getID(),$f->getFiltertypename()); - } - $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']); - $filterentryID = $this->data['filtertypeID']; - }catch (Zend_Exception $e) { - echo "Error message 1: " . $e->getMessage() . "\n"; - } - switch($filterentryID){ - default: - $desc = "Select the filtertype"; - $label1 = 'Value 1:'; - $label2 = 'Value 2:'; - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'id' => 'val1' - )); - $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'id' => 'val2' - )); - break; - case "1": - $desc = "You can set one IP or an IP-Range"; - $label1 = 'Start:'; - $label2 = 'End:'; - - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'validators' => array( - array( - 'regex', - false, - array( - '/^(([0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([[0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", - Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val1' - )); - $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'validators' => array( - array( - 'regex', - false, - array( - '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", - Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val2' - )); - break; - case "2": - $desc = "You can set one Mac-Adress or an Mac-Range"; - $label1 = 'Start:'; - $label2 = 'End:'; - - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'validators' => array( - array( - 'regex', - false, - array( - '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", - Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val1' - )); - $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'validators' => array( - array( - 'regex', - false, - array( - '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", - Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val2' - )); - break; - case "3": - $desc = "Select your Pool"; - $label1 = 'PoolID:'; - - $filtervalue1 = $this->createElement('select','filtervalue'); - $filtervalue1 ->setLabel($label1); - if(count($this->selectData['pools'])>0){ - foreach($this->selectData['pools'] as $id => $g){ - $filtervalue1->addMultiOption($g['poolID'], $g['title']); - } - } - $filtervalue1->setRegisterInArrayValidator(false); - break; - case "4": - $desc = "Select your BootIso"; - $label1 = 'BootIsoID:'; - - $filtervalue1 = $this->createElement('select','filtervalue'); - $filtervalue1 ->setLabel($label1); - if(count($this->selectData['bootisos'])>0){ - foreach($this->selectData['bootisos'] as $id => $g){ - $filtervalue1->addMultiOption($g['bootisoID'], $g['title']); - } - } - $filtervalue1->setRegisterInArrayValidator(false); - - break; - case "5": - $desc = "Select a Membership"; - $label1 = 'Membership:'; - - $filtervalue1 = $this->createElement('select','filtervalue'); - $filtervalue1 ->setLabel($label1); - if(count($this->selectData['memberships'])>0){ - $personMapper = new Application_Model_PersonMapper(); - foreach($this->selectData['memberships'] as $id => $g){ - // Display full name of Person - $person = new Application_Model_Person(); - $personMapper->find($g['personID'],$person); - $filtervalue1->addMultiOption($g['membershipID'], $person->getName().", ".$person->getFirstname()); - } - } - $filtervalue1->setRegisterInArrayValidator(false); - break; - case "6": - $desc = "For all members in this Group"; - $label1 = 'Group:'; - // TODO: insert the child Groups - $filtervalue1 = $this->createElement('select','filtervalue'); - $filtervalue1 ->setLabel($label1); - if(count($this->selectData['groups'])>0){ - foreach($this->selectData['groups'] as $id => $g){ - $filtervalue1->addMultiOption($g['groupID'], $g['title']); - } - } - $filtervalue1->setRegisterInArrayValidator(false); - break; - case "7": - $desc = "Specify a time-range"; - $label1 = 'Start:'; - $label2 = 'End:'; - - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'validators' => array( - array( - 'regex', - false, - array( - '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", - Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val1' - )); - $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'validators' => array( - array( - 'regex', - false, - array( - '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", - Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val2' - )); - echo '<script type="text/javascript"> - $(function() { - $( "#val1" ).timepicker({ - showPeriod: false, - showPeriodLabels: false - }); - $( "#val2" ).timepicker({ - showPeriod: false, - showPeriodLabels: false - }); - }); - </script>'; - break; - case "8": - $desc = "Select a Client"; - $label1 = 'Client:'; - - $filtervalue1 = $this->createElement('select','filtervalue'); - $filtervalue1 ->setLabel($label1); - if(count($this->selectData['clients'])>0){ - foreach($this->selectData['clients'] as $id => $g){ - $filtervalue1->addMultiOption($g['clientID'], $g['macadress']." - ".$g['hardwarehash']); - } - } - $filtervalue1->setRegisterInArrayValidator(false); - break; - case "9": - $desc = "Define a Hardwarehash"; - $label1 = 'Hardwarehash:'; - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(32, 32)), - ), - 'required' => true, - 'id' => 'val1' - )); - break; - case "10": - $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range"; - $label1 = 'Start Day:'; - $label2 = 'End Day:'; - - - - $filtervalue1 = $this->createElement('select','filtervalue', array( - 'label' => $label1, - 'validators' => array( - array( - 'regex', - false, - array( - '/^([1-7])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", - Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val1' - )); - $filtervalue1->addMultiOption(1, "Monday") - ->addMultiOption(2, "Tuesday") - ->addMultiOption(3, "Wednesday") - ->addMultiOption(4, "Thursday") - ->addMultiOption(5, "Friday") - ->addMultiOption(6, "Saturday") - ->addMultiOption(7, "Sunday"); - - - $filtervalue2 = $this->createElement('select', 'filtervalue2', array( - 'label' => $label2, - 'validators' => array( - array( - 'regex', - false, - array( - '/^([1-7])$/i', - 'messages' => array( - Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", - Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' - ) - ) - ) - ), - 'required' => true, - 'id' => 'val2' - )); - $filtervalue2->addMultiOption(1, "Monday") - ->addMultiOption(2, "Tuesday") - ->addMultiOption(3, "Wednesday") - ->addMultiOption(4, "Thursday") - ->addMultiOption(5, "Friday") - ->addMultiOption(6, "Saturday") - ->addMultiOption(7, "Sunday"); - break; - case "11": - $desc = "Specify the date or a day range of the filter"; - $label1 = 'Start Date:'; - $label2 = 'End Date:'; - - $filtervalue1 = $this->createElement('text', 'filtervalue', array( - 'label' => $label1, - 'required' => true, - 'id' => 'val1' - )); - $filtervalue1->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); - - $filtervalue2 = $this->createElement('text', 'filtervalue2', array( - 'label' => $label2, - 'required' => true, - 'id' => 'val2' - )); - $filtervalue2->addValidator('Date',false, array('format'=>'dd.MM.yyyy')); - echo '<script type="text/javascript"> - $(function() { - $( "#val1" ).datepicker({ dateFormat: "dd.mm.yy"}); - $( "#val2" ).datepicker({ dateFormat: "dd.mm.yy"}); - }); - </script>'; - break; - } - $filtertypes->setDescription($desc); - $this->addElement($filtertypes); - - - - $this->addElement($filtervalue1); - if(isset($filtervalue2 )){ - $this->addElement($filtervalue2); - } + public function init() { + $this->setName("Add Filterentry"); + $this->setMethod('post'); + $this->setAttrib('id', 'filterentryform'); +#print_a($this->data); +#print_a($this->selectData); + try { + $filtertypemapper = new Application_Model_FilterTypeMapper(); + $filtertype = $filtertypemapper->fetchAll(); - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => $this->buttontext, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' - )); - - $this->addElement('hidden', 'filterID', array( - 'value' => $this->filterID - )); - - + $filtertypes = $this->createElement('select', 'filtertypeID'); + $filtertypes ->setLabel('Type:'); + $filtertypes ->setAttrib('id', 'filtertype'); + $filtertypes->addMultiOption('', ''); + foreach($filtertype as $f) { + $filtertypes->addMultiOption($f->getID(), $f->getFiltertypename()); + } + $filterentry = $filtertypes->getMultiOption($this->data['filtertypeID']); + $filterentryID = $this->data['filtertypeID']; + } catch (Zend_Exception $e) { + echo "Error message 1: " . $e->getMessage() . "\n"; } + switch($filterentryID) { + default: + $desc = "Select the filtertype"; + $label1 = 'Value 1:'; + $label2 = 'Value 2:'; + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'id' => 'val2' + )); + break; + case "1": + $desc = "You can set one IP or an IP-Range"; + $label1 = 'Start:'; + $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^(([0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([[0-9]|[1-9][0-9]|0[0-9]{2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", + Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid IP-Adress", + Zend_Validate_Regex::INVALID => 'IP-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); + break; + case "2": + $desc = "You can set one Mac-Adress or an Mac-Range"; + $label1 = 'Start:'; + $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", + Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Mac-Adress", + Zend_Validate_Regex::INVALID => 'Mac-Adress contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); + break; + case "3": + $desc = "Select your Pool"; + $label1 = 'PoolID:'; + + $filtervalue1 = $this->createElement('select', 'filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['pools']) > 0) { + foreach($this->selectData['pools'] as $id => $g) { + $filtervalue1->addMultiOption($g['poolID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); + break; + case "4": + $desc = "Select your BootIso"; + $label1 = 'BootIsoID:'; + + $filtervalue1 = $this->createElement('select', 'filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['bootisos']) > 0) { + foreach($this->selectData['bootisos'] as $id => $g) { + $filtervalue1->addMultiOption($g['bootisoID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); + + break; + case "5": + $desc = "Select a Membership"; + $label1 = 'Membership:'; + + $filtervalue1 = $this->createElement('select', 'filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['memberships']) > 0) { + $personMapper = new Application_Model_PersonMapper(); + foreach($this->selectData['memberships'] as $id => $g) { + // Display full name of Person + $person = new Application_Model_Person(); + $personMapper->find($g['personID'], $person); + $filtervalue1->addMultiOption($g['membershipID'], $person->getName().", ".$person->getFirstname()); + } + } + $filtervalue1->setRegisterInArrayValidator(false); + break; + case "6": + $desc = "For all members in this Group"; + $label1 = 'Group:'; + // TODO: insert the child Groups + $filtervalue1 = $this->createElement('select', 'filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['groups']) > 0) { + foreach($this->selectData['groups'] as $id => $g) { + $filtervalue1->addMultiOption($g['groupID'], $g['title']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); + break; + case "7": + $desc = "Specify a time-range"; + $label1 = 'Start:'; + $label2 = 'End:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([0-1][0-9]|[2][0-3]):([0-5][0-9])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Time-Format, It must be HH:MM", + Zend_Validate_Regex::INVALID => 'Time contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); + echo '<script type="text/javascript"> + $(function() { + $( "#val1" ).timepicker({ + showPeriod: false, + showPeriodLabels: false + }); + $( "#val2" ).timepicker({ + showPeriod: false, + showPeriodLabels: false + }); + }); + </script>'; + break; + case "8": + $desc = "Select a Client"; + $label1 = 'Client:'; + + $filtervalue1 = $this->createElement('select', 'filtervalue'); + $filtervalue1 ->setLabel($label1); + if(count($this->selectData['clients']) > 0) { + foreach($this->selectData['clients'] as $id => $g) { + $filtervalue1->addMultiOption($g['clientID'], $g['macadress']." - ".$g['hardwarehash']); + } + } + $filtervalue1->setRegisterInArrayValidator(false); + break; + case "9": + $desc = "Define a Hardwarehash"; + $label1 = 'Hardwarehash:'; + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(32, 32)), + ), + 'required' => true, + 'id' => 'val1' + )); + break; + case "10": + $desc = "Specify the Weekday (Monday:1, Tuesday:2 ... Sunday:7) or a range"; + $label1 = 'Start Day:'; + $label2 = 'End Day:'; + + + + $filtervalue1 = $this->createElement('select', 'filtervalue', array( + 'label' => $label1, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val1' + )); + $filtervalue1->addMultiOption(1, "Monday") + ->addMultiOption(2, "Tuesday") + ->addMultiOption(3, "Wednesday") + ->addMultiOption(4, "Thursday") + ->addMultiOption(5, "Friday") + ->addMultiOption(6, "Saturday") + ->addMultiOption(7, "Sunday"); + + + $filtervalue2 = $this->createElement('select', 'filtervalue2', array( + 'label' => $label2, + 'validators' => array( + array( + 'regex', + false, + array( + '/^([1-7])$/i', + 'messages' => array( + Zend_Validate_Regex::NOT_MATCH => "'%value%' is not a valid Day-Format, It must be betweeen 1 and 7", + Zend_Validate_Regex::INVALID => 'Day contains invalid characters.' + ) + ) + ) + ), + 'required' => true, + 'id' => 'val2' + )); + $filtervalue2->addMultiOption(1, "Monday") + ->addMultiOption(2, "Tuesday") + ->addMultiOption(3, "Wednesday") + ->addMultiOption(4, "Thursday") + ->addMultiOption(5, "Friday") + ->addMultiOption(6, "Saturday") + ->addMultiOption(7, "Sunday"); + break; + case "11": + $desc = "Specify the date or a day range of the filter"; + $label1 = 'Start Date:'; + $label2 = 'End Date:'; + + $filtervalue1 = $this->createElement('text', 'filtervalue', array( + 'label' => $label1, + 'required' => true, + 'id' => 'val1' + )); + $filtervalue1->addValidator('Date', false, array('format' => 'dd.MM.yyyy')); + + $filtervalue2 = $this->createElement('text', 'filtervalue2', array( + 'label' => $label2, + 'required' => true, + 'id' => 'val2' + )); + $filtervalue2->addValidator('Date', false, array('format' => 'dd.MM.yyyy')); + echo '<script type="text/javascript"> + $(function() { + $( "#val1" ).datepicker({ dateFormat: "dd.mm.yy"}); + $( "#val2" ).datepicker({ dateFormat: "dd.mm.yy"}); + }); + </script>'; + break; + } + $filtertypes->setDescription($desc); + $this->addElement($filtertypes); + + + + $this->addElement($filtervalue1); + if(isset($filtervalue2 )) { + $this->addElement($filtervalue2); + } + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' + )); + + $this->addElement('hidden', 'filterID', array( + 'value' => $this->filterID + )); + + + } } -?> -<script type="text/javascript"> - $('#filtertype').change(function(){ - //alert($("#filtertype option:selected").val()); - $('#filterentryform').submit(); - }); - $('#val1').focusout(function(){ - if($("#filtertype option:selected").val() == 1 && $('#val2').val() == ""){ - $('#val2').val($('#val1').val()); - } - if($("#filtertype option:selected").val() == 2 && $('#val2').val() == ""){ - $('#val2').val($('#val1').val()); - } - }); -</script> +? > +< script type = "text/javascript" > +$('#filtertype').change(function() { + //alert($("#filtertype option:selected").val()); + $('#filterentryform').submit(); +}); +$('#val1').focusout(function() { + if($("#filtertype option:selected").val() == 1 && $('#val2').val() == "") { + $('#val2').val($('#val1').val()); + } + if($("#filtertype option:selected").val() == 2 && $('#val2').val() == "") { + $('#val2').val($('#val1').val()); + } +}); +< / script > diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php index 9bf1e81..8ad3364 100644 --- a/application/modules/user/forms/GroupAdd.php +++ b/application/modules/user/forms/GroupAdd.php @@ -1,74 +1,72 @@ -<?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/ - */ +* 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_GroupAdd extends Zend_Form -{ - private $grouplist; +class user_Form_GroupAdd extends Zend_Form { + private $grouplist; - public function setGrouplist($grouplist){ - $this->grouplist = $grouplist; - - } + public function setGrouplist($grouplist) { + $this->grouplist = $grouplist; + } - public function init() - { - $this->setName("GroupAdd"); - $this->setMethod('post'); - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); + public function init() { + $this->setName("GroupAdd"); + $this->setMethod('post'); - $this->addElement('text', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'label' => 'Description:', - )); - /* - $groupfield = $this->createElement('select','superordinatedGroupID'); - $groupfield ->setLabel('superordinated Group:'); + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); - $groupfield->addMultiOption('-1', '---- none ----'); + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + )); + /* + $groupfield = $this->createElement('select','superordinatedGroupID'); + $groupfield ->setLabel('superordinated Group:'); - if(count($this->grouplist)>0){ - foreach($this->grouplist as $group => $g){ - $groupfield->addMultiOption($g->getID(), $g->getTitle()); - } - } - $groupfield->setRegisterInArrayValidator(false); - $this->addElement($groupfield); - */ - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Add', - )); + $groupfield->addMultiOption('-1', '---- none ----'); - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + */ + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Add', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php index 41924c3..d428f23 100644 --- a/application/modules/user/forms/GroupEdit.php +++ b/application/modules/user/forms/GroupEdit.php @@ -1,60 +1,58 @@ -<?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_GroupEdit extends Zend_Form -{ - private $groupID; - - public function setGroupID($groupID){ - $this->groupID = $groupID; - - } - - public function init() - { - $this->setName("GroupEdit"); - $this->setMethod('post'); - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - 'value' => $_POST['title'], - )); - - $this->addElement('text', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'label' => 'Description:', - 'value' => $_POST['description'], - )); - - $this->addElement('submit', 'save', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Save', - )); - - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } +* 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_GroupEdit extends Zend_Form { + private $groupID; + + public function setGroupID($groupID) { + $this->groupID = $groupID; + + } + + public function init() { + $this->setName("GroupEdit"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $_POST['title'], + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + 'value' => $_POST['description'], + )); + + $this->addElement('submit', 'save', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } }
\ No newline at end of file diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php index 9ff2fa2..0b82ed3 100644 --- a/application/modules/user/forms/GroupLink.php +++ b/application/modules/user/forms/GroupLink.php @@ -1,67 +1,65 @@ -<?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/ - */ +* 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_GroupLink extends Zend_Form -{ - private $grouplist; +class user_Form_GroupLink extends Zend_Form { + private $grouplist; - public function setGrouplist($grouplist){ - $this->grouplist = $grouplist; - - } + public function setGrouplist($grouplist) { + $this->grouplist = $grouplist; - public function init() - { - $this->setName("GroupLink"); - $this->setMethod('post'); - -/* - $groupfield1 = $this->createElement('select','superordinatedGroupID'); - $groupfield1 ->setLabel('Parent Group:'); + } + + public function init() { + $this->setName("GroupLink"); + $this->setMethod('post'); + + /* + $groupfield1 = $this->createElement('select','superordinatedGroupID'); + $groupfield1 ->setLabel('Parent Group:'); - if(count($this->grouplist)>0){ - foreach($this->grouplist as $group => $g){ - $groupfield1->addMultiOption($g->getID(), $g->getTitle()); - } - } - $groupfield1->setRegisterInArrayValidator(false); - $this->addElement($groupfield1); - */ + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield1->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield1->setRegisterInArrayValidator(false); + $this->addElement($groupfield1); + */ - $groupfield = $this->createElement('select','groupID'); - $groupfield ->setLabel('Group:'); - $groupfield->setAttrib('onchange', "reloadGraph();"); + $groupfield = $this->createElement('select', 'groupID'); + $groupfield ->setLabel('Group:'); + $groupfield->setAttrib('onchange', "reloadGraph();"); - if(count($this->grouplist)>0){ - foreach($this->grouplist as $group => $g){ - $groupfield->addMultiOption($g->getID(), $g->getTitle()); - } - } - $groupfield->setRegisterInArrayValidator(false); - $this->addElement($groupfield); + if(count($this->grouplist) > 0) { + foreach($this->grouplist as $group => $g) { + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); - $this->addElement('submit', 'link', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Link', - )); + $this->addElement('submit', 'link', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Link', + )); - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/GroupRequest.php b/application/modules/user/forms/GroupRequest.php index 8cf033c..a5fe5ab 100644 --- a/application/modules/user/forms/GroupRequest.php +++ b/application/modules/user/forms/GroupRequest.php @@ -1,59 +1,57 @@ -<?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_GroupRequest extends Zend_Form -{ - private $grouplist; - - public function setGrouplist($grouplist){ - $this->grouplist = $grouplist; - - } - - public function getGrouplist(){ - return $this->grouplist; - } - - public function init() - { - $this->setName("GroupRequest"); - $this->setMethod('post'); - - $groupfield = $this->createElement('select','groupID'); - $groupfield ->setLabel('Group:'); - - if(count($this->grouplist)>0){ - foreach($this->grouplist as $group => $g){ - $groupfield->addMultiOption($g->getID(), $g->getTitle()); - } - } - - $groupfield->setRegisterInArrayValidator(false); - $this->addElement($groupfield); - - $this->addElement('submit', 'request', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Request', - )); - - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - - } +* 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_GroupRequest extends Zend_Form { + private $grouplist; + + public function setGrouplist($grouplist) { + $this->grouplist = $grouplist; + + } + + public function getGrouplist() { + return $this->grouplist; + } + + public function init() { + $this->setName("GroupRequest"); + $this->setMethod('post'); + + $groupfield = $this->createElement('select', 'groupID'); + $groupfield ->setLabel('Group:'); + + if(count($this->grouplist) > 0) { + foreach($this->grouplist as $group => $g) { + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + + $this->addElement('submit', 'request', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Request', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + + } } diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php index 80d0402..ad4585b 100644 --- a/application/modules/user/forms/LinkRight.php +++ b/application/modules/user/forms/LinkRight.php @@ -1,75 +1,73 @@ -<?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/ - */ +* 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_LinkRight extends Zend_Form -{ - private $rightlist; +class user_Form_LinkRight extends Zend_Form { + private $rightlist; - public function setRightlist($rightlist){ - $this->rightlist = $rightlist; - } + public function setRightlist($rightlist) { + $this->rightlist = $rightlist; + } - public function init() - { - $this->setName("LinkRights"); - $this->setMethod('post'); + public function init() { + $this->setName("LinkRights"); + $this->setMethod('post'); - $sform = new Zend_Form_SubForm(array('legend' => 'Rights:')); - - $sform->addElement('button', 'checkAll', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Check All', - 'class' => 'leftbutton', - 'onclick' => "checkAllCheckBoxes();", - )); - - $sform->addElement('button', 'uncheckAll', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Uncheck All', - 'onclick' => "uncheckAllCheckBoxes();", - )); - - if(count($this->rightlist) > 0) { - foreach($this->rightlist as $rightcategory => $rights) { - foreach($rights as $rightID => $rightTitle) { - $element = $this->createElement('checkbox', "$rightID", array( - 'label' => $rightTitle . ':', - 'belongsTo' => 'rights', - )); - $elements[] = $rightID; - $sform->addElement($element); - } - $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":")); - unset($elements); - } - } - - $this->addSubForm($sform, 'rights'); + $sform = new Zend_Form_SubForm(array('legend' => 'Rights:')); - $this->addElement('submit', 'link', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Add Rights', - )); + $sform->addElement('button', 'checkAll', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Check All', + 'class' => 'leftbutton', + 'onclick' => "checkAllCheckBoxes();", + )); - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } + $sform->addElement('button', 'uncheckAll', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Uncheck All', + 'onclick' => "uncheckAllCheckBoxes();", + )); + + if(count($this->rightlist) > 0) { + foreach($this->rightlist as $rightcategory => $rights) { + foreach($rights as $rightID => $rightTitle) { + $element = $this->createElement('checkbox', "$rightID", array( + 'label' => $rightTitle . ':', + 'belongsTo' => 'rights', + )); + $elements[] = $rightID; + $sform->addElement($element); + } + $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":")); + unset($elements); + } + } + + $this->addSubForm($sform, 'rights'); + + $this->addElement('submit', 'link', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Add Rights', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/Login.php b/application/modules/user/forms/Login.php index d2dbd63..736841b 100644 --- a/application/modules/user/forms/Login.php +++ b/application/modules/user/forms/Login.php @@ -1,47 +1,45 @@ -<?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_Login extends Zend_Form -{ - - public function init() - { - $this->setName("LoginForm"); - $this->setMethod('post'); - - $this->addElement('text', 'email', array( - 'filters' => array('StringTrim', 'StringToLower'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'E-Mail:', - )); - - $this->addElement('password', 'password', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Password:', - )); - - $this->addElement('submit', 'login', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Login', - )); - } +* 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_Login extends Zend_Form { + + public function init() { + $this->setName("LoginForm"); + $this->setMethod('post'); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'E-Mail:', + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Password:', + )); + + $this->addElement('submit', 'login', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Login', + )); + } } diff --git a/application/modules/user/forms/MembershipSelect.php b/application/modules/user/forms/MembershipSelect.php index ea2804c..39ee52b 100644 --- a/application/modules/user/forms/MembershipSelect.php +++ b/application/modules/user/forms/MembershipSelect.php @@ -1,51 +1,49 @@ -<?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_MembershipSelect extends Zend_Form -{ - private $membershiplist; - - public function setMembershiplist($membershiplist){ - $this->membershiplist = $membershiplist; - - } - - public function getMembershiplist(){ - return $this->membershiplist; - } - - public function init() - { - $this->setName("MembershipSelect"); - $this->setMethod('post'); - - $membershipfield = $this->createElement('select','membershipID'); - $membershipfield ->setLabel('Membership:'); - - if(count($this->membershiplist)>0){ - foreach($this->membershiplist as $membership => $m){ - $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']); - } - } - - $membershipfield->setRegisterInArrayValidator(false); - $this->addElement($membershipfield); - - $this->addElement('submit', 'selectmembership', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Select', - )); - } +* 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_MembershipSelect extends Zend_Form { + private $membershiplist; + + public function setMembershiplist($membershiplist) { + $this->membershiplist = $membershiplist; + + } + + public function getMembershiplist() { + return $this->membershiplist; + } + + public function init() { + $this->setName("MembershipSelect"); + $this->setMethod('post'); + + $membershipfield = $this->createElement('select', 'membershipID'); + $membershipfield ->setLabel('Membership:'); + + if(count($this->membershiplist) > 0) { + foreach($this->membershiplist as $membership => $m) { + $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']); + } + } + + $membershipfield->setRegisterInArrayValidator(false); + $this->addElement($membershipfield); + + $this->addElement('submit', 'selectmembership', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Select', + )); + } } diff --git a/application/modules/user/forms/NewPassword.php b/application/modules/user/forms/NewPassword.php index 915620d..3d84406 100644 --- a/application/modules/user/forms/NewPassword.php +++ b/application/modules/user/forms/NewPassword.php @@ -1,47 +1,45 @@ -<?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_NewPassword extends Zend_Form -{ - private $personID; - - public function setPersonID($personID){ - $this->personID = $personID; - } - - public function init() - { - $this->setName("NewPassword"); - $this->setMethod('post'); - - $this->addElement('hidden', 'personID', array( - 'value' => $this->personID - )); - - $this->addElement('password', 'password', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Password:', - )); - - $this->addElement('submit', 'savePassword', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Save', - )); - } +* 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_NewPassword extends Zend_Form { + private $personID; + + public function setPersonID($personID) { + $this->personID = $personID; + } + + public function init() { + $this->setName("NewPassword"); + $this->setMethod('post'); + + $this->addElement('hidden', 'personID', array( + 'value' => $this->personID + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Password:', + )); + + $this->addElement('submit', 'savePassword', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + } } diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php index 09d090a..2a5f40a 100644 --- a/application/modules/user/forms/PersonEdit.php +++ b/application/modules/user/forms/PersonEdit.php @@ -1,126 +1,124 @@ -<?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_PersonEdit extends Zend_Form -{ - - public function init() - { - $this->setName("PersonEdit"); - $this->setMethod('post'); - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - 'value' => $this->getView()->person->getTitle(), - )); - - - $this->addElement('text', 'name', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Name:', - 'value' => $this->getView()->person->getName(), - )); - - $this->addElement('text', 'firstname', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Firstname:', - 'value' => $this->getView()->person->getFirstname(), - )); - - $this->addElement('text', 'street', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Street:', - 'value' => $this->getView()->person->getStreet(), - )); - - $this->addElement('text', 'housenumber', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Housenumber:', - 'value' => $this->getView()->person->getHousenumber(), - )); - - $this->addElement('text', 'city', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'City:', - 'value' => $this->getView()->person->getCity(), - )); - - $this->addElement('text', 'postalcode', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Postalcode:', - 'value' => $this->getView()->person->getPostalcode(), - )); - - $this->addElement('text', 'email', array( - 'filters' => array('StringTrim', 'StringToLower'), - 'validators' => array( - array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true), - ), - 'required' => true, - 'label' => 'Email:', - 'value' => $this->getView()->person->getEmail(), - )); - - $this->addElement('password', 'newpassword', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(5, 50)), - ), - 'required' => false, - 'label' => 'Neues Password:', - )); - - $this->addElement('submit', 'save', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Save', - )); - - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } +* 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_PersonEdit extends Zend_Form { + + public function init() { + $this->setName("PersonEdit"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $this->getView()->person->getTitle(), + )); + + + $this->addElement('text', 'name', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Name:', + 'value' => $this->getView()->person->getName(), + )); + + $this->addElement('text', 'firstname', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Firstname:', + 'value' => $this->getView()->person->getFirstname(), + )); + + $this->addElement('text', 'street', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Street:', + 'value' => $this->getView()->person->getStreet(), + )); + + $this->addElement('text', 'housenumber', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Housenumber:', + 'value' => $this->getView()->person->getHousenumber(), + )); + + $this->addElement('text', 'city', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'City:', + 'value' => $this->getView()->person->getCity(), + )); + + $this->addElement('text', 'postalcode', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Postalcode:', + 'value' => $this->getView()->person->getPostalcode(), + )); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(0, 50)), array('EmailAddress', "deep" => true, "mx" => true), + ), + 'required' => true, + 'label' => 'Email:', + 'value' => $this->getView()->person->getEmail(), + )); + + $this->addElement('password', 'newpassword', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(5, 50)), + ), + 'required' => false, + 'label' => 'Neues Password:', + )); + + $this->addElement('submit', 'save', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/Pool.php b/application/modules/user/forms/Pool.php index 4b30c9c..2fa05e1 100644 --- a/application/modules/user/forms/Pool.php +++ b/application/modules/user/forms/Pool.php @@ -1,68 +1,66 @@ -<?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/ - */ +* 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_Pool extends Zend_Form -{ - private $buttontext = 'Save'; - private $page; - - public function setButtontext($v){ - $this->buttontext = $v; - } - public function setPage($page){ - $this->page = $page; - } +class user_Form_Pool extends Zend_Form { + private $buttontext = 'Save'; + private $page; - public function init() - { - $this->setName("pool"); - $this->setMethod('post'); + public function setButtontext($v) { + $this->buttontext = $v; + } + public function setPage($page) { + $this->page = $page; + } - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 30)), - ), - 'required' => true, - 'label' => 'Title:', - )); - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'label' => 'Description:', - )); + public function init() { + $this->setName("pool"); + $this->setMethod('post'); - $this->addElement('text', 'location', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 30)), - ), - 'required' => true, - 'label' => 'Location:', - )); + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 30)), + ), + 'required' => true, + 'label' => 'Title:', + )); + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + )); - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => $this->buttontext, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/pool/index/page/'.$this->page.'"' - )); - } + $this->addElement('text', 'location', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 30)), + ), + 'required' => true, + 'label' => 'Location:', + )); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/pool/index/page/'.$this->page.'"' + )); + } } diff --git a/application/modules/user/forms/PoolClient.php b/application/modules/user/forms/PoolClient.php index 9acf21b..17b8ae8 100644 --- a/application/modules/user/forms/PoolClient.php +++ b/application/modules/user/forms/PoolClient.php @@ -1,53 +1,51 @@ -<?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/ - */ +* 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_PoolClient extends Zend_Form -{ - private $clients; - private $page; - private $buttontext = 'Save'; - - function setButtontext($v){ - $this->buttontext = $v; - } - public function setClients($clients){ - $this->clients = $clients; - return $this; - } - public function setPage($page){ - $this->page = $page; - } - - public function init() - { - $this->setName("addClientToPool"); - $this->setMethod('post'); - - $clientfield = $this->createElement('select','clientID'); - $clientfield ->setLabel('Client:'); - foreach($this->clients as $c){ - $clientfield->addMultiOption($c['clientID'],$c['macadress']." - ".$c['hardwarehash']); - } - $this->addElement($clientfield); - - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Save', - )); - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' - )); +class user_Form_PoolClient extends Zend_Form { + private $clients; + private $page; + private $buttontext = 'Save'; + + function setButtontext($v) { + $this->buttontext = $v; + } + public function setClients($clients) { + $this->clients = $clients; + return $this; + } + public function setPage($page) { + $this->page = $page; + } + + public function init() { + $this->setName("addClientToPool"); + $this->setMethod('post'); + + $clientfield = $this->createElement('select', 'clientID'); + $clientfield ->setLabel('Client:'); + foreach($this->clients as $c) { + $clientfield->addMultiOption($c['clientID'], $c['macadress']." - ".$c['hardwarehash']); } - + $this->addElement($clientfield); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/filter/index/page/'.$this->page.'"' + )); + } + } diff --git a/application/modules/user/forms/Preboot.php b/application/modules/user/forms/Preboot.php index f1a609f..a862fdf 100644 --- a/application/modules/user/forms/Preboot.php +++ b/application/modules/user/forms/Preboot.php @@ -1,89 +1,87 @@ -<?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_Preboot extends Zend_Form -{ - - private $action; - private $page; - - public function setAction($action){ - $this->action = $action; - } - public function setPage($p){ - $this->page = $p; - } - - public function init() - { - $this->setName($this->action); - $this->setMethod('post'); - $this->setEnctype("multipart/form-data"); - - if (!Pbs_Acl::checkRight('pre') && $this->action == 'editpreboot') - $meta = true; - else - $meta = null; - - if($this->action == 'editpreboot') - $filereq = false; - else - $filereq = true; - - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); - - $this->addElement('textarea', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'rows' => 5, - 'cols' => 50, - 'label' => 'Description:', - )); - - $this->addElement('file', 'preboot', array( - 'validators' => array(array('Extension', false, array('zip'))), - 'required' => $filereq, - 'readOnly' => $meta, - 'label' => 'Preboot:', - )); - - if($this->action == "createpreboot") - $label = "Create Preboot"; - else - $label = "Edit Preboot"; - - $this->addElement('submit', $this->action, array( - 'required' => false, - 'ignore' => true, - 'label' => $label, - )); - - $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/user/preboot/index/page/'.$this->page.'"' - )); - - } - - +* 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_Preboot extends Zend_Form { + + private $action; + private $page; + + public function setAction($action) { + $this->action = $action; + } + public function setPage($p) { + $this->page = $p; + } + + public function init() { + $this->setName($this->action); + $this->setMethod('post'); + $this->setEnctype("multipart/form-data"); + + if (!Pbs_Acl::checkRight('pre') && $this->action == 'editpreboot') + { $meta = true; } + else + { $meta = null; } + + if($this->action == 'editpreboot') + { $filereq = false; } + else + { $filereq = true; } + + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'rows' => 5, + 'cols' => 50, + 'label' => 'Description:', + )); + + $this->addElement('file', 'preboot', array( + 'validators' => array(array('Extension', false, array('zip'))), + 'required' => $filereq, + 'readOnly' => $meta, + 'label' => 'Preboot:', + )); + + if($this->action == "createpreboot") + { $label = "Create Preboot"; } + else + { $label = "Edit Preboot"; } + + $this->addElement('submit', $this->action, array( + 'required' => false, + 'ignore' => true, + 'label' => $label, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/preboot/index/page/'.$this->page.'"' + )); + + } + + } diff --git a/application/modules/user/forms/RecoverPassword.php b/application/modules/user/forms/RecoverPassword.php index 0e064b0..28ce336 100644 --- a/application/modules/user/forms/RecoverPassword.php +++ b/application/modules/user/forms/RecoverPassword.php @@ -1,37 +1,35 @@ -<?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/ - */ +* 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_RecoverPassword extends Zend_Form -{ +class user_Form_RecoverPassword extends Zend_Form { - public function init() - { - $this->setName("RecoverPassword"); - $this->setMethod('post'); + public function init() { + $this->setName("RecoverPassword"); + $this->setMethod('post'); - $this->addElement('text', 'email', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 30)), - ), - 'required' => true, - 'label' => 'Email:', - )); - $this->addElement('submit', 'recoverPassword', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Recover', - )); - } + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 30)), + ), + 'required' => true, + 'label' => 'Email:', + )); + $this->addElement('submit', 'recoverPassword', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Recover', + )); + } } diff --git a/application/modules/user/forms/Register.php b/application/modules/user/forms/Register.php index 0808088..baa7cdd 100644 --- a/application/modules/user/forms/Register.php +++ b/application/modules/user/forms/Register.php @@ -1,113 +1,111 @@ -<?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_Register extends Zend_Form -{ - - public function init() - { - $this->setName("Register"); - $this->setMethod('post'); - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); - - - $this->addElement('text', 'name', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Name:', - )); - - $this->addElement('text', 'firstname', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Firstname:', - )); - - $this->addElement('text', 'street', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Street:', - )); - - $this->addElement('text', 'housenumber', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Housenumber:', - )); - - $this->addElement('text', 'city', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'City:', - )); - - $this->addElement('text', 'postalcode', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Postalcode:', - )); - - $this->addElement('text', 'email', array( - 'filters' => array('StringTrim', 'StringToLower'), - 'validators' => array( - array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true), - ), - 'required' => true, - 'label' => 'Email:', - )); - - $this->addElement('password', 'password', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(5, 50)), - ), - 'required' => true, - 'label' => 'Password:', - )); - - $this->addElement('submit', 'register', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Register', - )); - - - } +* 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_Register extends Zend_Form { + + public function init() { + $this->setName("Register"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + + $this->addElement('text', 'name', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Name:', + )); + + $this->addElement('text', 'firstname', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Firstname:', + )); + + $this->addElement('text', 'street', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Street:', + )); + + $this->addElement('text', 'housenumber', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Housenumber:', + )); + + $this->addElement('text', 'city', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'City:', + )); + + $this->addElement('text', 'postalcode', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Postalcode:', + )); + + $this->addElement('text', 'email', array( + 'filters' => array('StringTrim', 'StringToLower'), + 'validators' => array( + array('StringLength', false, array(0, 50)), array('EmailAddress', "deep" => true, "mx" => true), + ), + 'required' => true, + 'label' => 'Email:', + )); + + $this->addElement('password', 'password', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(5, 50)), + ), + 'required' => true, + 'label' => 'Password:', + )); + + $this->addElement('submit', 'register', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Register', + )); + + + } diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php index e44c2a3..36f602e 100644 --- a/application/modules/user/forms/RoleAdd.php +++ b/application/modules/user/forms/RoleAdd.php @@ -1,120 +1,118 @@ -<?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_RoleAdd extends Zend_Form -{ - private $rightlist; - private $inheritanceright; - private $addrighttoroleright; - - public function setRightlist($rightlist){ - $this->rightlist = $rightlist; - } - - public function setAddrighttoroleright($addrighttoroleright){ - $this->addrighttoroleright = $addrighttoroleright; - } - - public function setInheritanceright($inheritanceright){ - $this->inheritanceright = $inheritanceright; - } - - public function init() - { - $this->setName("RoleAdd"); - $this->setMethod('post'); - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - )); - - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => false, - 'label' => 'Title:', - )); - - $this->addElement('text', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'label' => 'Description:', - 'value' => $_POST['description'], - )); - - if($this->addrighttoroleright) { - $sform = new Zend_Form_SubForm(array('legend' => 'Rights:')); - $sform->addElement('button', 'checkAll', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Check All', - 'class' => 'leftbutton', - 'onclick' => "checkAllCheckBoxes(new Array('inheritance'));", - )); - - $sform->addElement('button', 'uncheckAll', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Uncheck All', - 'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));", - )); - - if(count($this->rightlist) > 0) { - foreach($this->rightlist as $rightcategory => $rights) { - foreach($rights as $rightID => $rightTitle) { - $element = $this->createElement('checkbox', "$rightID", array( - 'label' => $rightTitle . ':', - 'belongsTo' => 'rights', - )); - $elements[] = $rightID; - $sform->addElement($element); - } - $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":")); - unset($elements); - } - } - - $this->addSubForm($sform, 'rights'); - } - - if($this->inheritanceright) { - $this->addElement('checkbox', 'inheritance', array( - 'label' => 'Inheritance:', - )); - } - - $this->addElement('submit', 'add', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Add', - )); - - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } +* 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_RoleAdd extends Zend_Form { + private $rightlist; + private $inheritanceright; + private $addrighttoroleright; + + public function setRightlist($rightlist) { + $this->rightlist = $rightlist; + } + + public function setAddrighttoroleright($addrighttoroleright) { + $this->addrighttoroleright = $addrighttoroleright; + } + + public function setInheritanceright($inheritanceright) { + $this->inheritanceright = $inheritanceright; + } + + public function init() { + $this->setName("RoleAdd"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'Title:', + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + 'value' => $_POST['description'], + )); + + if($this->addrighttoroleright) { + $sform = new Zend_Form_SubForm(array('legend' => 'Rights:')); + $sform->addElement('button', 'checkAll', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Check All', + 'class' => 'leftbutton', + 'onclick' => "checkAllCheckBoxes(new Array('inheritance'));", + )); + + $sform->addElement('button', 'uncheckAll', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Uncheck All', + 'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));", + )); + + if(count($this->rightlist) > 0) { + foreach($this->rightlist as $rightcategory => $rights) { + foreach($rights as $rightID => $rightTitle) { + $element = $this->createElement('checkbox', "$rightID", array( + 'label' => $rightTitle . ':', + 'belongsTo' => 'rights', + )); + $elements[] = $rightID; + $sform->addElement($element); + } + $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":")); + unset($elements); + } + } + + $this->addSubForm($sform, 'rights'); + } + + if($this->inheritanceright) { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + } + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Add', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php index 1505e78..68a740d 100644 --- a/application/modules/user/forms/RoleEdit.php +++ b/application/modules/user/forms/RoleEdit.php @@ -1,83 +1,81 @@ -<?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/ - */ +* 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_RoleEdit extends Zend_Form -{ - private $roleID; - private $inheritanceright; +class user_Form_RoleEdit extends Zend_Form { + private $roleID; + private $inheritanceright; - public function setRoleID($roleID){ - $this->roleID = $roleID; - } + public function setRoleID($roleID) { + $this->roleID = $roleID; + } - public function setInheritanceright($inheritanceright){ - $this->inheritanceright = $inheritanceright; - } + public function setInheritanceright($inheritanceright) { + $this->inheritanceright = $inheritanceright; + } - public function init() - { - $this->setName("RoleEdit"); - $this->setMethod('post'); + public function init() { + $this->setName("RoleEdit"); + $this->setMethod('post'); - $this->addElement('text', 'title', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'Title:', - 'value' => $_POST['title'], - )); + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $_POST['title'], + )); - $this->addElement('text', 'description', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 140)), - ), - 'required' => false, - 'label' => 'Description:', - 'value' => $_POST['description'], - )); + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + 'value' => $_POST['description'], + )); - if($this->inheritanceright) { - if($_POST['inheritance'] == 1) { - $this->addElement('checkbox', 'inheritance', array( - 'label' => 'Inheritance:', - 'checked' => 'checked', - )); - } else { - $this->addElement('checkbox', 'inheritance', array( - 'label' => 'Inheritance:', - )); - } - } + if($this->inheritanceright) { + if($_POST['inheritance'] == 1) { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + 'checked' => 'checked', + )); + } else { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + } + } - $this->addElement('hidden', 'groupID', array( - 'value' => $_POST['groupID'], - )); + $this->addElement('hidden', 'groupID', array( + 'value' => $_POST['groupID'], + )); - $this->addElement('submit', 'save', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Save', - )); + $this->addElement('submit', 'save', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="javascript:history.back();"', - )); - } + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="javascript:history.back();"', + )); + } } |