diff options
84 files changed, 1653 insertions, 375 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index 7ad37ee..262f79c 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -47,6 +47,7 @@ <dbTableFile dbTableName="Session"/> <dbTableFile dbTableName="PreBoot"/> <dbTableFile dbTableName="PasswordRecovery"/> + <dbTableFile dbTableName="RightCategory"/> </dbTableDirectory> <modelFile modelName="BootIsoMapper"/> <modelFile modelName="BootMenuMapper"/> @@ -96,6 +97,8 @@ <modelFile modelName="PreBootMapper"/> <modelFile modelName="PasswordRecovery"/> <modelFile modelName="PasswordRecoveryMapper"/> + <modelFile modelName="RightCategory"/> + <modelFile modelName="RightCategoryMapper"/> </modelsDirectory> <modulesDirectory> <moduleDirectory moduleName="user"> @@ -123,6 +126,14 @@ </controllerFile> <controllerFile controllerName="Group"> <actionMethod actionName="index"/> + <actionMethod actionName="add"/> + <actionMethod actionName="edit"/> + <actionMethod actionName="show"/> + <actionMethod actionName="link"/> + <actionMethod actionName="delete"/> + <actionMethod actionName="grantperson"/> + <actionMethod actionName="revokeperson"/> + <actionMethod actionName="showall"/> </controllerFile> <controllerFile controllerName="Role"> <actionMethod actionName="index"/> @@ -187,6 +198,10 @@ <formFile formName="RoleAdd"/> <formFile formName="RoleEdit"/> <formFile formName="LinkRight"/> + <formFile formName="GroupEdit"/> + <formFile formName="GroupAdd"/> + <formFile formName="GroupLink"/> + <formFile formName="ConfirmDeleteAccount"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -209,15 +224,6 @@ <viewControllerScriptsDirectory forControllerName="Auth"> <viewScriptFile forActionName="recoverpassword"/> </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Person"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Group"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Role"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Bootiso"> <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> @@ -282,6 +288,9 @@ <viewScriptFile forActionName="removefilterentry"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Person"> + <viewScriptFile forActionName="index"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Person"> <viewScriptFile forActionName="edit"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Person"> @@ -291,6 +300,9 @@ <viewScriptFile forActionName="selectmembership"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Role"> + <viewScriptFile forActionName="index"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Role"> <viewScriptFile forActionName="add"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Role"> @@ -304,6 +316,20 @@ </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Preboot"> <viewScriptFile forActionName="index"/> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="add"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="edit"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="show"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="link"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Group"> + <viewScriptFile forActionName="showall"/> </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> @@ -322,10 +348,13 @@ <actionMethod actionName="index"/> <actionMethod actionName="login"/> <actionMethod actionName="logout"/> + <actionMethod actionName="selectmembership"/> + <actionMethod actionName="changemembership"/> </controllerFile> </controllersDirectory> <formsDirectory> <formFile formName="Login"/> + <formFile formName="MembershipSelect"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -337,13 +366,10 @@ <viewScriptFile forActionName="index"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Auth"> - <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> - <viewControllerScriptsDirectory forControllerName="Auth"> <viewScriptFile forActionName="login"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Auth"> - <viewScriptFile forActionName="logout"/> + <viewScriptFile forActionName="selectmembership"/> </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> @@ -502,6 +528,7 @@ <formFile formName="LinkRight"/> <formFile formName="RoleAdd"/> <formFile formName="NewPassword"/> + <formFile formName="ConfirmDeleteAccount"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -525,6 +552,9 @@ <viewScriptFile forActionName="register"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Auth"> + <viewScriptFile forActionName="delete"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Auth"> <viewScriptFile forActionName="recoverpassword"/> </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Bootos"> diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml index 463be5d..86c4155 100644 --- a/application/layouts/default.phtml +++ b/application/layouts/default.phtml @@ -44,15 +44,16 @@ echo $this->headScript()."\n"; <div id="content"> <?php echo $this->layout()->content; ?> </div> -</div> - -<div id="footer" class="footer flexbox flex"> - <div style='padding:5px;'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // - <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // - <i>version: 0.1.1</i> - </div> -</div> + + <div id="footer" class="footer flexbox flex"> + <div style='padding:5px;'> + <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // + <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // + <i>version: 0.1.1</i> + </div> + </div> +</div> + <div id='debug'> <div class='v1'> <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> diff --git a/application/models/DbTable/RightCategory.php b/application/models/DbTable/RightCategory.php new file mode 100644 index 0000000..65150ba --- /dev/null +++ b/application/models/DbTable/RightCategory.php @@ -0,0 +1,10 @@ +<?php + +class Application_Model_DbTable_RightCategory extends Zend_Db_Table_Abstract +{ + + protected $_name = 'pbs_rightcategory'; + + +} + diff --git a/application/models/Right.php b/application/models/Right.php index c0df29c..874453c 100644 --- a/application/models/Right.php +++ b/application/models/Right.php @@ -3,6 +3,7 @@ class Application_Model_Right { protected $_rightID; + protected $_rightcategoryID; protected $_title; protected $_description; @@ -53,6 +54,15 @@ class Application_Model_Right $this->_rightID = $_rightID; return $this; } + public function getRightcategoryID() + { + return $this->_rightcategoryID; + } + public function setRightcategoryID($_rightcategoryID) + { + $this->_rightID = $_rightcategoryID; + return $this; + } public function getTitle() { return $this->_title; @@ -71,39 +81,39 @@ class Application_Model_Right $this->_description = $_description; return $this; } - /** - * Returns current data as associative array using ReflectionClass - * - * @return array Returns associative array containing model data + /** + * Returns current data as associative array using ReflectionClass + * + * @return array Returns associative array containing model data * If "get"-method not available (our primary keys) the function getID() is called - */ - public function toArray() - { - $reflectionClass = new ReflectionClass($this); - $properties = $reflectionClass->getProperties(); - $result = array(); - foreach ($properties as $property) { - $key = $property->name; - if (substr($key, 0, 1) != '_' && $this->$key !== null) { - $method = 'get' . ucfirst($key); - if ($reflectionClass->hasMethod($method)) { - $result[$key] = $this->$method(); - } else { - $result[$key] = $this->$key; - } - } + */ + public function toArray() + { + $reflectionClass = new ReflectionClass($this); + $properties = $reflectionClass->getProperties(); + $result = array(); + foreach ($properties as $property) { + $key = $property->name; + if (substr($key, 0, 1) != '_' && $this->$key !== null) { + $method = 'get' . ucfirst($key); + if ($reflectionClass->hasMethod($method)) { + $result[$key] = $this->$method(); + } else { + $result[$key] = $this->$key; + } + } elseif(substr($key, 0, 1) == '_' && $this->$key !== null) { $key = substr($key, 1); - $method = 'get' . ucfirst($key); + $method = 'get' . ucfirst($key); if ($reflectionClass->hasMethod($method)) { $result[$key] = $this->$method(); }else{ $result[$key] = $this->getID(); } - + } - } - return $result; - } + } + return $result; + } } diff --git a/application/models/RightCategory.php b/application/models/RightCategory.php new file mode 100644 index 0000000..42bcbb8 --- /dev/null +++ b/application/models/RightCategory.php @@ -0,0 +1,94 @@ +<?php + +class Application_Model_RightCategory +{ + protected $_rightcategoryID; + protected $_title; + + public function __construct(array $options = null) + { + if (is_array($options)) { + $this->setOptions($options); + } + } + + public function __set($name, $value) + { + $method = 'set' . $name; + if (('mapper' == $name) || !method_exists($this, $method)) { + throw new Exception('Invalid rightcategory property'); + } + $this->$method($value); + } + + public function __get($name) + { + $method = 'get' . $name; + if (('mapper' == $name) || !method_exists($this, $method)) { + throw new Exception('Invalid rightcategory property'); + } + return $this->$method(); + } + + public function setOptions(array $options) + { + $methods = get_class_methods($this); + foreach ($options as $key => $value) { + $method = 'set' . ucfirst($key); + if (in_array($method, $methods)) { + $this->$method($value); + } + } + return $this; + } + + public function getID() + { + return $this->_rightcategoryID; + } + public function setID($_rightcategoryID) + { + $this->_rightID = $_rightcategoryID; + return $this; + } + public function getTitle() + { + return $this->_title; + } + public function setTitle($_title) + { + $this->_title = $_title; + return $this; + } + + public function toArray() + { + $reflectionClass = new ReflectionClass($this); + $properties = $reflectionClass->getProperties(); + $result = array(); + foreach ($properties as $property) { + $key = $property->name; + if (substr($key, 0, 1) != '_' && $this->$key !== null) { + $method = 'get' . ucfirst($key); + if ($reflectionClass->hasMethod($method)) { + $result[$key] = $this->$method(); + } else { + $result[$key] = $this->$key; + } + } + elseif(substr($key, 0, 1) == '_' && $this->$key !== null) { + $key = substr($key, 1); + $method = 'get' . ucfirst($key); + if ($reflectionClass->hasMethod($method)) { + $result[$key] = $this->$method(); + }else{ + $result[$key] = $this->getID(); + } + + } + } + return $result; + } + +} + diff --git a/application/models/RightCategoryMapper.php b/application/models/RightCategoryMapper.php new file mode 100644 index 0000000..1a3d093 --- /dev/null +++ b/application/models/RightCategoryMapper.php @@ -0,0 +1,103 @@ +<?php + +class Application_Model_RightCategoryMapper +{ + + protected $_dbTable; + + public function findBy($criteria, $value) + { + try{ + $db = Zend_Db_Table::getDefaultAdapter(); + $select = $this->getDbTable()->select() + ->from($this->_dbTable) + ->where($criteria . ' = ?', $value); + $stmt = $select->query(); + $result = $stmt->fetchAll(); + return $result; + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + } + } + + public function setDbTable($dbTable) + { + if (is_string($dbTable)) { + $dbTable = new $dbTable(); + } + + if (!$dbTable instanceof Zend_Db_Table_Abstract) { + throw new Exception('Invalid table data gateway provided'); + } + + $this->_dbTable = $dbTable; + + return $this; + } + + public function getDbTable() + { + if (null === $this->_dbTable) { + $this->setDbTable('Application_Model_DbTable_RightCategory'); + } + + return $this->_dbTable; + } + + public function save(Application_Model_RightCategory $rightCategory) + { + + $data = array('rightcategoryID'=> $rightCategory->getID() ,'title'=> $rightCategory->getTitle() ); + + if (null === ($id = $rightCategory->getID()) ) { + unset($data['rightcategoryID']); + $this->getDbTable()->insert($data); + } else { + $this->getDbTable()->update($data, array('rightcategoryID = ?' => $id)); + } + } + + public function delete(Application_Model_RightCategory $rightCategory) + { + if (null === ($id = $rightCategory->getID()) ) { + return; + } else { + $this->getDbTable()->delete(array('rightcategoryID = ?' => $id)); + } + } + + public function find($id) + { + $result = $this->getDbTable()->find($id); + if (0 == count($result)) { + return; + } + + $row = $result->current(); + + $rightCategory = new Application_Model_RightCategory(); + $rightCategory->setID($row->rightcategoryID)->setTitle($row->title); + return $rightCategory; + } + + public function fetchAll() + { + $resultSet = $this->getDbTable()->fetchAll(); + $entries = array(); + foreach ($resultSet as $row) { + $entry = new Application_Model_RightCategory(); + + $entry->setID($row->rightcategoryID)->setTitle($row->title); + $entries[] = $entry; + } + return $entries; + } + + public function compare(Application_Model_RightCategory $v1,Application_Model_RightCategory $v2){ + $vv1 = $v1->toArray(); + $vv2 = $v2->toArray(); + return array_diff($vv1,$vv2); + } + +} + diff --git a/application/models/Role.php b/application/models/Role.php index 28f0af1..49ed377 100644 --- a/application/models/Role.php +++ b/application/models/Role.php @@ -6,6 +6,7 @@ class Application_Model_Role protected $_groupID; protected $_title; protected $_description; + protected $_inheritance; public function __construct(array $options = null) { @@ -81,39 +82,48 @@ class Application_Model_Role $this->_description = $_description; return $this; } - /** - * Returns current data as associative array using ReflectionClass - * - * @return array Returns associative array containing model data + public function getInheritance() + { + return $this->_inheritance; + } + public function setInheritance($_inheritance) + { + $this->_inheritance = $_inheritance; + return $this; + } + /** + * Returns current data as associative array using ReflectionClass + * + * @return array Returns associative array containing model data * If "get"-method not available (our primary keys) the function getID() is called - */ - public function toArray() - { - $reflectionClass = new ReflectionClass($this); - $properties = $reflectionClass->getProperties(); - $result = array(); - foreach ($properties as $property) { - $key = $property->name; - if (substr($key, 0, 1) != '_' && $this->$key !== null) { - $method = 'get' . ucfirst($key); - if ($reflectionClass->hasMethod($method)) { - $result[$key] = $this->$method(); - } else { - $result[$key] = $this->$key; - } - } + */ + public function toArray() + { + $reflectionClass = new ReflectionClass($this); + $properties = $reflectionClass->getProperties(); + $result = array(); + foreach ($properties as $property) { + $key = $property->name; + if (substr($key, 0, 1) != '_' && $this->$key !== null) { + $method = 'get' . ucfirst($key); + if ($reflectionClass->hasMethod($method)) { + $result[$key] = $this->$method(); + } else { + $result[$key] = $this->$key; + } + } elseif(substr($key, 0, 1) == '_' && $this->$key !== null) { $key = substr($key, 1); - $method = 'get' . ucfirst($key); + $method = 'get' . ucfirst($key); if ($reflectionClass->hasMethod($method)) { $result[$key] = $this->$method(); }else{ $result[$key] = $this->getID(); } - + } - } - return $result; - } + } + return $result; + } } diff --git a/application/models/RoleMapper.php b/application/models/RoleMapper.php index 561a7d4..4001e3e 100644 --- a/application/models/RoleMapper.php +++ b/application/models/RoleMapper.php @@ -47,7 +47,7 @@ class Application_Model_RoleMapper public function save(Application_Model_Role $role) { - $data = array('roleID'=> $role->getID() ,'groupID'=> $role->getGroupID() ,'title'=> $role->getTitle() ,'description'=> $role->getDescription() ); + $data = array('roleID'=> $role->getID() ,'groupID'=> $role->getGroupID() ,'title'=> $role->getTitle() ,'description'=> $role->getDescription(), 'inheritance' => $role->getInheritance() ); if (null === ($id = $role->getID()) ) { unset($data['roleID']); @@ -75,7 +75,7 @@ class Application_Model_RoleMapper $row = $result->current(); $role = new Application_Model_Role(); - $role->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description); + $role->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance); return $role; } @@ -86,7 +86,7 @@ class Application_Model_RoleMapper foreach ($resultSet as $row) { $entry = new Application_Model_Role(); - $entry->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description); + $entry->setID($row->roleID)->setGroupID($row->groupID)->setTitle($row->title)->setDescription($row->description)->setInheritance($row->inheritance); $entries[] = $entry; } diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php index 41952a2..078a4cf 100644 --- a/application/modules/dev/controllers/AuthController.php +++ b/application/modules/dev/controllers/AuthController.php @@ -110,8 +110,9 @@ class dev_AuthController extends Zend_Controller_Action $this->_helper-> viewRenderer-> setNoRender(); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); - $this->_helper->redirector('login', 'auth'); + Zend_Session::namespaceUnset('userIDs'); Zend_Session::forgetMe(); + $this->_helper->redirector('login', 'auth'); return; } @@ -206,25 +207,31 @@ class dev_AuthController extends Zend_Controller_Action public function deleteAction() { - $this->_helper-> viewRenderer-> setNoRender(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); - $person = $result[0]; - $personID = $person["personID"]; - if (isset($personID)){ - $this->personmapper = new Application_Model_PersonMapper(); - $person = $this->personmapper->find($personID); - try { - $this->personmapper->delete($person); - }catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; + if($_POST['confirmdelete']) { + $auth = Zend_Auth::getInstance(); + $result = $this->personmapper->findBy('email', $auth->getIdentity()); + $person = $result[0]; + $personID = $person["personID"]; + if (isset($personID)){ + $this->personmapper = new Application_Model_PersonMapper(); + $person = $this->personmapper->find($personID); + try { + $this->personmapper->delete($person); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $auth->clearIdentity(); + Zend_Session::namespaceUnset('userIDs'); + Zend_Session::forgetMe(); + $this->_helper->redirector('login', 'auth'); return; } - $auth = Zend_Auth::getInstance(); - $auth->clearIdentity(); - $this->_helper->redirector('login', 'auth'); - return; + } else { + $deleteconfirmform = new dev_Form_ConfirmDeleteAccount(); + $this->view->deleteconfirmform = $deleteconfirmform; } } } diff --git a/application/modules/dev/controllers/RoleController.php b/application/modules/dev/controllers/RoleController.php index 709d623..65989b6 100644 --- a/application/modules/dev/controllers/RoleController.php +++ b/application/modules/dev/controllers/RoleController.php @@ -75,6 +75,7 @@ class dev_RoleController extends Zend_Controller_Action $_POST['title'] = $role->getTitle(); $_POST['description'] = $role->getDescription(); $_POST['groupID'] = $role->getGroupID(); + $_POST['inheritance'] = $role->getInheritance(); $editForm = new dev_Form_RoleEdit(); } else { $editForm = new dev_Form_RoleEdit($_POST); diff --git a/application/modules/dev/forms/AuthRecoverPassword.php b/application/modules/dev/forms/AuthRecoverPassword.php index a1de7ea..35779fc 100644 --- a/application/modules/dev/forms/AuthRecoverPassword.php +++ b/application/modules/dev/forms/AuthRecoverPassword.php @@ -19,7 +19,7 @@ class dev_Form_AuthRecoverPassword extends Zend_Form $this->addElement('submit', 'recoverPassword', array( 'required' => false, 'ignore' => true, - 'label' => 'Recover Password', + 'label' => 'Recover', )); } diff --git a/application/modules/dev/forms/ConfirmDeleteAccount.php b/application/modules/dev/forms/ConfirmDeleteAccount.php new file mode 100644 index 0000000..c093996 --- /dev/null +++ b/application/modules/dev/forms/ConfirmDeleteAccount.php @@ -0,0 +1,27 @@ +<?php + +class dev_Form_ConfirmDeleteAccount extends Zend_Form +{ + + public function init() + { + $this->setName("ConfirmDeleteAccount"); + $this->setMethod('post'); + + $this->addElement('submit', 'confirmdelete', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Confirm', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); + } + + +} + diff --git a/application/modules/dev/forms/GroupAdd.php b/application/modules/dev/forms/GroupAdd.php index a235b56..8132f3a 100644 --- a/application/modules/dev/forms/GroupAdd.php +++ b/application/modules/dev/forms/GroupAdd.php @@ -56,7 +56,7 @@ class dev_Form_GroupAdd extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/group/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/GroupEdit.php b/application/modules/dev/forms/GroupEdit.php index f2f51a4..96784de 100644 --- a/application/modules/dev/forms/GroupEdit.php +++ b/application/modules/dev/forms/GroupEdit.php @@ -39,7 +39,7 @@ class dev_Form_GroupEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/group/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/GroupLink.php b/application/modules/dev/forms/GroupLink.php index 81c2dbe..8a65e77 100644 --- a/application/modules/dev/forms/GroupLink.php +++ b/application/modules/dev/forms/GroupLink.php @@ -24,7 +24,7 @@ class dev_Form_GroupLink extends Zend_Form } $groupfield->setRegisterInArrayValidator(false); $this->addElement($groupfield); - + $groupfield1 = $this->createElement('select','superordinatedGroupID'); $groupfield1 ->setLabel('superordinated Group:'); @@ -46,7 +46,7 @@ class dev_Form_GroupLink extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/group/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/GroupRequest.php b/application/modules/dev/forms/GroupRequest.php index efaafaf..2c12aaf 100644 --- a/application/modules/dev/forms/GroupRequest.php +++ b/application/modules/dev/forms/GroupRequest.php @@ -33,7 +33,7 @@ class dev_Form_GroupRequest extends Zend_Form $this->addElement('submit', 'request', array( 'required' => false, 'ignore' => true, - 'label' => 'Request Membership', + 'label' => 'Request', )); } diff --git a/application/modules/dev/forms/GroupSelect.php b/application/modules/dev/forms/GroupSelect.php index 1eaf455..be28997 100644 --- a/application/modules/dev/forms/GroupSelect.php +++ b/application/modules/dev/forms/GroupSelect.php @@ -33,7 +33,7 @@ class dev_Form_GroupSelect extends Zend_Form $this->addElement('submit', 'selectgroup', array( 'required' => false, 'ignore' => true, - 'label' => 'Select Group', + 'label' => 'Select', )); } diff --git a/application/modules/dev/forms/LinkRight.php b/application/modules/dev/forms/LinkRight.php index 8b9c3a9..0745791 100644 --- a/application/modules/dev/forms/LinkRight.php +++ b/application/modules/dev/forms/LinkRight.php @@ -32,14 +32,14 @@ class dev_Form_LinkRight extends Zend_Form $this->addElement('submit', 'link', array( 'required' => false, 'ignore' => true, - 'label' => 'Add Right', + 'label' => 'Add', )); $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/role/show/roleID/' . $this->roleID . '"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/PersonEdit.php b/application/modules/dev/forms/PersonEdit.php index aa39c34..c04f418 100644 --- a/application/modules/dev/forms/PersonEdit.php +++ b/application/modules/dev/forms/PersonEdit.php @@ -108,7 +108,7 @@ class dev_Form_PersonEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/person/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/RoleAdd.php b/application/modules/dev/forms/RoleAdd.php index d773b17..6d43904 100644 --- a/application/modules/dev/forms/RoleAdd.php +++ b/application/modules/dev/forms/RoleAdd.php @@ -31,6 +31,10 @@ class dev_Form_RoleAdd extends Zend_Form 'label' => 'Description:', )); + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + $this->addElement('submit', 'add', array( 'required' => false, 'ignore' => true, @@ -41,7 +45,7 @@ class dev_Form_RoleAdd extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/role/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/dev/forms/RoleEdit.php b/application/modules/dev/forms/RoleEdit.php index 2c79050..1a9afc5 100644 --- a/application/modules/dev/forms/RoleEdit.php +++ b/application/modules/dev/forms/RoleEdit.php @@ -3,9 +3,9 @@ class dev_Form_RoleEdit extends Zend_Form { - public function init() - { - $this->setName("RoleEdit"); + public function init() + { + $this->setName("RoleEdit"); $this->setMethod('post'); $this->addElement('text', 'title', array( @@ -28,6 +28,17 @@ class dev_Form_RoleEdit extends Zend_Form 'value' => $_POST['description'], )); + if($_POST['inheritance'] == 1) { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + 'checked' => 'checked', + )); + } else { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + } + $this->addElement('hidden', 'groupID', array( 'value' => $_POST['groupID'], )); @@ -42,9 +53,9 @@ class dev_Form_RoleEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/dev/role/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); - } + } } diff --git a/application/modules/dev/layouts/dev.phtml b/application/modules/dev/layouts/dev.phtml index 29b5306..944c617 100644 --- a/application/modules/dev/layouts/dev.phtml +++ b/application/modules/dev/layouts/dev.phtml @@ -43,7 +43,7 @@ echo $this->headScript()."\n"; <li class='navTreeItem'><a href='/dev/auth/register'>Register</a></li> <?php } else {?> - <li class='navTreeItem'><a href='/dev/auth/delete'>Account Löschen</a></li> + <li class='navTreeItem'><a href='/dev/auth/delete'>Delete Account</a></li> <li class='navTreeItem'><a href='/dev/auth/logout'>Logout</a></li> <?php } @@ -70,15 +70,16 @@ echo $this->headScript()."\n"; <div id="content"> <?php echo $this->layout()->content; ?> </div> -</div> - -<div id="footer" class="footer flexbox flex"> - <div style='padding:5px;'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // - <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // - <i>version: 0.1.1</i> - </div> -</div> + + <div id="footer" class="footer flexbox flex"> + <div style='padding:5px;'> + <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // + <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // + <i>version: 0.1.1</i> + </div> + </div> +</div> + <div id='debug'> <div class='v1'> <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> diff --git a/application/modules/dev/views/scripts/auth/delete.phtml b/application/modules/dev/views/scripts/auth/delete.phtml new file mode 100644 index 0000000..62bf24e --- /dev/null +++ b/application/modules/dev/views/scripts/auth/delete.phtml @@ -0,0 +1,6 @@ +<h1>Delete Account</h1> +Do you really want to delete this account? +<?php +$this->deleteconfirmform->setAction($this->url()); +echo $this->deleteconfirmform; +?>
\ No newline at end of file diff --git a/application/modules/dev/views/scripts/auth/login.phtml b/application/modules/dev/views/scripts/auth/login.phtml index 815cda4..e22bd0b 100644 --- a/application/modules/dev/views/scripts/auth/login.phtml +++ b/application/modules/dev/views/scripts/auth/login.phtml @@ -1,3 +1,4 @@ +<h1>Login</h1> <?php $this->loginForm->setAction($this->url()); echo $this->loginForm; diff --git a/application/modules/dev/views/scripts/auth/recoverpassword.phtml b/application/modules/dev/views/scripts/auth/recoverpassword.phtml index 881e00e..089aec3 100644 --- a/application/modules/dev/views/scripts/auth/recoverpassword.phtml +++ b/application/modules/dev/views/scripts/auth/recoverpassword.phtml @@ -1,3 +1,4 @@ +<h1>Recover Password</h1> <?php $this->recoverPasswordForm->setAction($this->url()); echo $this->recoverPasswordForm; diff --git a/application/modules/dev/views/scripts/auth/register.phtml b/application/modules/dev/views/scripts/auth/register.phtml index 5196738..74c7df5 100644 --- a/application/modules/dev/views/scripts/auth/register.phtml +++ b/application/modules/dev/views/scripts/auth/register.phtml @@ -1,3 +1,4 @@ +<h1>New Account</h1> <?php $this->registerForm->setAction($this->url()); echo $this->registerForm; diff --git a/application/modules/dev/views/scripts/group/add.phtml b/application/modules/dev/views/scripts/group/add.phtml index 4f96cf0..588ce31 100644 --- a/application/modules/dev/views/scripts/group/add.phtml +++ b/application/modules/dev/views/scripts/group/add.phtml @@ -1,3 +1,4 @@ +<h1>Add Group</h1> <?php $this->addForm->setAction($this->url()); echo $this->addForm; diff --git a/application/modules/dev/views/scripts/group/edit.phtml b/application/modules/dev/views/scripts/group/edit.phtml index dd3acbe..6b042e1 100644 --- a/application/modules/dev/views/scripts/group/edit.phtml +++ b/application/modules/dev/views/scripts/group/edit.phtml @@ -1,6 +1,7 @@ +<h1>Edit Group</h1> <?php if(isset($this->addForm)) { - $this->addForm->setAction('/etc/group/add'); + $this->addForm->setAction('/dev/group/add'); echo $this->addForm; } else { diff --git a/application/modules/dev/views/scripts/group/link.phtml b/application/modules/dev/views/scripts/group/link.phtml index 94ad343..5bb2a9d 100644 --- a/application/modules/dev/views/scripts/group/link.phtml +++ b/application/modules/dev/views/scripts/group/link.phtml @@ -1,3 +1,4 @@ +<h1>Link Groups</h1> <?php $this->linkForm->setAction($this->url()); echo $this->linkForm; diff --git a/application/modules/dev/views/scripts/person/edit.phtml b/application/modules/dev/views/scripts/person/edit.phtml index 955ed35..3e666d4 100644 --- a/application/modules/dev/views/scripts/person/edit.phtml +++ b/application/modules/dev/views/scripts/person/edit.phtml @@ -1,3 +1,4 @@ +<h1>Edit Person</h1> <?php $this->editForm->setAction($this->url()); echo $this->editForm; diff --git a/application/modules/dev/views/scripts/person/request.phtml b/application/modules/dev/views/scripts/person/request.phtml index 2da570f..91a625b 100644 --- a/application/modules/dev/views/scripts/person/request.phtml +++ b/application/modules/dev/views/scripts/person/request.phtml @@ -1,3 +1,4 @@ +<h1>Request Membership</h1> <?php if(count($this->requestForm->getGrouplist())>0) { $this->requestForm->setAction($this->url()); diff --git a/application/modules/dev/views/scripts/role/add.phtml b/application/modules/dev/views/scripts/role/add.phtml index 4f96cf0..23d4c55 100644 --- a/application/modules/dev/views/scripts/role/add.phtml +++ b/application/modules/dev/views/scripts/role/add.phtml @@ -1,3 +1,4 @@ +<h1>Add Role</h1> <?php $this->addForm->setAction($this->url()); echo $this->addForm; diff --git a/application/modules/dev/views/scripts/role/edit.phtml b/application/modules/dev/views/scripts/role/edit.phtml index c976a90..59482f0 100644 --- a/application/modules/dev/views/scripts/role/edit.phtml +++ b/application/modules/dev/views/scripts/role/edit.phtml @@ -1,3 +1,4 @@ +<h1>Edit Role</h1> <?php if(isset($this->addForm)) { $this->addForm->setAction('/etc/role/add'); diff --git a/application/modules/dev/views/scripts/role/groupselect.phtml b/application/modules/dev/views/scripts/role/groupselect.phtml index fe81758..d1c08fd 100644 --- a/application/modules/dev/views/scripts/role/groupselect.phtml +++ b/application/modules/dev/views/scripts/role/groupselect.phtml @@ -1,3 +1,4 @@ +<h1>Select Group</h1> <?php $this->groupSelectForm->setAction($this->url()); echo $this->groupSelectForm; diff --git a/application/modules/dev/views/scripts/role/linkright.phtml b/application/modules/dev/views/scripts/role/linkright.phtml index 94ad343..38c0d45 100644 --- a/application/modules/dev/views/scripts/role/linkright.phtml +++ b/application/modules/dev/views/scripts/role/linkright.phtml @@ -1,3 +1,4 @@ +<h1>Add Right</h1> <?php $this->linkForm->setAction($this->url()); echo $this->linkForm; diff --git a/application/modules/dev/views/scripts/role/show.phtml b/application/modules/dev/views/scripts/role/show.phtml index 93f2782..38e6023 100644 --- a/application/modules/dev/views/scripts/role/show.phtml +++ b/application/modules/dev/views/scripts/role/show.phtml @@ -13,10 +13,12 @@ if($this->roleID) { <tr> <th>Title</th> <th>Description</th> + <th>Inheritance</th> </tr> <tr class="entry"> <td><?php echo $this->role->getTitle(); ?></td> <td><?php echo $this->role->getDescription(); ?></td> + <td><?php if($this->role->getInheritance() == 1) echo "yes"; else echo "no"; ?></td> </tr> </table> <br /> diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php index e9b6666..1b7b5fe 100644 --- a/application/modules/fbgui/controllers/AuthController.php +++ b/application/modules/fbgui/controllers/AuthController.php @@ -3,27 +3,27 @@ class Fbgui_AuthController extends Zend_Controller_Action { - public function init() - { + public function init() + { $this->db = Zend_Db_Table::getDefaultAdapter(); $this->personmapper = new Application_Model_PersonMapper(); - } + } - public function indexAction() - { + public function indexAction() + { $this->_helper-> viewRenderer-> setNoRender(); $this->_helper->redirector('login', 'auth'); - } + } - public function loginAction() - { + public function loginAction() + { if (Zend_Auth::getInstance()->hasIdentity()) { - $this->_redirect('/user/'); + $this->_redirect('/fbgui/'); } else { if (!isset($_POST["login"])){ - $loginForm = new user_Form_Login(); + $loginForm = new fbgui_Form_Login(); } else { - $loginForm = new user_Form_Login($_POST); + $loginForm = new fbgui_Form_Login($_POST); if ($loginForm->isValid($_POST)) { @@ -31,51 +31,54 @@ class Fbgui_AuthController extends Zend_Controller_Action $adapter = new Zend_Auth_Adapter_DbTable( $this->db, - 'pbs_person', - 'email', - 'password', - 'MD5(CONCAT(?, password_salt))' - ); - - - $adapter->setIdentity($loginForm->getValue('email')); - $adapter->setCredential($loginForm->getValue('password')); - - $result = $auth->authenticate($adapter); - - // TODO: erweiterte fehlerbeschreibung des Users - - if ($result->isValid()) { - $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); - $person = new Application_Model_Person($result[0]); - $person->setID($result[0]['personID']); - $date = new DateTime(); - $person->setLogindate($date->getTimestamp()); - $this->personmapper->save($person); - $this->_helper->redirector('selectmembership', 'person'); - return; - } else { - echo "Wrong Email or Password."; - } + 'pbs_person', + 'email', + 'password', + 'MD5(CONCAT(?, password_salt))' + ); + + + $adapter->setIdentity($loginForm->getValue('email')); + $adapter->setCredential($loginForm->getValue('password')); + + $result = $auth->authenticate($adapter); + + // TODO: erweiterte fehlerbeschreibung des Users + + if ($result->isValid()) { + $this->personmapper = new Application_Model_PersonMapper(); + $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $person = new Application_Model_Person($result[0]); + $person->setID($result[0]['personID']); + $date = new DateTime(); + $person->setLogindate($date->getTimestamp()); + $this->personmapper->save($person); + $this->_helper->redirector('selectmembership', 'person'); + return; + } else { + echo "Wrong Email or Password."; + } } } $this->view->loginForm = $loginForm; } - } + } - public function logoutAction() - { + public function logoutAction() + { $this->_helper-> viewRenderer-> setNoRender(); $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); Zend_Session::namespaceUnset('userIDs'); + Zend_Session::forgetMe(); $this->_helper->redirector('login', 'auth'); return; - } + } +} + + -} diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 809ecae..c70386f 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -76,7 +76,7 @@ class Fbgui_IndexController extends Zend_Controller_Action } } else{ - echo "<h1>Not Welcome</h1>"; + echo "<h1>Not Welcome</h1>"; } } diff --git a/application/modules/fbgui/controllers/PersonController.php b/application/modules/fbgui/controllers/PersonController.php new file mode 100644 index 0000000..06076c5 --- /dev/null +++ b/application/modules/fbgui/controllers/PersonController.php @@ -0,0 +1,76 @@ +<?php + +class Fbgui_PersonController extends Zend_Controller_Action +{ + protected $person; + protected $personmapper; + protected $membershipMapper; + protected $memberships; + + public function init() + { + if (Zend_Auth::getInstance()->hasIdentity()) { + $this->personmapper = new Application_Model_PersonMapper(); + $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $this->person = new Application_Model_Person($result[0]); + $this->person->setID($result[0]['personID']); + $this->membershipMapper = new Application_Model_MembershipMapper(); + $this->memberships = $this->membershipMapper->findBy("personID",$this->person->getID()); + } else { + $this->_helper->redirector('login', 'auth'); + } + } + + public function indexAction() + { + $this->_helper->redirector('selectmembership', 'person'); + } + + public function selectmembershipAction() + { + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($userIDsNamespace['membershipID'])) { + $this->_redirect('/fbgui/'); + } else { + if(count($this->memberships) > 0) { + if(isset($_POST['selectmembership'])) { + $roleSession = new Zend_Session_Namespace('userIDs'); + $roleSession->membershipID = $_POST['membershipID']; + $roleSession->personID = $this->person->getID(); + $membership = $this->membershipMapper->find($_POST['membershipID']); + $roleSession->groupID = $membership->getGroupID(); + $roleSession->roleID = $membership->getRoleID(); + $this->_redirect('/fbgui/'); + return; + } else { + $groupMapper = new Application_Model_GroupMapper(); + $roleMapper = new Application_Model_RoleMapper(); + if(isset($this->memberships)) { + foreach($this->memberships as $membership) { + $group = $groupMapper->find($membership['groupID']); + $role = $roleMapper->find($membership['roleID']); + $membershipList[] = array( + 'membershipID' => $membership['membershipID'], + 'group' => $group->getTitle(), + 'role' => $role->getTitle() + ); + } + } + $membershipSelectForm = new fbgui_Form_MembershipSelect(array('membershiplist' => $membershipList)); + $this->view->membershipSelectForm = $membershipSelectForm; + } + } else { + $this->_redirect('/fbgui/'); + } + } + } + + public function changemembershipAction() + { + $this->_helper-> viewRenderer-> setNoRender(); + Zend_Session::namespaceUnset('userIDs'); + $this->_helper->redirector('selectmembership', 'person'); + return; + } +} + diff --git a/application/modules/fbgui/forms/MembershipSelect.php b/application/modules/fbgui/forms/MembershipSelect.php new file mode 100644 index 0000000..6e03f7d --- /dev/null +++ b/application/modules/fbgui/forms/MembershipSelect.php @@ -0,0 +1,42 @@ +<?php + +class fbgui_Form_MembershipSelect extends Zend_Form +{ + private $membershiplist; + + public function setMembershiplist($membershiplist){ + $this->membershiplist = $membershiplist; + + } + + public function getMembershiplist(){ + return $this->membershiplist; + } + + public function init() + { + $this->setName("MembershipSelect"); + $this->setMethod('post'); + + $membershipfield = $this->createElement('select','membershipID'); + $membershipfield ->setLabel('Membership:'); + + if(count($this->membershiplist)>0){ + foreach($this->membershiplist as $membership => $m){ + $membershipfield->addMultiOption($m['membershipID'], $m['group'] . ' - ' . $m['role']); + } + } + + $membershipfield->setRegisterInArrayValidator(false); + $this->addElement($membershipfield); + + $this->addElement('submit', 'selectmembership', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Select', + )); + } + + +} + diff --git a/application/modules/fbgui/layouts/fbgui.phtml b/application/modules/fbgui/layouts/fbgui.phtml index 7bb59fa..09f2f9d 100644 --- a/application/modules/fbgui/layouts/fbgui.phtml +++ b/application/modules/fbgui/layouts/fbgui.phtml @@ -49,15 +49,16 @@ echo $this->headScript()."\n"; <div id="content"> <?php echo $this->layout()->content; ?> </div> + + <div id="footer" class="footer flexbox flex"> + <div style='padding:5px;'> + <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // + <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // + <i>version: 0.1.1</i> + </div> + </div> </div> - -<div id="footer" class="footer flexbox flex"> - <div style='padding:5px;'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // - <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // - <i>version: 0.1.1</i> - </div> -</div> + <div id='debug'> <div class='v1'> <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> diff --git a/application/modules/fbgui/views/scripts/auth/login.phtml b/application/modules/fbgui/views/scripts/auth/login.phtml index d68d2af..9742c35 100644 --- a/application/modules/fbgui/views/scripts/auth/login.phtml +++ b/application/modules/fbgui/views/scripts/auth/login.phtml @@ -1,5 +1,5 @@ +<h1>Login</h1> <?php $this->loginForm->setAction($this->url()); echo $this->loginForm; -?> -<div><button onclick="location.href='/user/auth/recoverpassword'">Recover Password</button></div>
\ No newline at end of file +?>
\ No newline at end of file diff --git a/application/modules/fbgui/views/scripts/person/selectmembership.phtml b/application/modules/fbgui/views/scripts/person/selectmembership.phtml new file mode 100644 index 0000000..5f7e5bf --- /dev/null +++ b/application/modules/fbgui/views/scripts/person/selectmembership.phtml @@ -0,0 +1,5 @@ +<h1>Select Membership</h1> +<?php +$this->membershipSelectForm->setAction($this->url()); +echo $this->membershipSelectForm; +?>
\ No newline at end of file diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index db47f44..5d63b20 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -74,6 +74,7 @@ class User_AuthController extends Zend_Controller_Action $auth = Zend_Auth::getInstance(); $auth->clearIdentity(); Zend_Session::namespaceUnset('userIDs'); + Zend_Session::forgetMe(); $this->_helper->redirector('login', 'auth'); return; } @@ -119,25 +120,31 @@ class User_AuthController extends Zend_Controller_Action public function deleteAction() { - $this->_helper-> viewRenderer-> setNoRender(); - $result = $this->personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); - $person = $result[0]; - $personID = $person["personID"]; - if (isset($personID)){ - $this->personmapper = new Application_Model_PersonMapper(); - $person = $this->personmapper->find($personID); - try { - $this->personmapper->delete($person); - }catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; + if($_POST['confirmdelete']) { + $auth = Zend_Auth::getInstance(); + $result = $this->personmapper->findBy('email', $auth->getIdentity()); + $person = $result[0]; + $personID = $person["personID"]; + if (isset($personID)){ + $this->personmapper = new Application_Model_PersonMapper(); + $person = $this->personmapper->find($personID); + try { + $this->personmapper->delete($person); + }catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $auth->clearIdentity(); + Zend_Session::namespaceUnset('userIDs'); + Zend_Session::forgetMe(); + $this->_helper->redirector('login', 'auth'); return; } - $auth = Zend_Auth::getInstance(); - $auth->clearIdentity(); - $this->_helper->redirector('login', 'auth'); - return; + } else { + $deleteconfirmform = new user_Form_ConfirmDeleteAccount(); + $this->view->deleteconfirmform = $deleteconfirmform; } } diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index d49e68f..fd8eaf5 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -171,10 +171,9 @@ class User_FilterController extends Zend_Controller_Action $filtermapper->find($this->_request->getParam('filterID'),$DBfilterentry); $compareresult = $filtermapper->compare($newfilterentry,$DBfilterentry); - print_a($compareresult); if(isset($compareresult['priority']) && count($compareresult) == 1){ $filtermapper->save($newfilterentry); - #$this->_redirect('/user/filter/index/modifyresult/ok'); + $this->_redirect('/user/filter/index/modifyresult/ok'); } else{ $this->_redirect('/user/filter/index/modifyresult/forbidden'); diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 52136af..7a21aa9 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -3,20 +3,291 @@ class User_GroupController extends Zend_Controller_Action { + protected $groupMapper = null; + + protected $groupGroupsMapper = null; + + protected $membershipMapper = null; + + protected $groupRequestMapper = null; + + protected $personmapper = null; + + protected $rolemapper = null; + + protected $groupList = null; + + protected $userIDsNamespace = null; + public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { - + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + $this->groupMapper = new Application_Model_GroupMapper(); + $this->groupGroupsMapper = new Application_Model_GroupGroupsMapper(); + $this->membershipMapper = new Application_Model_MembershipMapper(); + $this->groupRequestMapper = new Application_Model_GroupRequestMapper(); + $this->personmapper = new Application_Model_PersonMapper(); + $this->rolemapper = new Application_Model_RoleMapper(); + $this->groupList = $this->groupMapper->fetchAll(); } else { $this->_helper->redirector('login', 'auth'); + return; } } public function indexAction() { - // action body + $this->_helper->redirector('show', 'group'); } + public function addAction() + { + if (!isset($_POST["add"])){ + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList)); + } else { + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList),$_POST); + + if ($addForm->isValid($_POST)) { + $group = new Application_Model_Group($_POST); + try { + $this->groupMapper->save($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + if($_POST['superordinatedGroupID'] != -1) { + $lastID = $this->groupMapper->getDbTable()->getDefaultAdapter()->lastInsertId(); + $groupgroups = new Application_Model_GroupGroups(); + $groupgroups->setParentID($_POST['superordinatedGroupID']); + $groupgroups->setGroupID($lastID); + try { + $this->groupGroupsMapper->save($groupgroups); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + + } + $this->_helper->redirector('', 'group'); + return; + } + } + + $this->view->addForm = $addForm; + } + + public function editAction() + { + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + if(count($this->userIDsNamespace) > 0) { + $groupID = $this->userIDsNamespace['groupID']; + } + } + if(!isset($groupID)) { + $addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList)); + $this->view->addForm = $addForm; + return; + } + if (!isset($_POST["save"])){ + $group = $this->groupMapper->find($groupID); + $_POST['title'] = $group->getTitle(); + $_POST['description'] = $group->getDescription(); + $editForm = new user_Form_GroupEdit(array('groupID' => $groupID)); + } else { + $editForm = new user_Form_GroupEdit(array('groupID' => $groupID), $_POST); + if ($editForm->isValid($_POST)) { + $group = new Application_Model_Group($_POST); + $group->setID($this->_request->getParam('groupID')); + try { + $this->groupMapper->save($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_redirect($_SERVER['HTTP_REFERER']); + return; + } + } + + $this->view->editForm = $editForm; + } + + public function showAction() + { + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + if(count($this->userIDsNamespace) > 0) { + $groupID = $this->userIDsNamespace['groupID']; + } + } + if($groupID) { + $groupRequests = $this->groupRequestMapper->findBy('groupID', $groupID); + if(isset($groupRequests)) { + foreach($groupRequests as $groupRequest) { + $person = $this->personmapper->find($groupRequest['personID']); + $groupRequestList[] = array( + 'grouprequestID' => $groupRequest['grouprequestID'], + 'person' => $person + ); + } + if(is_array($groupRequestList)) { + $this->view->groupRequestList = $groupRequestList; + } + $this->view->roleList = $this->rolemapper->findBy('groupID', $groupID); + } + $members = $this->membershipMapper->findBy('groupID', $groupID); + if(isset($members)) { + foreach($members as $member) { + $person = $this->personmapper->find($member['personID']); + $membersList[] = array( + 'membershipID' => $member['membershipID'], + 'person' => $person + ); + } + if(is_array($membersList)) { + $this->view->membersList = $membersList; + } + } + $groupgroups = $this->groupGroupsMapper->findBy('groupID', $groupID); + if(is_object($groupgroups)) { + $parentGroup = $this->groupMapper->find($groupgroups->getParentID()); + $this->view->$parentGroup = $parentGroup; + } + $group = $this->groupMapper->find($groupID); + $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->group = $group; + $this->view->groupID = $groupID; + } else { + $this->_redirect('/user/'); + return; + } + } + + public function linkAction() + { + if (!isset($_POST["link"])){ + $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList)); + } else { + $linkForm = new user_Form_GroupLink(array('grouplist' => $this->groupList),$_POST); + + if ($linkForm->isValid($_POST)) { + $groupgroups = new Application_Model_GroupGroups(); + $groupgroups->setParentID($_POST['superordinatedGroupID']); + $groupgroups->setGroupID($_POST['groupID']); + try { + $this->groupGroupsMapper->save($groupgroups); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_helper->redirector('', 'group'); + return; + } + } + + $this->view->linkForm = $linkForm; + } + + public function deleteAction() + { + $this->_helper->viewRenderer->setNoRender(); + $groupID = $this->_request->getParam('groupID'); + if(!isset($groupID)) { + if(count($this->userIDsNamespace) > 0) { + $groupID = $this->userIDsNamespace['groupID']; + } + } + if (isset($groupID)){ + $group = $this->groupMapper->find($groupID); + try { + $this->groupMapper->delete($group); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { + if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { + $this->_redirect('/user/group/showall'); + } else { + $this->_helper->redirector('changemembership', 'person'); + } + } else { + $this->_helper->redirector('showall', 'group'); + } + return; + } else { + $this->_redirect('/user/'); + return; + } + } + + public function grantpersonAction() + { + $this->_helper->viewRenderer->setNoRender(); + if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) { + $groupRequest = $this->groupRequestMapper->find($_POST['grouprequestID']); + try { + $this->groupRequestMapper->delete($groupRequest); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $membership = new Application_Model_Membership(); + $membership->setGroupID($groupRequest->getGroupID()); + $membership->setPersonID($groupRequest->getPersonID()); + $membership->setRoleID($_POST['roleID']); + try { + $this->membershipMapper->save($membership); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_redirect("/user/group/show/groupID/" . $groupRequest->getGroupID()); + } + } + + public function revokepersonAction() + { + $this->_helper->viewRenderer->setNoRender(); + $membershipID = $this->_request->getParam('membershipID'); + if(isset($membershipID)) { + $membership = $this->membershipMapper->find($membershipID); + if(isset($membership)) { + try { + $this->membershipMapper->delete($membership); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + return; + } + $this->_redirect("/user/group/edit/groupID/" . $membership->getGroupID()); + } + + } } + + public function showallAction() + { + $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->groupList = $this->groupList; + } + } diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index da65507..0b0cb7d 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -2,15 +2,15 @@ class User_RoleController extends Zend_Controller_Action { - private $userIDsNamespace; + protected $userIDsNamespace; public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - if($this->userIDsNamespace['groupID'] ==''){ + if($this->userIDsNamespace['roleID'] ==''){ $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('No groupID set','forbidden'); + echo $pbsNotifier->notify('No roleID set','forbidden'); } $this->roleMapper = new Application_Model_RoleMapper(); $this->rightMapper = new Application_Model_RightMapper(); @@ -67,6 +67,11 @@ class User_RoleController extends Zend_Controller_Action { $roleID = $this->_request->getParam('roleID'); if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } + if(!isset($roleID)) { $addForm = new user_Form_RoleAdd(); $this->view->addForm = $addForm; return; @@ -76,10 +81,12 @@ class User_RoleController extends Zend_Controller_Action $_POST['title'] = $role->getTitle(); $_POST['description'] = $role->getDescription(); $_POST['groupID'] = $role->getGroupID(); + $_POST['inheritance'] = $role->getInheritance(); $editForm = new user_Form_RoleEdit(array('roleID' => $roleID)); } else { $editForm = new user_Form_RoleEdit(array('roleID' => $roleID), $_POST); if ($editForm->isValid($_POST)) { + $role = new Application_Model_Role($_POST); $role->setID($this->_request->getParam('roleID')); try { @@ -90,7 +97,7 @@ class User_RoleController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; return; } - $this->_helper->redirector('', 'role'); + $this->_redirect($_SERVER['HTTP_REFERER']); return; } } @@ -100,6 +107,11 @@ class User_RoleController extends Zend_Controller_Action public function showAction() { $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if($roleID) { $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); if(count($rightroles) > 0) { @@ -113,6 +125,7 @@ class User_RoleController extends Zend_Controller_Action } $this->view->role = $this->roleMapper->find($roleID); $this->view->roleID = $roleID; + $this->view->userIDsNamespace = $this->userIDsNamespace; } else { $this->_helper->redirector('', 'role'); return; @@ -123,6 +136,11 @@ class User_RoleController extends Zend_Controller_Action { $this->_helper->viewRenderer->setNoRender(); $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if (isset($roleID)){ $role = $this->roleMapper->find($roleID); try { @@ -144,6 +162,11 @@ class User_RoleController extends Zend_Controller_Action public function linkrightAction() { $roleID = $this->_request->getParam('roleID'); + if(!isset($roleID)) { + if(count($this->userIDsNamespace) > 0) { + $roleID = $this->userIDsNamespace['roleID']; + } + } if(isset($roleID)) { $rightroles = $this->rightRolesMapper->findBy('roleID', $roleID); $rights = $this->rightMapper->fetchAll(); diff --git a/application/modules/user/forms/ConfirmDeleteAccount.php b/application/modules/user/forms/ConfirmDeleteAccount.php new file mode 100644 index 0000000..7bf5a32 --- /dev/null +++ b/application/modules/user/forms/ConfirmDeleteAccount.php @@ -0,0 +1,27 @@ +<?php + +class user_Form_ConfirmDeleteAccount extends Zend_Form +{ + + public function init() + { + $this->setName("ConfirmDeleteAccount"); + $this->setMethod('post'); + + $this->addElement('submit', 'confirmdelete', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Confirm', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); + } + + +} + diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php new file mode 100644 index 0000000..ff2b97a --- /dev/null +++ b/application/modules/user/forms/GroupAdd.php @@ -0,0 +1,65 @@ +<?php + +class user_Form_GroupAdd extends Zend_Form +{ + private $grouplist; + + public function setGrouplist($grouplist){ + $this->grouplist = $grouplist; + + } + + + public function init() + { + $this->setName("GroupAdd"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + )); + + $groupfield = $this->createElement('select','superordinatedGroupID'); + $groupfield ->setLabel('superordinated Group:'); + + $groupfield->addMultiOption('-1', '---- none ----'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Add', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); + } + + +} + diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php new file mode 100644 index 0000000..4f0d7fc --- /dev/null +++ b/application/modules/user/forms/GroupEdit.php @@ -0,0 +1,50 @@ +<?php + +class user_Form_GroupEdit extends Zend_Form +{ + private $groupID; + + public function setGroupID($groupID){ + $this->groupID = $groupID; + + } + + public function init() + { + $this->setName("GroupEdit"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + 'value' => $_POST['title'], + )); + + $this->addElement('text', 'description', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 140)), + ), + 'required' => false, + 'label' => 'Description:', + 'value' => $_POST['description'], + )); + + $this->addElement('submit', 'save', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Save', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); + } +}
\ No newline at end of file diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php new file mode 100644 index 0000000..9db7ce4 --- /dev/null +++ b/application/modules/user/forms/GroupLink.php @@ -0,0 +1,55 @@ +<?php + +class user_Form_GroupLink extends Zend_Form +{ + private $grouplist; + + public function setGrouplist($grouplist){ + $this->grouplist = $grouplist; + + } + + public function init() + { + $this->setName("GroupLink"); + $this->setMethod('post'); + + $groupfield = $this->createElement('select','groupID'); + $groupfield ->setLabel('Group:'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield->setRegisterInArrayValidator(false); + $this->addElement($groupfield); + + $groupfield1 = $this->createElement('select','superordinatedGroupID'); + $groupfield1 ->setLabel('superordinated Group:'); + + if(count($this->grouplist)>0){ + foreach($this->grouplist as $group => $g){ + $groupfield1->addMultiOption($g->getID(), $g->getTitle()); + } + } + $groupfield1->setRegisterInArrayValidator(false); + $this->addElement($groupfield1); + + $this->addElement('submit', 'link', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Link', + )); + + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); + } + + +} + diff --git a/application/modules/user/forms/GroupRequest.php b/application/modules/user/forms/GroupRequest.php index 2cdada0..c9ba273 100644 --- a/application/modules/user/forms/GroupRequest.php +++ b/application/modules/user/forms/GroupRequest.php @@ -33,14 +33,14 @@ class user_Form_GroupRequest extends Zend_Form $this->addElement('submit', 'request', array( 'required' => false, 'ignore' => true, - 'label' => 'Request Membership', + 'label' => 'Request', )); $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/person/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php index 139aee4..a7b28b1 100644 --- a/application/modules/user/forms/LinkRight.php +++ b/application/modules/user/forms/LinkRight.php @@ -32,14 +32,14 @@ class user_Form_LinkRight extends Zend_Form $this->addElement('submit', 'link', array( 'required' => false, 'ignore' => true, - 'label' => 'Add Right', + 'label' => 'Add', )); $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/role/show/roleID/' . $this->roleID . '"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/user/forms/MembershipSelect.php b/application/modules/user/forms/MembershipSelect.php index fbf8b8a..b4b54c4 100644 --- a/application/modules/user/forms/MembershipSelect.php +++ b/application/modules/user/forms/MembershipSelect.php @@ -33,7 +33,7 @@ class user_Form_MembershipSelect extends Zend_Form $this->addElement('submit', 'selectmembership', array( 'required' => false, 'ignore' => true, - 'label' => 'Select Group', + 'label' => 'Select', )); } diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php index d6c68e7..a6bd123 100644 --- a/application/modules/user/forms/PersonEdit.php +++ b/application/modules/user/forms/PersonEdit.php @@ -108,7 +108,7 @@ class user_Form_PersonEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/person/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/user/forms/RecoverPassword.php b/application/modules/user/forms/RecoverPassword.php index 90feb87..22a775f 100644 --- a/application/modules/user/forms/RecoverPassword.php +++ b/application/modules/user/forms/RecoverPassword.php @@ -19,7 +19,7 @@ class user_Form_RecoverPassword extends Zend_Form $this->addElement('submit', 'recoverPassword', array( 'required' => false, 'ignore' => true, - 'label' => 'Recover Password', + 'label' => 'Recover', )); } diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php index 3b5200b..e8e99a5 100644 --- a/application/modules/user/forms/RoleAdd.php +++ b/application/modules/user/forms/RoleAdd.php @@ -31,6 +31,10 @@ class user_Form_RoleAdd extends Zend_Form 'label' => 'Description:', )); + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + $this->addElement('submit', 'add', array( 'required' => false, 'ignore' => true, @@ -41,7 +45,7 @@ class user_Form_RoleAdd extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/role/"', + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', )); } diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php index 170a2f9..0bdc977 100644 --- a/application/modules/user/forms/RoleEdit.php +++ b/application/modules/user/forms/RoleEdit.php @@ -33,6 +33,17 @@ class user_Form_RoleEdit extends Zend_Form 'value' => $_POST['description'], )); + if($_POST['inheritance'] == 1) { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + 'checked' => 'checked', + )); + } else { + $this->addElement('checkbox', 'inheritance', array( + 'label' => 'Inheritance:', + )); + } + $this->addElement('hidden', 'groupID', array( 'value' => $_POST['groupID'], )); @@ -43,21 +54,12 @@ class user_Form_RoleEdit extends Zend_Form 'label' => 'Save', )); - if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show/roleID')) { - $this->addElement('button', 'cancel', array( + $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/role/show/roleID/' . $this->roleID . '"', - )); - } else { - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="/user/role/"', - )); - } + 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + )); } diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml index 83b1c49..35f0b22 100644 --- a/application/modules/user/layouts/user.phtml +++ b/application/modules/user/layouts/user.phtml @@ -1,8 +1,8 @@ <?php echo $this->doctype(); ?> - + <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de"> <head> - + <?php $request = Zend_Controller_Front::getInstance()->getRequest(); $this->headTitle()->append(ucwords($request->getControllerName())); @@ -13,12 +13,13 @@ echo $this->headStyle()."\n"; echo $this->headLink()."\n"; echo $this->headScript()."\n"; ?> -<script src='/media/js/jquery.min.js'></script> +<script src='/media/js/jquery.min.js'></script> <script src='/media/js/jquery-ui.min.js'></script> -<script src='/media/js/script.js'></script> +<script src='/media/js/script.js'></script> </head> <body> <div id='sidepannel'> +<<<<<<< HEAD <div id="logo"><div id="logo-bar-gray"></div></div> <div id="sidepannel-top" class='portletNavigationTree'> <ul class='navTreeLevel0'> @@ -47,51 +48,86 @@ echo $this->headScript()."\n"; <li class='navTreeItem'><a href='/user/auth/logout'>Logout</a></li> <?php } +======= +<div id="logo"> +<div id="logo-bar-gray"></div> +</div> +<div id="sidepannel-top" class='portletNavigationTree'> +<ul class='navTreeLevel0'> + <li class='navTreeItem'><a href='/'><<</a></li> + <li class='navTreeItem'><a href='/user/'>user</a></li> + <li> + <ul class='navTreeLevel1'> + <li class='navTreeItem'><a href='/user/person'>Person</a></li> + <li class='navTreeItem'><a href='/user/group'>Group</a></li> + <li class='navTreeItem'><a href='/user/role'>Role</a></li> + <li class='navTreeItem'><a href='/user/bootiso'>BootIso</a></li> + <li class='navTreeItem'><a href='/user/bootmenu'>BootMenu</a></li> + <li class='navTreeItem'><a href='/user/config'>Config</a></li> + <li class='navTreeItem'><a href='/user/bootos'>BootOs</a></li> + <li class='navTreeItem'><a href='/user/client'>Client</a></li> + <li class='navTreeItem'><a href='/user/filter'>Filter</a></li> + <li class='navTreeItem'><a href='/user/pool'>Pool</a></li> + <?php + if(count(Zend_Session::namespaceGet('userIDs')) > 0) { + ?> + <li class='navTreeItem'><a href='/user/person/changemembership'>Change + Membership</a></li> + <?php + } else { +>>>>>>> d7af4710c133f5cfaf830c9ef617bac9730a77d3 ?> - </ul></li> - </ul> -</ul> - </div> + <li class='navTreeItem'><a href='/user/person/selectmembership'>Select + Membership</a></li> + <?php + } + ?> + <?php if (!Zend_Auth::getInstance()->hasIdentity()) {?> + <li class='navTreeItem'><a href='/user/auth/login'>Login</a></li> + <li class='navTreeItem'><a href='/user/auth/register'>Register</a></li> + <?php + } else {?> + <li class='navTreeItem'><a href='/user/auth/delete'>Delete Account</a></li> + <li class='navTreeItem'><a href='/user/auth/logout'>Logout</a></li> + <?php + } + ?> + </ul> + </li> +</ul> +</ul> +</div> </div> <div id='main'> - <div id="head-bg"> - <div id="head"> - <h1>pbs<sup>2</sup></h1> - <h2>Rechenzentrum Universität Freiburg</h2> - </div> - </div> - <div id="logo-bar-red"></div> - <div id="head-titlebar"> - <?php - echo ucwords($request->getControllerName()) . " > " . ucwords($request->getActionName()); - ?> - </div> - <div id="content"> - <?php echo $this->layout()->content; ?> - </div> +<div id="head-bg"> +<div id="head"> +<h1>pbs<sup>2</sup></h1> +<h2>Rechenzentrum Universität Freiburg</h2> +</div> +</div> +<div id="logo-bar-red"></div> +<div id="head-titlebar"><?php +echo ucwords($request->getControllerName()) . " > " . ucwords($request->getActionName()); +?></div> +<div id="content"><?php echo $this->layout()->content; ?></div> + +<div id="footer" class="footer flexbox flex"> +<div style='padding: 5px;'><a + onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display +Debug</a> // <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> +// <i>version: 0.1.1</i></div> </div> - -<div id="footer" class="footer flexbox flex"> - <div style='padding:5px;'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">display Debug</a> // - <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i> // - <i>version: 0.1.1</i> - </div> </div> + <div id='debug'> - <div class='v1'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> - <img src='/media/img/down.png' /> - </a> - </div> - <div class='v2' style='display:none;'> - <div style='text-align:right;'> - <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> - <img src='/media/img/up.png' /> - </a> - </div> - <?php print_a('Session',$_SESSION,'GET',$_GET,'POST',$_POST); ?> - </div> +<div class='v1'><a + onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> <img + src='/media/img/down.png' /> </a></div> +<div class='v2' style='display: none;'> +<div style='text-align: right;'><a + onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> <img + src='/media/img/up.png' /> </a></div> +<?php print_a('Session',$_SESSION,'GET',$_GET,'POST',$_POST); ?></div> </div> -</body> -</html> +</body> +</html> diff --git a/application/modules/user/views/scripts/auth/delete.phtml b/application/modules/user/views/scripts/auth/delete.phtml new file mode 100644 index 0000000..62bf24e --- /dev/null +++ b/application/modules/user/views/scripts/auth/delete.phtml @@ -0,0 +1,6 @@ +<h1>Delete Account</h1> +Do you really want to delete this account? +<?php +$this->deleteconfirmform->setAction($this->url()); +echo $this->deleteconfirmform; +?>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/auth/login.phtml b/application/modules/user/views/scripts/auth/login.phtml index d68d2af..899c6e7 100644 --- a/application/modules/user/views/scripts/auth/login.phtml +++ b/application/modules/user/views/scripts/auth/login.phtml @@ -1,3 +1,4 @@ +<h1>Login</h1> <?php $this->loginForm->setAction($this->url()); echo $this->loginForm; diff --git a/application/modules/user/views/scripts/auth/recoverpassword.phtml b/application/modules/user/views/scripts/auth/recoverpassword.phtml index 881e00e..089aec3 100644 --- a/application/modules/user/views/scripts/auth/recoverpassword.phtml +++ b/application/modules/user/views/scripts/auth/recoverpassword.phtml @@ -1,3 +1,4 @@ +<h1>Recover Password</h1> <?php $this->recoverPasswordForm->setAction($this->url()); echo $this->recoverPasswordForm; diff --git a/application/modules/user/views/scripts/auth/register.phtml b/application/modules/user/views/scripts/auth/register.phtml index 2033b04..6217e06 100644 --- a/application/modules/user/views/scripts/auth/register.phtml +++ b/application/modules/user/views/scripts/auth/register.phtml @@ -1,3 +1,4 @@ +<h1>New Account</h1> <?php $this->registerForm->setAction($this->url()); echo $this->registerForm; diff --git a/application/modules/user/views/scripts/group/add.phtml b/application/modules/user/views/scripts/group/add.phtml new file mode 100644 index 0000000..588ce31 --- /dev/null +++ b/application/modules/user/views/scripts/group/add.phtml @@ -0,0 +1,5 @@ +<h1>Add Group</h1> +<?php +$this->addForm->setAction($this->url()); +echo $this->addForm; +?>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/edit.phtml b/application/modules/user/views/scripts/group/edit.phtml new file mode 100644 index 0000000..add3a77 --- /dev/null +++ b/application/modules/user/views/scripts/group/edit.phtml @@ -0,0 +1,11 @@ +<h1>Edit Group</h1> +<?php +if(isset($this->addForm)) { + $this->addForm->setAction('/user/group/add'); + echo $this->addForm; +} +else { + $this->editForm->setAction($this->url()); + echo $this->editForm; +} +?> diff --git a/application/modules/user/views/scripts/group/index.phtml b/application/modules/user/views/scripts/group/index.phtml deleted file mode 100644 index a1e5635..0000000 --- a/application/modules/user/views/scripts/group/index.phtml +++ /dev/null @@ -1 +0,0 @@ -<br /><br /><center>View script for controller <b>Group</b> and script/action name <b>index</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/link.phtml b/application/modules/user/views/scripts/group/link.phtml new file mode 100644 index 0000000..5bb2a9d --- /dev/null +++ b/application/modules/user/views/scripts/group/link.phtml @@ -0,0 +1,5 @@ +<h1>Link Groups</h1> +<?php +$this->linkForm->setAction($this->url()); +echo $this->linkForm; +?>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml new file mode 100644 index 0000000..d343204 --- /dev/null +++ b/application/modules/user/views/scripts/group/show.phtml @@ -0,0 +1,144 @@ +<?php +if($this->groupID) { + if(isset($this->userIDsNamespace['groupID'])) { + ?> +<h1>Group</h1> + <?php + echo $this->formButton('deletegroup', 'Delete', array( + 'onclick' => 'self.location="/user/group/delete/"', + 'class' => 'rightbutton')); + echo $this->formButton('editgroup', 'Edit', array( + 'onclick' => 'self.location="/user/group/edit/"', + 'class' => 'rightbutton')); + } else { + ?> +<h1>Group Details</h1> + <?php + echo $this->formButton('deletegroup', 'Delete', array( + 'onclick' => 'self.location="/user/group/delete/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton')); + echo $this->formButton('editgroup', 'Edit', array( + 'onclick' => 'self.location="/user/group/edit/groupID/' . $this->group->getID() .'"', + 'class' => 'rightbutton')); + } + ?> +<span class="clear"></span> +<table> + <tr> + <th>Title</th> + <th>Description</th> + </tr> + <tr class="entry"> + <td><?php echo $this->group->getTitle(); ?></td> + <td><?php echo $this->group->getDescription(); ?></td> + </tr> + <?php + if(isset($parentGroup) && is_object($parentGroup)) { + ?> + <tr> + <td><b>Superordinated Group:</b></td> + <td><?php echo $this->parentGroup->getTitle(); ?></td> + </tr> + <?php + } + ?> +</table> + <?php + echo $this->formButton('editgroup', 'Show Grouplist', array( + 'onclick' => 'self.location="/user/group/showall"', + 'class' => 'rightbutton')); + if(isset($this->groupRequestList)) { + ?> +<br /> +<h2>Requests:</h2> +<table> + <tr> + <th>Firstname</th> + <th>Name</th> + <th>email</th> + <th>city</th> + <th>grant</th> + </tr> + <?php + foreach($this->groupRequestList as $grouprequest) { + $grouprequestID = $grouprequest['grouprequestID']; + $person = $grouprequest['person']; + ?> + <tr class="entry"> + <td><?php echo $person->getFirstname(); ?></td> + <td><?php echo $person->getName(); ?></td> + <td><?php echo $person->getEmail(); ?></td> + <td><?php echo $person->getCity(); ?></td> + <td> + <form action="/user/group/grantperson" method="post"><input + type="hidden" name="grouprequestID" + value="<?php echo $grouprequestID; ?>" /> <?php printRoleSelect($this->roleList); ?> + <input type="image" src='/media/img/save.png' alt='Grant Person' + name="confirm" value="confirm" /></form> + </td> + </tr> + <?php + } + ?> +</table> + <?php + } + if(isset($this->membersList)) { + ?> +<br /> +<h2>Members:</h2> +<table> + <tr> + <th>Firstname</th> + <th>Name</th> + <th>email</th> + <th>city</th> + <th>revoke</th> + </tr> + + <?php + foreach($this->membersList as $member) { + $membershipID = $member['membershipID']; + $person = $member['person']; + ?> + <tr class="entry"> + <td><?php echo $person->getFirstname(); ?></td> + <td><?php echo $person->getName(); ?></td> + <td><?php echo $person->getEmail(); ?></td> + <td><?php echo $person->getCity(); ?></td> + <td class='action'><a + href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'revokeperson', + 'membershipID' => $membershipID, + ), + 'default', + true) ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a> + </td> + </tr> + <?php + } + ?> +</table> + <?php + } +} + +function printRoleSelect($roleList) { + if(!is_array($roleList)) { + return; + } + echo "<select name=\"roleID\">"; + foreach($roleList as $role) { + echo "<option value=\"" . $role['roleID'] . "\">" . $role['title'] . "</option>"; + } + echo "</select>"; +} +?> +<br /> +<br /> +<br /> +<br /> +<br /> diff --git a/application/modules/user/views/scripts/group/showall.phtml b/application/modules/user/views/scripts/group/showall.phtml new file mode 100644 index 0000000..e26e91e --- /dev/null +++ b/application/modules/user/views/scripts/group/showall.phtml @@ -0,0 +1,79 @@ +<h1>Groups</h1> +<?php echo $this->formButton('addgroup', 'Add Group', array( + 'onclick' => 'self.location="/user/group/add"', + 'class' => 'addbutton')) +?> +<table> + <tr> + <th>Title</th> + <th colspan=3>Actions</th> + </tr> + <?php + $count = 0; + foreach($this->groupList as $group) { + ?> + <tr + <?php if($group->getID() == $this->userIDsNamespace['groupID']) echo 'class="selectedEntry"'; else echo 'class="entry"'; ?>> + <td><?php echo $group->getTitle(); ?></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'show' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'show', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/show.png' alt='Show Group' /></a></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'edit' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'edit', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/edit.png' alt='Edit Group' /></a></td> + <td class='action'><a + href="<?php if($group->getID() == $this->userIDsNamespace['groupID']) echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'delete' + ), + 'default', + true); else echo $this->url( + array( + 'module' => 'user', + 'controller' => 'group', + 'action' => 'delete', + 'groupID' => $group->getID() + ), + 'default', + true); ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a> + </td> + </tr> + <?php + $count++; + } + ?> +</table> + <?php echo $this->formButton('linkgroups', 'Link Groups', array( + 'onclick' => 'self.location="/user/group/link"', + 'class' => 'addbutton')) + ?> diff --git a/application/modules/user/views/scripts/person/edit.phtml b/application/modules/user/views/scripts/person/edit.phtml index 955ed35..3e666d4 100644 --- a/application/modules/user/views/scripts/person/edit.phtml +++ b/application/modules/user/views/scripts/person/edit.phtml @@ -1,3 +1,4 @@ +<h1>Edit Person</h1> <?php $this->editForm->setAction($this->url()); echo $this->editForm; diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml index f23bc07..cdf5c6b 100644 --- a/application/modules/user/views/scripts/person/index.phtml +++ b/application/modules/user/views/scripts/person/index.phtml @@ -32,7 +32,7 @@ if(isset($this->groups)) { foreach($this->groups as $group) { ?> <tr - <?php if($group['membershipID'] == $this->userIDsNamespace['membershipID']) echo 'class="selectedMembership"'; else echo 'class="entry"'; ?>> + <?php if($group['membershipID'] == $this->userIDsNamespace['membershipID']) echo 'class="selectedEntry"'; else echo 'class="entry"'; ?>> <td><?php echo $group['title']; ?></td> <td><?php echo $group['description']; ?></td> <td class='action'><a diff --git a/application/modules/user/views/scripts/person/request.phtml b/application/modules/user/views/scripts/person/request.phtml index 2da570f..91a625b 100644 --- a/application/modules/user/views/scripts/person/request.phtml +++ b/application/modules/user/views/scripts/person/request.phtml @@ -1,3 +1,4 @@ +<h1>Request Membership</h1> <?php if(count($this->requestForm->getGrouplist())>0) { $this->requestForm->setAction($this->url()); diff --git a/application/modules/user/views/scripts/person/selectmembership.phtml b/application/modules/user/views/scripts/person/selectmembership.phtml index 2bfe4d6..5f7e5bf 100644 --- a/application/modules/user/views/scripts/person/selectmembership.phtml +++ b/application/modules/user/views/scripts/person/selectmembership.phtml @@ -1,3 +1,4 @@ +<h1>Select Membership</h1> <?php $this->membershipSelectForm->setAction($this->url()); echo $this->membershipSelectForm; diff --git a/application/modules/user/views/scripts/role/add.phtml b/application/modules/user/views/scripts/role/add.phtml index 4f96cf0..23d4c55 100644 --- a/application/modules/user/views/scripts/role/add.phtml +++ b/application/modules/user/views/scripts/role/add.phtml @@ -1,3 +1,4 @@ +<h1>Add Role</h1> <?php $this->addForm->setAction($this->url()); echo $this->addForm; diff --git a/application/modules/user/views/scripts/role/edit.phtml b/application/modules/user/views/scripts/role/edit.phtml index c976a90..59482f0 100644 --- a/application/modules/user/views/scripts/role/edit.phtml +++ b/application/modules/user/views/scripts/role/edit.phtml @@ -1,3 +1,4 @@ +<h1>Edit Role</h1> <?php if(isset($this->addForm)) { $this->addForm->setAction('/etc/role/add'); diff --git a/application/modules/user/views/scripts/role/linkright.phtml b/application/modules/user/views/scripts/role/linkright.phtml index 94ad343..38c0d45 100644 --- a/application/modules/user/views/scripts/role/linkright.phtml +++ b/application/modules/user/views/scripts/role/linkright.phtml @@ -1,3 +1,4 @@ +<h1>Add Right</h1> <?php $this->linkForm->setAction($this->url()); echo $this->linkForm; diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml index 9abab1a..b99c1f8 100644 --- a/application/modules/user/views/scripts/role/show.phtml +++ b/application/modules/user/views/scripts/role/show.phtml @@ -1,6 +1,14 @@ -<h1>Role Details</h1> <?php if($this->roleID) { + if(isset($this->userIDsNamespace['roleID'])) { + ?> +<h1>Role</h1> + <?php + } else { + ?> +<h1>Role Details</h1> + <?php + } ?> <?php echo $this->formButton('deleterole', 'Delete', array( 'onclick' => 'self.location="/user/role/delete/roleID/' . $this->role->getID() .'"', @@ -13,10 +21,12 @@ if($this->roleID) { <tr> <th>Title</th> <th>Description</th> + <th>Inheritance</th> </tr> <tr class="entry"> <td><?php echo $this->role->getTitle(); ?></td> <td><?php echo $this->role->getDescription(); ?></td> + <td><?php if($this->role->getInheritance() == 1) echo "yes"; else echo "no"; ?></td> </tr> </table> <br /> diff --git a/library/Pbs/Filter.php b/library/Pbs/Filter.php index 753bdf7..81ec205 100644 --- a/library/Pbs/Filter.php +++ b/library/Pbs/Filter.php @@ -248,10 +248,10 @@ class Pbs_Filter{ // Time $filtertypID = 7; if(!$testFilter){ - $nowShort = date("h:i"); + $nowShort = date("H:i"); } else{ - $nowShort = date("h:i",$time); + $nowShort = date("H:i",$time); } $nowShort = str_replace(":","",$nowShort); @@ -262,7 +262,7 @@ class Pbs_Filter{ REPLACE(fe.filtervalue,":","") <= '.$nowShort.' AND REPLACE(fe.filtervalue2,":","") >= '.$nowShort." AND fe.filterID = f.filterID AND - f.groupID = '".$groupID."'"); + f.groupID = '".$groupID."'"); $result = $stmt->fetchAll(); foreach($result as $r){ $set[$filtertypID][] = $r['filterID']; @@ -323,7 +323,7 @@ class Pbs_Filter{ if($debuglevel >= 3) print_a('weekday',$result,$set[$filtertypID]); ######################################################### - // weekday + // date $filtertypID = 11; if(!$testFilter){ $date = date('d.m.Y'); @@ -344,7 +344,7 @@ class Pbs_Filter{ catch(Exception $e){} if($debuglevel >= 3) - print_a('weekday',$result,$set[$filtertypID]); + print_a('date',$result,$set[$filtertypID]); ######################################## // ErgebnisSet auswerten if($debuglevel >= 2) diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php index fc21336..df36ac4 100644 --- a/library/Pbs/Graph.php +++ b/library/Pbs/Graph.php @@ -17,7 +17,7 @@ class Pbs_Graph{ size="5,5"; graph[ bgcolor=transparent ]; node [ style=filled fillcolor="#ffffffff" ]; - "'.$this->getGroupTitle($groupID).'" [ fontcolor="#ffffffff", style=filled, fillcolor="#003592FF"]; + "'.$this->getGroupTitle($groupID).'" [ fontcolor="#ffffffff", style=filled, fillcolor="#004A99FF"]; '; $this->getParentGroups($groupID); $this->getChildGroups($groupID); diff --git a/pbs-newdata.sql b/pbs-newdata.sql index 9a447ef..a85fdf2 100644 --- a/pbs-newdata.sql +++ b/pbs-newdata.sql @@ -36,16 +36,21 @@ INSERT INTO `pbs`.`pbs_groupgroups` (`parentID`, `groupID`) VALUES (3, 10); -- Adding role -INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (1, '1', 'Role 1-Group1', NULL); -INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (2, '1', 'Role 2-Group1', NULL); -INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (3, '2', 'Role 1-Group2', NULL); -INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`) VALUES (4, '2', 'Role 2-Group2', NULL); +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (1, '1', 'Role 1-Group1', NULL, 0); +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (2, '1', 'Role 2-Group1', NULL, 0); +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (3, '2', 'Role 1-Group2', NULL, 0); +INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (4, '2', 'Role 2-Group2', NULL, 0); -- Adding right -INSERT INTO `pbs_right` (`rightID`, `title`, `description`) VALUES (1, 'Recht 1', NULL); -INSERT INTO `pbs_right` (`rightID`, `title`, `description`) VALUES (2, 'Recht 2', NULL); -INSERT INTO `pbs_right` (`rightID`, `title`, `description`) VALUES (3, 'Recht 3', NULL); -INSERT INTO `pbs_right` (`rightID`, `title`, `description`) VALUES (4, 'Recht 4', NULL); +INSERT INTO `pbs_rightcategory` (`rightcategoryID`, `title`) VALUES +(1, 'rightcategory 1'), +(2, 'rightcategory 2'), +(3, 'rightcategory 3'); + +INSERT INTO `pbs_right` (`rightID`, `rightcategoryID`, `title`, `description`) VALUES (1, 1, 'Recht 1', NULL); +INSERT INTO `pbs_right` (`rightID`, `rightcategoryID`, `title`, `description`) VALUES (2, 1, 'Recht 2', NULL); +INSERT INTO `pbs_right` (`rightID`, `rightcategoryID`, `title`, `description`) VALUES (3, 2, 'Recht 3', NULL); +INSERT INTO `pbs_right` (`rightID`, `rightcategoryID`, `title`, `description`) VALUES (4, 3, 'Recht 4', NULL); INSERT INTO `pbs_rightroles` (`roleID`, `rightID`) VALUES (1, 1), @@ -9,23 +9,33 @@ CREATE TABLE IF NOT EXISTS `pbs_group` ( PRIMARY KEY (`groupID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +CREATE TABLE IF NOT EXISTS `pbs_rightcategory` ( + `rightcategoryID` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`rightcategoryID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; CREATE TABLE IF NOT EXISTS `pbs_right` ( `rightID` int(11) NOT NULL AUTO_INCREMENT, + `rightcategoryID` int(11) NOT NULL, `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(140) COLLATE utf8_unicode_ci, - PRIMARY KEY (`rightID`) + `description` varchar(140) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`rightID`), + KEY `rightcategoryID` (`rightcategoryID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +ALTER TABLE `pbs_right` + ADD CONSTRAINT `pbs_right_ibfk_1` FOREIGN KEY (`rightcategoryID`) REFERENCES `pbs_rightcategory` (`rightcategoryID`) ON DELETE CASCADE; CREATE TABLE IF NOT EXISTS `pbs_role` ( `roleID` int(11) NOT NULL AUTO_INCREMENT, `groupID` int(11) NOT NULL, `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(140) COLLATE utf8_unicode_ci, + `description` varchar(140) COLLATE utf8_unicode_ci DEFAULT NULL, + `inheritance` tinyint(1) NOT NULL, PRIMARY KEY (`roleID`), KEY `groupID` (`groupID`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; ALTER TABLE `pbs_role` ADD CONSTRAINT `pbs_role_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; diff --git a/public/media/css/style.css b/public/media/css/style.css index 7e147d0..b9e56f4 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -34,21 +34,25 @@ body { #sidepannel { float: left; - font-size:12px; + font-size: 12px; } - -#footer { +#footer { margin: 0; - width: 1000px; clear: both; bottom: 0px; border-top: 1px solid #ccc; - background-color: #eee; + background-color: #004A99; text-align: right; font-size: 10.5px; - line-height: 16px; - color: #666; + line-height: 12px; + color: #FFF; +} +.footer { + text-align: right; + font-size: 10px; + font-family: Verdana, Arial; + padding: 5px 2px 5px 0px; } #main { @@ -58,13 +62,14 @@ body { #head-bg { height: 116px; - background-color: #003592; + background-color: #004A99; + } #head { height: 116px; background: url(/media/img/siegel-93x55.png) bottom left no-repeat, - url(/media/img/sub-logo-small.gif) bottom right no-repeat; + url(/media/img/sub-logo-small-transparent.gif) bottom right no-repeat; } #head h1,h2 { @@ -107,8 +112,8 @@ body { #content { padding: 10px; font-size: 13px; - min-height:400px; - background-color:#F2F3F1; + min-height: 400px; + background-color: #F2F3F1; } #debug { @@ -138,37 +143,35 @@ body { width: 160px; padding: 0; margin: 0 0 21px 0; - background-color: #ffffff; - border-bottom: none; + background-color: #ffffff; + border-bottom: none; overflow: hidden; - } +} .portletNavigationTree .portletItem { - border-left: none; - border-right: none; - } + border-left: none; + border-right: none; +} .portletNavigationTree dt { display: none; - } +} -.portletNavigationTree ul, -.portletNavigationTree ul li, -.portletNavigationTree dd, -.portletNavigationTree div { +.portletNavigationTree ul,.portletNavigationTree ul li,.portletNavigationTree dd,.portletNavigationTree div + { margin: 0; padding: 0; - } +} .portletNavigationTree ul li { margin: 0; border-bottom: 1px solid #fff; list-style: none; - } +} .portletNavigationTree ul li.navTreeLastItem { - border-bottom: none; - } + border-bottom: none; +} .portletNavigationTree li.navTreeItem a { display: block; @@ -178,100 +181,98 @@ body { text-decoration: none; color: #363534; background: #c9cac8; - } - +} /* - navTreeLevel0 - */ .portletNavigationTree ul.navTreeLevel0 a { - padding-left: 4px; - } + padding-left: 4px; +} .portletNavigationTree ul.navTreeLevel0 a:hover { - background: #004a99; - color: #fff; - } + background: #004a99; + color: #fff; +} .portletNavigationTree ul.navTreeLevel0 a.navTreeCurrentItem { background: #004a99 !important; color: #fff; margin-left: 0px; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel0 li { - background: url(/media/img/navigationLevel0.gif) repeat-y left top #c9cac8; - padding-left: 4px; - } - + background: url(/media/img/navigationLevel0.gif) repeat-y left top + #c9cac8; + padding-left: 4px; +} /* - navTreeLevel1 - */ .portletNavigationTree ul.navTreeLevel1 { - /* border-top: 1px solid #fff; */ - margin: 0 0 0 0px; - } + /* border-top: 1px solid #fff; */ + margin: 0 0 0 0px; +} .portletNavigationTree ul.navTreeLevel1 a { background: #d5d6d2; color: #363534; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel1 a:hover { background: #2a6ebb; color: #fff; - } +} .portletNavigationTree ul.navTreeLevel1 li { - background: url(/media/img/navigationLevel1.gif) repeat-y 0px top; - } + background: url(/media/img/navigationLevel1.gif) repeat-y 0px top; +} .portletNavigationTree ul.navTreeLevel1 a.navTreeCurrentItem { background: #2a6ebb !important; color: #fff; margin-left: 0px; - } +} .portletNavigationTree ul.navTreeLevel1 li.navTreeLastItem { - border-bottom: none; - } - + border-bottom: none; +} /* - navTreeLevel2 - */ .portletNavigationTree ul.navTreeLevel2 { - border-top: 1px solid #fff; - margin: 0; - } + border-top: 1px solid #fff; + margin: 0; +} .portletNavigationTree ul.navTreeLevel2 a { background: #e0e1dd; margin-left: 0px; padding-left: 4px; - } +} .portletNavigationTree ul.navTreeLevel2 a:hover { background: #6f9ad3; color: #fff; - } +} .portletNavigationTree ul.navTreeLevel2 li { - background: url(/media/img/navigationLevel2.gif) repeat-y left top; - } + background: url(/media/img/navigationLevel2.gif) repeat-y left top; +} .portletNavigationTree ul.navTreeLevel2 li.navTreeLastItem { - border: none; - } + border: none; +} .portletNavigationTree ul.navTreeLevel2 a.navTreeCurrentItem { background: #6f9ad3 !important; color: #fff !important; - } +} .portletNavigationTree ul.navTreeLevel2 a.navTreeItemInPath { background: #6f9ad3 !important; color: #fff !important; - } -/* ################################################### */ +} +/* ################################################### */ #content h1 { display: block; text-align: center; @@ -297,13 +298,15 @@ td { font-size: 12px; border: 1px solid #CCC; } -.updatebutton, .addbutton { + +.updatebutton,.addbutton { float: right; } .updatebutton:before { content: url(/media/img/update.png) ' '; } + .addbutton:before { content: url(/media/img/create.png) ' '; } @@ -323,14 +326,6 @@ td { background-color: #FFF5CC; } -tr.selectedMembership { - background-color: red; -} - -tr.selectedMembership td { - padding-left: 3px; -} - .monospace { font-family: Courier New, monospace; } @@ -389,12 +384,6 @@ td.action img { font-weight: bold; } -.footer { - text-align: right; - font-size: 10px; - font-family: Verdana, Arial; - padding: 10px 0px 10px 0px; -} /* boxes */ .okbox,.warningbox,.errorbox,.infobox { @@ -435,4 +424,4 @@ td.action img { background: #FFFFFF url('/media/img/box_info.png') no-repeat; background-position: 10px center; color: #777; -} +}
\ No newline at end of file diff --git a/public/media/css/user.css b/public/media/css/user.css index 24e830e..00d144a 100644 --- a/public/media/css/user.css +++ b/public/media/css/user.css @@ -1,19 +1,30 @@ -.dashboard ul{ - padding:0px; +.dashboard ul { + padding: 0px; } -.dashboard li{ - list-style:none; - border:1px solid black; + +.dashboard li { + list-style: none; + border: 1px solid black; -moz-border-radius: 1em 4em 1em 4em; border-radius: 1em 4em 1em 4em; - padding:10px 40px; - margin:10px; - background-color:#FFF; + padding: 10px 40px; + margin: 10px; + background-color: #FFF; } -.dashboard a{ - color:#000; - text-decoration:none; + +.dashboard a { + color: #000; + text-decoration: none; } -.dashboard .bottomimg{ - text-align:center; + +.dashboard .bottomimg { + text-align: center; } + +tr.selectedEntry { + background-color: red; +} + +tr.selectedEntry td { + padding-left: 3px; +}
\ No newline at end of file diff --git a/public/media/img/sub-logo-small-transparent.gif b/public/media/img/sub-logo-small-transparent.gif Binary files differnew file mode 100644 index 0000000..6ac7b92 --- /dev/null +++ b/public/media/img/sub-logo-small-transparent.gif |