diff options
author | michael pereira | 2011-04-05 15:35:35 +0200 |
---|---|---|
committer | michael pereira | 2011-04-05 15:35:35 +0200 |
commit | 324b653c50e328019127c0aad29939fb933e4bcf (patch) | |
tree | 10f6eaa134ab8a8bb804b8699293ad8fa2ef5b65 | |
parent | Rechte in Controller eingepflanzt (diff) | |
parent | Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2 (diff) | |
download | pbs2-324b653c50e328019127c0aad29939fb933e4bcf.tar.gz pbs2-324b653c50e328019127c0aad29939fb933e4bcf.tar.xz pbs2-324b653c50e328019127c0aad29939fb933e4bcf.zip |
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
49 files changed, 595 insertions, 187 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index c7a4807..21e4994 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -123,6 +123,8 @@ <actionMethod actionName="leave"/> <actionMethod actionName="selectMembership"/> <actionMethod actionName="changemembership"/> + <actionMethod actionName="showall"/> + <actionMethod actionName="show"/> </controllerFile> <controllerFile controllerName="Group"> <actionMethod actionName="index"/> @@ -316,7 +318,7 @@ </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Preboot"> <viewScriptFile forActionName="index"/> - </viewControllerScriptsDirectory> + </viewControllerScriptsDirectory> <viewControllerScriptsDirectory forControllerName="Group"> <viewScriptFile forActionName="add"/> </viewControllerScriptsDirectory> @@ -332,8 +334,14 @@ <viewControllerScriptsDirectory forControllerName="Group"> <viewScriptFile forActionName="showall"/> </viewControllerScriptsDirectory> - <viewHelpersDirectory/> - <viewFiltersDirectory/> + <viewHelpersDirectory/> + <viewFiltersDirectory/> + <viewControllerScriptsDirectory forControllerName="Person"> + <viewScriptFile forActionName="showall"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Person"> + <viewScriptFile forActionName="show"/> + </viewControllerScriptsDirectory> </viewScriptsDirectory> </viewsDirectory> <bootstrapFile filesystemName="Bootstrap.php"/> diff --git a/application/modules/dev/forms/ConfirmDeleteAccount.php b/application/modules/dev/forms/ConfirmDeleteAccount.php index c093996..b82bf0b 100644 --- a/application/modules/dev/forms/ConfirmDeleteAccount.php +++ b/application/modules/dev/forms/ConfirmDeleteAccount.php @@ -18,10 +18,8 @@ class dev_Form_ConfirmDeleteAccount extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } - - } diff --git a/application/modules/dev/forms/GroupAdd.php b/application/modules/dev/forms/GroupAdd.php index 8132f3a..6c5cea9 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/GroupEdit.php b/application/modules/dev/forms/GroupEdit.php index 96784de..f375181 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/GroupLink.php b/application/modules/dev/forms/GroupLink.php index 8a65e77..40cbc5b 100644 --- a/application/modules/dev/forms/GroupLink.php +++ b/application/modules/dev/forms/GroupLink.php @@ -46,7 +46,7 @@ class dev_Form_GroupLink extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/LinkRight.php b/application/modules/dev/forms/LinkRight.php index 0745791..e371b3a 100644 --- a/application/modules/dev/forms/LinkRight.php +++ b/application/modules/dev/forms/LinkRight.php @@ -39,7 +39,7 @@ class dev_Form_LinkRight extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/PersonEdit.php b/application/modules/dev/forms/PersonEdit.php index c04f418..0dfa5e6 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/RoleAdd.php b/application/modules/dev/forms/RoleAdd.php index 6d43904..3e12355 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/dev/forms/RoleEdit.php b/application/modules/dev/forms/RoleEdit.php index 1a9afc5..7eb0a0e 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php index 7eccc98..8160104 100644 --- a/application/modules/user/controllers/AuthController.php +++ b/application/modules/user/controllers/AuthController.php @@ -2,9 +2,7 @@ class User_AuthController extends Zend_Controller_Action { - protected $personmapper = null; - private $db = null; public function init() @@ -120,11 +118,19 @@ class User_AuthController extends Zend_Controller_Action public function deleteAction() { + if($this->_request->getParam('personID')) { + if(!Pbs_Acl::checkRight('peoa')) { + $this->_redirect('/user'); + } + $personID = $this->_request->getParam('personID'); + } else { + if(!Pbs_Acl::checkRight('pdo')) { + $this->_redirect('/user'); + } + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + $personID = $userIDsNamespace['personID']; + } if($_POST['confirmdelete']) { - $auth = Zend_Auth::getInstance(); - $result = $this->personmapper->findBy(array('email' => $auth->getIdentity()),true); - $person = $result[0]; - $personID = $person["personID"]; if (isset($personID)){ $this->personmapper = new Application_Model_PersonMapper(); $person = $this->personmapper->find($personID); diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index 84d51ab..5c3acaa 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -79,6 +79,16 @@ class user_BootisoController extends Zend_Controller_Action $this->view->bootisolist = array_reverse($this->view->bootisolist); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('bootiso'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->bootisolist = $mySearch->search($this->view->bootisolist); + } // Pagination $pagination = new Pbs_Pagination(); @@ -104,6 +114,10 @@ class user_BootisoController extends Zend_Controller_Action } + public function searchAction(){ + $this->_redirect('/user/bootiso/index/search/'.($_GET['search'])); + } + public function downloadbootisoAction() { $this->_helper->layout->disableLayout(); diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index b18adbe..84c31ff 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -87,6 +87,17 @@ class user_BootmenuController extends Zend_Controller_Action } } + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('bootmenu'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $bootmenu = $mySearch->search($bootmenu); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(2); @@ -102,6 +113,10 @@ class user_BootmenuController extends Zend_Controller_Action $this->view->bootmenuentrylist = $bootmenuentries; } + + public function searchAction(){ + $this->_redirect('/user/bootmenu/index/search/'.($_GET['search'])); + } public function createbootmenuAction() diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index 34fddd0..eeb60a7 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -66,6 +66,17 @@ class user_BootosController extends Zend_Controller_Action $this->view->bootoslist = $this->bootosMapper->findBy(array("groupID" => $groupID)); $this->view->update = array(); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('bootos'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->bootoslist = $mySearch->search($this->view->bootoslist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(5); @@ -92,6 +103,9 @@ class user_BootosController extends Zend_Controller_Action } } + public function searchAction(){ + $this->_redirect('/user/bootos/index/search/'.($_GET['search'])); + } public function createbootosAction() { diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 87e764d..9fe4b03 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -53,15 +53,16 @@ class User_ClientController extends Zend_Controller_Action $search = $this->_request->getParam('search'); $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); + $mySearch->setModule('client'); $this->view->searchform = $mySearch->searchForm(); if($search != ''){ - $this->view->search = $search; + $this->view->search = $mySearch->getSearchTerm(); $clientsInGroup = $mySearch->search($clientsInGroup); } // Pagination $pagination = new Pbs_Pagination(); - $pagination->setPerPage(10); + $pagination->setPerPage(10); $pagination->setElement($clientsInGroup); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/client/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -73,7 +74,7 @@ class User_ClientController extends Zend_Controller_Action } public function searchAction(){ - $this->_redirect('/user/client/index/search/'.$_GET['search']); + $this->_redirect('/user/client/index/search/'.($_GET['search'])); } public function addclientAction() diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 000a5e9..ecc3c65 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -65,6 +65,17 @@ class user_ConfigController extends Zend_Controller_Action $config->setGroupID("[".$config->getGroupID()."] ".$groupMapper->find($config->getGroupID())->getTitle()); } + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('config'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->configlist = $mySearch->search($this->view->configlist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(2); @@ -78,6 +89,10 @@ class user_ConfigController extends Zend_Controller_Action $this->view->configlist = $this->view->configlist; } + + public function searchAction(){ + $this->_redirect('/user/config/index/search/'.($_GET['search'])); + } public function createconfigAction() { diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 4ab3ad6..f84f501 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -55,6 +55,17 @@ class User_FilterController extends Zend_Controller_Action $ff->setID($filter['filterID']); $allFilter[] = $ff; } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('filter'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $allFilter = $mySearch->search($allFilter); + } // Pagination $pagination = new Pbs_Pagination(); @@ -69,6 +80,10 @@ class User_FilterController extends Zend_Controller_Action $this->view->filters = $allFilter; } + + public function searchAction(){ + $this->_redirect('/user/filter/index/search/'.($_GET['search'])); + } public function addfilterAction() { diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php index 76639bd..83358c4 100644 --- a/application/modules/user/controllers/GroupController.php +++ b/application/modules/user/controllers/GroupController.php @@ -2,21 +2,13 @@ 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() @@ -112,7 +104,15 @@ class User_GroupController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; return; } - $this->_redirect($_SERVER['HTTP_REFERER']); + if($_SERVER['HTTP_REFERER']) { + $this->_redirect($_SERVER['HTTP_REFERER']); + } else { + if(isset($groupID)) { + $this->_redirect('/user/group/show/groupID/' . $groupID); + } else { + $this->_helper->redirector('', 'group'); + } + } return; } } @@ -217,12 +217,8 @@ class User_GroupController extends Zend_Controller_Action 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'); - } + if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/groupID/') === false) { + $this->_helper->redirector('changemembership', 'person'); } else { $this->_helper->redirector('showall', 'group'); } diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php index e614b98..08add21 100644 --- a/application/modules/user/controllers/PersonController.php +++ b/application/modules/user/controllers/PersonController.php @@ -2,7 +2,6 @@ class user_PersonController extends Zend_Controller_Action { - protected $person = null; protected $personmapper = null; protected $membershipMapper = null; @@ -10,14 +9,20 @@ class user_PersonController extends Zend_Controller_Action protected $groupMapper = null; protected $groups = null; protected $groupRequestMapper = null; + protected $userIDsNamespace = null; public function init() { if (Zend_Auth::getInstance()->hasIdentity()) { $this->personmapper = new Application_Model_PersonMapper(); - $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); - $this->person = new Application_Model_Person($result[0]); - $this->person->setID($result[0]['personID']); + $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if($this->userIDsNamespace['personID']) { + $this->person = $this->personmapper->find($this->userIDsNamespace['personID']); + } else { + $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true); + $this->person = new Application_Model_Person($result[0]); + $this->person->setID($result[0]['personID']); + } $this->groupMapper = new Application_Model_GroupMapper(); $this->groupRequestMapper = new Application_Model_GroupRequestMapper(); $this->membershipMapper = new Application_Model_MembershipMapper(); @@ -26,10 +31,10 @@ class user_PersonController extends Zend_Controller_Action foreach($this->memberships as $membership) { $group = $this->groupMapper->find($membership['groupID']); $this->groups[] = array ( - 'groupID' => $group->getID(), - 'title' => $group->getTitle(), - 'description' => $group->getDescription(), - 'membershipID' => $membership['membershipID'] + 'groupID' => $group->getID(), + 'title' => $group->getTitle(), + 'description' => $group->getDescription(), + 'membershipID' => $membership['membershipID'] ); } } @@ -41,12 +46,15 @@ class user_PersonController extends Zend_Controller_Action public function indexAction() { - if(!Pbs_Acl::checkRight('psod')) { $this->_redirect('/user'); } $this->view->person = $this->person; $this->view->groups = $this->groups; + $this->view->groupRequestRight = Pbs_Acl::checkRight('grm'); + $this->view->editRight = Pbs_Acl::checkRight('peoa'); + $this->view->leaveRight = Pbs_Acl::checkRight('gl'); + $this->view->overviewRight = Pbs_Acl::checkRight('pso'); $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); } @@ -55,27 +63,54 @@ class user_PersonController extends Zend_Controller_Action if(!Pbs_Acl::checkRight('peod')) { $this->_redirect('/user'); } - $this->view->person = $this->person; + if($personID = $this->_request->getParam('personID')) { + if(!Pbs_Acl::checkRight('peoa')) { + $this->_redirect('/user'); + } + $person = $this->personmapper->find($personID); + $this->view->person = $person; + } else { + $this->view->person = $this->person; + } if (!isset($_POST["save"])){ $editForm = new user_Form_PersonEdit(); } else { $editForm = new user_Form_PersonEdit($_POST); if ($editForm->isValid($_POST)) { - if(isset($_POST['newpassword'])) { - $date = new DateTime(); - $this->person->setPassword($_POST['newpassword']); - $this->person->setPasswordSalt(MD5($date->getTimestamp())); - $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt())); - } - $this->person->setOptions($_POST); - try { - $this->personmapper->save($this->person); - } catch(Zend_Exception $e) - { - echo "Caught exception: " . get_class($e) . "<br/>"; - echo "Message: " . $e->getMessage() . "<br/>"; - echo "Email Address already existing."; - return; + if($personID = $this->_request->getParam('personID')) { + if(isset($_POST['newpassword'])) { + $date = new DateTime(); + $person->setPassword($_POST['newpassword']); + $person->setPasswordSalt(MD5($date->getTimestamp())); + $person->setPassword(MD5($person->getPassword() . $this->person->getPasswordSalt())); + } + $person->setOptions($_POST); + try { + $this->personmapper->save($person); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + echo "Email Address already existing."; + return; + } + } else { + if(isset($_POST['newpassword'])) { + $date = new DateTime(); + $this->person->setPassword($_POST['newpassword']); + $this->person->setPasswordSalt(MD5($date->getTimestamp())); + $this->person->setPassword(MD5($this->person->getPassword() . $this->person->getPasswordSalt())); + } + $this->person->setOptions($_POST); + try { + $this->personmapper->save($this->person); + } catch(Zend_Exception $e) + { + echo "Caught exception: " . get_class($e) . "<br/>"; + echo "Message: " . $e->getMessage() . "<br/>"; + echo "Email Address already existing."; + return; + } } $this->_helper->redirector('', 'person'); return; @@ -151,10 +186,9 @@ class user_PersonController extends Zend_Controller_Action public function leaveAction() { - // Nicht klar welches Recht geprüft werden soll - /*if(!Pbs_Acl::checkRight('peod')) { - $this->_redirect('/user'); - }*/ + if(!Pbs_Acl::checkRight('gl')) { + $this->_redirect('/user'); + } $this->_helper-> viewRenderer-> setNoRender(); $this->view->person = $this->person; $membershipID = $this->_request->getParam('membershipID'); @@ -197,9 +231,9 @@ class user_PersonController extends Zend_Controller_Action $group = $groupMapper->find($membership['groupID']); $role = $roleMapper->find($membership['roleID']); $membershipList[] = array( - 'membershipID' => $membership['membershipID'], - 'group' => $group->getTitle(), - 'role' => $role->getTitle() + 'membershipID' => $membership['membershipID'], + 'group' => $group->getTitle(), + 'role' => $role->getTitle() ); } } @@ -220,6 +254,54 @@ class user_PersonController extends Zend_Controller_Action return; } + public function showallAction() + { + if(!Pbs_Acl::checkRight('pso')) { + $this->_redirect('/user'); + } + $this->view->showRight = Pbs_Acl::checkRight('psod'); + $this->view->editRight = Pbs_Acl::checkRight('peoa'); + $this->view->deleteRight = Pbs_Acl::checkRight('pd'); + $this->view->showOtherRight = Pbs_Acl::checkRight('psood'); + $this->view->editOtherRight = Pbs_Acl::checkRight('peoa'); + $this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo'); + $this->view->userIDsNamespace = $this->userIDsNamespace; + $this->view->personList = $this->personmapper->fetchAll(); + } + + public function showAction() + { + if(!Pbs_Acl::checkRight('psood')) { + $this->_redirect('/user'); + } + $personID = $this->_request->getParam('personID'); + if($personID) { + $person = $this->personmapper->find($personID); + $memberships = $this->membershipMapper->findBy(array("personID" => $person->getID()),true); + if(isset($memberships)) { + foreach($memberships as $membership) { + $group = $this->groupMapper->find($membership['groupID']); + $groups[] = array ( + 'groupID' => $group->getID(), + 'title' => $group->getTitle(), + 'description' => $group->getDescription(), + 'membershipID' => $membership['membershipID'] + ); + } + } + $this->view->person = $person; + $this->view->groups = $groups; + $this->view->personID = $personID; + $this->view->editRight = Pbs_Acl::checkRight('peoa'); + $this->view->deleteRight = Pbs_Acl::checkRight('pd'); + $this->view->overviewRight = Pbs_Acl::checkRight('pso'); + $this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + } else { + $this->_helper->redirector('', 'person'); + return; + } + } + } @@ -237,3 +319,7 @@ class user_PersonController extends Zend_Controller_Action + + + + diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index e5fea8c..7800c7a 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -64,6 +64,17 @@ class User_PoolController extends Zend_Controller_Action $ff->setID($pool['poolID']); $yourpools[] = $ff; } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('pool'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $yourpools = $mySearch->search($yourpools); + } // Pagination $pagination = new Pbs_Pagination(); @@ -95,6 +106,10 @@ class User_PoolController extends Zend_Controller_Action if(Pbs_Acl::checkRight('posuc')) $this->view->freeclients = $freeclients; } + + public function searchAction(){ + $this->_redirect('/user/pool/index/search/'.($_GET['search'])); + } public function createpoolAction() { diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index 0572c32..94759f6 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -64,6 +64,17 @@ class User_PrebootController extends Zend_Controller_Action $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID)); + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('preboot'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $this->view->prebootlist = $mySearch->search($this->view->prebootlist); + } + // Pagination $pagination = new Pbs_Pagination(); $pagination->setPerPage(2); @@ -88,6 +99,10 @@ class User_PrebootController extends Zend_Controller_Action } } + public function searchAction(){ + $this->_redirect('/user/preboot/index/search/'.($_GET['search'])); + } + public function createprebootAction() { diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php index 059d9c4..38c12b0 100644 --- a/application/modules/user/controllers/RoleController.php +++ b/application/modules/user/controllers/RoleController.php @@ -2,7 +2,7 @@ class User_RoleController extends Zend_Controller_Action { - protected $userIDsNamespace; + protected $userIDsNamespace = null; public function init() { @@ -76,8 +76,8 @@ class User_RoleController extends Zend_Controller_Action } } } - //$this->_helper->redirector('', 'role'); - //return; + $this->_helper->redirector('', 'role'); + return; } } @@ -127,7 +127,15 @@ class User_RoleController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; return; } - $this->_redirect($_SERVER['HTTP_REFERER']); + if($_SERVER['HTTP_REFERER']) { + $this->_redirect($_SERVER['HTTP_REFERER']); + } else { + if(isset($roleID)) { + $this->_redirect('/user/role/show/roleID/' . $roleID); + } else { + $this->_helper->redirector('', 'role'); + } + } return; } } @@ -215,7 +223,11 @@ class User_RoleController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "<br/>"; return; } - $this->_helper->redirector('', 'role'); + if(strpos($_SERVER['HTTP_REFERER'], '/user/role/show') !== false && strpos($_SERVER['HTTP_REFERER'], '/roleID/') === false) { + $this->_helper->redirector('changemembership', 'person'); + } else { + $this->_helper->redirector('', 'role'); + } return; } else { $pbsNotifier = new Pbs_Notifier(); diff --git a/application/modules/user/forms/ConfirmDeleteAccount.php b/application/modules/user/forms/ConfirmDeleteAccount.php index 7bf5a32..6237844 100644 --- a/application/modules/user/forms/ConfirmDeleteAccount.php +++ b/application/modules/user/forms/ConfirmDeleteAccount.php @@ -18,7 +18,7 @@ class user_Form_ConfirmDeleteAccount extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php index 0676ba8..76cf3f8 100644 --- a/application/modules/user/forms/Filter.php +++ b/application/modules/user/forms/Filter.php @@ -10,7 +10,7 @@ class user_Form_Filter extends Zend_Form $this->setName("Add Filter"); $this->setMethod('post'); - if(Pbs_Acl::checkRight('fefp')){ + if(Pbs_Acl::checkRight('fefp') || Pbs_Acl::checkRight('fa')){ $edit = 'true'; } else{ diff --git a/application/modules/user/forms/GroupAdd.php b/application/modules/user/forms/GroupAdd.php index ff2b97a..b1ae0ee 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/GroupEdit.php b/application/modules/user/forms/GroupEdit.php index 4f0d7fc..43e568b 100644 --- a/application/modules/user/forms/GroupEdit.php +++ b/application/modules/user/forms/GroupEdit.php @@ -44,7 +44,7 @@ class user_Form_GroupEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } }
\ No newline at end of file diff --git a/application/modules/user/forms/GroupLink.php b/application/modules/user/forms/GroupLink.php index 9db7ce4..9bddb19 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/GroupRequest.php b/application/modules/user/forms/GroupRequest.php index c9ba273..a381207 100644 --- a/application/modules/user/forms/GroupRequest.php +++ b/application/modules/user/forms/GroupRequest.php @@ -40,7 +40,7 @@ class user_Form_GroupRequest extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php index 8fe2f46..54aacd6 100644 --- a/application/modules/user/forms/LinkRight.php +++ b/application/modules/user/forms/LinkRight.php @@ -32,7 +32,7 @@ class user_Form_LinkRight extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php index a6bd123..7175691 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="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php index 9a9570c..5968b47 100644 --- a/application/modules/user/forms/RoleAdd.php +++ b/application/modules/user/forms/RoleAdd.php @@ -62,7 +62,7 @@ class user_Form_RoleAdd extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/forms/RoleEdit.php b/application/modules/user/forms/RoleEdit.php index 0bdc977..938ebce 100644 --- a/application/modules/user/forms/RoleEdit.php +++ b/application/modules/user/forms/RoleEdit.php @@ -58,7 +58,7 @@ class user_Form_RoleEdit extends Zend_Form 'required' => false, 'ignore' => true, 'label' => 'Cancel', - 'onclick' => 'location.href="' . $_SERVER['HTTP_REFERER'] . '"', + 'onclick' => 'location.href="javascript:history.back();"', )); } diff --git a/application/modules/user/views/scripts/bootiso/index.phtml b/application/modules/user/views/scripts/bootiso/index.phtml index f43949d..23f7780 100644 --- a/application/modules/user/views/scripts/bootiso/index.phtml +++ b/application/modules/user/views/scripts/bootiso/index.phtml @@ -1,19 +1,20 @@ <h1>BootMedien</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createbootiso', 'Create BootISO', array( 'onclick' => 'self.location="/user/bootiso/createbootiso/page/'.$this->page.'"', 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>MembershipID</th> - <th>PrebootID</th> - <th>Serialnumber</th> - <th>Created</th> - <th>Expires</th> - <th>Public</th> + <th>ID <span class='code'>bootosID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>MembershipID <span class='code'>membershipID</span></th> + <th>PrebootID <span class='code'>prebootID</span></th> + <th>Serialnumber <span class='code'>serialnumber</span></th> + <th>Created <span class='code'>created</span></th> + <th>Expires <span class='code'>expires</span></th> + <th>Public <span class='code'>public</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->bootisolist)==0) diff --git a/application/modules/user/views/scripts/bootmenu/index.phtml b/application/modules/user/views/scripts/bootmenu/index.phtml index a43a058..b580237 100644 --- a/application/modules/user/views/scripts/bootmenu/index.phtml +++ b/application/modules/user/views/scripts/bootmenu/index.phtml @@ -1,14 +1,15 @@ <h1>BootMenu</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createbootmenu', 'Create BootMenu', array( 'onclick' => 'self.location="/user/bootmenu/createbootmenu/page/'.$this->page.'"', 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>Changed</th> + <th>ID <span class='code'>bootmenuID</span></th> + <th>Title <span class='code'>title</span></th> + <th>Changed <span class='code'>created</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->bootmenulist)==0) diff --git a/application/modules/user/views/scripts/bootos/index.phtml b/application/modules/user/views/scripts/bootos/index.phtml index 8982fb2..a678cef 100644 --- a/application/modules/user/views/scripts/bootos/index.phtml +++ b/application/modules/user/views/scripts/bootos/index.phtml @@ -1,5 +1,6 @@ <h1>BootOS</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('checkupdate', 'Check for Updates', array( 'onclick' => 'self.location="/user/bootos/index/page/'.$this->page.'/checkupdate/true"', 'class' => 'updatebutton', @@ -10,18 +11,18 @@ <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>MembershipID</th> - <th>ConfigID</th> - <th>Init</th> - <th>Kernel</th> - <th>Kcl</th> - <th>Description</th> - <th>Changed</th> - <th>Expires</th> - <th>Public</th> + <th>ID <span class='code'>bootosID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>MembershipID <span class='code'>membershipID</span></th> + <th>ConfigID <span class='code'>configID</span></th> + <th>Init <span class='code'>init</span></th> + <th>Kernel <span class='code'>kernel</span></th> + <th>Kcl <span class='code'>kcl</span></th> + <th>Description <span class='code'>description</span></th> + <th>Changed <span class='code'>Changed</span></th> + <th>Expires <span class='code'>expires</span></th> + <th>Public <span class='code'>public</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->bootoslist)==0) diff --git a/application/modules/user/views/scripts/client/index.phtml b/application/modules/user/views/scripts/client/index.phtml index 051ea90..95bf7a2 100644 --- a/application/modules/user/views/scripts/client/index.phtml +++ b/application/modules/user/views/scripts/client/index.phtml @@ -8,8 +8,8 @@ <?php if ($this->clients): ?> <table> <tr> - <th>MAC<span class='code'> [macadress]</span></th> - <th>Hardwarehash<span class='code'> [hardwarehash]</span></th> + <th>MAC <span class='code'>macadress</span></th> + <th>Hardwarehash <span class='code'>hardwarehash</span></th> <th colspan=2>Actions</th> </tr> <?php foreach ($this->clients as $client): ?> diff --git a/application/modules/user/views/scripts/config/index.phtml b/application/modules/user/views/scripts/config/index.phtml index 478a12d..91177f4 100644 --- a/application/modules/user/views/scripts/config/index.phtml +++ b/application/modules/user/views/scripts/config/index.phtml @@ -1,16 +1,17 @@ <h1>Config</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Config', array( 'onclick' => 'self.location="/user/config/createconfig/page/'.$this->page.'"', 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>Shellscript</th> - <th>Changed</th> + <th>ID <span class='code'>configID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>Shellscript <span class='code'>shellscript</span></th> + <th>Changed <span class='code'>created</span></th> <th colspan=2>Actions</th> </tr> <?php if(count($this->configlist)==0) diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml index 9800d42..7f8bad8 100644 --- a/application/modules/user/views/scripts/filter/index.phtml +++ b/application/modules/user/views/scripts/filter/index.phtml @@ -1,5 +1,6 @@ <h1>Filters</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Filter', array( 'onclick' => 'self.location="/user/filter/addfilter/page/'.$this->page.'"', 'class' => 'addbutton'))?> @@ -7,11 +8,11 @@ <?php if ($this->filters): ?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>Description</th> - <th>Priority</th> - <th>TargetBootMenu</th> + <th>ID <span class='code'>filterID</span></th> + <th>Title <span class='code'>title</span></th> + <th>Description <span class='code'>description</span></th> + <th>Priority <span class='code'>priority</span></th> + <th>TargetBootMenu <span class='code'>bootmenuID</span></th> <th colspan=3>Actions</th> </tr> <?php foreach ($this->filters as $filter): ?> diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml index d343204..9777b21 100644 --- a/application/modules/user/views/scripts/group/show.phtml +++ b/application/modules/user/views/scripts/group/show.phtml @@ -139,6 +139,3 @@ function printRoleSelect($roleList) { ?> <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 index e26e91e..e58e762 100644 --- a/application/modules/user/views/scripts/group/showall.phtml +++ b/application/modules/user/views/scripts/group/showall.phtml @@ -1,4 +1,4 @@ -<h1>Groups</h1> +<h1>Groups Overview</h1> <?php echo $this->formButton('addgroup', 'Add Group', array( 'onclick' => 'self.location="/user/group/add"', 'class' => 'addbutton')) @@ -77,3 +77,5 @@ 'onclick' => 'self.location="/user/group/link"', 'class' => 'addbutton')) ?> +<br /> +<br /> diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml index cdf5c6b..715bd95 100644 --- a/application/modules/user/views/scripts/person/index.phtml +++ b/application/modules/user/views/scripts/person/index.phtml @@ -1,5 +1,5 @@ <h1>Person</h1> -<?php echo $this->formButton('editperson', 'Edit', array( +<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array( 'onclick' => 'self.location="/user/person/edit/"', 'class' => 'rightbutton'))?> <br /> @@ -15,18 +15,23 @@ <div class="personColorDiv"><span class="bold">Last Login Date:</span> <?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?></div> <div class="personDiv"><span class="bold">Register Date:</span> <?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?></div> <?php +if($this->overviewRight === true) echo $this->formButton('showallperson', 'Show Personlist', array( + 'onclick' => 'self.location="/user/person/showall/"', + 'class' => 'rightbutton')); if(isset($this->groups)) { ?> <br /> <h2>Member in the following Groups:</h2> - <?php echo $this->formButton('changeGroup', 'Select other Membership', array( - 'onclick' => 'self.location="/user/person/changemembership"', - 'class' => 'rightbutton'))?> <table> <tr> <th>Title</th> <th>Description</th> + <?php if($this->leaveRight === true) { + ?> <th>Leave</th> + <?php + } + ?> </tr> <?php foreach($this->groups as $group) { @@ -35,6 +40,8 @@ if(isset($this->groups)) { <?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> + <?php if($this->leaveRight === true) { + ?> <td class='action'><a href="<?php echo $this->url( array( @@ -46,12 +53,15 @@ if(isset($this->groups)) { 'default', true) ?>"> <img src='/media/img/delete.png' alt='Delete Group' /></a> </td> + <?php + } + ?> </tr> <?php } ?> </table> - <?php echo $this->formButton('addtogroup', 'Add to additional + <?php if($this->groupRequestRight === true) echo $this->formButton('addtogroup', 'Add to additional Groups', array( 'onclick' => 'self.location="/user/person/request/"', 'class' => 'addbutton')); @@ -59,6 +69,3 @@ Groups', array( ?> <br /> <br /> -<br /> -<br /> -<br /> diff --git a/application/modules/user/views/scripts/person/show.phtml b/application/modules/user/views/scripts/person/show.phtml new file mode 100644 index 0000000..a380b3c --- /dev/null +++ b/application/modules/user/views/scripts/person/show.phtml @@ -0,0 +1,48 @@ +<h1>Person</h1> +<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array( + 'onclick' => 'self.location="/user/person/edit/personID/' . $this->personID . '"', + 'class' => 'rightbutton')) ?> +<?php if($this->deleteRight === true) echo $this->formButton('deleteperson', 'Delete', array( + 'onclick' => 'self.location="/user/auth/delete/personID/' . $this->personID . '"', + 'class' => 'rightbutton')) ?> +<br /> +<br /> +<div class="personColorDiv"><span class="bold">Title:</span> <?php echo $this->person->getTitle(); ?></div> +<div class="personDiv"><span class="bold">Name:</span> <?php echo $this->person->getName(); ?></div> +<div class="personColorDiv"><span class="bold">Firstname:</span> <?php echo $this->person->getFirstname(); ?></div> +<div class="personDiv"><span class="bold">Street:</span> <?php echo $this->person->getStreet(); ?></div> +<div class="personColorDiv"><span class="bold">Housenumber:</span> <?php echo $this->person->getHousenumber(); ?></div> +<div class="personDiv"><span class="bold">City:</span> <?php echo $this->person->getCity(); ?></div> +<div class="personColorDiv"><span class="bold">Postalcode:</span> <?php echo $this->person->getPostalcode(); ?></div> +<div class="personDiv"><span class="bold">Email:</span> <?php echo $this->person->getEmail(); ?></div> +<div class="personColorDiv"><span class="bold">Last Login Date:</span> <?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?></div> +<div class="personDiv"><span class="bold">Register Date:</span> <?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?></div> +<?php +if($this->overviewRight === true) echo $this->formButton('showallperson', 'Show Personlist', array( + 'onclick' => 'self.location="/user/person/showall/"', + 'class' => 'rightbutton')); +if(isset($this->groups)) { + ?> +<br /> +<h2>Member in the following Groups:</h2> +<table> + <tr> + <th>Title</th> + <th>Description</th> + </tr> + <?php + foreach($this->groups as $group) { + ?> + <tr class="entry"> + <td><?php echo $group['title']; ?></td> + <td><?php echo $group['description']; ?></td> + </tr> + <?php + } + ?> +</table> + <?php +} +?> +<br /> +<br /> diff --git a/application/modules/user/views/scripts/person/showall.phtml b/application/modules/user/views/scripts/person/showall.phtml new file mode 100644 index 0000000..68e9e7c --- /dev/null +++ b/application/modules/user/views/scripts/person/showall.phtml @@ -0,0 +1,117 @@ +<h1>Persons Overview</h1> +<br /> +<br /> +<table> + <tr> + <th>Title</th> + <th>Name</th> + <th>Firstname</th> + <th>Email</th> + <?php + if($this->showRight === true || $this->editRight === true || $this->deleteRight === true) { + ?> + <th colspan=3>Actions</th> + <?php + } + ?> + </tr> + <?php + if(count($this->personList) > 0) { + foreach($this->personList as $person) { + ?> + <tr + <?php if($person->getID() == $this->userIDsNamespace['personID']) echo 'class="selectedEntry"'; else echo 'class="entry"'; ?>> + <td><?php echo $person->getTitle(); ?></td> + <td><?php echo $person->getName(); ?></td> + <td><?php echo $person->getFirstname(); ?></td> + <td><?php echo $person->getEmail(); ?></td> + <?php + if($person->getID() == $this->userIDsNamespace['personID']) { + if($this->showRight === true) { + ?> + <td class='action'><a + href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'person', + 'action' => 'index' + ), + 'default', + true);?>"> <img src='/media/img/show.png' alt='Show Person' /></a></td> + <?php + } + if($this->editRight === true) { ?> + <td class='action'><a + href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'person', + 'action' => 'edit' + ), + 'default', + true);?>"> <img src='/media/img/edit.png' alt='Edit Person' /></a></td> + <?php + } + if($this->deleteRight === true) { ?> + <td class='action'><a + href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'auth', + 'action' => 'delete' + ), + 'default', + true);?>"> <img src='/media/img/delete.png' alt='Delete Account' /></a></td> + <?php + } + } else { + if($this->showOtherRight === true) { + ?> + <td class='action'><a + href=" <?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'person', + 'action' => 'show', + 'personID' => $person->getID() + ), + 'default', + true); ?>"> <img src='/media/img/show.png' alt='Show Person' /></a></td> + <?php + } + if($this->editOtherRight === true) { + ?> + <td class='action'><a + href=" <?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'person', + 'action' => 'edit', + 'personID' => $person->getID() + ), + 'default', + true); ?>"> <img src='/media/img/edit.png' alt='Edit Person' /></a></td> + <?php + } + if($this->deleteOtherRight === true) { + ?> + <td class='action'><a + href=" <?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'auth', + 'action' => 'delete', + 'personID' => $person->getID() + ), + 'default', + true); ?>"> <img src='/media/img/delete.png' alt='Delete Account' /></a></td> + <?php + } + } + ?> + </tr> + <?php + } + } + ?> +</table> diff --git a/application/modules/user/views/scripts/pool/index.phtml b/application/modules/user/views/scripts/pool/index.phtml index 80053f2..f7d04e2 100644 --- a/application/modules/user/views/scripts/pool/index.phtml +++ b/application/modules/user/views/scripts/pool/index.phtml @@ -1,5 +1,6 @@ <h1>Pools</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('createconfig', 'Create Pool', array( 'onclick' => 'self.location="/user/pool/createpool/page/'.$this->page.'"', 'class' => 'addbutton'))?> @@ -7,10 +8,10 @@ <?php if ($this->pools): ?> <table > <tr> - <!--<th>ID</th>--> - <th>Title</th> - <th>Description</th> - <th>Location</th> + <!--<th>ID <span class='code'>poolID</span></th>--> + <th>Title <span class='code'>title</span></th> + <th>Description <span class='code'>description</span></th> + <th>Location <span class='code'>location</span></th> <th colspan=3>Actions</th> </tr> <?php foreach ($this->pools as $pool): ?> diff --git a/application/modules/user/views/scripts/preboot/index.phtml b/application/modules/user/views/scripts/preboot/index.phtml index 9e73de1..295f1ca 100644 --- a/application/modules/user/views/scripts/preboot/index.phtml +++ b/application/modules/user/views/scripts/preboot/index.phtml @@ -1,5 +1,6 @@ <h1>Preboot</h1> <?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->searchform; ?> <?php echo $this->formButton('checkupdate', 'Check for Updates', array( 'onclick' => 'self.location="/user/preboot/index/checkupdate/true"', 'class' => 'updatebutton', @@ -9,11 +10,11 @@ 'class' => 'addbutton'))?> <table> <tr> - <th>ID</th> - <th>Title</th> - <th>GroupID</th> - <th>MembershipID</th> - <th>Preboot Path</th> + <th>ID <span class='code'>prebootID</span></th> + <th>Title <span class='code'>title</span></th> + <th>GroupID <span class='code'>groupID</span></th> + <th>MembershipID <span class='code'>membershipID</span></th> + <th>Preboot Path <span class='code'>path_preboot</span></th> <th colspan=3>Actions</th> </tr> <?php if(count($this->prebootlist)==0) diff --git a/application/modules/user/views/scripts/role/index.phtml b/application/modules/user/views/scripts/role/index.phtml index db20aa2..a0b4284 100644 --- a/application/modules/user/views/scripts/role/index.phtml +++ b/application/modules/user/views/scripts/role/index.phtml @@ -56,4 +56,6 @@ if($this->userIDsNamespace['groupID']) { </table> <?php } -?>
\ No newline at end of file +?> +<br /> +<br /> diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml index 6c6f8f5..6769336 100644 --- a/application/modules/user/views/scripts/role/show.phtml +++ b/application/modules/user/views/scripts/role/show.phtml @@ -88,4 +88,7 @@ if($this->roleID) { </center> <?php } -}
\ No newline at end of file +} +?> +<br /> +<br /> diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index c06f519..971bdab 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -5,14 +5,15 @@ class Pbs_Search{ private $searchTerm = ''; private $searcha; private $searchb; + private $module; public function searchForm(){ - $str = "<form style='text-align:right;' action='/user/client/search'> - <input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.$this->searchTerm.'"':'')."> + $str = "<form style='float:left;' action='/user/".$this->module."/search'> + <input type='text' id='search' name='search' ".(($this->searchTerm != '')?'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"':'')."> <button type='submit' class='searchbutton' value='search'> Search</button>"; $highlight = array(); if($this->searchTerm != ''){ - $str .= "<a href='/user/client/'><img src='/media/img/delete.png' alt='Delete Client'/></a> + $str .= "<a href='/user/".$this->module."/'><img src='/media/img/delete.png' alt='Delete Client'/></a> <script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>"; foreach($this->getSearchTerms() as $term){ $highlight[] = "$('table').highlight('".$term."');"; @@ -23,81 +24,91 @@ class Pbs_Search{ $(document).ready(function(){"; $str .= implode("\n",$highlight); $str .= "$('#search') - .focus(function() { - $('table tr .code').show(); - }).focusout(function() { - $('table tr .code').css('verticalAlign','-2px').animate({ - opacity: 0, - width:0 - }, 1000, function() { - $(this).attr({'style': 'display:none'}); - }); - - });"; + .focus(function() { + $('table th .code').show(); + }).focusout(function() { + $('table th .code').hide(); + }); + $('table th').click(function(){ + $('#search').val($('#search').val()+' '+$(this).find('.code').text()+':'); + });"; $str .= "}); </script>"; $str .= "</form>"; return $str; } - + public function setModule($m){ + $this->module = $m; + } public function setSearchTerm($search){ - $this->searchTerm = $search; + $this->searchTerm = trim($search); - $parts = explode(" ",$search); - foreach($parts as $search){ - if(stristr($search,":") && ctype_alpha(substr($search,0,strpos($search,":")))){ + // search for "text" + preg_match_all("!\"(.*?)\"!is",$this->searchTerm,$matches); + $tmpsearch = $this->searchTerm; + for($i=0;$i<=count($matches[0]);$i++){ + $replace = str_replace(" ","<|>",$matches[0][$i]); + $tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch); + } + $parts = explode(" ",$tmpsearch); + foreach($parts as $search){ + if(stristr($search,":") && preg_match('/^[a-z_A-Z]+$/',$search) >= 0){ $key = substr($search,0,strpos($search,":")); - $value = substr($search,strpos($search,":")+1); + $value = substr($search,strpos($search,":")+1); + if(stristr($value,'"')){ + $value = substr(str_replace('<|>',' ',$value),1,-1); + } $searcha[$key] = $value; } else{ + if(stristr($search,'"')){ + $search = substr(str_replace('<|>',' ',$search),1,-1); + } $searchb[] = $search; } } $this->searcha = $searcha; $this->searchb = $searchb; } - + public function getSearchTerm(){ + return $this->searchTerm; + } public function getSearchTerms(){ $beta = $this->searcha; foreach($this->searchb as $b) $beta[] = $b; - return $beta; + return $beta; } public function search($array){ foreach($array as $counter => $cig){ + if(is_object($cig)){ + $cig = $cig->toArray(); + } foreach($cig as $k => $v){ if(count($this->searcha) > 0){ foreach($this->searcha as $sk => $sv){ if($k == $sk){ if(stristr($v,$sv)){ - $com1[] = $counter; + $com1[$counter] += 1; } } } } - if(count($searchb) >= 0){ - foreach($this->searchb as $sk => $sv){ + if(count($this->searchb) >= 0){ + foreach($this->searchb as $sk => $sv){ $comm = stristr($v,$sv); if($comm != false){ - $com2[] = $counter; - break; + $com2[$counter] += 1; } } } - } - } - if (count($this->searcha) == 0){ - $data = $com2; - } - if (count($this->searchb) == 0){ - $data = $com1; - } - if (count($this->searcha) > 0 && count($this->searchb) > 0){ - $data = array_intersect($com1,$com2); - } - $data = array_unique($data); + } + if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)){ + // add item in resultlist + $data[] = $counter; + } + } foreach( $data as $c) $ges[] = $array[$c]; return $ges; @@ -361,6 +361,8 @@ INSERT INTO `pbs_rightcategory` (`rightcategoryID`, `title`) VALUES -- Insert rights INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title`, `description`) VALUES -- Person + -- Personenübersicht anzeigen +(NULL, '1', 'pso', 'Show overview of persons', NULL), -- Eigene Personendetails ändern (NULL, '1', 'peod', 'Edit own profiledetails', NULL), -- Eigene Personendetails anzeigen @@ -379,7 +381,7 @@ INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title` -- Gruppen -- Gruppenübersicht anzeigen -(NULL, '2', 'gso', 'Show overview of group', NULL), +(NULL, '2', 'gso', 'Show overview of groups', NULL), -- Gruppendetails der eigenen Gruppe anzeigen (NULL, '2', 'gsdo', 'Show details of own group', NULL), -- Gruppendetails anderer Gruppen anzeigen @@ -395,9 +397,11 @@ INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title` -- Gruppenanfragen stellen (NULL, '2', 'grm', 'Request membership', NULL), -- Gruppenanfragen akzeptieren -(NULL, '2', 'gam', 'Accect membership request', NULL), +(NULL, '2', 'gam', 'Accept membership request', NULL), -- Gruppenanfragen ablehnen (NULL, '2', 'gdm', 'Decline membership request', NULL), + -- Gruppe verlassen +(NULL, '2', 'gl', 'Leave Group', NULL), -- Mitgliedschaften aus eigenen Gruppen entfernen (NULL, '2', 'gdmo', 'Delete membership in own group', NULL), -- Mitgliedschaften aus anderen Gruppen entfernen @@ -552,4 +556,4 @@ INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (1, 'OpenSLX', 'This is the OpenSLX-Group'); INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (1, '1', 'SuperAdmin', 'The SuperAdmin', 0); INSERT INTO `pbs`.`pbs_rightroles` (`roleID`, `rightID`) VALUES -(1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(1, 6),(1, 7),(1, 8),(1, 9),(1, 10),(1, 11),(1, 12),(1, 13),(1, 14),(1, 15),(1, 16),(1, 17),(1, 18),(1, 19),(1, 20),(1, 21),(1, 22),(1, 23),(1, 24),(1, 25),(1, 26),(1, 27),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(1, 33),(1, 34),(1, 35),(1, 36),(1, 37),(1, 38),(1, 39),(1, 40),(1, 41),(1, 42),(1, 43),(1, 44),(1, 45),(1, 46),(1, 47),(1, 48),(1, 49),(1, 50),(1, 51),(1, 52),(1, 53),(1, 54),(1, 55),(1, 56),(1, 57),(1, 58),(1, 59),(1, 60),(1, 61),(1, 62),(1, 63),(1, 64),(1, 65),(1, 66),(1, 67),(1, 68),(1, 69),(1, 70),(1, 71),(1, 72),(1, 73),(1, 74),(1, 75),(1, 76),(1, 77),(1, 78),(1, 79),(1, 80),(1, 81),(1, 82); +(1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(1, 6),(1, 7),(1, 8),(1, 9),(1, 10),(1, 11),(1, 12),(1, 13),(1, 14),(1, 15),(1, 16),(1, 17),(1, 18),(1, 19),(1, 20),(1, 21),(1, 22),(1, 23),(1, 24),(1, 25),(1, 26),(1, 27),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(1, 33),(1, 34),(1, 35),(1, 36),(1, 37),(1, 38),(1, 39),(1, 40),(1, 41),(1, 42),(1, 43),(1, 44),(1, 45),(1, 46),(1, 47),(1, 48),(1, 49),(1, 50),(1, 51),(1, 52),(1, 53),(1, 54),(1, 55),(1, 56),(1, 57),(1, 58),(1, 59),(1, 60),(1, 61),(1, 62),(1, 63),(1, 64),(1, 65),(1, 66),(1, 67),(1, 68),(1, 69),(1, 70),(1, 71),(1, 72),(1, 73),(1, 74),(1, 75),(1, 76),(1, 77),(1, 78),(1, 79),(1, 80),(1, 81),(1, 82),(1, 83),(1, 84); diff --git a/public/media/css/style.css b/public/media/css/style.css index 4cd29e9..2057c54 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -297,8 +297,8 @@ th { border: 1px solid #999; } th .code{ - font-size: 11px; - font-family:"Courier New",Verdana; + font-size: 9px; + color:#666; display:none; } |