From 3d04fb75a980dba20e51dc91afd49f0eb9ee43fe Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 9 Mar 2011 16:31:58 +0100 Subject: Form-Verhalten geändert & Datenbank korrigiert --- application/forms/FilterAdd.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'application/forms') diff --git a/application/forms/FilterAdd.php b/application/forms/FilterAdd.php index af4f9b2..091eb37 100644 --- a/application/forms/FilterAdd.php +++ b/application/forms/FilterAdd.php @@ -2,6 +2,7 @@ class Application_Form_FilterAdd extends Zend_Form { + private $bootmenus; public function init() { @@ -22,14 +23,16 @@ class Application_Form_FilterAdd extends Zend_Form 'label' => 'Description:', )); - $this->addElement('text', 'bootmenuID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'bootmenuID:', - )); + $bootmenufield = $this->createElement('select','bootmenuID'); + $bootmenufield ->setLabel('Bootmenu:'); + + if(count($this->bootmenus)>0){ + foreach($this->bootmenus as $id => $g){ + $bootmenufield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootmenufield->setRegisterInArrayValidator(false); + $this->addElement($bootmenufield); $this->addElement('text', 'priority', array( 'filters' => array('StringTrim'), @@ -45,7 +48,10 @@ class Application_Form_FilterAdd extends Zend_Form 'label' => 'Save', )); } - + function setBootmenus($val){ + $this->bootmenus = $val; + return; + } } -- cgit v1.2.3-55-g7522 From 431b51eba154912c7a636f54cf8de918c7c09147 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 9 Mar 2011 18:37:34 +0100 Subject: Testen der Filter mit Dummywerten über Formular möglich --- .zfproject.xml | 5 + application/controllers/FilterController.php | 400 +++++++++++++-------- application/forms/FilterEvaluate.php | 123 +++++++ application/layouts/main.phtml | 1 + application/views/scripts/filter/index.phtml | 3 + .../views/scripts/filter/testevaluate.phtml | 4 + pbs-data.sql | 1 + public/media/css/style.css | 1 + 8 files changed, 392 insertions(+), 146 deletions(-) create mode 100644 application/forms/FilterEvaluate.php create mode 100644 application/views/scripts/filter/testevaluate.phtml (limited to 'application/forms') diff --git a/.zfproject.xml b/.zfproject.xml index 1147d7a..4ff354b 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -33,6 +33,7 @@ + @@ -102,6 +103,7 @@ + @@ -309,6 +311,9 @@ + + + diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php index 2853706..d17aceb 100644 --- a/application/controllers/FilterController.php +++ b/application/controllers/FilterController.php @@ -4,31 +4,33 @@ class FilterController extends Zend_Controller_Action { private $_filtermapper = null; - private $db; + + private $db = null; + public function init() { try{ - - $this->_filtermapper = new Application_Model_FilterMapper(); - }catch (Zend_Exception $e) { - echo "Error message 1: " . $e->getMessage() . "\n"; - } - $this->db = Zend_Db_Table::getDefaultAdapter(); + + $this->_filtermapper = new Application_Model_FilterMapper(); + }catch (Zend_Exception $e) { + echo "Error message 1: " . $e->getMessage() . "\n"; + } + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() { try{ - $this->_filtermapper = new Application_Model_FilterMapper(); - $this->view->filters = $this->_filtermapper->fetchAll(); - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; - } - } + $this->_filtermapper = new Application_Model_FilterMapper(); + $this->view->filters = $this->_filtermapper->fetchAll(); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } public function addfilterAction() { - $bmmapper = new Application_Model_BootMenuMapper(); + $bmmapper = new Application_Model_BootMenuMapper(); //TODO get bootmenu by group $bootmenus = $bmmapper->fetchAll(); if (!isset($_POST["add"])){ @@ -60,65 +62,63 @@ class FilterController extends Zend_Controller_Action public function removefilterAction() { - - $filterID = $this->_request->getParam('filterID'); - // TODO: ACL implementieren ob er den filter löschen darf - if(is_numeric($filterID)){ - $deletefilter = new Application_Model_Filter(); - $deletefilter->setID($filterID); - $filtermapper = new Application_Model_FilterMapper(); - $filtermapper->delete($deletefilter); - } - $this->_redirect('/filter'); + $filterID = $this->_request->getParam('filterID'); + // TODO: ACL implementieren ob er den filter löschen darf + if(is_numeric($filterID)){ + $deletefilter = new Application_Model_Filter(); + $deletefilter->setID($filterID); + $filtermapper = new Application_Model_FilterMapper(); + $filtermapper->delete($deletefilter); + } + $this->_redirect('/filter'); } public function editfilterAction() { - $bmmapper = new Application_Model_BootMenuMapper(); - //TODO get bootmenu by group - $bootmenus = $bmmapper->fetchAll(); - if (!isset($_POST["add"])){ - // TODO: ACL implementieren ob er editieren darf - $filterID = $this->_request->getParam('filterID'); - $filter = new Application_Model_Filter(); - - - $filtermapper = new Application_Model_FilterMapper(); - $filtermapper->find($filterID,$filter); - $filter2 = $filter->toArray(); - - $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus)); - $editfilterform->populate($filter2); - $this->view->editfilterform = $editfilterform; - - } else{ - try{ - $filterID = $this->_request->getParam('filterID'); - - $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST); - //TODO: ACL integrieren - $_POST['groupID'] = 1; - $_POST['membershipID'] = 1; - $_POST['created'] = time(); - - if ($editfilterform->isValid($_POST)) { - $newfilterenty = new Application_Model_Filter($_POST); - $newfilterenty->setID($this->_request->getParam('filterID')); - $newfilter2 = new Application_Model_FilterMapper(); - $newfilter2->save($newfilterenty); - echo 'valid'; - $this->_redirect('/filter'); - } - $this->view->editfilterform = $editfilterform; - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; - } - } + $bmmapper = new Application_Model_BootMenuMapper(); + //TODO get bootmenu by group + $bootmenus = $bmmapper->fetchAll(); + if (!isset($_POST["add"])){ + // TODO: ACL implementieren ob er editieren darf + $filterID = $this->_request->getParam('filterID'); + $filter = new Application_Model_Filter(); + + + $filtermapper = new Application_Model_FilterMapper(); + $filtermapper->find($filterID,$filter); + $filter2 = $filter->toArray(); + + $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus)); + $editfilterform->populate($filter2); + $this->view->editfilterform = $editfilterform; + + } else{ + try{ + $filterID = $this->_request->getParam('filterID'); + + $editfilterform = new Application_Form_FilterAdd(array('bootmenus'=>$bootmenus),$_POST); + //TODO: ACL integrieren + $_POST['groupID'] = 1; + $_POST['membershipID'] = 1; + $_POST['created'] = time(); + + if ($editfilterform->isValid($_POST)) { + $newfilterenty = new Application_Model_Filter($_POST); + $newfilterenty->setID($this->_request->getParam('filterID')); + $newfilter2 = new Application_Model_FilterMapper(); + $newfilter2->save($newfilterenty); + echo 'valid'; + $this->_redirect('/filter'); + } + $this->view->editfilterform = $editfilterform; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } } public function addfilterentryAction() { - // TODO: ACL implementieren ob er editieren darf if (!isset($_POST["add"])){ try{ @@ -150,7 +150,8 @@ class FilterController extends Zend_Controller_Action $this->view->editfilterform = $editfilterform; } } - public function editfilterentryAction() + + public function editfilterentryAction() { if (!isset($_POST["add"])){ echo "case1"; @@ -195,54 +196,86 @@ class FilterController extends Zend_Controller_Action $this->view->editfilterform = $editfilterform; }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; - } + } } } - public function removefilterentryAction() - { - - try{ - $filterentriesID = $this->_request->getParam('filterentriesID'); - - // TODO: ACL implementieren ob er den filter löschen darf - if(is_numeric($filterentriesID)){ - $deletefilterentry = new Application_Model_FilterEntries(); - $deletefilterentry->setID($filterentriesID); - echo "
";
-				print_r($deletefilterentry);
-				echo "
"; - $filterentriesmapper = new Application_Model_FilterEntriesMapper(); - $filterentriesmapper->delete($deletefilterentry); - echo "ok"; + public function removefilterentryAction() + { + try{ + $filterentriesID = $this->_request->getParam('filterentriesID'); + + // TODO: ACL implementieren ob er den filter löschen darf + if(is_numeric($filterentriesID)){ + $deletefilterentry = new Application_Model_FilterEntries(); + $deletefilterentry->setID($filterentriesID); + echo "
";
+        				print_r($deletefilterentry);
+        				echo "
"; + + $filterentriesmapper = new Application_Model_FilterEntriesMapper(); + $filterentriesmapper->delete($deletefilterentry); + echo "ok"; + } + $this->_redirect('/filter'); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; } -# echo "ready"; - $this->_redirect('/filter'); - }catch (Zend_Exception $e) { - echo "Error message 2: " . $e->getMessage() . "\n"; - } } - private function fillIP($ip){ - $ar = explode(".",$ip); - $representation = array(); - foreach($ar as $part){ - $representation[] = sprintf("%03s",$part); - } - return implode(".",$representation); - } - private function fillMac($ip){ - $ar = explode(":",$ip); - $representation = array(); - foreach($ar as $part){ - $representation[] = sprintf("%02s",$part); + + private function fillIP($ip) + { + $ar = explode(".",$ip); + $representation = array(); + foreach($ar as $part){ + $representation[] = sprintf("%03s",$part); + } + return implode(".",$representation); + } + + private function fillMac($ip) + { + $ar = explode(":",$ip); + $representation = array(); + foreach($ar as $part){ + $representation[] = sprintf("%02s",$part); + } + return implode(":",$representation); + } + + public function evaluateAction() + { + $db = $this->db; + $showPartResults = false; + // For Testing Filters + + + $testFilter = (isset($_POST['submit']))?true:false; + + if($testFilter){ + $ipAdress = $_POST['ip']; + $macAdress = $_POST['mac']; + $poolID = $_POST['poolID']; + $bootisoID = $_POST['bootisoID']; + $membershipID = $_POST['membershipID']; + $groupID = $_POST['groupID']; + $time = strtotime($_POST['time']); + $clientID = $_POST['clientID']; + print_a('Input', + array('ipAdress'=>$ipAdress, + 'macAdress'=>$macAdress, + 'poolID' => $poolID, + 'bootisoID' => $bootisoID, + 'membershipID'=>$membershipID, + 'groupID'=>$groupID, + 'time'=>$time." - ".date('d.m.Y H:i:s',$time), + 'clientID' => $clientID)); } - return implode(":",$representation); - } - public function evaluateAction(){ - $db = $this->db; - $showPartResults = false; + + try{ $mysession = '1'; + $set = array(); $filtertypID = 8; $session = new Application_Model_Session(); @@ -252,31 +285,37 @@ class FilterController extends Zend_Controller_Action // IP Adress $filtertypID = 1; // get it from session_table with session_id from the session - $ipAdress = $session->getIp(); + if(!$testFilter){ + $ipAdress = $session->getIp(); + } $ipAdress = str_replace(".","",$this->fillIP($ipAdress)); + $select = $db->select() - ->from(array('pbs_filterentries') + ->from(array('pbs_filterentries') ) ->where('filtertypeID = ?',$filtertypID) ->where('REPLACE(filtervalue,".","") <= ?',$ipAdress) ->where('? <= REPLACE(filtervalue2,".","")',$ipAdress); - + $stmt = $select->query(); $result = $stmt->fetchAll(); foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('ipAdress',$result,$set[$filtertypID]); + ######################################################### // Mac range $filtertypID = 2; // get it from session_table with session_id from the session - $client = new Application_Model_Client(); - $clientmapper = new Application_Model_ClientMapper(); - $clientmapper->find($session->getClientID(),$client); - - $macAdress = $client->getMacadress(); + if(!$testFilter){ + $client = new Application_Model_Client(); + $clientmapper = new Application_Model_ClientMapper(); + $clientmapper->find($session->getClientID(),$client); + $macAdress = $client->getMacadress(); + } $macAdress = str_replace(":","",$this->fillMac($ipAdress)); $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND @@ -288,44 +327,60 @@ class FilterController extends Zend_Controller_Action } if($showPartResults) print_a('macAdress',$result,$set[$filtertypID]); + ######################################################### // PoolID $filtertypID = 3; // get PoolID from client_ID from session_id from the session - $poolentry = new Application_Model_PoolEntries(); - $poolentrymapper = new Application_Model_PoolEntriesMapper(); - $poolentry = $poolentrymapper->findby('clientID',$client->getID()); - $poolentry = $poolentry[0]; + if(!$testFilter){ + $poolentry = new Application_Model_PoolEntries(); + $poolentrymapper = new Application_Model_PoolEntriesMapper(); + $poolentry = $poolentrymapper->findby('clientID',$client->getID()); + $poolentry = $poolentry[0]; + + $poolID = $poolentry['poolID']; + } + - $poolID = $poolentry['poolID']; - print_a($poolentry); $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND - filtervalue = ".$poolID." "); + filtervalue = ".$poolID." "); $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + if(count($result)>0){ + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + if($showPartResults) print_a('poolID',$result,$set[$filtertypID]); ######################################################### // ClientID $filtertypID = 8; // get client_ID from session_id from the session + + if(!$testFilter){ + $clientID = $session->getClientID(); + } + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND - filtervalue = ".$session->getClientID()." "); + filtervalue = ".$clientID." "); $result = $stmt->fetchAll(); foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('clientID',$result,$set[$filtertypID]); ######################################################### // BootIsoID $filtertypID = 4; - // get BootIsoID from client_ID from session_id from the session - $bootisoID = $session->getBootisoID(); + // get BootIsoID from client_ID from session_id from the session + if(!$testFilter){ + $bootisoID = $session->getBootisoID(); + } + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND filtervalue = ".$bootisoID." "); @@ -333,14 +388,18 @@ class FilterController extends Zend_Controller_Action foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('bootisoID',$result,$set[$filtertypID]); ######################################################### // MembershipID $filtertypID = 5; + + if(!$testFilter){ // get membership from the session - //TODO: GET MEMBERSHIP from SESSION - $membershipID = 1; + //TODO: GET MEMBERSHIP from SESSION + $membershipID = 1; + } $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND @@ -349,14 +408,18 @@ class FilterController extends Zend_Controller_Action foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('membership',$result,$set[$filtertypID]); ######################################################### // GroupID $filtertypID = 6; + + if(!$testFilter){ // get membership from the session - //TODO: GET GROUP from SESSION - $groupID = 1; + //TODO: GET GROUP from SESSION + $groupID = 1; + } $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE filtertypeID = ".$filtertypID." AND @@ -365,35 +428,41 @@ class FilterController extends Zend_Controller_Action foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('membership',$result,$set[$filtertypID]); ######################################################### // Time $filtertypID = 7; - $nowShort = date('H-i',time()); - $nowLong = date('Y-m-d-H-i',time()); + if(!$testFilter){ + $time = time(); + } + + $nowShort = date('H-i',$time); + $nowLong = date('Y-m-d-H-i',$time); $nowShort = str_replace("-","",$nowShort); $nowLong = str_replace("-","",$nowLong); $select = $db->select() - ->from(array('pbs_filterentries') + ->from(array('pbs_filterentries') ) ->where('filtertypeID = ?',$filtertypID) ->where('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowShort) ->orWhere('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowLong); - + $stmt = $select->query(); $result = $stmt->fetchAll(); foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; } + if($showPartResults) print_a('time',$result,$set[$filtertypID]); ######################################## // ErgebnisSet auswerten print_a('the result sets of the filtertypes',$set); - + // Merging of the resultsets of the filter $kk = array(); foreach($set as $myset){ @@ -401,18 +470,21 @@ class FilterController extends Zend_Controller_Action } $set = $kk; // counting how often a filter is evaluated at database + $a = array(); foreach($set as $k=> $s){ $a[$s] += 1; } - + print_a('Übereinstimmungen pro Filter',$a); // Get the number of filtertypes every filter has $stmt = $db->query('SELECT filterID, COUNT(filtertypeID) as num FROM pbs_filterentries GROUP BY filterID'); $resultset = $stmt->fetchAll(); foreach($resultset as $d){ $database[$d['filterID']] = $d['num']; } - + print_a('Anzahl Filterentries in Datenbank',$database); + // remove all filters from resultset, which to few filtertypes satisfied + $result = array(); foreach($a as $i=>$b){ if($a[$i] < $database[$i]){ unset($a[$i]); @@ -421,8 +493,8 @@ class FilterController extends Zend_Controller_Action $result[] = $i; } } - - print_a('result set of filterIDs',$result); + + print_a('True Filters',$result); // now selecting the filter with the highest priority $query = 'SELECT filterID, bootmenuID, priority FROM pbs_filter WHERE '; @@ -431,16 +503,50 @@ class FilterController extends Zend_Controller_Action } $query .= implode(" OR ", $queryTmp); $query .= 'ORDER BY priority DESC LIMIT 0,1'; - $stmt = $db->query($query); - $resultset = $stmt->fetchAll(); - print_a($resultset); - echo "

