Code

Updated snapshot handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 07:49:53 +0000 (07:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 May 2008 07:49:53 +0000 (07:49 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11092 594d385d-05f5-0310-b6e9-bd551577e9d8

17 files changed:
gosa-core/include/class_MultiSelectWindow.inc
gosa-core/include/class_plugin.inc
gosa-core/include/class_userinfo.inc
gosa-core/plugins/admin/acl/class_divListACL.inc
gosa-core/plugins/admin/groups/class_divListGroup.inc
gosa-core/plugins/admin/ogroups/class_divListOGroup.inc
gosa-core/plugins/admin/users/class_divListUsers.inc
gosa-plugins/fai/admin/fai/class_divListFai.inc
gosa-plugins/gofax/gofax/blocklists/class_divListBlocklists.inc
gosa-plugins/gofon/gofon/conference/class_divListConferences.inc
gosa-plugins/gofon/gofon/macro/class_divListMacros.inc
gosa-plugins/goto/admin/applications/class_divListApplication.inc
gosa-plugins/goto/admin/devices/class_divListDevices.inc
gosa-plugins/goto/admin/mimetypes/class_divListMimeTypes.inc
gosa-plugins/sudo/admin/sudo/class_divListSudo.inc
gosa-plugins/sudo/admin/sudo/class_sudoManagement.inc
gosa-plugins/systems/admin/systems/class_divListSystem.inc

index e76ee82ffe76c1f3b03b584ae666d11c30ea83f5..8946d061e58b6fce3a24bfe1972c114d11b37078 100644 (file)
@@ -635,55 +635,6 @@ class MultiSelectWindow{
        }
 
 
-  /* Create header snapshot value */
-  function get_snapshot_header($layer_menu = FALSE)
-  {
-    $str = "";
-    if($this->parent->snapshotEnabled()){
-      $ok = false;
-      foreach($this->parent->get_used_snapshot_bases() as $base){
-        $ok |= count($this->parent->getAllDeletedSnapshots($base)) >= 1 ;
-      }
-      if($ok){
-        if($layer_menu){
-          $str = "..|<img class='center' src='images/lists/restore.png' alt='"._("Restore")."'>&nbsp;"._("Restore")."|RestoreDeletedSnapShot|\n";
-        }else{
-          $str = "<input class='center' type='image' align='middle' src='images/lists/restore.png'
-            title='"._("Restore snapshopts of already deleted objects")."' 
-            alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
-        }
-      }else{
-        if($layer_menu){
-          $str = "..|<img class='center' src='images/lists/restore_grey.png' alt=''>&nbsp;"._("Restore")."||\n";
-        }else{
-          $str = "<img class='center' src='images/lists/restore_grey.png' alt=''>&nbsp;";
-        }
-      }
-    }
-    return($str);
-  }
-
-
-  function GetSnapShotActions($dn)
-  {
-    $str= "";
-    if($this->parent->snapshotEnabled()){
-
-      if(count($this->parent->Available_SnapsShots($dn))){
-        $str.= "<input class='center' type='image' src='images/lists/restore.png'
-          alt='"._("Restore snapshot")."' name='RestoreSnapShotDialog_".base64_encode($dn)."' title='"._("Restore snapshot")."'>&nbsp;";
-      } else {
-        $str = "<img class='center' src='images/lists/restore_grey.png' alt=''>&nbsp;";
-      }
-
-      $str.= "<input class='center' type='image' src='images/snapshot.png'
-        alt='"._("Create snapshot")."' name='CreateSnapShotDialog_".base64_encode($dn)."' title='"._("Create a new snapshot from this object")."'>&nbsp;";
-    }
-
-    return($str);
-  }
-
-
        /* this function adds the sub-departments of the current tree to the list */
        function AddDepartments($base = false,$numtabs = 3,$empty_tabs_in_front = 0)
        {
index 51d372862f43ae8cb657a5c5096c340b8583e9d7..6f6a6e52b52ae9fb3c370093d609479d63a9b370 100644 (file)
@@ -1925,6 +1925,58 @@ class plugin
     $message = plugin::check();
     return($message);
   }
+
+
+  /*! \brief  Returns the snapshot header part for "Actions" menu in management dialogs 
+      @param  $layer_menu  
+   */   
+  function get_snapshot_header($base,$category)
+  {
+    $str = "";
+    $ui = get_userinfo();
+    if($this->snapshotEnabled() && $ui->allow_snapshot_restore($base,$category)){
+
+      $ok = false;
+      foreach($this->get_used_snapshot_bases() as $base){
+        $ok |= count($this->getAllDeletedSnapshots($base)) >= 1 ;
+      }
+
+      if($ok){
+        $str = "..|<img class='center' src='images/lists/restore.png' ".
+          "alt='"._("Restore")."'>&nbsp;"._("Restore").                       "|RestoreDeletedSnapShot|\n";
+      }else{
+        $str = "..|<img class='center' src='images/lists/restore_grey.png' alt=''>&nbsp;"._("Restore")."||\n";
+      }
+    }
+    return($str);
+  }
+
+
+  function get_snapshot_action($base,$category)
+  {
+    $str= ""; 
+    $ui = get_userinfo();
+    if($this->snapshotEnabled() && $ui->allow_snapshot_create($base,$category)){
+
+      if(count($this->Available_SnapsShots($base))){
+        $str.= "<input class='center' type='image' src='images/lists/restore.png'
+          alt='"._("Restore snapshot")."' name='RestoreSnapShotDialog_".base64_encode($base)."' title='"._("Restore snapshot")."'>&nbsp;";
+      } else {
+        $str = "<img class='center' src='images/lists/restore_grey.png' alt=''>&nbsp;";
+      }
+
+      $str.= "<input class='center' type='image' src='images/snapshot.png'
+        alt='"._("Create snapshot")."' name='CreateSnapShotDialog_".base64_encode($base)."' title='"._("Create a new snapshot from this object")."'>&nbsp;";
+    }
+
+    return($str);
+  }
+
+
+  function get_used_snapshot_bases()
+  {
+     return(array());
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 45f6a1324ad44fa32f80de5c5e0f26ace5dec402..86f1bbadafee11f2ebb5befbd1f289709da92f40 100644 (file)
@@ -197,12 +197,25 @@ class userinfo
     return ($acl);
   }
 
-
+  
+  /*! \brief Check if the given object (dn) is copyable
+      @param  String The object dn 
+      @param  String The acl  category (e.g. users) 
+      @param  String The acl  class (e.g. user) 
+      @return Boolean   TRUE if the given object is copyable else FALSE 
+  */
   function is_copyable($dn, $object, $class)
   {
     return(preg_match("/r/",$this->has_complete_category_acls($dn, $object)));
   }
 
+
+  /*! \brief Check if the given object (dn) is cutable
+      @param  String The object dn 
+      @param  String The acl  category (e.g. users) 
+      @param  String The acl  class (e.g. user) 
+      @return Boolean   TRUE if the given object is cutable else FALSE 
+  */
   function is_cutable($dn, $object, $class)
   {
     $remove = preg_match("/d/",$this->get_permissions($dn,$object."/".$class));
@@ -210,11 +223,55 @@ class userinfo
     return($remove && $read);
   }
 
+
+  /*! \brief  Checks if we are allowed to paste an object to the given destination ($dn)
+      @param  String The destination dn 
+      @param  String The acl  category (e.g. users) 
+      @param  String The acl  class (e.g. user) 
+      @return Boolean   TRUE if we are allowed to paste an object.
+  */
   function is_pasteable($dn, $object, $class)
   {
     return(preg_match("/w/",$this->has_complete_category_acls($dn, $object)));
   }
 
+
+  /*! \brief  Checks if we are allowed to restore a snapshot for the given dn.
+      @param  String The destination dn 
+      @param  String The acl  category (e.g. users) 
+      @return Boolean   TRUE if we are allowed to restore a snapshot.
+  */
+  function allow_snapshot_restore($dn, $object)
+  {
+    if(!is_array($object)){
+      $object = array($object);
+    }
+    $r = $w = $c = TRUE;
+    foreach($object as $category){
+      $w |= preg_match("/w/",$this->has_complete_category_acls($dn, $category));
+      $c |= preg_match("/c/",$this->has_complete_category_acls($dn, $category));
+      $r |= preg_match("/r/",$this->has_complete_category_acls($dn, $category));
+#      print_a(array($category => $w.$c.$r));
+    }
+    return($r); 
+  }  
+
+
+  /*! \brief  Checks if we are allowed to create a snapshot of the given dn.
+      @param  String The source dn 
+      @param  String The acl category (e.g. users) 
+      @return Boolean   TRUE if we are allowed to restore a snapshot.
+  */
+  function allow_snapshot_create($dn, $object)
+  {
+    $w = preg_match("/w/",$this->has_complete_category_acls($dn, $object));
+    $c = preg_match("/c/",$this->has_complete_category_acls($dn, $object));
+    $r = preg_match("/r/",$this->has_complete_category_acls($dn, $object));
+#    print_a(array($object => $w.$c.$r));
+    return($r && $w && $c) ; 
+  }  
+
+
   function get_permissions($dn, $object, $attribute= "", $skip_write= FALSE)
   {
     /* If we are forced to skip ACLs checks for the current user 
index 0da6caed1ea582981a2987224eac5f6c5983f867..5838c761501cceb5c328c3d0de0f13355a9242b5 100644 (file)
@@ -42,7 +42,7 @@ class divListACL extends MultiSelectWindow
 
   function divListACL (&$config, &$parent)
   {
-    MultiSelectWindow::MultiSelectWindow($config, "ACL", "acl");
+    MultiSelectWindow::MultiSelectWindow($config, "ACL", array("acl","aclroles"));
     
     $this->parent       = &$parent;
     $this->ui           = get_userinfo();
@@ -185,11 +185,7 @@ class divListACL extends MultiSelectWindow
       $s.="..|".$img."&nbsp;"._("Paste")."\n";
     }
 
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -224,14 +220,14 @@ class divListACL extends MultiSelectWindow
         }
 
         /* Add copy & paste handler */
-        if($ui->is_cutable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){
+        if($ui->is_cutable($acl_entry['dn'],"aclroles","aclRole") && $this->parent->CopyPasteHandler){
           $action .= "<input class='center' type='image'
             src='images/lists/cut.png' alt='"._("cut")."' name='cut_%KEY%' title='"._("Cut this entry")."'>&nbsp;";
         }else{
           $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
         }
 
-        if($ui->is_copyable($acl_entry['dn'],"acl","aclRole") && $this->parent->CopyPasteHandler){
+        if($ui->is_copyable($acl_entry['dn'],"aclroles","aclRole") && $this->parent->CopyPasteHandler){
           $action.= "<input class='center' type='image'
             src='images/lists/copy.png' alt='"._("copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
         }else{
@@ -246,9 +242,7 @@ class divListACL extends MultiSelectWindow
         }
 
         /* Add snapshot functionality */
-        if(preg_match("/(c.*w|w.*c)/", $acl_all)){
-          $action.= $this->GetSnapShotActions($acl_entry['dn']);
-        }
+        $action.= $this->parent->get_snapshot_action($acl_entry['dn'],"aclroles");
 
         if(preg_match("/d/", $acl)){
           $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."' 
index d58ace3ed028541301ef58c33ce34cc079cd23cd..c3e1fb78ce788ea01e08e35d2cf2b25c52eec423 100644 (file)
@@ -223,11 +223,8 @@ class divListGroup extends MultiSelectWindow
       $s.="..|".$img."&nbsp;"._("Paste")."\n";
     }
 
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    /* Add snapshot functionality */
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
 
@@ -317,13 +314,8 @@ class divListGroup extends MultiSelectWindow
         src='images/lists/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot functionality */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+  
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
           src='images/lists/trash.png' alt='"._("delete")."' name='group_del_%KEY%' title='"._("Delete this entry")."'>";
index cd60dead1a6db71b9f05340781f2e7fa3301bc68..4894f9b13491a82501a174a3ef69730251709d55 100644 (file)
@@ -237,10 +237,7 @@ class divListOGroup extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);    
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -298,12 +295,7 @@ class divListOGroup extends MultiSelectWindow
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='group_edit_%KEY%' title='"._("Edit this entry")."'>";
     
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
index 3aaf8bac251c363276585dbfe8d511d5465d7c1b..9e2d725e44ee90060fa42a8e2756ca2b7ae20e5a 100644 (file)
@@ -216,11 +216,7 @@ class divListUsers extends MultiSelectWindow
       $s.="..|".$img."&nbsp;"._("Paste")."\n";
     }
 
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -354,13 +350,8 @@ class divListUsers extends MultiSelectWindow
           title='"._("Not allowed")."'>";
       }
 
-      /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      /* Add snapshot functionality */
+      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       /* Add remove icon, if we are allowed to remove the current user */
       if(preg_match("/d/",$acl)) {
index 9f0362e4ded39b8cd453a7aa77c7f056c9bc08fb..8820af5f85d12bacde28507ba93cad5584590d99 100644 (file)
@@ -177,12 +177,7 @@ class divListFai extends MultiSelectWindow
     }
 
 #   /* Add snapshot icons, if we are allowed to write and create the complete fai module ($ui->has_complete_category_acls) */ 
-#   if(preg_match("/(c.*w|w.*c)/",$acl_all)){ 
-#     if($this->parent->snapshotEnabled()){
-#       $s .= "..|---|\n";
-#       $s .= $this->get_snapshot_header(TRUE);
-#     }
-#   }
+#   $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -275,6 +270,8 @@ class divListFai extends MultiSelectWindow
          }
        }
 
