diff options
| author | michael pereira | 2011-03-16 16:35:20 +0100 |
|---|---|---|
| committer | michael pereira | 2011-03-16 16:35:20 +0100 |
| commit | b09352fc9ec322ea0ae744077a66fcaf61465ed5 (patch) | |
| tree | b9e45999ce4d1eaa08035601bfd8f14f91547d30 | |
| parent | KCLAppend hinzugefuegt, KCL fertig :-) (diff) | |
| parent | ClientController geändert, Forms können in FBGui und User nicht benutzt werden (diff) | |
| download | pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.gz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.tar.xz pbs2-b09352fc9ec322ea0ae744077a66fcaf61465ed5.zip | |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
37 files changed, 502 insertions, 53 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index 5f9c531..c0eba40 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -243,6 +243,9 @@ </controllerFile> <controllerFile controllerName="Client"> <actionMethod actionName="index"/> + <actionMethod actionName="addclient"/> + <actionMethod actionName="removeclient"/> + <actionMethod actionName="editclient"/> </controllerFile> <controllerFile controllerName="Config"> <actionMethod actionName="index"/> @@ -252,10 +255,16 @@ </controllerFile> <controllerFile controllerName="Pool"> <actionMethod actionName="index"/> + <actionMethod actionName="createpool"/> + <actionMethod actionName="deletepool"/> + <actionMethod actionName="editpool"/> + <actionMethod actionName="linkclient"/> + <actionMethod actionName="unlinkclient"/> </controllerFile> </controllersDirectory> <formsDirectory> <formFile formName="Login"/> + <formFile formName="Client"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -299,6 +308,30 @@ <viewControllerScriptsDirectory forControllerName="Pool"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Client"> + <viewScriptFile forActionName="addclient"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Client"> + <viewScriptFile forActionName="removeclient"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Client"> + <viewScriptFile forActionName="editclient"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Pool"> + <viewScriptFile forActionName="createpool"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Pool"> + <viewScriptFile forActionName="deletepool"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Pool"> + <viewScriptFile forActionName="editpool"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Pool"> + <viewScriptFile forActionName="linkclient"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Pool"> + <viewScriptFile forActionName="unlinkclient"/> + </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory/> diff --git a/application/Bootstrap.php b/application/Bootstrap.php index db7b4e0..cfa09f5 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -12,7 +12,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap 'basePath' => APPLICATION_PATH, 'resourceTypes' => array( 'form' => array( - 'path' => 'forms/', + 'path' => 'forms', 'namespace' => 'Form', ) ) @@ -42,7 +42,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $layout = $this->getResource('layout'); $view = $layout->getView(); - # print_a($layout); $view->doctype('XHTML1_STRICT'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8'); $view->headLink()->appendStylesheet('/media/css/style.css'); diff --git a/application/models/Client.php b/application/models/Client.php index a27c3b3..3c2b050 100644 --- a/application/models/Client.php +++ b/application/models/Client.php @@ -3,6 +3,7 @@ class Application_Model_Client { protected $_clientID; + protected $_groupID; protected $_macadress; protected $_hardwarehash; @@ -53,6 +54,15 @@ class Application_Model_Client $this->_clientID = $_clientID; return $this; } + public function getGroupID() + { + return $this->_groupID; + } + public function setGroupID($_groupID) + { + $this->_groupID = $_groupID; + return $this; + } public function getMacadress() { return $this->_macadress; diff --git a/application/models/ClientMapper.php b/application/models/ClientMapper.php index 7016ae7..2c530d9 100644 --- a/application/models/ClientMapper.php +++ b/application/models/ClientMapper.php @@ -47,7 +47,11 @@ class Application_Model_ClientMapper public function save(Application_Model_Client $client) { - $data = array('clientID'=> $client->getID() ,'macadress'=> $client->getMacadress() ,'hardwarehash'=> $client->getHardwarehash() ); + $data = array('clientID'=> $client->getID() , + 'groupID' => $client->getGroupID(), + 'macadress'=> $client->getMacadress() , + 'hardwarehash'=> $client->getHardwarehash() + ); if (null === ($id = $client->getID()) ) { unset($data['clientID']); @@ -75,7 +79,7 @@ class Application_Model_ClientMapper $row = $result->current(); - $client->setID($row->clientID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $client->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); } public function fetchAll() @@ -85,7 +89,7 @@ class Application_Model_ClientMapper foreach ($resultSet as $row) { $entry = new Application_Model_Client(); - $entry->setID($row->clientID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); + $entry->setID($row->clientID)->setGroupID($row->groupID)->setMacadress($row->macadress)->setHardwarehash($row->hardwarehash); $entries[] = $entry; } diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php index 83f0687..0810566 100644 --- a/application/models/SessionMapper.php +++ b/application/models/SessionMapper.php @@ -45,8 +45,7 @@ class Application_Model_SessionMapper } public function save(Application_Model_Session $session) - { - + { $data = array( 'sessionID'=> $session->getID() , 'alphasessionID'=> $session->getAlphasessionID(), 'clientID'=> $session->getClientID() , @@ -59,7 +58,7 @@ class Application_Model_SessionMapper 'ip6'=> $session->getIp6() ); if (null === ($id = $session->getID()) ) { unset($data['sessionID']); - $this->getDbTable()->insert($data); + return $this->getDbTable()->insert($data); } else { $this->getDbTable()->update($data, array('sessionID = ?' => $id)); } diff --git a/application/modules/dev/controllers/ClientController.php b/application/modules/dev/controllers/ClientController.php index d73379c..aa66a96 100644 --- a/application/modules/dev/controllers/ClientController.php +++ b/application/modules/dev/controllers/ClientController.php @@ -18,15 +18,19 @@ class dev_ClientController extends Zend_Controller_Action { $mac = $this->_request->getParam('mac'); $hh = $this->_request->getParam('hh'); + + $groupMapper = new Application_Model_GroupMapper(); + $groups = $groupMapper->fetchAll(); + #print_a($groups);die(); if (!isset($_POST["add"])){ - $addclient = new dev_Form_Client(array('buttontext' => 'Create Client')); + $addclient = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups)); $this->view->addclient = $addclient; } else{ - $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client'),$_POST); + $addfilterform = new dev_Form_Client(array('buttontext' => 'Create Client','groups'=>$groups),$_POST); if ($addfilterform->isValid($_POST) || ($mac != '' && $hh != '') ) { - $client = new Application_Model_Client(); + $client = new Application_Model_Client($_POST); $mac = ($mac!='')?$mac:$_POST['macadress']; $hh = ($hh!='')?$hh:$_POST['hardwarehash']; $client->setMacadress($mac); @@ -55,18 +59,22 @@ class dev_ClientController extends Zend_Controller_Action public function editclientAction() { + $groupMapper = new Application_Model_GroupMapper(); + $groups = $groupMapper->fetchAll(); + # print_a($this);die(); + if (!isset($_POST["add"])){ $clientID = $this->_request->getParam('clientID'); $data = new Application_Model_Client(); $mapper = new Application_Model_ClientMapper(); $mapper->find($clientID,$data); - $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client')); + $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client', 'groups'=>$groups)); $editclient->populate($data->toArray()); $this->view->editclient = $editclient; } else{ - $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client'),$_POST); + $editclient = new dev_Form_Client(array('buttontext' => 'Edit Client','groups'=>$groups),$_POST); if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) { $client = new Application_Model_Client($_POST); $client->setID($this->_request->getParam('clientID')); diff --git a/application/modules/dev/forms/Client.php b/application/modules/dev/forms/Client.php index f09f720..1e62877 100644 --- a/application/modules/dev/forms/Client.php +++ b/application/modules/dev/forms/Client.php @@ -7,7 +7,16 @@ class dev_Form_Client extends Zend_Form { $this->setName("pool"); $this->setMethod('post'); - + + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + + foreach($this->groups as $c){ + $groupfield->addMultiOption($c->getID(),$c->getTitle()); + } + $this->addElement($groupfield); + + $this->addElement('text', 'macadress', array( 'filters' => array('StringTrim'), 'validators' => array( @@ -32,13 +41,18 @@ class dev_Form_Client extends Zend_Form )); $this->addElement('button', 'Cancel', array( - 'onclick' => 'self.location="/client"' + 'onclick' => 'self.location="/dev/client"' )); } private $buttontext = 'Save'; + private $groups; function setButtontext($v){ $this->buttontext = $v; } + public function setGroups($groups){ + $this->groups = $groups; + return $this; + } } diff --git a/application/modules/dev/layouts/dev.phtml b/application/modules/dev/layouts/dev.phtml index 2c7f6f0..b911944 100644 --- a/application/modules/dev/layouts/dev.phtml +++ b/application/modules/dev/layouts/dev.phtml @@ -22,7 +22,7 @@ echo $this->headScript()."\n"; <div id='sidepannel'> <div id="logo"><div id="logo-bar-gray"></div></div> <div id="sidepannel-top"> - <h1>dev</h1> + <h1><a href=/><</a> <a href=/dev/>dev</a></h1> <ul> <li>Controller: <ul> diff --git a/application/modules/dev/views/scripts/client/index.phtml b/application/modules/dev/views/scripts/client/index.phtml index fa12ed7..612e23b 100644 --- a/application/modules/dev/views/scripts/client/index.phtml +++ b/application/modules/dev/views/scripts/client/index.phtml @@ -7,6 +7,7 @@ <table> <tr> <th>ID</th> + <th>GroupID</th> <th>MAC</th> <th>Hardwarehash</th> <th colspan=2>Actions</th> @@ -14,6 +15,7 @@ <?php foreach ($this->clients as $client): ?> <tr class=entry> <td><?php echo $this->escape($client->getID()) ?></td> + <td><?php echo $this->escape($client->getGroupID()) ?></td> <td class='monospace'><?php echo $this->escape($client->getMacadress()) ?></td> <td class='monospace'><?php echo $this->escape($client->getHardwarehash()) ?></td> <td class='action'><a href="<?php echo $this->url( diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index c1621dc..d141733 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -11,6 +11,15 @@ class Fbgui_IndexController extends Zend_Controller_Action public function indexAction() { // action body + + // Call this Procedure after Login to create a session and save the alphasessionID to session + $n = new Pbs_PbsSession(); + $session = new Application_Model_Session(); + $session->setBootisoID(1); + $session->setTime(time()); + $session->setIp($_SERVER['REMOTE_ADDR']); + $session = $n->createsession($session); + $_SESSION['alphasessionID'] = $session->getAlphasessionID(); } diff --git a/application/modules/fbgui/layouts/fbgui.phtml b/application/modules/fbgui/layouts/fbgui.phtml index 1f10683..e3b286a 100644 --- a/application/modules/fbgui/layouts/fbgui.phtml +++ b/application/modules/fbgui/layouts/fbgui.phtml @@ -23,8 +23,8 @@ echo $this->headScript()."\n"; <div id='sidepannel'> <div id="logo"><div id="logo-bar-gray"></div></div> <div id="sidepannel-top"> + <h1><a href=/><</a> <a href=/fbgui/>fbgui</a></h1> <ul> - <h1>fbgui</h1> <li>Controller: <ul> <li><a href='/dev/person'>Person</a></li> diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 4721616..76dc243 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -11,6 +11,7 @@ class User_AuthController extends Zend_Controller_Action public function indexAction() { // action body + $_SESSION['membershipID'] = 1; } diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 54280f4..f5f1810 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -2,17 +2,97 @@ class User_ClientController extends Zend_Controller_Action { - + private $membership; public function init() { /* Initialize action controller here */ + $membershipMapper = new Application_Model_MembershipMapper(); + $this->membership = new Application_Model_Membership(); + $membershipMapper->find($_SESSION['membershipID'],$this->membership); } public function indexAction() { + // TODO: ACL: is he athorized to see this ? + + // Get the Clients which booted with a bootiso of this group + $result = $this->_request->getParam('deleteresult'); + if($result != ""){ + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('delete',$result); + } + $clientMapper = new Application_Model_ClientMapper(); + $clientsInGroup = $clientMapper->findBy('groupID',$this->membership->getGroupID()); + # print_a($clientsInGroup); + + $this->view->clients = $clientsInGroup; + + } + + public function addclientAction() + { // action body } + public function removeclientAction() + { + $clientID = $this->_request->getParam('clientID'); + // TODO: ACL: is he authorized to delete clients? + $clientMapper = new Application_Model_ClientMapper(); + if(is_numeric($clientID)){ + $client = new Application_Model_Client(); + $clientMapper->find($clientID,$client); + // TODO: ACL: Is He authorized to delete + if($client->getGroupID() == $this->membership->getGroupID()){ + $clientMapper = new Application_Model_ClientMapper(); + $clientMapper->delete($client); + $this->_redirect('/user/client/index/deleteresult/ok'); + } + else{ + $this->_redirect('/user/client/index/deleteresult/forbidden'); + } + } + $this->_redirect('/user/client/index/deleteresult/error'); + } + + public function editclientAction(){ + + if (!isset($_POST["add"])){ + $clientID = $this->_request->getParam('clientID'); + $client = new Application_Model_Client(); + $mapper = new Application_Model_ClientMapper(); + $mapper->find($clientID,$client); + + if($client->getGroupID() == $this->membership->getGroupID()){ + # print_a($this);die(); + $editclient = new user_Form_Client(array('buttontext' => 'Edit Client')); + $editclient->populate($client->toArray()); + $this->view->editclient = $editclient; + } + else{ + $this->_redirect('/user/client/index/modifyresult/error'); + } + } + else{ + $editclient = new user_Form_Client(array('buttontext' => 'Edit Client','groups'=>$groups),$_POST); + if ($editclient->isValid($_POST) || ($mac != '' && $hh != '') ) { + $client = new Application_Model_Client($_POST); + $client->setID($this->_request->getParam('clientID')); + $clientmapper = new Application_Model_ClientMapper(); + $clientmapper->save($client); + print_a('updated'); + $this->_redirect('/dev/client'); + } + $this->view->editclient = $editclient; + } + } + } + + + + + + diff --git a/application/modules/user/controllers/IndexController.php b/application/modules/user/controllers/IndexController.php index 1d41157..8b295e0 100644 --- a/application/modules/user/controllers/IndexController.php +++ b/application/modules/user/controllers/IndexController.php @@ -2,20 +2,26 @@ class User_IndexController extends Zend_Controller_Action { - public function init() { /* Initialize action controller here */ } - public function indexAction() - { - $n = new Pbs_PbsSession(); - $session = new Application_Model_Session(); - $session->setID('1'); - $n->createsession($session); + public function indexAction() + { + if (!Zend_Auth::getInstance()->hasIdentity()) { + $this->view->text = 'Your not logged in, please log in first <a href="/user/auth/">here</a>.'; + } + else{ + $this->view->text = "You're Welcome"; + $links = array( + '/user/person' => 'Change your Details', + '/user/person/request' => 'Request Membership in a Group', + '/user/config' => 'Create your own Configuration', + '/user/bootmenu' => 'Create your Bootmenu', + ); + } + $this->view->links = $links; } - - } diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index caa7dd4..cf4dfe7 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -13,6 +13,41 @@ class User_PoolController extends Zend_Controller_Action // action body } + public function createpoolAction() + { + // action body + } + + public function deletepoolAction() + { + // action body + } + + public function editpoolAction() + { + // action body + } + + public function linkclientAction() + { + // action body + } + + public function unlinkclientAction() + { + // action body + } + } + + + + + + + + + + diff --git a/application/modules/user/forms/Client.php b/application/modules/user/forms/Client.php new file mode 100644 index 0000000..a79ede1 --- /dev/null +++ b/application/modules/user/forms/Client.php @@ -0,0 +1,46 @@ +<?php + +class user_Form_Client extends Zend_Form +{ + + public function init() + { + $this->setName("pool"); + $this->setMethod('post'); + + $this->addElement('text', 'macadress', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'MacAdress:', + )); + $this->addElement('text', 'hardwarehash', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + '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"' + )); + } + private $buttontext = 'Save'; + private $groups; + function setButtontext($v){ + $this->buttontext = $v; + } + + +} + diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml index 91e5eb8..36d73b4 100644 --- a/application/modules/user/layouts/user.phtml +++ b/application/modules/user/layouts/user.phtml @@ -23,8 +23,8 @@ echo $this->headScript()."\n"; <div id='sidepannel'> <div id="logo"><div id="logo-bar-gray"></div></div> <div id="sidepannel-top"> + <h1><a href=/><</a> <a href=/user/>user</a></h1> <ul> - <h1>user</h1> <li>Controller: <ul> <li><a href='/user/person'>Person</a></li> @@ -37,7 +37,7 @@ echo $this->headScript()."\n"; <li><a href='/user/client'>Client</a></li> <li><a href='/user/filter'>Filter</a></li> <li><a href='/user/pool'>Pool</a></li> - + <li><a href='/user/auth'>Auth</a></li> <?php if (!Zend_Auth::getInstance()->hasIdentity()) {?> <li><a href='/user/auth/login'>Login</a></li> <li><a href='/user/auth/register'>Register</a></li> diff --git a/application/modules/user/views/scripts/client/addclient.phtml b/application/modules/user/views/scripts/client/addclient.phtml new file mode 100644 index 0000000..13511fb --- /dev/null +++ b/application/modules/user/views/scripts/client/addclient.phtml @@ -0,0 +1,3 @@ +<?php +echo $this->addclient; +?> diff --git a/application/modules/user/views/scripts/client/editclient.phtml b/application/modules/user/views/scripts/client/editclient.phtml new file mode 100644 index 0000000..2753a0f --- /dev/null +++ b/application/modules/user/views/scripts/client/editclient.phtml @@ -0,0 +1,3 @@ +<?php +echo $this->editclient; +?> diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index 4f0e6ec..dd791ad 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -1 +1,42 @@ -<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>index</b></center>
\ No newline at end of file +<h1>Clients</h1> +<?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->formButton('createbootos', 'Create Client', array( + 'onclick' => 'self.location="/user/client/addclient"', + 'class' => 'addbutton'))?> + +<?php if ($this->clients): ?> + <table> + <tr> + <th>MAC</th> + <th>Hardwarehash</th> + <th colspan=2>Actions</th> + </tr> + <?php foreach ($this->clients as $client): ?> + <tr class=entry> + <td class='monospace'><?php echo $this->escape($client['macadress']) ?></td> + <td class='monospace'><?php echo $this->escape($client['hardwarehash']) ?></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'client', + 'action' => 'editclient', + 'clientID' => $client['clientID'] + ), + 'default', + true) ?>"><img src='/media/img/edit.png' alt='Edit Client'/></a></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'client', + 'action' => 'removeclient', + 'clientID' => $client['clientID'] + ), + 'default', + true) ?>"><img src='/media/img/delete.png' alt='Delete Client'/></a></td> + </tr> + <?php endforeach ?> + </table> + +<?php else: ?> + <p>There are no clients to display.</p> +<?php endif;?> diff --git a/application/modules/user/views/scripts/client/removeclient.phtml b/application/modules/user/views/scripts/client/removeclient.phtml new file mode 100644 index 0000000..97254f6 --- /dev/null +++ b/application/modules/user/views/scripts/client/removeclient.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Client</b> and script/action name <b>removeclient</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/index/index.phtml b/application/modules/user/views/scripts/index/index.phtml index 57e6edb..a6e84a7 100644 --- a/application/modules/user/views/scripts/index/index.phtml +++ b/application/modules/user/views/scripts/index/index.phtml @@ -1 +1,18 @@ <h1>Welcome</h1> + +<div class='infobox'>infobox: <?php echo $this->text;?></div> +<div class='okbox'>okbox: <?php echo $this->text;?></div> +<div class='warningbox'>warningbox: <?php echo $this->text;?></div> +<div class='errorbox'>errorbox: <?php echo $this->text;?></div> +<?php print_a($this->links);?> + +<?php if(count($this->links)>0 && is_array($this->links)): ?> +<ul> +<?php foreach($this->links as $link => $text):?> +<li><a href='<?php echo $link;?>'><?php echo $text;?></a></li> + +<?php endforeach ?> +</ul> + +<?php endif ?> + diff --git a/application/modules/user/views/scripts/pool/createpool.phtml b/application/modules/user/views/scripts/pool/createpool.phtml new file mode 100644 index 0000000..3d7f8ca --- /dev/null +++ b/application/modules/user/views/scripts/pool/createpool.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>createpool</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/pool/deletepool.phtml b/application/modules/user/views/scripts/pool/deletepool.phtml new file mode 100644 index 0000000..622e663 --- /dev/null +++ b/application/modules/user/views/scripts/pool/deletepool.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>deletepool</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/pool/editpool.phtml b/application/modules/user/views/scripts/pool/editpool.phtml new file mode 100644 index 0000000..c70464e --- /dev/null +++ b/application/modules/user/views/scripts/pool/editpool.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>editpool</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/pool/linkclient.phtml b/application/modules/user/views/scripts/pool/linkclient.phtml new file mode 100644 index 0000000..a2f9a6c --- /dev/null +++ b/application/modules/user/views/scripts/pool/linkclient.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>linkpool</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/pool/unlinkclient.phtml b/application/modules/user/views/scripts/pool/unlinkclient.phtml new file mode 100644 index 0000000..e1d5397 --- /dev/null +++ b/application/modules/user/views/scripts/pool/unlinkclient.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Pool</b> and script/action name <b>unlinkpool</b></center>
\ No newline at end of file diff --git a/library/Pbs/Notifier.php b/library/Pbs/Notifier.php new file mode 100644 index 0000000..f2f889b --- /dev/null +++ b/library/Pbs/Notifier.php @@ -0,0 +1,54 @@ +<?php + +class Pbs_Notifier{ + + + public function notify($action,$result){ + + switch($action){ + case "delete": + switch($result){ + case "forbidden": + $result = "<div class='errorbox'>Not allowed to delete this</div>"; + break; + case "ok": + $result = "<div class='checkbox'>Delete sucessful</div>"; + break; + case "error": + $result = "<div class='warningbox'>Delete failed</div>"; + break; + } + break; + case "modify": + switch($result){ + case "forbidden": + $result = "<div class='errorbox'>Not allowed to modify this</div>"; + break; + case "ok": + $result = "<div class='checkbox'>Modify sucessful</div>"; + break; + case "error": + $result = "<div class='warningbox'>Modify failed</div>"; + break; + } + break; + case "create": + switch($result){ + case "forbidden": + $result = "<div class='errorbox'>Not allowed to create this</div>"; + break; + case "ok": + $result = "<div class='checkbox'>Creation sucessful</div>"; + break; + case "error": + $result = "<div class='warningbox'>Creation failed</div>"; + break; + } + break; + } + return $result; + + } +} + +?> diff --git a/library/Pbs/PbsNotifier.php b/library/Pbs/PbsNotifier.php new file mode 100644 index 0000000..b079f2d --- /dev/null +++ b/library/Pbs/PbsNotifier.php @@ -0,0 +1,27 @@ +<?php + +class Pbs_PbsNotifier{ + + + public function notify($boxstyle, $action, $result){ + switch($boxstyle){ + default: + case "info": + $boxstyle = 'infobox'; + break; + case "warning": + $boxstyle = 'warning'; + break; + case "ok": + $boxstyle = 'okbox'; + break; + case "error": + $boxstyle = 'errorbox'; + break; + } + + + } +} + +?> diff --git a/library/Pbs/PbsSession.php b/library/Pbs/PbsSession.php index 1e7bf46..1ed7cb1 100644 --- a/library/Pbs/PbsSession.php +++ b/library/Pbs/PbsSession.php @@ -7,7 +7,24 @@ class Pbs_PbsSession{ print_a("das ist ein Test"); } public function createsession(Application_Model_Session $session){ - print_a($session); + $sessionmapper = new Application_Model_SessionMapper(); + + $uniqid = $this->getUniqueCode(10); + $sm = new Application_Model_SessionMapper(); + while(count($sm->findBy('alphasessionID',$uniqid))>0){ + $uniqid = $this->getUniqueCode(16); + } + + $session->setAlphasessionID($uniqid); + $id = $sessionmapper->save($session); + $sessionmapper->find($id, $session); + return $session; + } + private function getUniqueCode($length = "") + { + $code = md5(uniqid(rand(), true)); + if ($length != "") return substr($code, 0, $length); + else return $code; } } diff --git a/pbs-newdata.sql b/pbs-newdata.sql index 7f4b958..1abb07c 100644 --- a/pbs-newdata.sql +++ b/pbs-newdata.sql @@ -20,17 +20,17 @@ INSERT INTO `pbs`.`pbs_membership` (`membershipID`, `groupID`, `roleID`, `person 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'); +INSERT INTO `pbs_client` (`clientID`, `groupID`,`macadress`, `hardwarehash`) VALUES +(1, 1, '00:00:00:00:00:10', 'ea9b82d9de911bc2d3cd23f53a6cab48'), +(2, 1, '00:00:00:00:10:00', '1e2b1599710fbbef0dc789e8cfe12455'), +(3, 1, '00:00:00:10:10:00', '8f6209ca3d6b35e223a11c249d1b69fc'), +(4, 1, '00:00:10:00:00:00', 'e17ab09f3586464f19629e2e8b1e9a9d'), +(5, 1, '00:10:00:00:00:00', '9bf70279d283b85440c2031c19bb6812'), +(6, 1, '10:00:00:00:00:00', 'ad3bce4464a6267441ec144744439c7e'), +(7, 1, '00:55:00:55:00:55', 'e8d7e80d79f224771b7a3a0af4e02748'), +(8, 1, '66:00:66:00:66:00', 'ded66ce272f384e9e386c1b57ded3e4d'), +(9, 1, '00:ff:ff:ff:ff:ff', '695610ee509c060b1fca9c8011529af4'), +(10, 1, '00:22:00:22:00:22', 'a3562c8cad2a4fa4fc11656025dc911b'); -- Adding config INSERT INTO `pbs_config` (`configID`, `title`, `groupID`, `membershipID`, `shellscript`, `created`) VALUES @@ -77,17 +77,13 @@ INSERT INTO `pbs_bootmenu` (`bootmenuID`, `membershipID`, `groupID`, `title`, `c -- Adding BootOs to BootMenus INSERT INTO `pbs_bootmenuentries` (`bootmenuentriesID`, `bootosID`, `bootmenuID`, `title`, `kcl`, `kclappend`, `configID`, `order`) VALUES -(1, 1, 1, 'Select BootOs 1', 'kcl 1', 'kcl 1', 1, 0), -(2, 1, 1, 'Select BootOs 1', 'kcl 2', 'kcl 2', 2, 1), -(3, 2, 1, 'Select BootOs 2', 'kcl 3', 'kcl 3', 2, 2), -(4, 5, 2, 'Select BootOs 5', 'kcl 5', 'kcl 5', 2, 0), -(5, 4, 2, 'Select BootOs 4', 'kcl 4', 'kcl 4', 2, 1), -(6, 10, 3, 'Select BootOs 10', 'kcl 10', 'kcl 10', 3, 0), -(7, 8, 3, 'Select BootOs 8', 'kcl 8', 'kcl 8', 4, 1), -(8, 1, 2, 'Select BootOs 7', 'kcl 7', 'kcl 7', 5, 2), -(9, 1, 5, 'Select BootOs 3', 'kcl 3', 'kcl 3', 4, 0), -(10, 9, 4, 'Select BootOs 9', 'kcl 9', 'kcl 9', 3, 0), -(11, 7, 4, 'Select BootOs 7', 'kcl 7', 'kcl 7', 5, 1); +(1, 5, 1, '123', 'default kcl 5', 'abc', 1, 0), +(2, 2, 1, 'menu2', 'default kcl 2', '123456', 1, 1), +(3, 6, 1, 'Mein OS 6', 'default kcl 6', 'appending', 1, 2), +(4, 10, 2, 'Das OS 10', 'default kcl 10', 'append', 1, 0), +(5, 9, 5, 'Bootos 9', 'default kcl 9', 'a', 1, 0), +(6, 1, 4, 'booting 1', 'default kcl 1', 'aphabeta', 1, 0), +(7, 6, 3, 'blablabla', 'default kcl 6', '11', 1, 0); -- Adding client to pools (poolentries) INSERT INTO `pbs_poolentries` (`poolentriesID`, `poolID`, `clientID`) VALUES @@ -208,6 +208,9 @@ CREATE TABLE IF NOT EXISTS `pbs_client` ( `hardwarehash` varchar(32), PRIMARY KEY (`clientID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; +ALTER TABLE `pbs_client` ADD `groupID` INT NOT NULL AFTER `clientID` ; +ALTER TABLE `pbs_client` + ADD CONSTRAINT `pbs_client_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; CREATE TABLE IF NOT EXISTS `pbs_session` ( `sessionID` int(11) NOT NULL AUTO_INCREMENT, @@ -225,6 +228,7 @@ ALTER TABLE `pbs_session` ADD `alphasessionID` VARCHAR( 16 ) NOT NULL AFTER `ses ALTER TABLE `pbs_session` ADD `bootmenuentryID` INT AFTER `clientID` ; ALTER TABLE `pbs_session` ADD `membershipID` INT NULL AFTER `bootisoID` ; + ALTER TABLE `pbs_session` ADD CONSTRAINT `pbs_session_ibfk_1` FOREIGN KEY (`clientID`) REFERENCES `pbs_client` (`clientID`) ON DELETE CASCADE, ADD CONSTRAINT `pbs_session_ibfk_2` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE SET NULL, diff --git a/public/media/css/style.css b/public/media/css/style.css index 183baac..8390fb2 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -235,3 +235,38 @@ tr td.action{ td.action img{border:none;} .clear{clear:both;} .footer{text-align:right;font-size:10px;font-family:Verdana, Arial;padding:10px 0px 10px 0px;} + +/* boxes */ +.okbox, .warningbox, .errorbox, .infobox { + margin:10px 0px; + padding:10px 10px 10px 40px; + border-width:1px; + color:#555; +} +.checkbox a, .warningbox a, .errorbox a{ + color:#555; +} +.infobox a{ + color:#777; +} +.warningbox{ + border:1px solid #CCC; + background: #FFFFAA url('/media/img/box_warning.png') no-repeat; + background-position:10px center; +} +.errorbox{ + border:1px solid #990000; + background: #FF9999 url('/media/img/box_error.png') no-repeat; + background-position:10px center; +} +.okbox{ + border:1px solid #339933; + background: #BBFFBB url('/media/img/box_check.png') no-repeat; + background-position:10px center; +} +.infobox{ + border:1px solid #CCC; + background: #FFFFFF url('/media/img/box_info.png') no-repeat; + background-position:10px center; + color:#777; +} diff --git a/public/media/img/box_check.png b/public/media/img/box_check.png Binary files differnew file mode 100644 index 0000000..65aaea6 --- /dev/null +++ b/public/media/img/box_check.png diff --git a/public/media/img/box_error.png b/public/media/img/box_error.png Binary files differnew file mode 100644 index 0000000..a5186cb --- /dev/null +++ b/public/media/img/box_error.png diff --git a/public/media/img/box_info.png b/public/media/img/box_info.png Binary files differnew file mode 100644 index 0000000..a31fb3e --- /dev/null +++ b/public/media/img/box_info.png diff --git a/public/media/img/box_warning.png b/public/media/img/box_warning.png Binary files differnew file mode 100644 index 0000000..57df115 --- /dev/null +++ b/public/media/img/box_warning.png |