".$resultset[0]['bootmenuID']."

"; - + $bootmenuID = 'null'; + try{ + $stmt = $db->query($query); + $resultset = $stmt->fetchAll(); + $bootmenuID = $resultset[0]['bootmenuID']; + } + catch(Exception $e){ + } + + echo "

Redirected BootmenuID: ".$bootmenuID."

"; + }catch (Zend_Exception $e) { echo "class: ".get_class($e)."
\n"; - echo "Error message 2: " . $e->getMessage() . "\n"; + echo "Error message 2: " . $e->getMessage() . "\n"; } - } + } + + public function testevaluateAction() + { + $pm = new Application_Model_PoolMapper(); + $pools = $pm->fetchAll(); + + $bim = new Application_Model_BootIsoMapper(); + $bootisos = $bim->fetchAll(); + + $mm = new Application_Model_MembershipMapper(); + $memberships = $mm->fetchAll(); + + $gm = new Application_Model_GroupMapper(); + $groups = $gm->fetchAll(); + + $cm = new Application_Model_ClientMapper(); + $clients = $cm->fetchAll(); + + $filterevaluate = new Application_Form_FilterEvaluate( + array( 'pools' => $pools, + 'bootisos' => $bootisos, + 'memberships' => $memberships, + 'groups' => $groups, + 'clients' => $clients + )); + $this->view->filterevaluate = $filterevaluate; + } + } @@ -452,3 +558,5 @@ class FilterController extends Zend_Controller_Action + + diff --git a/application/forms/FilterEvaluate.php b/application/forms/FilterEvaluate.php new file mode 100644 index 0000000..2c93aef --- /dev/null +++ b/application/forms/FilterEvaluate.php @@ -0,0 +1,123 @@ +setName("Test Filter"); + $this->setMethod('post'); + $this->setAction('/filter/evaluate'); + + $this->addElement('text', 'ip', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'IP:', + )); + ###################################### + $this->addElement('text', 'mac', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'Mac:', + )); + ###################################### + $poolfield = $this->createElement('select','poolID'); + $poolfield ->setLabel('Pool:'); + $poolfield->addMultiOption('',''); + if(count($this->pools)>0){ + foreach($this->pools as $id => $g){ + $poolfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $poolfield->setRegisterInArrayValidator(false); + $this->addElement($poolfield); + ###################################### + $bootisofield = $this->createElement('select','bootisoID'); + $bootisofield ->setLabel('BootIso:'); + $bootisofield->addMultiOption('',''); + if(count($this->bootisos)>0){ + foreach($this->bootisos as $id => $g){ + $bootisofield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootisofield->setRegisterInArrayValidator(false); + $this->addElement($bootisofield); + ###################################### + $membershipfield = $this->createElement('select','membershipID'); + $membershipfield ->setLabel('Membership:'); + $membershipfield->addMultiOption('',''); + if(count($this->memberships)>0){ + foreach($this->memberships as $id => $g){ + $membershipfield->addMultiOption($g->getID(), $g->getPersonID()); + } + } + $membershipfield->setRegisterInArrayValidator(false); + $this->addElement($membershipfield); + ###################################### + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + $groupfield->addMultiOption('',''); + if(count($this->groups)>0){ + foreach($this->groups as $id => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + ###################################### + $this->addElement('text', 'time', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => false, + 'label' => 'Time:', + )); + ###################################### + $clientfield = $this->createElement('select','clientID'); + $clientfield ->setLabel('Client:'); + $clientfield->addMultiOption('',''); + if(count($this->clients)>0){ + foreach($this->clients as $id => $g){ + $clientfield->addMultiOption($g->getID(), $g->getMacadress()); + } + } + $clientfield->setRegisterInArrayValidator(false); + $this->addElement($clientfield); + + $this->addElement('submit', 'submit', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Get It On!', + )); + } + function setPools($v){ + $this->pools = $v; + } + function setBootisos($v){ + $this->bootisos = $v; + } + function setMemberships($v){ + $this->memberships = $v; + } + function setGroups($v){ + $this->groups = $v; + } + function setClients($v){ + $this->clients = $v; + } + + +} + diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml index 3d95f2f..9ad6122 100644 --- a/application/layouts/main.phtml +++ b/application/layouts/main.phtml @@ -32,6 +32,7 @@ echo $this->headScript()."\n";
layout()->content; ?> +
diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml index a3d3efa..c14bf51 100644 --- a/application/views/scripts/filter/index.phtml +++ b/application/views/scripts/filter/index.phtml @@ -110,3 +110,6 @@

