X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=gosa-core%2Finclude%2Fclass_acl.inc;h=9302fbeb316651713be2a29278356909163f5a86;hb=2c35405295520149cdfb7a21cc9d7e73b4fb7442;hp=ebe5da1b437fda4168014132215d74b35036cd92;hpb=a7c1afe68709be7ee32fc863e3bf35d226e2691e;p=gosa.git diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index ebe5da1b4..9302fbeb3 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -54,7 +54,9 @@ class acl extends plugin var $myAclObjects = array(); var $acl_category = "acl/"; - var $list =NULL; + var $list =NULL; + + var $sectionList = NULL; function acl (&$config, $parent, $dn= NULL) { @@ -239,6 +241,17 @@ class acl extends plugin $this->is_account= TRUE; $this->updateList(); + + // Prepare lists + $this->sectionList = new sortableListing(); + $this->sectionList->setDeleteable(false); + $this->sectionList->setEditable(false); + $this->sectionList->setWidth("100%"); + $this->sectionList->setHeight("120px"); + $this->sectionList->setColspecs(array('200px','*')); + $this->sectionList->setHeader(array(_("Section"),_("Description"))); + $this->sectionList->setDefaultSortColumn(1); + $this->sectionList->setAcl('rwcdm'); // All ACLs, we filter on our own here. } @@ -298,14 +311,12 @@ class acl extends plugin // Get listing actions. Delete or Edit. $this->list->save_object(); $lAction = $this->list->getAction(); - if($lAction['action'] == "reorder" || $lAction['action'] == "delete"){ - $this->gosaAclEntry = $this->list->getMaintainedData(); - } + $this->gosaAclEntry = $this->list->getMaintainedData(); /* Act on HTML post and gets here. */ if($lAction['action'] == "edit"){ - $this->currentIndex = $lAction['targets'][0]; + $this->currentIndex = $this->list->getKey($lAction['targets'][0]); $this->dialogState= 'create'; $firstedit= TRUE; $this->dialog= TRUE; @@ -504,56 +515,61 @@ class acl extends plugin } if ($this->dialogState == 'create'){ - /* Draw list */ - $aclList= new divSelectBox("aclList"); - $aclList->SetHeight(150); - - // Create a map of all used sections, this allows us to simply hide the remove button - // if no acl is configured for the given section - // e.g. ';all;department/country;users/user; - $usedList = ";".implode(array_keys($this->aclContents),';').";"; - - /* Add settings for all categories to the (permanent) list */ - foreach ($this->aclObjects as $section => $dsc){ - $summary= ""; - foreach($this->ocMapping[$section] as $oc){ - if (isset($this->aclContents[$oc]) && count($this->aclContents[$oc]) && isset($this->aclContents[$oc][0]) && - $this->aclContents[$oc][0] != ""){ - - $summary.= "$oc, "; - continue; - } - if (isset($this->aclContents["$section/$oc"]) && count($this->aclContents["$section/$oc"])){ - $summary.= "$oc, "; - continue; - } - if (isset($this->aclContents[$oc]) && !isset($this->aclContents[$oc][0]) && count($this->aclContents[$oc])){ - $summary.= "$oc, "; - } - } - /* Set summary... */ - if ($summary == ""){ - $summary= ''._("No ACL settings for this category!").''; - } else { - $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary)); - } + // Create a map of all used sections, this allows us to simply hide the remove button + // if no acl is configured for the given section + // e.g. ';all;department/country;users/user; + $usedList = ";".implode(array_keys($this->aclContents),';').";"; + + /* Add settings for all categories to the (permanent) list */ + $data = $lData = array(); + foreach ($this->aclObjects as $section => $dsc){ + $summary= ""; + foreach($this->ocMapping[$section] as $oc){ + if (isset($this->aclContents[$oc]) && + count($this->aclContents[$oc]) && + isset($this->aclContents[$oc][0]) && + $this->aclContents[$oc][0] != ""){ + + $summary.= "$oc, "; + continue; + } + if (isset($this->aclContents["$section/$oc"]) && + count($this->aclContents["$section/$oc"])){ + $summary.= "$oc, "; + continue; + } + if (isset($this->aclContents[$oc]) && + !isset($this->aclContents[$oc][0]) && + count($this->aclContents[$oc])){ + $summary.= "$oc, "; + } + } - $actions =""; - if($this->acl_is_readable("")){ - $actions.= image('images/lists/edit.png','cat_edit_'.$section, msgPool::editButton(_("category ACL"))); - } - if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){ - $actions.= image('images/lists/trash.png','cat_del_'.$section, msgPool::delButton(_("category ACL"))); - } - - $field1= array("string" => $dsc, "attach" => "style='width:100px'"); - $field2= array("string" => $summary); - $field3= array("string" => $actions, "attach" => "style='border-right:0px;width:50px'"); - $aclList->AddEntry(array($field1, $field2, $field3)); - } + /* Set summary... */ + if ($summary == ""){ + $summary= ''._("No ACL settings for this category!").''; + } else { + $summary= trim($summary,", "); + $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary); + } - $smarty->assign("aclList", $aclList->DrawList()); + $actions =""; + if($this->acl_is_readable("")){ + $actions.= image('images/lists/edit.png','cat_edit_'.$section, + msgPool::editButton(_("category ACL"))); + } + if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){ + $actions.= image('images/lists/trash.png','cat_del_'.$section, + msgPool::delButton(_("category ACL"))); + } + $data[] = $section; + $lData[] = array('data'=>array($dsc, $summary, $actions)); + } + $this->sectionList->setListData($data,$lData); + $this->sectionList->update(); + $smarty->assign("aclList", $this->sectionList->render()); + $smarty->assign("aclType", $this->aclType); $smarty->assign("aclFilter", $this->aclFilter); $smarty->assign("aclTypes", $this->aclTypes);