+#      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+
        /* Cutted objects should be displayed in light grey */
        $display = $value['cn'].$desc;
        if($this->parent->CopyPasteHandler){
index 54dec38895aa01b048c5f0b8bc94a45940860279..234625466a775b81a774759f88c314e9bf41dd47 100644 (file)
@@ -169,11 +169,7 @@ class divListBlocklist extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -227,12 +223,7 @@ class divListBlocklist extends MultiSelectWindow
       $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'     name='goFaxBlocklist_edit_%KEY%' title='"._("Edit user")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
  
       /* Delete entry ; requires remove access */
       if(preg_match("/d/",$acl)){
index c50340950f239430720a4dfa0b4ed20fc23f57d5..b116eacdff0287a211a6b3e62a8b287d8472015f 100644 (file)
@@ -165,11 +165,7 @@ class divListConference extends MultiSelectWindow
       $s.="..|".$img."&nbsp;"._("Paste")."\n";
     }
 
-    /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -228,12 +224,7 @@ class divListConference extends MultiSelectWindow
                     alt='"._("edit")."'    name='conference_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($conference['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      $actions.= $this->parent->get_snapshot_action($conference['dn'],$this->module);
 
       /* Create delete link - Only if we are allowed to delete this entry */
       if(preg_match("/d/",$acl)){
index 22b1f499f90d6b4b4988c7775acd1610d9f01b9b..8420ead27c6e31ac87e1e2904f99c84d7a0d4fef 100644 (file)
@@ -164,10 +164,7 @@ class divListMacro extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -224,13 +221,7 @@ class divListMacro extends MultiSelectWindow
         name='goFonMacro_edit_%KEY%' title='"._("Edit macro")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
+      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);      
 
       if(preg_match("/d/",$acl)){
         $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."'   
index 9a53e5f31aac5b7c4f92d3964550c431e0a7b202..de0e1263bec6d0975e88810914e30d31bb596761 100644 (file)
@@ -180,10 +180,7 @@ class divListApplication extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -250,12 +247,7 @@ class divListApplication extends MultiSelectWindow
         src='images/lists/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       /* If we are allowed to remove the application account, display remove icon */
       if(preg_match("/d/",$acl)){
index b43c492fc236f5fadb5ac88441a5b7107b2c0b8e..7c4b39e2f0767932b7937070b05114d6e5e43a78 100644 (file)
@@ -165,10 +165,7 @@ class divListDevices extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
                                                                        
@@ -231,13 +228,7 @@ class divListDevices extends MultiSelectWindow
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='device_edit_%KEY%' title='"._("Edit this entry")."'>";
 
-#     /* Add snapshot icon */
-#     if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-#       $actions.= $this->GetSnapShotActions($val['dn']);
-#     }else{
-#       $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-#       $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-#     }
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       /* Add delete button */
       if(preg_match("/d/",$acl)){
index dbc60c50142c0501673e515cbe076724e23d5f80..53b9a1bd72c948c54a93af8654f6640c2075c7a3 100644 (file)
@@ -189,10 +189,7 @@ class divListMimeTypes extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -255,12 +252,7 @@ class divListMimeTypes extends MultiSelectWindow
         src='images/lists/edit.png' alt='"._("edit")."' name='mime_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
+      $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       /* Add delete button */
       if(preg_match("/d/",$acl)){
index f16ddd90c01e71d67c0bc8308c3f29a28656b9fc..98259d9fd454a4afd0c2aa2715000ea823f2b4a9 100644 (file)
@@ -139,11 +139,8 @@ class divListSudo extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
-    
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);   
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
   }
@@ -196,13 +193,7 @@ class divListSudo extends MultiSelectWindow
         src='images/lists/edit.png' alt='".msgPool::editButton()."' name='sudo_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $actions.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $actions.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
+      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
 
       if(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
index e866e24eedb3997f2ea381e533f5323547c0d251..8ce2d16a508ad572febb853944bd98c46d06e4f0 100644 (file)
@@ -255,7 +255,7 @@ class sudoManagement extends plugin
           add_lock($this->dns,$this->ui->dn);
 
           /* Lock the current entry, so nobody will edit it during deletion */
-          $smarty->assign("info", msgPool::deleteInfo($dns_names,_("Sudo role")));
+          $smarty->assign("info", msgPool::deleteInfo($this->dns,_("Sudo role")));
           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
         }
       }
index b49d1bd9c29800438a10030d553cf41d7edadfa2..8f549172f8307a0d87a9d91e66053ab634b117f3 100644 (file)
@@ -155,6 +155,7 @@ class divListSystem extends MultiSelectWindow
       $d = $ui->get_module_departments($module);      
       foreach($d as $department){
         $departments[$department] = $department;
+        
       }
     }
 
@@ -277,10 +278,7 @@ class divListSystem extends MultiSelectWindow
     }
 
     /* Add snapshot icons */