There are no filters to display.

+formButton('createconfig', 'Test Filters', array( + 'onclick' => 'self.location="/filter/testevaluate"', + 'class' => 'addbutton'))?> diff --git a/application/views/scripts/filter/testevaluate.phtml b/application/views/scripts/filter/testevaluate.phtml new file mode 100644 index 0000000..8a10629 --- /dev/null +++ b/application/views/scripts/filter/testevaluate.phtml @@ -0,0 +1,4 @@ +

Test Filters

+ +filterevaluate; diff --git a/pbs-data.sql b/pbs-data.sql index f80c8eb..a1f1c1b 100644 --- a/pbs-data.sql +++ b/pbs-data.sql @@ -77,5 +77,6 @@ INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `pat INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES (3, '1', '2', '3', '4', '5', '6', '7', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a'); +INSERT INTO `pbs`.`pbs_session` (`sessionID`, `clientID`, `bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES (NULL, '1', '1', '1', UNIX_TIMESTAMP(), '1.1.1.2', NULL); diff --git a/public/media/css/style.css b/public/media/css/style.css index ec6fcc7..6fe0906 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -126,3 +126,4 @@ tr td.action{ width:20px; } td.action img{border:none;} +.clear{clear:both;} -- cgit v1.2.3-55-g7522 From 5767c4f644a586d5f19e86fdd2de2ad47a21cb1a Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 9 Mar 2011 20:49:24 +0100 Subject: FilterController Evaluate funktioniert --- application/Bootstrap.php | 1 - application/controllers/FilterController.php | 139 +++++++++++++++----------- application/controllers/SessionController.php | 50 +++++++-- application/forms/Session.php | 71 ++++++++----- application/layouts/main.phtml | 3 + application/views/scripts/filter/index.phtml | 4 +- application/views/scripts/session/index.phtml | 2 +- pbs-newdata.sql | 125 +++++++++++++++++++++++ pbs.sql | 13 ++- public/media/css/style.css | 3 + zend-user.sh | 6 +- 11 files changed, 316 insertions(+), 101 deletions(-) create mode 100644 pbs-newdata.sql (limited to 'application/forms') diff --git a/application/Bootstrap.php b/application/Bootstrap.php index c286ad1..f0fe7d3 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -22,7 +22,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view->doctype('XHTML1_STRICT'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8'); $view->headLink()->appendStylesheet('/media/css/style.css'); - $view->headTitle()->setSeparator(' - '); $view->headTitle('pbs²') ->setSeparator(' :: '); } diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php index d17aceb..9141e10 100644 --- a/application/controllers/FilterController.php +++ b/application/controllers/FilterController.php @@ -316,15 +316,18 @@ class FilterController extends Zend_Controller_Action $clientmapper->find($session->getClientID(),$client); $macAdress = $client->getMacadress(); } - $macAdress = str_replace(":","",$this->fillMac($ipAdress)); - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - CONV(HEX('filtervalue'),16,10) <= CONV(HEX('".$macAdress."'),16,10) AND - CONV(HEX('".$macAdress."'),16,10) <= CONV(HEX('filtervalue2'),16,10)"); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $macAdress = str_replace(":","",$this->fillMac($ipAdress)); + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + CONV(HEX('filtervalue'),16,10) <= CONV(HEX('".$macAdress."'),16,10) AND + CONV(HEX('".$macAdress."'),16,10) <= CONV(HEX('filtervalue2'),16,10)"); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('macAdress',$result,$set[$filtertypID]); @@ -341,16 +344,18 @@ class FilterController extends Zend_Controller_Action $poolID = $poolentry['poolID']; } - - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - filtervalue = ".$poolID." "); - $result = $stmt->fetchAll(); - if(count($result)>0){ - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + filtervalue = ".$poolID." "); + $result = $stmt->fetchAll(); + if(count($result)>0){ + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } } + catch(Exception $e){} if($showPartResults) print_a('poolID',$result,$set[$filtertypID]); @@ -362,14 +367,16 @@ class FilterController extends Zend_Controller_Action if(!$testFilter){ $clientID = $session->getClientID(); } - - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - filtervalue = ".$clientID." "); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + filtervalue = ".$clientID." "); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('clientID',$result,$set[$filtertypID]); @@ -380,14 +387,16 @@ class FilterController extends Zend_Controller_Action if(!$testFilter){ $bootisoID = $session->getBootisoID(); } - - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - filtervalue = ".$bootisoID." "); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + filtervalue = ".$bootisoID." "); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('bootisoID',$result,$set[$filtertypID]); @@ -400,14 +409,16 @@ class FilterController extends Zend_Controller_Action //TODO: GET MEMBERSHIP from SESSION $membershipID = 1; } - - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - filtervalue = ".$membershipID." "); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + filtervalue = ".$membershipID." "); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('membership',$result,$set[$filtertypID]); @@ -420,14 +431,16 @@ class FilterController extends Zend_Controller_Action //TODO: GET GROUP from SESSION $groupID = 1; } - - $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE - filtertypeID = ".$filtertypID." AND - filtervalue = ".$groupID." "); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + try{ + $stmt = $db->query("SELECT * FROM pbs_filterentries WHERE + filtertypeID = ".$filtertypID." AND + filtervalue = ".$groupID." "); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('membership',$result,$set[$filtertypID]); @@ -443,19 +456,21 @@ class FilterController extends Zend_Controller_Action $nowShort = str_replace("-","",$nowShort); $nowLong = str_replace("-","",$nowLong); - - $select = $db->select() - ->from(array('pbs_filterentries') - ) - ->where('filtertypeID = ?',$filtertypID) - ->where('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowShort) - ->orWhere('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowLong); + try{ + $select = $db->select() + ->from(array('pbs_filterentries') + ) + ->where('filtertypeID = ?',$filtertypID) + ->where('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowShort) + ->orWhere('REPLACE(filtervalue,"-","") <= ? AND ? <= REPLACE(filtervalue2,"-","")',$nowLong); - $stmt = $select->query(); - $result = $stmt->fetchAll(); - foreach($result as $r){ - $set[$filtertypID][] = $r['filterID']; + $stmt = $select->query(); + $result = $stmt->fetchAll(); + foreach($result as $r){ + $set[$filtertypID][] = $r['filterID']; + } } + catch(Exception $e){} if($showPartResults) print_a('time',$result,$set[$filtertypID]); @@ -511,9 +526,16 @@ class FilterController extends Zend_Controller_Action } catch(Exception $e){ } + if($bootmenuID != 'null'){ + $bm = new Application_Model_BootMenu(); + $bmmapper = new Application_Model_BootMenuMapper(); + $bmmapper->find($bootmenuID,$bm); + echo "

Goto BootmenuID: ".$bootmenuID."

"; + } + else{ + echo "

No Result :-(

"; + } - echo "

Redirected BootmenuID: ".$bootmenuID."

"; - }catch (Zend_Exception $e) { echo "class: ".get_class($e)."
\n"; echo "Error message 2: " . $e->getMessage() . "\n"; @@ -542,7 +564,8 @@ class FilterController extends Zend_Controller_Action 'bootisos' => $bootisos, 'memberships' => $memberships, 'groups' => $groups, - 'clients' => $clients + 'clients' => $clients, + )); $this->view->filterevaluate = $filterevaluate; } diff --git a/application/controllers/SessionController.php b/application/controllers/SessionController.php index 21f94fa..09eadc9 100644 --- a/application/controllers/SessionController.php +++ b/application/controllers/SessionController.php @@ -16,16 +16,32 @@ class SessionController extends Zend_Controller_Action public function createsessionAction() { + $cm = new Application_Model_ClientMapper(); + $clients = $cm->fetchAll(); + + $bm = new Application_Model_BootOsMapper(); + $bootos = $bm->fetchAll(); + + $bi = new Application_Model_BootIsoMapper(); + $bootisos = $bi->fetchAll(); + if (!isset($_POST["add"])){ - $createsession = new Application_Form_Session(); + $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos)); $this->view->createsession = $createsession; }else { // TODO extend with normal function not only with post - $createsession = new Application_Form_Session($_POST); + $createsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST); print_a($_POST); if ($createsession->isValid($_POST)) { try{ $session = new Application_Model_Session($_POST); + $session->setTime(strtotime($_POST['time'])); + if($session->getClientID() == ''){ + $session->setClientID(null); + } + if($session->getBootosID() == ''){ + $session->setBootosID(null); + } $sessionmapper = new Application_Model_SessionMapper(); $sessionmapper->save($session); @@ -35,16 +51,22 @@ class SessionController extends Zend_Controller_Action echo "Error message 2: " . $e->getMessage() . "\n"; } print_a('saved'); - $this->_redirect('/session'); - } - else{ - print_a('not saved'); + #$this->_redirect('/session'); } + $this->view->createsession = $createsession; } } public function editsessionAction() { + $cm = new Application_Model_ClientMapper(); + $clients = $cm->fetchAll(); + + $bm = new Application_Model_BootOsMapper(); + $bootos = $bm->fetchAll(); + + $bi = new Application_Model_BootIsoMapper(); + $bootisos = $bi->fetchAll(); if (!isset($_POST["add"])){ // TODO: ACL implementieren ob er editieren darf $sessionID = $this->_request->getParam('sessionID'); @@ -52,10 +74,11 @@ class SessionController extends Zend_Controller_Action $sessionmapper = new Application_Model_SessionMapper(); - $sessionmapper->find($sessionID,$session); + $sessionmapper->find($sessionID,$session); + $session->setTime(date('d.m.Y H:i',$session->getTime())); $session2 = $session->toArray(); - $editsession = new Application_Form_Session(); + $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos)); $editsession->populate($session2); $this->view->editsession = $editsession; @@ -63,11 +86,18 @@ class SessionController extends Zend_Controller_Action try{ $sessionID = $this->_request->getParam('sessionID'); - $editsession = new Application_Form_Session($_POST); + $editsession = new Application_Form_Session(array('clients'=>$clients,'bootos'=>$bootos,'bootisos'=>$bootisos),$_POST); if ($editsession->isValid($_POST)) { $session = new Application_Model_Session($_POST); - $session->setID($this->_request->getParam('sessionID')); + $session->setID($this->_request->getParam('sessionID')); + $session->setTime(strtotime($_POST['time'])); + if($session->getClientID() == ''){ + $session->setClientID(null); + } + if($session->getBootosID() == ''){ + $session->setBootosID(null); + } $sessionmapper = new Application_Model_SessionMapper(); $sessionmapper->save($session); echo 'valid'; diff --git a/application/forms/Session.php b/application/forms/Session.php index f094676..30aefda 100644 --- a/application/forms/Session.php +++ b/application/forms/Session.php @@ -3,36 +3,48 @@ class Application_Form_Session extends Zend_Form { + private $clients; + private $bootos; + private $bootisos; + public function init() { $this->setName("session"); $this->setMethod('post'); - $this->addElement('text', 'clientID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'clientID:', - )); + $clientfield = $this->createElement('select','clientID'); + $clientfield ->setLabel('Client:'); + $clientfield->addMultiOption('',''); + if(count($this->clients)>0){ + foreach($this->clients as $id => $g){ + $clientfield->addMultiOption($g->getID(), $g->getMacadress()); + } + } + $clientfield->setRegisterInArrayValidator(false); + $this->addElement($clientfield); + + + $bootosfield = $this->createElement('select','bootosID'); + $bootosfield ->setLabel('BootOs:'); + $bootosfield->addMultiOption('',''); + if(count($this->bootos)>0){ + foreach($this->bootos as $id => $g){ + $bootosfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootosfield->setRegisterInArrayValidator(false); + $this->addElement($bootosfield); + + $bootisofield = $this->createElement('select','bootisoID'); + $bootisofield ->setLabel('BootIso:'); + if(count($this->bootisos)>0){ + foreach($this->bootisos as $id => $g){ + $bootisofield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootisofield->setRegisterInArrayValidator(false); + $this->addElement($bootisofield); - $this->addElement('text', 'bootosID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'bootosID:', - )); -$this->addElement('text', 'bootisoID', array( - 'filters' => array('StringTrim'), - 'validators' => array( - array('StringLength', false, array(0, 50)), - ), - 'required' => true, - 'label' => 'bootisoID:', - )); $this->addElement('text', 'time', array( 'filters' => array('StringTrim'), 'validators' => array( @@ -64,7 +76,16 @@ $this->addElement('text', 'ip6', array( 'label' => 'Save', )); } - + function setClients($v){ + $this->clients = $v; + } + function setBootos($v){ + $this->bootos = $v; + } + function setBootisos($v){ + $this->bootisos = $v; + } + } diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml index 483d267..57d09c7 100644 --- a/application/layouts/main.phtml +++ b/application/layouts/main.phtml @@ -4,6 +4,9 @@ getRequest(); +$this->headTitle()->append(ucwords($request->getControllerName())); +$this->headTitle()->append(ucwords($request->getActionName())); echo $this->headTitle()."\n"; echo $this->headMeta()."\n"; echo $this->headStyle()."\n"; diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml index c14bf51..188bed3 100644 --- a/application/views/scripts/filter/index.phtml +++ b/application/views/scripts/filter/index.phtml @@ -8,6 +8,7 @@ ID Title + Description Priority TargetBootMenu Actions @@ -16,6 +17,7 @@ escape($filter->getID()) ?> escape($filter->title) ?> + escape($filter->Description) ?> escape($filter->priority) ?> escape($filter->bootmenuID) ?> url( diff --git a/pbs-newdata.sql b/pbs-newdata.sql new file mode 100644 index 0000000..48a1dc6 --- /dev/null +++ b/pbs-newdata.sql @@ -0,0 +1,125 @@ +USE pbs; +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; + +-- Adding person test//test +INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES +(1, 'Herr', 'Test 1', 'Test 1', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a'); +-- Adding person test2//test +INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES +(2, 'Herr', 'Test 2', 'Test 2', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test2', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a'); + +-- Adding group +INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (1 , 'Group 1', NULL); + +-- Adding role +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (1, '1', 'Role 1', NULL); +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (2, '1', 'Role 2', NULL); + +-- Adding memberships +INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (1, '1', '1', '1'); +INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `personID`) VALUES (2, '1', '2', '2'); + +-- Adding clients +INSERT INTO `pbs_client` (`clientID`, `macadress`, `hardwarehash`) VALUES +(1, '00:00:00:00:00:10', 'ea9b82d9de911bc2d3cd23f53a6cab48'), +(2, '00:00:00:00:10:00', '1e2b1599710fbbef0dc789e8cfe12455'), +(3, '00:00:00:10:10:00', '8f6209ca3d6b35e223a11c249d1b69fc'), +(4, '00:00:10:00:00:00', 'e17ab09f3586464f19629e2e8b1e9a9d'), +(5, '00:10:00:00:00:00', '9bf70279d283b85440c2031c19bb6812'), +(6, '10:00:00:00:00:00', 'ad3bce4464a6267441ec144744439c7e'), +(7, '00:55:00:55:00:55', 'e8d7e80d79f224771b7a3a0af4e02748'), +(8, '66:00:66:00:66:00', 'ded66ce272f384e9e386c1b57ded3e4d'), +(9, '00:ff:ff:ff:ff:ff', '695610ee509c060b1fca9c8011529af4'), +(10, '00:22:00:22:00:22', 'a3562c8cad2a4fa4fc11656025dc911b'); + +-- Adding config +INSERT INTO `pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `shellscript`, `created`) VALUES +(1, 'Config 1', 1, 1, 'shellscript 1', '1299693677'), +(2, 'Config 2', 1, 1, 'shellskript 2', '1299693690'), +(3, 'Config 3', 1, 1, 'shellskript 3', '1299693690'), +(4, 'Config 4', 1, 1, 'shellskript 4', '1299693690'), +(5, 'Config 5', 1, 1, 'shellskript 5', '1299693690'); + +-- Adding bootos +INSERT INTO `pbs_bootos` (`bootosID`, `configID`, `groupID`, `membershipID`, `title`, `description`, `path_init`, `path_kernel`, `defaultkcl`, `created`, `expires`, `public`) VALUES +(1, 1, 1, 1, 'BootOs 1', 'Description 1', 'initpath 1', 'kernelpath 1', 'default kcl 1', '1299693782', '2012-03-09', 0), +(2, 1, 1, 1, 'BootOs 2', 'Description 2', 'initpath 2', 'kernelpath 2', 'default kcl 2', '1299693782', '2012-03-09', 0), +(3, 1, 1, 1, 'BootOs 3', 'Description 3', 'initpath 3', 'kernelpath 3', 'default kcl 3', '1299693782', '2012-03-09', 0), +(4, 1, 1, 1, 'BootOs 4', 'Description 4', 'initpath 4', 'kernelpath 4', 'default kcl 4', '1299693782', '2012-03-09', 0), +(5, 1, 1, 1, 'BootOs 5', 'Description 5', 'initpath 5', 'kernelpath 5', 'default kcl 5', '1299693782', '2012-03-09', 0), +(6, 1, 1, 1, 'BootOs 6', 'Description 6', 'initpath 6', 'kernelpath 6', 'default kcl 6', '1299693782', '2012-03-09', 0), +(7, 1, 1, 1, 'BootOs 7', 'Description 7', 'initpath 7', 'kernelpath 7', 'default kcl 7', '1299693782', '2012-03-09', 0), +(8, 1, 1, 1, 'BootOs 8', 'Description 8', 'initpath 8', 'kernelpath 8', 'default kcl 8', '1299693782', '2012-03-09', 0), +(9, 1, 1, 1, 'BootOs 9', 'Description 9', 'initpath 9', 'kernelpath 9', 'default kcl 9', '1299693782', '2012-03-09', 0), +(10, 1, 1, 1, 'BootOs 10', 'Description 10', 'initpath 10', 'kernelpath 10', 'default kcl 10', '1299693782', '2012-03-09', 0); + +-- Adding bootiso +INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `path`, `serialnumber`, `created`, `expires`, `public`) VALUES +(1, 'BootIso 1', 1, 1, 'Path 1', 123456789, '1299693879', '2012-03-09', 0), +(2, 'BootIso 2', 1, 1, 'Path 2', 2147483647, '1299693899', '2012-03-09', 0), +(3, 'BootIso 3', 1, 1, 'Path 3', 2147483647, '1299693899', '2012-03-09', 0); + +-- Adding Pools +INSERT INTO `pbs_pool` (`poolID`, `title`, `description`, `location`) VALUES +(1, 'Pool 1', 'Description 1', 'Keller'), +(2, 'Pool 2', 'Description 2', 'EG'), +(3, 'Pool 3', 'Description 3', '1 OG'), +(4, 'Pool 4', 'Description', '2 OG'); + +-- Adding BootOs to BootMenus +INSERT INTO `pbs_bootmenuentries` (`bootmenuentriesID`, `bootosID`, `bootmenuID`, `title`, `kcl`, `configID`, `order`) VALUES +(1, 1, 1, 'Select BootOs 1', 'kcl 1', 1, 0), +(2, 1, 1, 'Select BootOs 1', 'kcl 2', 2, 1), +(3, 2, 1, 'Select BootOs 2', 'kcl 3', 2, 2), +(4, 5, 2, 'Select BootOs 5', 'kcl 5', 2, 0), +(5, 4, 2, 'Select BootOs 4', 'kcl 4', 2, 1), +(6, 10, 3, 'Select BootOs 10', 'kcl 10', 3, 0), +(7, 8, 3, 'Select BootOs 8', 'kcl 8', 4, 1), +(8, 1, 2, 'Select BootOs 7', 'kcl 7', 5, 2), +(9, 1, 5, 'Select BootOs 3', 'kcl 3', 4, 0), +(10, 9, 4, 'Select BootOs 9', 'kcl 9', 3, 0), +(11, 7, 4, 'Select BootOs 7', 'kcl 7', 5, 1); + +-- Adding client to pools (poolentries) +INSERT INTO `pbs_poolentries` (`poolentriesID`, `poolID`, `clientID`) VALUES +(1, 1, 1), +(2, 1, 2), +(3, 1, 3), +(4, 1, 4), +(5, 2, 5), +(6, 2, 6), +(7, 3, 7), +(8, 3, 8), +(9, 4, 9), +(10, 4, 10); + +-- Adding Bootmenus +INSERT INTO `pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `created`) VALUES +(1, 1, 1, 'Bootmenu 1', '1299694422'), +(2, 1, 1, 'Bootmenu 2', '1299694433'), +(3, 1, 1, 'Bootmenu 3', '1299694441'), +(4, 1, 1, 'Bootmenu 4', '1299694454'), +(5, 1, 1, 'Bootmenu 5', '1299694461'); + +-- Adding Sessions +INSERT INTO `pbs_session` (`sessionID`, `clientID`, `bootosID`, `bootisoID`, `time`, `ip`, `ip6`) VALUES +(1, 1, NULL, 1, '1299684000', '132.230.5.6', ''), +(2, 9, NULL, 2, '1299684000', '132.230.10.2', ''), +(3, 10, NULL, 1, '1299648000', '132.20.20.2', ''), +(4, 7, NULL, 3, '1299676800', '84.23.56.86', ''), +(5, 4, NULL, 3, '1299674340', '70.81.94.222', ''), +(6, 5, NULL, 3, '1299683100', '210.84.65.2', ''); + +-- Adding Filter +INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `title`, `description`, `created`, `priority`) VALUES +(1, 1, 1, 1, 'Filter 1', 'Innerhalb der Uni', '1299697337', 10), +(2, 1, 1, 5, 'Filter 2', 'Ausserhalb der Uni', '1299697073', 20), +(3, 1, 1, 4, 'Filter 3', 'Desc3', '1299697277', 5); + +-- Adding Filterentries +INSERT INTO `pbs_filterentries` (`filterentriesID`, `filterID`, `filtertypeID`, `filtervalue`, `filtervalue2`) VALUES +(1, 1, 7, '08-00', '18-00'), +(2, 2, 1, '001.001.001.001', '132.229.255.255'), +(3, 2, 1, '132.231.001.001', '255.255.255.255'), +(4, 1, 1, '132.230.001.001', '132.230.255.255'), +(5, 3, 3, '1', ''); diff --git a/pbs.sql b/pbs.sql index a4149c2..f404b0a 100644 --- a/pbs.sql +++ b/pbs.sql @@ -204,8 +204,8 @@ CREATE TABLE IF NOT EXISTS `pbs_client` ( CREATE TABLE IF NOT EXISTS `pbs_session` ( `sessionID` int(11) NOT NULL AUTO_INCREMENT, - `clientID` int(11) NOT NULL, - `bootosID` int(11) NOT NULL, + `clientID` int(11), + `bootosID` int(11), `time` varchar(14) NOT NULL, `ip` varchar(15) NOT NULL, `ip6` varchar(45), @@ -303,5 +303,14 @@ ALTER TABLE `pbs_filterentries` ADD CONSTRAINT `pbs_filterentries_ibfk_2` FOREIGN KEY (`filtertypeID`) REFERENCES `pbs_filtertype` (`filtertypeID`) ON DELETE CASCADE; +-- Insert Filtertypes +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'IP'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'MAC'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'PoolID'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'BootIso'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Membership'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Group'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Time'); +INSERT INTO `pbs`.`pbs_filtertype` (`filtertypeID`, `filtertypename`) VALUES (NULL, 'Client'); diff --git a/public/media/css/style.css b/public/media/css/style.css index 345ba12..1d3da5d 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -85,6 +85,9 @@ border:1px solid #CCC; .addbutton { float:right; } +.addbutton:before{ + content: url(/media/img/create.png)' '; +} .monospace { font-family:Courier New, monospace; diff --git a/zend-user.sh b/zend-user.sh index 6e4bbeb..16ba63e 100644 --- a/zend-user.sh +++ b/zend-user.sh @@ -1,4 +1,4 @@ #!/bin/bash -cp ~/pbs2/application/configs/application.ini /tmp/pbs2/application/configs/application.ini -mysql -u root -p < /tmp/pbs2/pbs.sql -mysql -u root -p < /tmp/pbs2/pbs-data.sql +cp /tmp/pbs2/application/configs/application.ini.dist /tmp/pbs2/application/configs/application.ini +mysql -u root -p view->bootosmapper = $bootosmapper; - $this->view->configmapper = $configmapper; - $this->view->bootmenulist = $bootmenumapper->fetchAll(); - - $bootmenuentries = array(); - foreach ($this->view->bootmenulist as $bootmenu){ - $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID()); - $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle()); - $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname()); - } + $bootmenumapper = new Application_Model_BootMenuMapper(); + $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper(); + $bootosmapper = new Application_Model_BootOsMapper(); + $configmapper = new Application_Model_ConfigMapper(); + $membershipmapper = new Application_Model_MembershipMapper(); + $groupmapper = new Application_Model_GroupMapper(); + $personmapper = new Application_Model_PersonMapper(); + + $this->view->bootosmapper = $bootosmapper; + $this->view->configmapper = $configmapper; + + $bootmenuID = $this->_request->getParam('bootmenuid'); + + if($bootmenuID == "") + { + $this->view->bootmenulist = $bootmenumapper->fetchAll(); + $bootmenuentries = array(); + foreach ($this->view->bootmenulist as $bootmenu){ + $bootmenuentries[$bootmenu->getID()] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenu->getID()); + $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle()); + $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname()); + } + }else{ + $bootmenu = new Application_Model_BootMenu(); + $bootmenumapper->find($bootmenuID, $bootmenu); + + $bootmenuentries = array(); + $bootmenuentries[$bootmenuID] = $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID); + $bootmenu->setGroupID("[".$bootmenu->getGroupID()."] ".$groupmapper->find($bootmenu->getGroupID())->getTitle()); + $bootmenu->setMembershipID("[".$bootmenu->getMembershipID()."] ".$personmapper->find($membershipmapper->find($bootmenu->getMembershipID())->getPersonID())->getFirstname()); + + $this->view->bootmenulist = array($bootmenu); + + } + $this->view->bootmenuentrylist = $bootmenuentries; + } public function addbootmenuentryAction() @@ -37,13 +55,12 @@ class BootmenuController extends Zend_Controller_Action $bootmenuID = $this->_request->getParam('bootmenuID'); $bootosmapper = new Application_Model_BootOsMapper(); $configmapper = new Application_Model_ConfigMapper(); -// $bootmenuentriesmapper = new Application_Model_BootMenuEntriesMapper(); -// -// $bootoslist = $this->arrayDiff($bootosmapper->fetchAll(), $bootmenuentriesmapper->findBy('bootmenuID',$bootmenuID)); if (!isset($_POST["addbootmenuentry"])){ $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll())); $addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder'))); + unset($_POST['kcl']); + $addbootmenuentryForm->populate($_POST); } else { $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()),$_POST); @@ -170,7 +187,12 @@ class BootmenuController extends Zend_Controller_Action $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry); $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll())); - $editbootmenuentryForm->populate($bootmenuentry->toArray()); + if(!isset($_POST['kcl'])) + $editbootmenuentryForm->populate($bootmenuentry->toArray()); + else + unset($_POST['bootmenuID']); + $editbootmenuentryForm->populate($_POST); + } }else{ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()),$_POST); diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php index 0f2109e..2731f60 100644 --- a/application/forms/BootmenuEntriesAdd.php +++ b/application/forms/BootmenuEntriesAdd.php @@ -8,7 +8,6 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form public function setBootoslist($bootoslist){ $this->bootoslist = $bootoslist; - } public function setMaxorder($maxorder){ @@ -21,9 +20,15 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form } - + public function init() { + + if(!isset($_POST['bootosID'])){ + $firstbootos = array_slice($this->bootoslist,0,1); + $_POST['bootosID'] = $firstbootos[0]->getID(); + } + $this->setName("BootMenuEntryAdd"); $this->setMethod('post'); @@ -38,6 +43,8 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form $bootosfield = $this->createElement('select','bootosID'); $bootosfield ->setLabel('BootOs:'); + $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();"); + if(count($this->bootoslist)>0){ foreach($this->bootoslist as $bootos => $b){ @@ -45,6 +52,7 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form } } $bootosfield->setRegisterInArrayValidator(false); + $this->addElement($bootosfield); $this->addElement('textarea', 'kcl', array( @@ -56,6 +64,7 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form 'cols' => 50, 'rows' => 5, 'label' => 'KCL:', + 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl() )); diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php index 7fd97fe..8eb4b95 100644 --- a/application/forms/BootmenuEntriesEdit.php +++ b/application/forms/BootmenuEntriesEdit.php @@ -24,6 +24,12 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form public function init() { + + if(!isset($_POST['bootosID'])){ + $firstbootos = array_slice($this->bootoslist,0,1); + $_POST['bootosID'] = $firstbootos[0]->getID(); + } + $this->setName("BootMenuEntryAdd"); $this->setMethod('post'); @@ -37,7 +43,9 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form )); $bootosfield = $this->createElement('select','bootosID'); - $bootosfield ->setLabel('BootOs:'); + $bootosfield->setLabel('BootOs:'); + $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();"); + if(count($this->bootoslist)>0){ foreach($this->bootoslist as $bootos => $b){ @@ -56,6 +64,7 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form 'cols' => 50, 'rows' => 5, 'label' => 'KCL:', + 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl() )); $configfield = $this->createElement('select','configID'); diff --git a/application/models/BootOsMapper.php b/application/models/BootOsMapper.php index a6e9a7f..66de08d 100644 --- a/application/models/BootOsMapper.php +++ b/application/models/BootOsMapper.php @@ -14,7 +14,9 @@ class Application_Model_BootOsMapper ->where($criteria . ' = ?', $value); $stmt = $select->query(); $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { echo "Error message 2: " . $e->getMessage() . "\n"; } @@ -87,7 +89,7 @@ class Application_Model_BootOsMapper $entry->setID($row->bootosID)->setConfigID($row->configID)->setGroupID($row->groupID)->setMembershipID($row->membershipID)->setTitle($row->title)->setPath_init($row->path_init)->setPath_kernel($row->path_kernel)->setDefaultkcl($row->defaultkcl)->setCreated($row->created)->setDescription($row->description)->setExpires($row->expires)->setPublic($row->public); - $entries[] = $entry; + $entries[$row->bootosID] = $entry; } return $entries; } -- cgit v1.2.3-55-g7522 From 98b708fd4b640cccff3e24a3d08edbd673a9f8e9 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Thu, 10 Mar 2011 10:56:48 +0100 Subject: default kcl und config hinzugefuegt --- application/controllers/BootmenuController.php | 12 ++++++++---- application/forms/BootmenuEntriesAdd.php | 9 ++++++--- application/forms/BootmenuEntriesEdit.php | 8 ++++++-- 3 files changed, 20 insertions(+), 9 deletions(-) (limited to 'application/forms') diff --git a/application/controllers/BootmenuController.php b/application/controllers/BootmenuController.php index 26dba2d..e2f4a2b 100644 --- a/application/controllers/BootmenuController.php +++ b/application/controllers/BootmenuController.php @@ -60,6 +60,7 @@ class BootmenuController extends Zend_Controller_Action $addbootmenuentryForm = new Application_Form_BootmenuEntriesAdd(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll())); $addbootmenuentryForm->populate(array('order' => $this->_request->getParam('maxorder'))); unset($_POST['kcl']); + unset($_POST['configID']); $addbootmenuentryForm->populate($_POST); } else { @@ -154,6 +155,7 @@ class BootmenuController extends Zend_Controller_Action $bootmenu->setID($bootmenuID); try { + $bootmenumapper->save($bootmenu); }catch(Zend_Exception $e) { @@ -187,12 +189,14 @@ class BootmenuController extends Zend_Controller_Action $bootmenuentrymapper->find($bootmenuentryID, $bootmenuentry); $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder' => $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll())); - if(!isset($_POST['kcl'])) + if(!isset($_POST['kcl'])){ $editbootmenuentryForm->populate($bootmenuentry->toArray()); - else - unset($_POST['bootmenuID']); + } + else{ + unset($_POST['kcl']); + unset($_POST['configID']); $editbootmenuentryForm->populate($_POST); - + } } }else{ $editbootmenuentryForm = new Application_Form_BootmenuEntriesEdit(array('bootoslist'=>$bootosmapper->fetchAll(), 'maxorder'=> $this->_request->getParam('maxorder'), 'configlist'=>$configmapper->fetchAll()),$_POST); diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php index 2731f60..4aea750 100644 --- a/application/forms/BootmenuEntriesAdd.php +++ b/application/forms/BootmenuEntriesAdd.php @@ -45,7 +45,6 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form $bootosfield ->setLabel('BootOs:'); $bootosfield->setAttrib('onChange', "document.getElementById('BootMenuEntryAdd').submit();"); - if(count($this->bootoslist)>0){ foreach($this->bootoslist as $bootos => $b){ $bootosfield->addMultiOption($b->getID(), $b->getTitle()); @@ -68,14 +67,18 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form )); + $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID(); $configfield = $this->createElement('select','configID'); - $configfield ->setLabel('Config:'); + $configfield->setLabel('Config:'); + $configfield->addMultiOption($defaultconfigid, 'default'); if(count($this->configlist)>0){ foreach($this->configlist as $config => $c){ - $configfield->addMultiOption($c->getID(), $c->getTitle()); + if($c->getID() != $defaultconfigid) + $configfield->addMultiOption($c->getID(), $c->getTitle()); } } + $configfield->setRegisterInArrayValidator(false); $this->addElement($configfield); diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php index 8eb4b95..1548129 100644 --- a/application/forms/BootmenuEntriesEdit.php +++ b/application/forms/BootmenuEntriesEdit.php @@ -67,12 +67,16 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form 'value' => $this->bootoslist[$_POST['bootosID']]->getDefaultkcl() )); + $defaultconfigid = $this->bootoslist[$_POST['bootosID']]->getConfigID(); $configfield = $this->createElement('select','configID'); - $configfield ->setLabel('Config:'); + $configfield->setLabel('Config:'); + $configfield->addMultiOption($defaultconfigid, 'default'); + if(count($this->configlist)>0){ foreach($this->configlist as $config => $c){ - $configfield->addMultiOption($c->getID(), $c->getTitle()); + if($c->getID() != $defaultconfigid) + $configfield->addMultiOption($c->getID(), $c->getTitle()); } } $configfield->setRegisterInArrayValidator(false); -- cgit v1.2.3-55-g7522 From ae7d2ce03b014db0047194199d5962b77f9b1a0a Mon Sep 17 00:00:00 2001 From: michael pereira Date: Thu, 10 Mar 2011 21:19:06 +0100 Subject: postinit.local angepasst, extrahiert aus der kernelcommandline die configid --- application/forms/BootmenuEntriesAdd.php | 2 +- application/forms/BootmenuEntriesEdit.php | 2 +- application/forms/BootosCreate.php | 2 +- application/forms/BootosEdit.php | 2 +- resources/bootos/1/initramfs/initramfs | Bin 6020724 -> 6077246 bytes resources/config/1/config/etc/nsswitch.conf | 29 +++++++++---------- resources/config/1/config/etc/pam.d/common-account | 30 ++++++++++++++++---- resources/config/1/config/etc/pam.d/common-auth | 22 +++++++++++---- resources/config/1/config/etc/pam.d/common-session | 31 +++++++++++++++++---- 9 files changed, 84 insertions(+), 36 deletions(-) (limited to 'application/forms') diff --git a/application/forms/BootmenuEntriesAdd.php b/application/forms/BootmenuEntriesAdd.php index 4aea750..6981619 100644 --- a/application/forms/BootmenuEntriesAdd.php +++ b/application/forms/BootmenuEntriesAdd.php @@ -59,7 +59,7 @@ class Application_Form_BootmenuEntriesAdd extends Zend_Form 'validators' => array( array('StringLength', false, array(0, 50)), ), - 'required' => true, + 'required' => false, 'cols' => 50, 'rows' => 5, 'label' => 'KCL:', diff --git a/application/forms/BootmenuEntriesEdit.php b/application/forms/BootmenuEntriesEdit.php index 1548129..6dc1aab 100644 --- a/application/forms/BootmenuEntriesEdit.php +++ b/application/forms/BootmenuEntriesEdit.php @@ -60,7 +60,7 @@ class Application_Form_BootmenuEntriesEdit extends Zend_Form 'validators' => array( array('StringLength', false, array(0, 50)), ), - 'required' => true, + 'required' => false, 'cols' => 50, 'rows' => 5, 'label' => 'KCL:', diff --git a/application/forms/BootosCreate.php b/application/forms/BootosCreate.php index a6d74c6..8f699ce 100644 --- a/application/forms/BootosCreate.php +++ b/application/forms/BootosCreate.php @@ -78,7 +78,7 @@ class Application_Form_BootosCreate extends Zend_Form 'validators' => array( array('StringLength', false, array(0, 50)), ), - 'required' => true, + 'required' => false, 'rows' => 5, 'cols' => 50, 'label' => 'Default-KCL:', diff --git a/application/forms/BootosEdit.php b/application/forms/BootosEdit.php index 572e712..641429d 100644 --- a/application/forms/BootosEdit.php +++ b/application/forms/BootosEdit.php @@ -86,7 +86,7 @@ class Application_Form_BootosEdit extends Zend_Form 'validators' => array( array('StringLength', false, array(0, 50)), ), - 'required' => true, + 'required' => false, 'rows' => 5, 'cols' => 50, 'label' => 'Default-KCL:', diff --git a/resources/bootos/1/initramfs/initramfs b/resources/bootos/1/initramfs/initramfs index e7bfa9e..20fc809 100644 Binary files a/resources/bootos/1/initramfs/initramfs and b/resources/bootos/1/initramfs/initramfs differ diff --git a/resources/config/1/config/etc/nsswitch.conf b/resources/config/1/config/etc/nsswitch.conf index 7251f2c..6886def 100755 --- a/resources/config/1/config/etc/nsswitch.conf +++ b/resources/config/1/config/etc/nsswitch.conf @@ -1,22 +1,19 @@ -# file copied from configuration package (rootfs/etc/nsswitch.conf) -# # /etc/nsswitch.conf # +# Example configuration of GNU Name Service Switch functionality. +# If you have the `glibc-doc-reference' and `info' packages installed, try: +# `info libc "Name Service Switch"' for information about this file. -passwd: files ldap -group: files ldap +passwd: compat +group: compat +shadow: compat -hosts: files dns -networks: files dns +hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 +networks: files -services: files -protocols: files -rpc: files -ethers: files -netmasks: files -netgroup: files -publickey: files +protocols: db files +services: db files +ethers: db files +rpc: db files -bootparams: files -automount: files nis -aliases: files +netgroup: nis diff --git a/resources/config/1/config/etc/pam.d/common-account b/resources/config/1/config/etc/pam.d/common-account index 3caf0dd..316b173 100755 --- a/resources/config/1/config/etc/pam.d/common-account +++ b/resources/config/1/config/etc/pam.d/common-account @@ -1,5 +1,25 @@ -# file copied from configuration package (rootfs/etc/pam.d/common-account) -account requisite pam_unix.so -account [success=ok new_authtok_reqd=ok ignore=ignore default=bad user_unknown=ignore] pam_krb5.so use_first_pass -account sufficient pam_localuser.so -account required pam_ldap.so use_first_pass +# +# /etc/pam.d/common-account - authorization settings common to all services +# +# This file is included from other service-specific PAM config files, +# and should contain a list of the authorization modules that define +# the central access policy for use on the system. The default is to +# only deny service to users whose accounts are expired in /etc/shadow. +# +# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. +# To take advantage of this, it is recommended that you configure any +# local modules either before or after the default block, and use +# pam-auth-update to manage selection of other modules. See +# pam-auth-update(8) for details. +# + +# here are the per-package modules (the "Primary" block) +account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so +# here's the fallback if no module succeeds +account requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +account required pam_permit.so +# and here are more per-package modules (the "Additional" block) +# end of pam-auth-update config diff --git a/resources/config/1/config/etc/pam.d/common-auth b/resources/config/1/config/etc/pam.d/common-auth index 5b8c00b..5facfa2 100755 --- a/resources/config/1/config/etc/pam.d/common-auth +++ b/resources/config/1/config/etc/pam.d/common-auth @@ -1,4 +1,3 @@ -# file copied from configuration package (rootfs/etc/pam.d/common-auth) # # /etc/pam.d/common-auth - authentication settings common to all services # @@ -8,8 +7,19 @@ # (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the # traditional Unix authentication mechanisms. # -auth required pam_env.so -auth optional pam_group.so -auth sufficient pam_unix.so -auth sufficient pam_krb5.so use_first_pass -auth required pam_ldap.so use_first_pass +# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. +# To take advantage of this, it is recommended that you configure any +# local modules either before or after the default block, and use +# pam-auth-update to manage selection of other modules. See +# pam-auth-update(8) for details. + +# here are the per-package modules (the "Primary" block) +auth [success=1 default=ignore] pam_unix.so nullok_secure +# here's the fallback if no module succeeds +auth requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +auth required pam_permit.so +# and here are more per-package modules (the "Additional" block) +# end of pam-auth-update config diff --git a/resources/config/1/config/etc/pam.d/common-session b/resources/config/1/config/etc/pam.d/common-session index aec02b8..464d41d 100755 --- a/resources/config/1/config/etc/pam.d/common-session +++ b/resources/config/1/config/etc/pam.d/common-session @@ -1,5 +1,26 @@ -# file copied from configuration package (rootfs/etc/pam.d/common-session) -session required pam_limits.so -session required pam_unix.so -session optional pam_krb5.so -session optional pam_umask.so +# +# /etc/pam.d/common-session - session-related modules common to all services +# +# This file is included from other service-specific PAM config files, +# and should contain a list of modules that define tasks to be performed +# at the start and end of sessions of *any* kind (both interactive and +# non-interactive). +# +# As of pam 1.0.1-6, this file is managed by pam-auth-update by default. +# To take advantage of this, it is recommended that you configure any +# local modules either before or after the default block, and use +# pam-auth-update to manage selection of other modules. See +# pam-auth-update(8) for details. + +# here are the per-package modules (the "Primary" block) +session [default=1] pam_permit.so +# here's the fallback if no module succeeds +session requisite pam_deny.so +# prime the stack with a positive return value if there isn't one already; +# this avoids us returning an error just because nothing sets a success code +# since the modules above will each just jump around +session required pam_permit.so +# and here are more per-package modules (the "Additional" block) +session required pam_unix.so +session optional pam_ck_connector.so nox11 +# end of pam-auth-update config -- cgit v1.2.3-55-g7522