Code

Updated system acls
[gosa.git] / plugins / admin / applications / class_divListApplication.inc
index 4f4634cd8848c992a48de9f253c61692670cfc3b..4676a4bb7ac129d4558fd42745548a8292ddfdf1 100755 (executable)
@@ -53,7 +53,6 @@ class divListApplication extends MultiSelectWindow
 
   function AddUserBoxToFilter($position){
     $str = "";
-    print_a($this->parent);
     if(($position  == 2) && ($this->parent->IsReleaseManagementActivated($this->config))){
       $smarty = get_smarty();
       $smarty->assign("selectedRelease",$this->selectedRelease);
@@ -85,20 +84,9 @@ class divListApplication extends MultiSelectWindow
       $Copy_Paste ="";
     }
 
-    /* Create listhead, it will be shown on top of the divlist.
-     * It provides general navigation and object creation
-     */
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-      " <input class='center' type='image' src='images/list_root.png' align='middle' ".
-        "title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
-      " <input class='center' type='image' align='middle' src='images/list_back.png' ".
-        "title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'>&nbsp;".
-      " <input class='center' type='image' align='middle' src='images/list_home.png' ".
-        "title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'>&nbsp;".
-      " <input class='center' type='image' src='images/list_reload.png' align='middle' ".
-        "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new").
+    /* Add default header */
+    $listhead = MultiSelectWindow::get_default_header();
+    $listhead.= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new").
         "' title='"._("Create new application")."' name='appl_new'>&nbsp;".
       $Copy_Paste.
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
@@ -132,26 +120,52 @@ class divListApplication extends MultiSelectWindow
     $empty    = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
 
 
-    /* Create action icons */
-    $actions = "";
-    if($this->parent->CopyPasteHandler){
-      $actions.= "<input class='center' type='image'
-        src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
-      $actions.= "<input class='center' type='image'
-        src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-    }
-    $actions.= "<input class='center' type='image'
-      src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
-    $actions.= "<input class='center' type='image'
-      src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
-
-
     /********************
       Attach objects
      ********************/
 
     foreach($list as $key => $val){
-      $title = "title='dn:&nbsp;".@LDAP::fix($val['dn'])."'";
+
+      $acl= get_permissions ($val['dn'], $this->ui->subtreeACL);
+      $acl= get_module_permission($acl, "application", $val['dn']);
+
+      /* Get state */
+      $state = "";
+      if(isset($val['FAIstate'])){
+        $state = $val['FAIstate'][0];
+      }
+
+      /* If this application is a freezed one, we must hide some action buttons */
+      $is_freezed = preg_match("/freeze/i",$state);
+
+      /* Create action icons */
+      $actions = "";
+
+      if($acl == "#all#"){
+        if(($this->parent->CopyPasteHandler) && (!$is_freezed)){
+          $actions.= "<input class='center' type='image'
+            src='images/editcut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
+        }
+        if($this->parent->CopyPasteHandler){
+          $actions.= "<input class='center' type='image'
+            src='images/editcopy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
+        }
+      }
+    
+      $actions.= "<input class='center' type='image'
+        src='images/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
+      if($is_freezed){
+        $actions.= "<img src='images/empty.png' width='16' alt='&nbsp;' class='center'>";
+      }else{
+
+        if(chkacl($acl,"delete") == ""){
+          $actions.= "<input class='center' type='image'
+            src='images/edittrash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
+        }
+      }
+
+
+      $title = "title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'";
 
       if(!isset($val['description'][0])){
         $desc = "";