-    if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){
-      $s .= "..|---|\n";
-      $s .= $this->get_snapshot_header(TRUE);
-    }
+    $s .= $this->parent->get_snapshot_header($this->selectedBase,$this->module);
 
     $this->SetDropDownHeaderMenu($s);
     $this->SetListHeader($listhead);
@@ -401,20 +399,7 @@ class divListSystem extends MultiSelectWindow
       $action.= "<input class='center' type='image' src='images/lists/edit.png' 
                     alt='"._("edit")."'     name='system_edit_%KEY%' title='"._("Edit system")."'>";
 
-      /* Add snapshot icon */
-      if(preg_match("/(r.*w|w.*r)/",$acl_all)){
-        $action.= $this->GetSnapShotActions($val['dn']);
-      }else{
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-      }
-
-      if(preg_match("/d/",$acl)){
-        $action.= "<input class='center' type='image' src='images/lists/trash.png' 
-          alt='"._("delete")."'   name='system_del_%KEY%' title='"._("Delete system")."'>";
-      }else{
-        $action.= $empty;    
-      }
+      $action.= $this->parent->get_snapshot_action($val['dn'],$acl_type);
 
       /* Generate picture list, which is currently disabled */
       if(in_array("goCupsServer"    ,$val['objectClass'])) $cups    = $img1;   else $cups  =$empty;