X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_acl.inc;h=2d9e72501b28b2e872d42c82deb8037d9d12a181;hb=f1714ac56cc41319519c97c1ab7749d4d8a637c3;hp=7bd9ba33f1c03eaa62b01d4b580be28d836e9bb2;hpb=e8e3c0cd95f2bf59cd18112164bd20aeeca3bd69;p=gosa.git diff --git a/include/class_acl.inc b/include/class_acl.inc index 7bd9ba33f..2d9e72501 100644 --- a/include/class_acl.inc +++ b/include/class_acl.inc @@ -28,7 +28,7 @@ class acl extends plugin var $wasNewEntry= FALSE; var $ocMapping= array(); var $savedAclContents= array(); - + var $myAclObjects = array(); function acl ($config, $parent, $dn= NULL) { @@ -187,11 +187,13 @@ class acl extends plugin $new_acl= array(); $aclDialog= FALSE; + $firstedit= FALSE; foreach($_POST as $name => $post){ /* Actions... */ if (preg_match('/^acl_edit_.*_x/', $name)){ $this->dialogState= 'create'; + $firstedit= TRUE; $this->dialog= TRUE; $this->currentIndex= preg_replace('/^acl_edit_([0-9]+).*$/', '\1', $name); $this->loadAclEntry(); @@ -263,7 +265,7 @@ class acl extends plugin } /* Only be interested in new acl's, if we're in the right _POST place */ - if ($aclDialog && is_array($this->ocMapping[$this->aclObject])){ + if ($aclDialog && $this->aclObject != "" && is_array($this->ocMapping[$this->aclObject])){ foreach ($this->ocMapping[$this->aclObject] as $oc){ unset($this->aclContents[$oc]); @@ -278,7 +280,7 @@ class acl extends plugin } /* Save new acl in case of base edit mode */ - if ($this->aclType == 'base'){ + if ($this->aclType == 'base' && !$firstedit){ $this->aclContents= $new_acl; } @@ -473,7 +475,32 @@ class acl extends plugin return ($smarty->fetch (get_template_path('acl.tpl'))); } - + function sort_by_priority($list) + { + $tmp= get_global('plist'); + $plist= $tmp->info; + asort($plist); + $newSort = array(); + + foreach($list as $name => $translation){ + $na = preg_replace("/^.*\//","",$name); + $prio = 0; + if(isset($plist[$na]['plPriority'])){ + $prio= $plist[$na]['plPriority'] ; + } + + $newSort[$name] = $prio; + } + + asort($newSort); + + $ret = array(); + foreach($newSort as $name => $prio){ + $ret[$name] = $list[$name]; + } + return($ret); + } + function buildAclSelector($list) { $display= ""; @@ -482,7 +509,39 @@ class acl extends plugin $plist= $tmp->info; asort($plist); + /* Add select all/none buttons */ + $style = "style='width:100px;'"; + + $display .= ""; + $display .= ""; + $display .= " - "; + $display .= ""; + $display .= " - "; + + $display .= ""; + $display .= ""; + + $display .= "
"; + + $style = "style='width:50px;'"; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= " - "; + $display .= ""; + $display .= ""; + $display .= ""; + $display .= " - "; + + $display .= ""; + $display .= ""; + $display .= ""; + $display .= ""; + /* Build general objects */ + $list =$this->sort_by_priority($list); foreach ($list as $key => $name){ /* Create sub acl if it does not exist */ @@ -544,7 +603,7 @@ class acl extends plugin $display.= "\n ". "\n $options". - "\n  ".("Complete object:")." $more_options". + "\n  "._("Complete object").": $more_options". "\n "; /* Walk through the list of attributes */