From e30767a8f83df955fec83d2a2e459a5a8f18193f Mon Sep 17 00:00:00 2001
From: Björn Geiger
Date: Fri, 8 Apr 2011 10:25:29 +0200
Subject: Eigener Menüpunkt für Person- und Grouplist
---
application/modules/user/controllers/PersonController.php | 2 --
1 file changed, 2 deletions(-)
(limited to 'application/modules/user/controllers')
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index c1e76d3..ff5517c 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -63,7 +63,6 @@ class user_PersonController extends Zend_Controller_Action
$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');
}
@@ -340,7 +339,6 @@ class user_PersonController extends Zend_Controller_Action
$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');
--
cgit v1.2.3-55-g7522
From fb9e5f028899f8205541fe86d7eb9c5e12c4a5ad Mon Sep 17 00:00:00 2001
From: Björn Geiger
Date: Fri, 8 Apr 2011 13:20:06 +0200
Subject: Auch beim hinzufügen von weiteren Rechten nun Checkboxliste
---
application/models/RightRolesMapper.php | 2 +-
.../modules/user/controllers/RoleController.php | 28 +++--
application/modules/user/forms/LinkRight.php | 45 +++++--
application/modules/user/forms/RoleAdd.php | 16 +++
application/modules/user/layouts/user.phtml | 101 +++++++--------
.../modules/user/views/scripts/role/show.phtml | 2 +-
public/media/css/style.css | 4 +
public/media/css/user.css | 138 ++++++++++++---------
public/media/js/user.js | 88 +++++++++++++
9 files changed, 287 insertions(+), 137 deletions(-)
(limited to 'application/modules/user/controllers')
diff --git a/application/models/RightRolesMapper.php b/application/models/RightRolesMapper.php
index 32ed666..4ab37f2 100644
--- a/application/models/RightRolesMapper.php
+++ b/application/models/RightRolesMapper.php
@@ -86,7 +86,7 @@ class Application_Model_RightRolesMapper
if (null === ($roleID = $rightroles->getRoleID()) || null === ($rightID = $rightroles->getRightID())) {
return;
} else {
- $this->getDbTable()->delete(array('roleID = ?' => $roleID, 'rightID = ?' => $roleID));
+ $this->getDbTable()->delete(array('roleID = ?' => $roleID, 'rightID = ?' => $rightID));
}
}
diff --git a/application/modules/user/controllers/RoleController.php b/application/modules/user/controllers/RoleController.php
index 4e0aa52..88e2eeb 100644
--- a/application/modules/user/controllers/RoleController.php
+++ b/application/modules/user/controllers/RoleController.php
@@ -303,20 +303,24 @@ class User_RoleController extends Zend_Controller_Action
}
if(count($rightlist) > 0) {
if (!isset($_POST["link"])){
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID));
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist));
} else {
- $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, 'roleID' => $roleID), $_POST);
+ $linkForm = new user_Form_LinkRight(array('rightlist' => $rightlist, $_POST));
if ($linkForm->isValid($_POST)) {
- $rightroles = new Application_Model_RightRoles();
- $rightroles->setRightID($_POST['rightID']);
- $rightroles->setRoleID($roleID);
- try {
- $this->rightRolesMapper->save($rightroles);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "
";
- echo "Message: " . $e->getMessage() . "
";
- return;
+ foreach($_POST['rights'] as $rightID => $bool) {
+ if($bool == 1) {
+ $rightroles = new Application_Model_RightRoles();
+ $rightroles->setRightID($rightID);
+ $rightroles->setRoleID($roleID);
+ try {
+ $this->rightRolesMapper->save($rightroles);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "
";
+ echo "Message: " . $e->getMessage() . "
";
+ return;
+ }
+ }
}
$this->_redirect('/user/role/show/roleID/' . $roleID);
return;
diff --git a/application/modules/user/forms/LinkRight.php b/application/modules/user/forms/LinkRight.php
index 54aacd6..80cfb1d 100644
--- a/application/modules/user/forms/LinkRight.php
+++ b/application/modules/user/forms/LinkRight.php
@@ -3,29 +3,54 @@
class user_Form_LinkRight extends Zend_Form
{
private $rightlist;
- private $roleID;
public function setRightlist($rightlist){
$this->rightlist = $rightlist;
}
- public function setRoleID($roleID){
- $this->roleID = $roleID;
- }
-
public function init()
{
- $this->setName("LinkRight");
+ $this->setName("LinkRights");
$this->setMethod('post');
- $rightfield = $this->createElement('select','rightID',array('label'=> 'Right: ','required' => true,'multioptions'=> $this->rightlist));
- $rightfield->setRegisterInArrayValidator(false);
- $this->addElement($rightfield);
+ $sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
+
+ $sform->addElement('button', 'checkAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Check All',
+ 'class' => 'leftbutton',
+ 'onclick' => "checkAllCheckBoxes();",
+ ));
+
+ $sform->addElement('button', 'uncheckAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Uncheck All',
+ 'onclick' => "uncheckAllCheckBoxes();",
+ ));
+
+ if(count($this->rightlist) > 0) {
+ foreach($this->rightlist as $rightcategory => $rights) {
+ foreach($rights as $rightID => $rightTitle) {
+ $element = $this->createElement('checkbox', "$rightID", array(
+ 'label' => $rightTitle . ':',
+ 'belongsTo' => 'rights',
+ ));
+ $elements[] = $rightID;
+ $sform->addElement($element);
+ }
+ $sform->addDisplayGroup($elements, "$rightcategory", array("legend" => $rightcategory . ":"));
+ unset($elements);
+ }
+ }
+
+ $this->addSubForm($sform, 'rights');
$this->addElement('submit', 'link', array(
'required' => false,
'ignore' => true,
- 'label' => 'Add',
+ 'label' => 'Add Rights',
));
$this->addElement('button', 'cancel', array(
diff --git a/application/modules/user/forms/RoleAdd.php b/application/modules/user/forms/RoleAdd.php
index 5968b47..d165701 100644
--- a/application/modules/user/forms/RoleAdd.php
+++ b/application/modules/user/forms/RoleAdd.php
@@ -32,6 +32,21 @@ class user_Form_RoleAdd extends Zend_Form
));
$sform = new Zend_Form_SubForm(array('legend' => 'Rights:'));
+
+ $sform->addElement('button', 'checkAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Check All',
+ 'class' => 'leftbutton',
+ 'onclick' => "checkAllCheckBoxes(new Array('inheritance'));",
+ ));
+
+ $sform->addElement('button', 'uncheckAll', array(
+ 'required' => false,
+ 'ignore' => true,
+ 'label' => 'Uncheck All',
+ 'onclick' => "uncheckAllCheckBoxes(new Array('inheritance'));",
+ ));
if(count($this->rightlist) > 0) {
foreach($this->rightlist as $rightcategory => $rights) {
foreach($rights as $rightID => $rightTitle) {
@@ -46,6 +61,7 @@ class user_Form_RoleAdd extends Zend_Form
unset($elements);
}
}
+
$this->addSubForm($sform, 'rights');
$this->addElement('checkbox', 'inheritance', array(
diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml
index edbe209..b27b747 100644
--- a/application/modules/user/layouts/user.phtml
+++ b/application/modules/user/layouts/user.phtml
@@ -29,60 +29,52 @@ echo $this->headScript()."\n";
user
- hasIdentity() && count(Zend_Session::namespaceGet('userIDs')) > 0) {
- # This should be splitted
- if(Pbs_Acl::checkRight('psod'))
- echo "- Own Details
";
- if(Pbs_Acl::checkRight('pso'))
- echo "- Personlist
";
- if(Pbs_Acl::checkRight('gsdo'))
- echo "- Own Group
";
- if(Pbs_Acl::checkRight('gso'))
- echo "- Grouplist
";
- if(Pbs_Acl::checkRight('ro'))
- echo "- Role
";
- if(Pbs_Acl::checkRight('bai') || Pbs_Acl::checkRight('bui'))
- echo "- BootIso
";
- if(Pbs_Acl::checkRight('pro'))
- echo "- PreBoot
";
- if(Pbs_Acl::checkRight('booai') || Pbs_Acl::checkRight('booui'))
- echo "- BootMenu
";
- if(Pbs_Acl::checkRight('csai') || Pbs_Acl::checkRight('csui'))
- echo "- Config
";
- if(Pbs_Acl::checkRight('boai') || Pbs_Acl::checkRight('boui'))
- echo "- BootOs
";
- if(Pbs_Acl::checkRight('clo'))
- echo "- Client
";
- if(Pbs_Acl::checkRight('fo'))
- echo "- Filter
";
- if(Pbs_Acl::checkRight('poo'))
- echo "- Pool
";
- if(Pbs_Acl::checkRight('so'))
- echo "- Session
";
- }
- ?>
- hasIdentity()) {?>
- - Login
- - Register
- hasIdentity() && count(Zend_Session::namespaceGet('userIDs')) > 0) {
+ # This should be splitted
+ if(Pbs_Acl::checkRight('psod'))
+ echo "- Own Details
";
+ if(Pbs_Acl::checkRight('pso'))
+ echo "- Personlist
";
+ if(Pbs_Acl::checkRight('gsdo'))
+ echo "- Own Group
";
+ if(Pbs_Acl::checkRight('gso'))
+ echo "- Grouplist
";
+ if(Pbs_Acl::checkRight('ro'))
+ echo "- Rolelist
";
+ if(Pbs_Acl::checkRight('bai') || Pbs_Acl::checkRight('bui'))
+ echo "- BootIso
";
+ if(Pbs_Acl::checkRight('pro'))
+ echo "- PreBoot
";
+ if(Pbs_Acl::checkRight('booai') || Pbs_Acl::checkRight('booui'))
+ echo "- BootMenu
";
+ if(Pbs_Acl::checkRight('csai') || Pbs_Acl::checkRight('csui'))
+ echo "- Config
";
+ if(Pbs_Acl::checkRight('boai') || Pbs_Acl::checkRight('boui'))
+ echo "- BootOs
";
+ if(Pbs_Acl::checkRight('clo'))
+ echo "- Client
";
+ if(Pbs_Acl::checkRight('fo'))
+ echo "- Filter
";
+ if(Pbs_Acl::checkRight('poo'))
+ echo "- Pool
";
+ if(Pbs_Acl::checkRight('so'))
+ echo "- Session
";
+ }
+ ?>
+ hasIdentity()) {
+ echo "- Login
";
+ echo "- Register
";
+ } else {
if(count(Zend_Session::namespaceGet('userIDs')) > 0) {
- ?>
- - Change
- Membership
- Change Membership
";
} else {
- ?>
- Select
- Membership
- Select Membership";
}
- ?>
- Delete Account
- Logout
-
+ if(Pbs_Acl::checkRight('pdo'))
+ echo "Delete Account";
+ echo "Logout";
+ }
+ ?>
@@ -97,11 +89,11 @@ echo $this->headScript()."\n";
-
hasIdentity()){
echo 'Angemeldet als ';
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
+
if(isset($userIDsNamespace['membershipID'])){
$membershipMapper = new Application_Model_MembershipMapper();
$membership = new Application_Model_Membership();
@@ -122,8 +114,7 @@ if(Zend_Auth::getInstance()->hasIdentity()){
echo "".$role->getTitle()."";
}
}
-?>
-
+?>
getControllerName()) . " > " . ucwords($request->getActionName());
?>
diff --git a/application/modules/user/views/scripts/role/show.phtml b/application/modules/user/views/scripts/role/show.phtml
index 6769336..8194353 100644
--- a/application/modules/user/views/scripts/role/show.phtml
+++ b/application/modules/user/views/scripts/role/show.phtml
@@ -33,7 +33,7 @@ if($this->roleID) {
Rights:
rightsAvailable === true) {
- echo $this->formButton('linkright', 'Add Right', array(
+ echo $this->formButton('linkright', 'Add Rights', array(
'onclick' => 'self.location="/user/role/linkright/roleID/' . $this->role->getID() .'"',
'class' => 'addbutton'))?>
diff --git a/public/media/css/style.css b/public/media/css/style.css
index 5b6497b..54e929f 100644
--- a/public/media/css/style.css
+++ b/public/media/css/style.css
@@ -335,6 +335,10 @@ div.dsf{
float: right;
}
+.leftbutton {
+ float: left;
+}
+
.personDiv {
border: 1px solid #CCC;
margin-bottom: 10px;
diff --git a/public/media/css/user.css b/public/media/css/user.css
index 416f10f..204d20b 100644
--- a/public/media/css/user.css
+++ b/public/media/css/user.css
@@ -67,90 +67,112 @@ tr.selectedEntry td {
/* */
.listelement {
- clear:both;
- padding-top:10px;
- margin:10px 0px;
+ clear: both;
+ padding-top: 10px;
+ margin: 10px 0px;
}
+
.listelement .element {
- border:1px solid black;
- margin:5px 0px;
- padding:5px;
+ border: 1px solid black;
+ margin: 5px 0px;
+ padding: 5px;
-moz-border-radius: 3px;
border-radius: 3px;
- background-color:white;
+ background-color: white;
}
+
.listelement .element:nth-child(even) {
- background-color:#F0F8FF;
+ background-color: #F0F8FF;
}
-.listelement .element:hover {
- background-color:#97BDE7;
- border-color:#214687;
+
+.listelement .element:hover {
+ background-color: #97BDE7;
+ border-color: #214687;
}
-.listelement .element .number{
- font-size:28px;
- float:left;
- padding:0px 5px 0px 0px;
- width:40px;
- text-align:center;
- color:#CCC;
- font-style:italic;
- font-weight:bold;
+
+.listelement .element .number {
+ font-size: 28px;
+ float: left;
+ padding: 0px 5px 0px 0px;
+ width: 40px;
+ text-align: center;
+ color: #CCC;
+ font-style: italic;
+ font-weight: bold;
}
-.listelement .element .content{
- margin-left:50px;
+
+.listelement .element .content {
+ margin-left: 50px;
}
-.listelement .element .content .title{
- font-weight:bold;
- font-size:1.2em;
+
+.listelement .element .content .title {
+ font-weight: bold;
+ font-size: 1.2em;
}
-.listelement .element .content .subtitle{
- font-style:italic;
+
+.listelement .element .content .subtitle {
+ font-style: italic;
}
-.listelement .element .actions{
- float:right;
- padding-right:5px;
+
+.listelement .element .actions {
+ float: right;
+ padding-right: 5px;
}
-.listelement .element .actions a{
- line-height:14px;
- padding-right:4px;
+
+.listelement .element .actions a {
+ line-height: 14px;
+ padding-right: 4px;
}
+
.listelement .element .details {
- margin:0px 20px 0px 10px;
+ margin: 0px 20px 0px 10px;
}
+
.listelement .element .dispnone {
- display:none;
+ display: none;
}
-.listelement .element .details label{
- float:left;
- font-style:italic;
- font-weight:bold;
- width:110px;
+
+.listelement .element .details label {
+ float: left;
+ font-style: italic;
+ font-weight: bold;
+ width: 110px;
}
-.listelement .element .details div.item{
- display:block;
+
+.listelement .element .details div.item {
+ display: block;
}
+
.listelement .highlight {
- background-color:#FFF5CC !important;
+ background-color: #FFF5CC !important;
}
+
.listelement .checked {
- background-image:url('/media/img/checked.png');
- background-repeat:no-repeat;
+ background-image: url('/media/img/checked.png');
+ background-repeat: no-repeat;
background-position: 15px center;
-}
-.searchvars{
- border:1px solid #000;
- background-color:#FFFFBB;
- display:none;
- padding:6px;
- clear:both;
+}
+
+.searchvars {
+ border: 1px solid #000;
+ background-color: #FFFFBB;
+ display: none;
+ padding: 6px;
+ clear: both;
-moz-border-radius: 3px;
border-radius: 3px;
}
-.searchvars div.head{
- font-weight:bold;
+
+.searchvars div.head {
+ font-weight: bold;
}
-.searchvars div.code{
- margin-left:10px;
- display:inline;
- color:#666;
+
+.searchvars div.code {
+ margin-left: 10px;
+ display: inline;
+ color: #666;
}
+
+#uncheckAll-label {
+ width: 5px;
+}
\ No newline at end of file
diff --git a/public/media/js/user.js b/public/media/js/user.js
index 488ab45..01c4721 100644
--- a/public/media/js/user.js
+++ b/public/media/js/user.js
@@ -17,3 +17,91 @@ $(document).ready(function(){
});
}
});
+
+function checkAllCheckBoxes(exceptions) {
+ var elements = document.getElementsByTagName('input');
+ if(!elements) {
+ return;
+ }
+ var countElements = elements.length;
+ var countExceptions;
+ if(exceptions) {
+ countExceptions = exceptions.length;
+ } else {
+ countExceptions = 0;
+ }
+ var foundException = false;
+ if(!countElements) {
+ if(elements.getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements.getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements.checked = true;
+ }
+ foundException = false;
+ }
+ } else {
+ for(var i = 0; i < countElements; i++) {
+ if(elements[i].getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements[i].getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements[i].checked = true;
+ }
+ foundException = false;
+ }
+ }
+ }
+}
+
+function uncheckAllCheckBoxes(exceptions) {
+ var elements = document.getElementsByTagName('input');
+ if(!elements) {
+ return;
+ }
+ var countElements = elements.length;
+ var countExceptions;
+ if(exceptions) {
+ countExceptions = exceptions.length;
+ } else {
+ countExceptions = 0;
+ }
+ var foundException = false;
+ if(!countElements) {
+ if(elements.getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements.getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements.checked = false;
+ }
+ foundException = false;
+ }
+ } else {
+ for(var i = 0; i < countElements; i++) {
+ if(elements[i].getAttribute('type') == 'checkbox') {
+ for(var j = 0; j < countExceptions; j++) {
+ if(elements[i].getAttribute('name') == exceptions[j]) {
+ foundException = true
+ break;
+ }
+ }
+ if(!foundException) {
+ elements[i].checked = false;
+ }
+ foundException = false;
+ }
+ }
+ }
+}
\ No newline at end of file
--
cgit v1.2.3-55-g7522
From 4a8cb9a0fedbd61c087b2ffc6e480693997746f8 Mon Sep 17 00:00:00 2001
From: Simon
Date: Fri, 8 Apr 2011 15:09:04 +0200
Subject: Notifies im Log verbessert
---
application/modules/user/controllers/BootmenuController.php | 3 +--
library/Pbs/Graph.php | 4 ++--
library/Pbs/Search.php | 8 ++++----
3 files changed, 7 insertions(+), 8 deletions(-)
(limited to 'application/modules/user/controllers')
diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php
index a79a770..adcf08f 100644
--- a/application/modules/user/controllers/BootmenuController.php
+++ b/application/modules/user/controllers/BootmenuController.php
@@ -106,9 +106,8 @@ class user_BootmenuController extends Zend_Controller_Action
$pagination->setElement($bootmenu);
$pagination->setRequestPage($this->_request->getParam('page'));
$pagination->setPageUrl('/user/bootmenu/index'.((isset($this->view->search))?'/search/'.$this->view->search:''));
- $bootmenu = $pagination->getElements();
+ $bootmenu = $pagination->getElements();
- $this->view->pagination = $pagination->pagination($pageurl);
$this->view->page = $pagination->getRequestPage();
$this->view->bootmenulist = $bootmenu;
diff --git a/library/Pbs/Graph.php b/library/Pbs/Graph.php
index 521275d..c924b59 100644
--- a/library/Pbs/Graph.php
+++ b/library/Pbs/Graph.php
@@ -62,7 +62,7 @@ class Pbs_Graph{
// Gets all childs-groups from a given group
private function getChildGroups($groupID, $level=1) {
- if($this->crawledNodes['child'][$groupID] == 1)
+ if(@$this->crawledNodes['child'][$groupID] == 1)
return;
$this->crawledNodes['child'][$groupID] = 1;
$db = Zend_Db_Table::getDefaultAdapter();
@@ -72,7 +72,7 @@ class Pbs_Graph{
foreach($result as $row){
// save the current groupID in level-list
#$data[$level][] = $row['groupID'];
- if($this->edges[$groupID][$row['groupID']] != 1){
+ if(@$this->edges[$groupID][$row['groupID']] != 1){
$this->graphstring .= '"'.$this->getGroupTitle($groupID).'" -> "'.$this->getGroupTitle($row['groupID']).'";'."\n";
$this->edges[$groupID][$row['groupID']] = 1;
}
diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php
index 127c4d3..9f25d03 100644
--- a/library/Pbs/Search.php
+++ b/library/Pbs/Search.php
@@ -74,8 +74,8 @@ class Pbs_Search{
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);
+ @$replace = str_replace(" ","<|>",$matches[0][$i]);
+ @$tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch);
}
$parts = explode(" ",$tmpsearch);
foreach($parts as $search){
@@ -94,8 +94,8 @@ class Pbs_Search{
$searchb[] = $search;
}
}
- $this->searcha = $searcha;
- $this->searchb = $searchb;
+ $this->searcha = @$searcha;
+ $this->searchb = @$searchb;
#print_a($searcha, $searchb);
}
public function getSearchTerm(){
--
cgit v1.2.3-55-g7522