From c8bbb9cae7b60ed988cbbf93f9e5cdbfae798ce2 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 8 Mar 2011 20:33:51 +0100 Subject: ansichten vereinheitlicht & Auth gefixxt & user test//test angelegt --- application/controllers/AuthController.php | 17 +++++++++++----- application/layouts/main.phtml | 16 ++++++++++++--- application/models/PersonMapper.php | 6 +++--- application/views/scripts/bootiso/index.phtml | 17 ++++++---------- application/views/scripts/bootmenu/index.phtml | 16 +++++---------- application/views/scripts/bootos/index.phtml | 15 +++++--------- application/views/scripts/client/index.phtml | 17 ++++++---------- application/views/scripts/config/index.phtml | 15 +++++--------- application/views/scripts/filter/index.phtml | 27 ++++++++++---------------- application/views/scripts/index/index.phtml | 2 +- application/views/scripts/pool/index.phtml | 22 ++++++++++----------- application/views/scripts/session/index.phtml | 14 ++++--------- pbs-data.sql | 4 ++++ 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.
"; echo "Weiter zum Login: Login"; + $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(); @@ -35,7 +44,8 @@ echo $this->headScript();
  • Filter
  • Pool
  • Session
  • -
  • Auth
  • +
  • Login
  • +
  • Register
  • 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 @@

    BootISO

    - - - - +formButton('createbootiso', 'Create BootISO', array( + 'onclick' => 'self.location="/bootiso/createbootiso"', + 'class' => 'addbutton'))?> +
    @@ -48,9 +44,8 @@ tr.entry{background-color:#E0ECF8;}
    ID Title
    -
    -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 25edc53..d213a6f 100644 --- a/application/views/scripts/bootmenu/index.phtml +++ b/application/views/scripts/bootmenu/index.phtml @@ -1,14 +1,10 @@

    BootMenu

    +formButton('createbootmenu', 'Create BootMenu', array( + 'onclick' => 'self.location="/bootmenu/createbootmenu"', + 'class' => 'addbutton'))?> - - +
    @@ -90,9 +86,7 @@ tr.bootentry{background-color:#E0ECF8;}
    ID Title
    -
    -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 @@

    BootOS

    +formButton('createbootos', 'Create BootOS', array( + 'onclick' => 'self.location="/bootos/createbootos"', + 'class' => 'addbutton'))?> - - - +
    @@ -54,9 +51,7 @@ tr.entry{background-color:#E0ECF8;}
    ID Title
    -
    -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 @@

    Clients

    +formButton('createbootos', 'Create Client', array( + 'onclick' => 'self.location="/client/addclient"', + 'class' => 'addbutton'))?> clients): ?> - add client - - +
    @@ -18,8 +13,8 @@ clients as $client): ?> - - + +
    clientID MAC
    escape($client->getID()) ?>escape($client->getMacadress()) ?>escape($client->getHardwarehash()) ?>escape($client->getMacadress()) ?>escape($client->getHardwarehash()) ?> 'addbutton'))?> - - - +
    @@ -42,9 +39,7 @@ tr.entry{background-color:#E0ECF8;}
    ID Title
    -
    -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 @@

    Filters

    - - -

    add new filter

    +formButton('createconfig', 'Add Filter', array( + 'onclick' => 'self.location="/filter/addfilter"', + 'class' => 'addbutton'))?> filters): ?> - - - +
    @@ -62,8 +50,13 @@ tr.filter{background-color:#DDD;} $erg = $fe->findBy('filterID',$filter->getID()); ?>
    filterID Title
    + + + + + - +
    FiltertypeValueValue2
    Zend-Framework Index +

    Welcome

    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 @@

    Pools

    - -create pool +formButton('createconfig', 'Create Pool', array( + 'onclick' => 'self.location="/pool/createpool"', + 'class' => 'addbutton'))?> pools): ?> - - - +
    @@ -52,7 +45,12 @@ -
    poolID Title
    +
    clientIDmachardwarehash + + + + + 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 @@

    Session

    - -

    create new session

    - -
    clientIDmachardwarehash
    +formButton('createconfig', 'Create Session', array( + 'onclick' => 'self.location="/session/createsession"', + 'class' => 'addbutton'))?> +
    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'); + + diff --git a/pbs.sql b/pbs.sql index 3923188..58c9392 100644 --- a/pbs.sql +++ b/pbs.sql @@ -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`) -- cgit v1.2.3-55-g7522
    SessionID ClientID