diff options
author | michael pereira | 2011-03-08 20:57:46 +0100 |
---|---|---|
committer | michael pereira | 2011-03-08 20:57:46 +0100 |
commit | 1a20e728eae09ceb8b3549628f67630a9b5d3ed8 (patch) | |
tree | 428c356ddad47c606a8834178cd6763abf5722de | |
parent | BootMenu Order fertig (diff) | |
parent | ansichten vereinheitlicht & Auth gefixxt & user test//test angelegt (diff) | |
download | pbs2-1a20e728eae09ceb8b3549628f67630a9b5d3ed8.tar.gz pbs2-1a20e728eae09ceb8b3549628f67630a9b5d3ed8.tar.xz pbs2-1a20e728eae09ceb8b3549628f67630a9b5d3ed8.zip |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
-rw-r--r-- | application/controllers/AuthController.php | 17 | ||||
-rw-r--r-- | application/layouts/main.phtml | 16 | ||||
-rw-r--r-- | application/models/PersonMapper.php | 6 | ||||
-rw-r--r-- | application/views/scripts/bootiso/index.phtml | 17 | ||||
-rw-r--r-- | application/views/scripts/bootmenu/index.phtml | 16 | ||||
-rw-r--r-- | application/views/scripts/bootos/index.phtml | 15 | ||||
-rw-r--r-- | application/views/scripts/client/index.phtml | 17 | ||||
-rw-r--r-- | application/views/scripts/config/index.phtml | 15 | ||||
-rw-r--r-- | application/views/scripts/filter/index.phtml | 27 | ||||
-rw-r--r-- | application/views/scripts/index/index.phtml | 2 | ||||
-rw-r--r-- | application/views/scripts/pool/index.phtml | 22 | ||||
-rw-r--r-- | application/views/scripts/session/index.phtml | 14 | ||||
-rw-r--r-- | pbs-data.sql | 4 | ||||
-rw-r--r-- | pbs.sql | 2 |
14 files changed, 85 insertions, 105 deletions
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php index c43e5a9..8ccb25c 100644 --- a/application/controllers/AuthController.php +++ b/application/controllers/AuthController.php @@ -2,10 +2,10 @@ class AuthController extends Zend_Controller_Action { - + private $db = null; public function init() { - $db = Zend_Db_Table::getDefaultAdapter(); + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() @@ -15,6 +15,9 @@ class AuthController extends Zend_Controller_Action public function loginAction() { + if (Zend_Auth::getInstance()->hasIdentity()) { + print_a('bereits angemeldet'); + } if (!isset($_POST["login"])){ $loginForm = new Application_Form_AuthLogin(); } else { @@ -25,7 +28,7 @@ class AuthController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $adapter = new Zend_Auth_Adapter_DbTable( - $db, + $this->db, 'pbs_person', 'email', 'password', @@ -41,7 +44,7 @@ class AuthController extends Zend_Controller_Action // TODO: erweiterte fehlerbeschreibung des Users if ($result->isValid()) { - $this->_redirect('/'); + $this->_redirect('/auth/login'); return; } else { echo "Falsche Email oder Passwort"; @@ -54,6 +57,9 @@ class AuthController extends Zend_Controller_Action public function registerAction() { + if (Zend_Auth::getInstance()->hasIdentity()) { + print_a('bereits angemeldet'); + } if (!isset($_POST["register"])){ $registerForm = new Application_Form_AuthRegister(); } else { @@ -68,7 +74,7 @@ class AuthController extends Zend_Controller_Action $person->setRegisterdate($date->getTimestamp()); $person->setPasswordSalt(MD5($date->getTimestamp())); $person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt())); - + print_a($person); try { $personmapper->save($person); }catch(Zend_Exception $e) @@ -80,6 +86,7 @@ class AuthController extends Zend_Controller_Action } echo "Erfolgreich registriert. <br/>"; echo "Weiter zum Login: <a href=\""."/auth/login"."\">Login</a>"; + $this->_redirect('/auth/login'); return; } } diff --git a/application/layouts/main.phtml b/application/layouts/main.phtml index 80147b9..4a3ba7f 100644 --- a/application/layouts/main.phtml +++ b/application/layouts/main.phtml @@ -13,13 +13,22 @@ echo $this->headScript(); <style> html{background-color:#E5F3FF} #wrapper{width:800px;margin:10px auto;border:1px solid black;background-color:#FFF;} - #innerwrapper{padding:20px;} + #innerwrapper{padding:20px;font-family:verdana, arial;} #nav{border-bottom:1px solid #000;background-color:#CCE7FF;padding:5px 10px;} #nav ul {margin:2px;} - #nav li{ display: inline;list-style-type: none;padding-right: 10px;font-family:verdana;font-size:11px;} + #nav li{ display: inline;list-style-type: none;padding-right: 10px;font-family:verdana;font-size:12px;} #nav li a{color:#000;} h1{display:block;width:400px;margin:5px auto;text-align:center;} table{width:100%;} + th{font-size:12px;border:1px solid #999;} + td{font-size:12px;border:1px solid #CCC;} + .addbutton{float:right;} + .monospace{font-family:Courier New, monospace;} + + dl.zend_form dt{width:120px;float:left;font-family:verdana, arial;font-size:12px;} + dl.zend_form dd{margin-left:120px;} + dl.zend_form dd *{font-size:12px;} + </style> </head> <body> @@ -35,7 +44,8 @@ echo $this->headScript(); <li><a href='/filter'>Filter</a></li> <li><a href='/pool'>Pool</a></li> <li><a href='/session'>Session</a></li> - <li><a href='/auth'>Auth</a></li> + <li><a href='/auth/login'>Login</a></li> + <li><a href='/auth/register'>Register</a></li> </ul> </div> <div id='innerwrapper'> diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php index 79a84c7..74f7250 100644 --- a/application/models/PersonMapper.php +++ b/application/models/PersonMapper.php @@ -47,7 +47,7 @@ class Application_Model_PersonMapper public function save(Application_Model_Person $person) { - $data = array('personID'=> $person->getID() ,'title'=> $person->getTitle() ,'name'=> $person->getName() ,'firstname'=> $person->getFirstname() ,'street'=> $person->getStreet() ,'housenumber'=> $person->getHousenumber() ,'city'=> $person->getCity() ,'postalcode'=> $person->getPostalcode() ,'logindate'=> $person->getLogindate() ,'registerdate'=> $person->getRegisterdate() ,'email'=> $person->getEmail() ,'login'=> $person->getLogin() ,'password'=> $person->getPassword() ,'password'=> $person->getPassword() ); + $data = array('personID'=> $person->getID() ,'title'=> $person->getTitle() ,'name'=> $person->getName() ,'firstname'=> $person->getFirstname() ,'street'=> $person->getStreet() ,'housenumber'=> $person->getHousenumber() ,'city'=> $person->getCity() ,'postalcode'=> $person->getPostalcode() ,'logindate'=> $person->getLogindate() ,'registerdate'=> $person->getRegisterdate() ,'email'=> $person->getEmail() ,'login'=> $person->getLogin() ,'password'=> $person->getPassword() ,'password_salt'=> $person->getPasswordSalt() ); if (null === ($id = $person->getID()) ) { unset($data['personID']); @@ -75,7 +75,7 @@ class Application_Model_PersonMapper $row = $result->current(); - $person->setID($row->personID)->setTitle($row->title)->setName($row->name)->setFirstname($row->firstname)->setStreet($row->street)->setHousenumber($row->housenumber)->setCity($row->city)->setPostalcode($row->postalcode)->setLogindate($row->logindate)->setRegisterdate($row->registerdate)->setEmail($row->email)->setLogin($row->login)->setPassword($row->password)->setPassword($row->password); + $person->setID($row->personID)->setTitle($row->title)->setName($row->name)->setFirstname($row->firstname)->setStreet($row->street)->setHousenumber($row->housenumber)->setCity($row->city)->setPostalcode($row->postalcode)->setLogindate($row->logindate)->setRegisterdate($row->registerdate)->setEmail($row->email)->setLogin($row->login)->setPassword($row->password)->setPasswordSalt($row->password_salt); } public function fetchAll() @@ -85,7 +85,7 @@ class Application_Model_PersonMapper foreach ($resultSet as $row) { $entry = new Application_Model_Person(); - $entry->setID($row->personID)->setTitle($row->title)->setName($row->name)->setFirstname($row->firstname)->setStreet($row->street)->setHousenumber($row->housenumber)->setCity($row->city)->setPostalcode($row->postalcode)->setLogindate($row->logindate)->setRegisterdate($row->registerdate)->setEmail($row->email)->setLogin($row->login)->setPassword($row->password)->setPassword($row->password); + $entry->setID($row->personID)->setTitle($row->title)->setName($row->name)->setFirstname($row->firstname)->setStreet($row->street)->setHousenumber($row->housenumber)->setCity($row->city)->setPostalcode($row->postalcode)->setLogindate($row->logindate)->setRegisterdate($row->registerdate)->setEmail($row->email)->setLogin($row->login)->setPassword($row->password)->setPasswordSalt($row->password_salt); $entries[] = $entry; } diff --git a/application/views/scripts/bootiso/index.phtml b/application/views/scripts/bootiso/index.phtml index 171d85f..f529ff3 100644 --- a/application/views/scripts/bootiso/index.phtml +++ b/application/views/scripts/bootiso/index.phtml @@ -1,12 +1,8 @@ <h1>BootISO</h1> - -<style> -table{font-family:verdana;font-size:12px;} -td{border:1px solid #CCC;} -tr.entry{background-color:#E0ECF8;} -</style> - -<table border=1> +<?php echo $this->formButton('createbootiso', 'Create BootISO', array( + 'onclick' => 'self.location="/bootiso/createbootiso"', + 'class' => 'addbutton'))?> +<table> <tr> <th>ID</th> <th>Title</th> @@ -48,9 +44,8 @@ tr.entry{background-color:#E0ECF8;} </tr> <?php endforeach; ?> </table> -<br/> -<?php echo $this->formButton('createbootiso', 'Create BootISO', array( - 'onclick' => 'self.location="/bootiso/createbootiso"'))?> + + diff --git a/application/views/scripts/bootmenu/index.phtml b/application/views/scripts/bootmenu/index.phtml index 2c02b0c..70bb134 100644 --- a/application/views/scripts/bootmenu/index.phtml +++ b/application/views/scripts/bootmenu/index.phtml @@ -1,14 +1,10 @@ <h1>BootMenu</h1> +<?php echo $this->formButton('createbootmenu', 'Create BootMenu', array( + 'onclick' => 'self.location="/bootmenu/createbootmenu"', + 'class' => 'addbutton'))?> -<style> -table{font-family:verdana;font-size:12px;} -td{border:1px solid #CCC;} -td.nostyle{background-color:#FFFFFF;} -tr.bootmenu{background-color:#D8D8D8;} -tr.bootentry{background-color:#E0ECF8;} -</style> -<table border=1> +<table> <tr> <th>ID</th> <th>Title</th> @@ -91,9 +87,7 @@ tr.bootentry{background-color:#E0ECF8;} <?php endforeach; ?> <?php endforeach; ?> </table> -<br/> -<?php echo $this->formButton('createbootmenu', 'Create BootMenu', array( - 'onclick' => 'self.location="/bootmenu/createbootmenu"'))?> + diff --git a/application/views/scripts/bootos/index.phtml b/application/views/scripts/bootos/index.phtml index 86bcdff..fefd219 100644 --- a/application/views/scripts/bootos/index.phtml +++ b/application/views/scripts/bootos/index.phtml @@ -1,12 +1,9 @@ <h1>BootOS</h1> +<?php echo $this->formButton('createbootos', 'Create BootOS', array( + 'onclick' => 'self.location="/bootos/createbootos"', + 'class' => 'addbutton'))?> -<style> -table{font-family:verdana;font-size:12px;} -td{border:1px solid #CCC;} -tr.entry{background-color:#E0ECF8;} -</style> - -<table border=1> +<table> <tr> <th>ID</th> <th>Title</th> @@ -54,9 +51,7 @@ tr.entry{background-color:#E0ECF8;} </tr> <?php endforeach; ?> </table> -<br/> -<?php echo $this->formButton('createbootos', 'Create BootOS', array( - 'onclick' => 'self.location="/bootos/createbootos"'))?> + diff --git a/application/views/scripts/client/index.phtml b/application/views/scripts/client/index.phtml index 0eb28b8..e9de06b 100644 --- a/application/views/scripts/client/index.phtml +++ b/application/views/scripts/client/index.phtml @@ -1,15 +1,10 @@ <h1>Clients</h1> +<?php echo $this->formButton('createbootos', 'Create Client', array( + 'onclick' => 'self.location="/client/addclient"', + 'class' => 'addbutton'))?> <?php if ($this->clients): ?> - <a href="<?php echo $this->url( - array( - 'controller' => 'client', - 'action' => 'addclient' - ), - 'default', - true) ?>">add client</a> - <!-- A table of filters. --> - <table border=1> + <table> <tr> <th>clientID</th> <th>MAC</th> @@ -18,8 +13,8 @@ <?php foreach ($this->clients as $client): ?> <tr class='client'> <td><?php echo $this->escape($client->getID()) ?></td> - <td><?php echo $this->escape($client->getMacadress()) ?></td> - <td><?php echo $this->escape($client->getHardwarehash()) ?></td> + <td class='monospace'><?php echo $this->escape($client->getMacadress()) ?></td> + <td class='monospace'><?php echo $this->escape($client->getHardwarehash()) ?></td> <td><a href="<?php echo $this->url( array( 'controller' => 'client', diff --git a/application/views/scripts/config/index.phtml b/application/views/scripts/config/index.phtml index e273b27..62ab1d4 100644 --- a/application/views/scripts/config/index.phtml +++ b/application/views/scripts/config/index.phtml @@ -1,12 +1,9 @@ <h1>Config</h1> +<?php echo $this->formButton('createconfig', 'Create Config', array( + 'onclick' => 'self.location="/config/createconfig"', + 'class' => 'addbutton'))?> -<style> -table{font-family:verdana;font-size:12px;} -td{border:1px solid #CCC;} -tr.entry{background-color:#E0ECF8;} -</style> - -<table border=1> +<table> <tr> <th>ID</th> <th>Title</th> @@ -42,9 +39,7 @@ tr.entry{background-color:#E0ECF8;} </tr> <?php endforeach; ?> </table> -<br/> -<?php echo $this->formButton('createconfig', 'Create Config', array( - 'onclick' => 'self.location="/config/createconfig"'))?> + diff --git a/application/views/scripts/filter/index.phtml b/application/views/scripts/filter/index.phtml index 5d70735..0de30a0 100644 --- a/application/views/scripts/filter/index.phtml +++ b/application/views/scripts/filter/index.phtml @@ -1,22 +1,10 @@ <h1>Filters</h1> - -<style> -table{font-family:verdana;font-size:12px;} -td{border:1px solid #CCC;} -tr.filter{background-color:#DDD;} -</style> -<p><a href="<?php echo $this->url( - array( - 'controller' => 'filter', - 'action' => 'addfilter' - ), - 'default', - true) ?>">add new filter</a></p> +<?php echo $this->formButton('createconfig', 'Add Filter', array( + 'onclick' => 'self.location="/filter/addfilter"', + 'class' => 'addbutton'))?> <?php if ($this->filters): ?> - - <!-- A table of filters. --> - <table border=1> + <table> <tr> <th>filterID</th> <th>Title</th> @@ -62,8 +50,13 @@ tr.filter{background-color:#DDD;} $erg = $fe->findBy('filterID',$filter->getID()); ?> <table style='width:100%;'> + <tr> + <th>Filtertype</th> + <th>Value</th> + <th>Value2</th> + </tr> <?php foreach ($erg as $filterentry): ?> - + <tr> <td><?php diff --git a/application/views/scripts/index/index.phtml b/application/views/scripts/index/index.phtml index 487bd28..57e6edb 100644 --- a/application/views/scripts/index/index.phtml +++ b/application/views/scripts/index/index.phtml @@ -1 +1 @@ -<h1>Zend-Framework Index</h1> +<h1>Welcome</h1> diff --git a/application/views/scripts/pool/index.phtml b/application/views/scripts/pool/index.phtml index c3a6be9..2df3e52 100644 --- a/application/views/scripts/pool/index.phtml +++ b/application/views/scripts/pool/index.phtml @@ -1,17 +1,10 @@ <h1>Pools</h1> - -<a href="<?php echo $this->url( - array( - 'controller' => 'pool', - 'action' => 'createpool' - ), - 'default', - true) ?>">create pool</a> +<?php echo $this->formButton('createconfig', 'Create Pool', array( + 'onclick' => 'self.location="/pool/createpool"', + 'class' => 'addbutton'))?> <?php if ($this->pools): ?> - - <!-- A table of filters. --> - <table border=1> + <table > <tr> <th>poolID</th> <th>Title</th> @@ -52,7 +45,12 @@ <tr> <td> </td> - <td colspan=6><table border=1><tr><th>clientID</th><th>mac</th><th>hardwarehash</th></th> + <td colspan=6><table> + <tr> + <th>clientID</th> + <th>mac</th> + <th>hardwarehash</th> + </tr> <?php $poolentriesMapper = new Application_Model_PoolEntriesMapper(); $clients = $poolentriesMapper->findBy('poolID',$pool->getID()); diff --git a/application/views/scripts/session/index.phtml b/application/views/scripts/session/index.phtml index d26e818..1d2506b 100644 --- a/application/views/scripts/session/index.phtml +++ b/application/views/scripts/session/index.phtml @@ -1,14 +1,8 @@ <h1>Session</h1> - -<p><a href="<?php echo $this->url( - array( - 'controller' => 'session', - 'action' => 'createsession' - ), - 'default', - true) ?>">create new session</a></p> - -<table border=1> +<?php echo $this->formButton('createconfig', 'Create Session', array( + 'onclick' => 'self.location="/session/createsession"', + 'class' => 'addbutton'))?> +<table> <tr> <th>SessionID</th> <th>ClientID</th> diff --git a/pbs-data.sql b/pbs-data.sql index 52a174a..89d9e92 100644 --- a/pbs-data.sql +++ b/pbs-data.sql @@ -71,3 +71,7 @@ INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `pat (1, 'BootISO 1', 1, 1, '', 1337, '', NULL, 1), (2, 'BootISO 2', 1, 1, '', 1337, '', NULL, 1); +INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`) VALUES +(1, '1', '2', '3', '4', '5', '6', '7', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a'); + + @@ -65,7 +65,7 @@ CREATE TABLE IF NOT EXISTS `pbs_person` ( `logindate` varchar(14) COLLATE utf8_unicode_ci, `registerdate` varchar(14) COLLATE utf8_unicode_ci NOT NULL, `email` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE, - `login` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `login` varchar(30) COLLATE utf8_unicode_ci, `password` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `password_salt` varchar(64) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`personID`) |