From 84f8c7b61f61ff68e9568e01c23689d591dc4828 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 28 Mar 2011 12:56:10 +0200 Subject: Groupcontroller User Module --- application/modules/user/forms/GroupAdd.php | 65 ++++++++++++++++++++++++++ application/modules/user/forms/GroupEdit.php | 68 ++++++++++++++++++++++++++++ application/modules/user/forms/GroupLink.php | 55 ++++++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 application/modules/user/forms/GroupAdd.php create mode 100644 application/modules/user/forms/GroupEdit.php create mode 100644 application/modules/user/forms/GroupLink.php (limited to 'application/modules/user/forms') diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php new file mode 100644 index 0000000..47855de --- /dev/null +++ b/application/modules/user/forms/GroupAdd.php @@ -0,0 +1,65 @@ +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="/dev/group/"', + )); + } + + +} + diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php new file mode 100644 index 0000000..0da0f61 --- /dev/null +++ b/application/modules/user/forms/GroupEdit.php @@ -0,0 +1,68 @@ +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', + )); + + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { + if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/show/groupID/' . $this->groupID . '"', + )); + } else { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/show/"', + )); + } + } else { + $this->addElement('button', 'cancel', array( + 'required' => false, + 'ignore' => true, + 'label' => 'Cancel', + 'onclick' => 'location.href="/user/group/showall"', + )); + } + } +} \ 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..d2aafcc --- /dev/null +++ b/application/modules/user/forms/GroupLink.php @@ -0,0 +1,55 @@ +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="/user/group/"', + )); + } + + +} + -- cgit v1.2.3-55-g7522 From 49ebfec064bb6d7a732466fa2071778665beb184 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 28 Mar 2011 14:38:51 +0200 Subject: Einführung von Vererbung von Rollen --- application/models/RightCategoryMapper.php | 6 ++- application/models/Role.php | 60 +++++++++++++--------- application/models/RoleMapper.php | 6 +-- .../modules/dev/controllers/RoleController.php | 1 + application/modules/dev/forms/RoleAdd.php | 4 ++ application/modules/dev/forms/RoleEdit.php | 19 +++++-- .../modules/dev/views/scripts/role/show.phtml | 2 + .../modules/user/controllers/GroupController.php | 12 ++++- .../modules/user/controllers/RoleController.php | 8 ++- application/modules/user/forms/RoleAdd.php | 4 ++ application/modules/user/forms/RoleEdit.php | 11 ++++ .../modules/user/views/scripts/role/show.phtml | 2 + pbs-newdata.sql | 8 +-- pbs.sql | 5 +- 14 files changed, 106 insertions(+), 42 deletions(-) (limited to 'application/modules/user/forms') diff --git a/application/models/RightCategoryMapper.php b/application/models/RightCategoryMapper.php index e0e324d..1a3d093 100644 --- a/application/models/RightCategoryMapper.php +++ b/application/models/RightCategoryMapper.php @@ -93,7 +93,11 @@ class Application_Model_RightCategoryMapper 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/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/RoleAdd.php b/application/modules/dev/forms/RoleAdd.php index d773b17..7aae426 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, diff --git a/application/modules/dev/forms/RoleEdit.php b/application/modules/dev/forms/RoleEdit.php index 2c79050..c0617b7 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'], )); @@ -44,7 +55,7 @@ class dev_Form_RoleEdit extends Zend_Form 'label' => 'Cancel', 'onclick' => 'location.href="/dev/role/"', )); - } + } } 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) { Title Description + Inheritance role->getTitle(); ?> role->getDescription(); ?> + role->getInheritance() == 1) echo "yes"; else echo "no"; ?>
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 3180ebd..1ceb844 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -110,7 +110,15 @@ class User_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - $this->_helper->redirector('', 'group'); + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { + if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { + $this->_redirect('/user/group/groupID/' . $groupID); + } else { + $this->_helper->redirector('show', 'group'); + } + } else { + $this->_helper->redirector('showall', 'group'); + } return; } } @@ -210,7 +218,7 @@ class User_GroupController extends Zend_Controller_Action } if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { - $this->_redirect('/user/group/show/groupID/' . $groupID); + $this->_redirect('/user/group/showall'); } else { $this->_helper->redirector('changemembership', 'person'); } diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index b3795de..62d1550 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -76,10 +76,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 +92,11 @@ class User_RoleController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - $this->_helper->redirector('', 'role'); + if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show/roleID')) { + $this->_redirect('/user/role/show/roleID/' . $roleID); + } else { + $this->_helper->redirector('', 'role'); + } return; } } diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php index 3b5200b..a7e43a7 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, diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php index 170a2f9..848dba3 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'], )); diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml index 9abab1a..8213e73 100644 --- a/application/modules/user/views/scripts/role/show.phtml +++ b/application/modules/user/views/scripts/role/show.phtml @@ -13,10 +13,12 @@ if($this->roleID) { Title Description + Inheritance role->getTitle(); ?> role->getDescription(); ?> + role->getInheritance() == 1) echo "yes"; else echo "no"; ?>
diff --git a/pbs-newdata.sql b/pbs-newdata.sql index b80f457..a85fdf2 100644 --- a/pbs-newdata.sql +++ b/pbs-newdata.sql @@ -36,10 +36,10 @@ 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_rightcategory` (`rightcategoryID`, `title`) VALUES diff --git a/pbs.sql b/pbs.sql index 656f144..b505444 100644 --- a/pbs.sql +++ b/pbs.sql @@ -31,10 +31,11 @@ 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; -- cgit v1.2.3-55-g7522 From fb1a885e8a1168212d7efc9bad1b586f9aee5252 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 28 Mar 2011 15:32:24 +0200 Subject: Membership Select im fbgui module --- .zfproject.xml | 13 +- .../modules/dev/controllers/AuthController.php | 3 +- .../modules/fbgui/controllers/AuthController.php | 147 +++++++++++++++------ .../modules/fbgui/forms/MembershipSelect.php | 42 ++++++ .../modules/fbgui/views/scripts/auth/login.phtml | 3 +- .../views/scripts/auth/selectmembership.phtml | 4 + .../modules/user/controllers/AuthController.php | 1 + .../modules/user/forms/MembershipSelect.php | 2 +- 8 files changed, 163 insertions(+), 52 deletions(-) create mode 100644 application/modules/fbgui/forms/MembershipSelect.php create mode 100644 application/modules/fbgui/views/scripts/auth/selectmembership.phtml (limited to 'application/modules/user/forms') diff --git a/.zfproject.xml b/.zfproject.xml index 3dcb267..35860e2 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -47,6 +47,7 @@ + @@ -96,6 +97,8 @@ + + @@ -339,10 +342,13 @@ + + + @@ -352,15 +358,10 @@ - - - - - - + diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php index 41952a2..0edb78c 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; } diff --git a/application/modules/fbgui/controllers/AuthController.php b/application/modules/fbgui/controllers/AuthController.php index e9b6666..f5c3a27 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,48 +31,107 @@ 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', 'auth'); + 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; - } + } + + public function selectmembershipAction() + { + if (Zend_Auth::getInstance()->hasIdentity()) { + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if(isset($userIDsNamespace['membershipID'])) { + $this->_redirect('/fbgui/'); + } else { + $personmapper = new Application_Model_PersonMapper(); + $result = $personmapper->findBy('email', Zend_Auth::getInstance()->getIdentity()); + $person = new Application_Model_Person($result[0]); + $person->setID($result[0]['personID']); + $membershipMapper = new Application_Model_MembershipMapper(); + $memberships = $membershipMapper->findBy("personID",$person->getID()); + if(count($memberships) > 0) { + if(isset($_POST['selectmembership'])) { + $roleSession = new Zend_Session_Namespace('userIDs'); + $roleSession->membershipID = $_POST['membershipID']; + $roleSession->personID = $person->getID(); + $membership = $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($memberships)) { + foreach($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/'); + } + } + + } else { + $this->_helper->redirector('login', 'auth'); + } + } + + public function changemembershipAction() + { + $this->_helper-> viewRenderer-> setNoRender(); + Zend_Session::namespaceUnset('userIDs'); + $this->_helper->redirector('selectmembership', 'auth'); + return; + } } @@ -81,3 +140,7 @@ class Fbgui_AuthController extends Zend_Controller_Action + + + + diff --git a/application/modules/fbgui/forms/MembershipSelect.php b/application/modules/fbgui/forms/MembershipSelect.php new file mode 100644 index 0000000..5b21fa7 --- /dev/null +++ b/application/modules/fbgui/forms/MembershipSelect.php @@ -0,0 +1,42 @@ +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 Membership', + )); + } + + +} + diff --git a/application/modules/fbgui/views/scripts/auth/login.phtml b/application/modules/fbgui/views/scripts/auth/login.phtml index d68d2af..17b1c16 100644 --- a/application/modules/fbgui/views/scripts/auth/login.phtml +++ b/application/modules/fbgui/views/scripts/auth/login.phtml @@ -1,5 +1,4 @@ loginForm->setAction($this->url()); echo $this->loginForm; -?> -
\ No newline at end of file +?> \ No newline at end of file diff --git a/application/modules/fbgui/views/scripts/auth/selectmembership.phtml b/application/modules/fbgui/views/scripts/auth/selectmembership.phtml new file mode 100644 index 0000000..2bfe4d6 --- /dev/null +++ b/application/modules/fbgui/views/scripts/auth/selectmembership.phtml @@ -0,0 +1,4 @@ +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..13ad7f4 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; } diff --git a/application/modules/user/forms/MembershipSelect.php b/application/modules/user/forms/MembershipSelect.php index fbf8b8a..fe6870a 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 Membership', )); } -- cgit v1.2.3-55-g7522 From 04c69f27f49c3f40888ee4938388413b07ad5e09 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 28 Mar 2011 16:51:10 +0200 Subject: überschriften hinzugefügt, andere Fehler korrigiert --- .zfproject.xml | 7 ++++ .../modules/dev/controllers/AuthController.php | 40 +++++++++++++--------- .../modules/dev/forms/AuthRecoverPassword.php | 2 +- .../modules/dev/forms/ConfirmDeleteAccount.php | 27 +++++++++++++++ application/modules/dev/forms/GroupAdd.php | 2 +- application/modules/dev/forms/GroupEdit.php | 2 +- application/modules/dev/forms/GroupLink.php | 4 +-- application/modules/dev/forms/GroupRequest.php | 2 +- application/modules/dev/forms/GroupSelect.php | 2 +- application/modules/dev/forms/LinkRight.php | 4 +-- application/modules/dev/forms/PersonEdit.php | 2 +- application/modules/dev/forms/RoleAdd.php | 2 +- application/modules/dev/forms/RoleEdit.php | 2 +- application/modules/dev/layouts/dev.phtml | 2 +- .../modules/dev/views/scripts/auth/delete.phtml | 6 ++++ .../modules/dev/views/scripts/auth/login.phtml | 1 + .../dev/views/scripts/auth/recoverpassword.phtml | 1 + .../modules/dev/views/scripts/auth/register.phtml | 1 + .../modules/dev/views/scripts/group/add.phtml | 1 + .../modules/dev/views/scripts/group/edit.phtml | 1 + .../modules/dev/views/scripts/group/link.phtml | 1 + .../modules/dev/views/scripts/person/edit.phtml | 1 + .../modules/dev/views/scripts/person/request.phtml | 1 + .../modules/dev/views/scripts/role/add.phtml | 1 + .../modules/dev/views/scripts/role/edit.phtml | 1 + .../dev/views/scripts/role/groupselect.phtml | 1 + .../modules/dev/views/scripts/role/linkright.phtml | 1 + .../modules/fbgui/forms/MembershipSelect.php | 2 +- .../modules/fbgui/views/scripts/auth/login.phtml | 1 + .../views/scripts/auth/selectmembership.phtml | 1 + .../modules/user/controllers/AuthController.php | 40 +++++++++++++--------- .../modules/user/controllers/RoleController.php | 1 + .../modules/user/forms/ConfirmDeleteAccount.php | 27 +++++++++++++++ application/modules/user/forms/GroupAdd.php | 2 +- application/modules/user/forms/GroupEdit.php | 24 ++----------- application/modules/user/forms/GroupLink.php | 2 +- application/modules/user/forms/GroupRequest.php | 4 +-- application/modules/user/forms/LinkRight.php | 4 +-- .../modules/user/forms/MembershipSelect.php | 2 +- application/modules/user/forms/PersonEdit.php | 2 +- application/modules/user/forms/RecoverPassword.php | 2 +- application/modules/user/forms/RoleAdd.php | 2 +- application/modules/user/forms/RoleEdit.php | 15 ++------ application/modules/user/layouts/user.phtml | 2 +- .../modules/user/views/scripts/auth/delete.phtml | 6 ++++ .../modules/user/views/scripts/auth/login.phtml | 1 + .../user/views/scripts/auth/recoverpassword.phtml | 1 + .../modules/user/views/scripts/auth/register.phtml | 1 + .../modules/user/views/scripts/group/add.phtml | 1 + .../modules/user/views/scripts/group/edit.phtml | 1 + .../modules/user/views/scripts/group/link.phtml | 1 + .../modules/user/views/scripts/group/show.phtml | 9 ++--- .../modules/user/views/scripts/person/edit.phtml | 1 + .../user/views/scripts/person/request.phtml | 1 + .../views/scripts/person/selectmembership.phtml | 1 + .../modules/user/views/scripts/role/add.phtml | 1 + .../modules/user/views/scripts/role/edit.phtml | 1 + .../user/views/scripts/role/linkright.phtml | 1 + .../modules/user/views/scripts/role/show.phtml | 10 +++++- 59 files changed, 189 insertions(+), 99 deletions(-) create mode 100644 application/modules/dev/forms/ConfirmDeleteAccount.php create mode 100644 application/modules/dev/views/scripts/auth/delete.phtml create mode 100644 application/modules/user/forms/ConfirmDeleteAccount.php create mode 100644 application/modules/user/views/scripts/auth/delete.phtml (limited to 'application/modules/user/forms') diff --git a/.zfproject.xml b/.zfproject.xml index 35860e2..588998d 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -198,6 +198,7 @@ + @@ -358,8 +359,10 @@ + + @@ -520,6 +523,7 @@ + @@ -542,6 +546,9 @@ + + + diff --git a/application/modules/dev/controllers/AuthController.php b/application/modules/dev/controllers/AuthController.php index 0edb78c..078a4cf 100644 --- a/application/modules/dev/controllers/AuthController.php +++ b/application/modules/dev/controllers/AuthController.php @@ -207,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) . "
"; - echo "Message: " . $e->getMessage() . "
"; + 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) . "
"; + echo "Message: " . $e->getMessage() . "
"; + 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/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 @@ +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 7aae426..6d43904 100644 --- a/application/modules/dev/forms/RoleAdd.php +++ b/application/modules/dev/forms/RoleAdd.php @@ -45,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 c0617b7..1a9afc5 100644 --- a/application/modules/dev/forms/RoleEdit.php +++ b/application/modules/dev/forms/RoleEdit.php @@ -53,7 +53,7 @@ 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 b9bd27a..944c617 100644 --- a/application/modules/dev/layouts/dev.phtml +++ b/application/modules/dev/layouts/dev.phtml @@ -43,7 +43,7 @@ echo $this->headScript()."\n"; - + Delete Account +Do you really want to delete this account? +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 @@ +

Login

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

Recover Password

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

New Account

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

Add Group

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 a0f9b32..6b042e1 100644 --- a/application/modules/dev/views/scripts/group/edit.phtml +++ b/application/modules/dev/views/scripts/group/edit.phtml @@ -1,3 +1,4 @@ +

Edit Group

addForm)) { $this->addForm->setAction('/dev/group/add'); 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 @@ +

Link Groups

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

Edit Person

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

Request Membership

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

Add Role

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

Edit Role

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

Select Group

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

Add Right

linkForm->setAction($this->url()); echo $this->linkForm; diff --git a/application/modules/fbgui/forms/MembershipSelect.php b/application/modules/fbgui/forms/MembershipSelect.php index 5b21fa7..6e03f7d 100644 --- a/application/modules/fbgui/forms/MembershipSelect.php +++ b/application/modules/fbgui/forms/MembershipSelect.php @@ -33,7 +33,7 @@ class fbgui_Form_MembershipSelect extends Zend_Form $this->addElement('submit', 'selectmembership', array( 'required' => false, 'ignore' => true, - 'label' => 'Select Membership', + 'label' => 'Select', )); } diff --git a/application/modules/fbgui/views/scripts/auth/login.phtml b/application/modules/fbgui/views/scripts/auth/login.phtml index 17b1c16..9742c35 100644 --- a/application/modules/fbgui/views/scripts/auth/login.phtml +++ b/application/modules/fbgui/views/scripts/auth/login.phtml @@ -1,3 +1,4 @@ +

Login

loginForm->setAction($this->url()); echo $this->loginForm; diff --git a/application/modules/fbgui/views/scripts/auth/selectmembership.phtml b/application/modules/fbgui/views/scripts/auth/selectmembership.phtml index 2bfe4d6..5f7e5bf 100644 --- a/application/modules/fbgui/views/scripts/auth/selectmembership.phtml +++ b/application/modules/fbgui/views/scripts/auth/selectmembership.phtml @@ -1,3 +1,4 @@ +

Select Membership

membershipSelectForm->setAction($this->url()); echo $this->membershipSelectForm; diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 13ad7f4..5d63b20 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -120,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) . "
"; - echo "Message: " . $e->getMessage() . "
"; + 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) . "
"; + echo "Message: " . $e->getMessage() . "
"; + 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/RoleController.php b/application/modules/user/controllers/RoleController.php index d2491ff..9e118b2 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -125,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; 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 @@ +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 index 47855de..ff2b97a 100644 --- a/application/modules/user/forms/GroupAdd.php +++ b/application/modules/user/forms/GroupAdd.php @@ -56,7 +56,7 @@ class user_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/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php index 0da0f61..4f0d7fc 100644 --- a/application/modules/user/forms/GroupEdit.php +++ b/application/modules/user/forms/GroupEdit.php @@ -40,29 +40,11 @@ class user_Form_GroupEdit extends Zend_Form 'label' => 'Save', )); - if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { - if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { - $this->addElement('button', 'cancel', array( + $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/group/show/groupID/' . $this->groupID . '"', - )); - } else { - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="/user/group/show/"', - )); - } - } else { - $this->addElement('button', 'cancel', array( - 'required' => false, - 'ignore' => true, - 'label' => 'Cancel', - 'onclick' => 'location.href="/user/group/showall"', - )); - } + '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 index d2aafcc..9db7ce4 100644 --- a/application/modules/user/forms/GroupLink.php +++ b/application/modules/user/forms/GroupLink.php @@ -46,7 +46,7 @@ class user_Form_GroupLink extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="/user/group/"', + '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 fe6870a..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 Membership', + '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 a7e43a7..e8e99a5 100644 --- a/application/modules/user/forms/RoleAdd.php +++ b/application/modules/user/forms/RoleAdd.php @@ -45,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 848dba3..0bdc977 100644 --- a/application/modules/user/forms/RoleEdit.php +++ b/application/modules/user/forms/RoleEdit.php @@ -54,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 e0c9961..c22811f 100644 --- a/application/modules/user/layouts/user.phtml +++ b/application/modules/user/layouts/user.phtml @@ -42,7 +42,7 @@ echo $this->headScript()."\n"; - + Delete Account +Do you really want to delete this account? +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 @@ +

Login

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

Recover Password

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

New Account

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 index 4f96cf0..588ce31 100644 --- a/application/modules/user/views/scripts/group/add.phtml +++ b/application/modules/user/views/scripts/group/add.phtml @@ -1,3 +1,4 @@ +

Add Group

addForm->setAction($this->url()); echo $this->addForm; diff --git a/application/modules/user/views/scripts/group/edit.phtml b/application/modules/user/views/scripts/group/edit.phtml index d513dea..add3a77 100644 --- a/application/modules/user/views/scripts/group/edit.phtml +++ b/application/modules/user/views/scripts/group/edit.phtml @@ -1,3 +1,4 @@ +

Edit Group

addForm)) { $this->addForm->setAction('/user/group/add'); diff --git a/application/modules/user/views/scripts/group/link.phtml b/application/modules/user/views/scripts/group/link.phtml index 94ad343..5bb2a9d 100644 --- a/application/modules/user/views/scripts/group/link.phtml +++ b/application/modules/user/views/scripts/group/link.phtml @@ -1,3 +1,4 @@ +

Link Groups

linkForm->setAction($this->url()); echo $this->linkForm; diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml index 18ad1d3..d343204 100644 --- a/application/modules/user/views/scripts/group/show.phtml +++ b/application/modules/user/views/scripts/group/show.phtml @@ -4,12 +4,6 @@ if($this->groupID) { ?>

Group

-

Group Details

- userIDsNamespace['groupID'])) { echo $this->formButton('deletegroup', 'Delete', array( 'onclick' => 'self.location="/user/group/delete/"', 'class' => 'rightbutton')); @@ -17,6 +11,9 @@ if($this->groupID) { 'onclick' => 'self.location="/user/group/edit/"', 'class' => 'rightbutton')); } else { + ?> +

Group Details

+ formButton('deletegroup', 'Delete', array( 'onclick' => 'self.location="/user/group/delete/groupID/' . $this->group->getID() .'"', 'class' => 'rightbutton')); 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 @@ +

Edit Person

editForm->setAction($this->url()); echo $this->editForm; 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 @@ +

Request Membership

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

Select Membership

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

Add Role

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

Edit Role

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

Add Right

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 8213e73..b99c1f8 100644 --- a/application/modules/user/views/scripts/role/show.phtml +++ b/application/modules/user/views/scripts/role/show.phtml @@ -1,6 +1,14 @@ -

Role Details

roleID) { + if(isset($this->userIDsNamespace['roleID'])) { + ?> +

Role

+ +

Role Details

+ formButton('deleterole', 'Delete', array( 'onclick' => 'self.location="/user/role/delete/roleID/' . $this->role->getID() .'"', -- cgit v1.2.3-55-g7522