Code

Removed snapshot stuff from class plugin - it has nothing to do there.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Apr 2010 12:52:45 +0000 (12:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 28 Apr 2010 12:52:45 +0000 (12:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17909 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_SnapShotDialog.inc
gosa-core/include/class_plugin.inc

index 315e9b451f8e1cb9922c68018de478cde6595a51..315d1525de8e90c3bb4b8e627b4a7a33c7471c5e 100644 (file)
@@ -104,16 +104,18 @@ class SnapShotDialog extends plugin
                or the snapshots for the given object dn */
             $res = array();
             $tmp = array();
+            $handler = new SnapshotHandler($this->config);
+
             if($this->display_all_removed_objects){
                 if(count($this->snap_shot_bases)){
                     foreach($this->snap_shot_bases as $dn){
-                        $tmp = array_merge($tmp,$this->getAllDeletedSnapshots($dn,true));
+                        $tmp = array_merge($tmp,$handler->getAllDeletedSnapshots($dn,true));
                     }
                 }else{
-                    $tmp = $this->getAllDeletedSnapshots($this->snap_shot_bases,true);
+                    $tmp = $handler->getAllDeletedSnapshots($this->snap_shot_bases,true);
                 }
             }else{
-                $tmp = $this->Available_SnapsShots($this->dn,true);
+                $tmp = $handler->Available_SnapsShots($this->dn,true);
             }
 
             $this->snapList->setAcl('rwcdm');
index 2e12cab6ccc742a8878dd9963fd11ba02da39322..86f04f7d209e4a7be028b29f36ae1cc13bd42e58 100644 (file)
@@ -1138,64 +1138,6 @@ class plugin
   }
 
 
- /* \brief Return available snapshots for the given base */
- function Available_SnapsShots($dn,$raw = false)
- {
-   if(!$this->snapshotEnabled()) return(array());
-
-   /* Create an additional ldap object which
-      points to our ldap snapshot server */
-   $ldap= $this->config->get_ldap_link();
-   $ldap->cd($this->config->current['BASE']);
-   $cfg= &$this->config->current;
-
-   /* check if there are special server configurations for snapshots */
-   if($this->config->get_cfg_value("snapshotURI") == ""){
-     $ldap_to      = $ldap;
-   }else{
-     $server         = $this->config->get_cfg_value("snapshotURI");
-     $user           = $this->config->get_cfg_value("snapshotAdminDn");
-     $password       = $this->config->get_credentials($this->config->get_cfg_value("snapshotAdminPassword"));
-     $snapldapbase   = $this->config->get_cfg_value("snapshotBase");
-     $ldap_to        = new ldapMultiplexer(new LDAP($user,$password, $server));
-     $ldap_to -> cd($snapldapbase);
-     if (!$ldap_to->success()){
-       msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap_to->get_error(), $snapldapbase, "", get_class()));
-     }
-   }
-
-   /* Prepare bases and some other infos */
-   $base           = $this->config->current['BASE'];
-   $snap_base      = $this->config->get_cfg_value("snapshotBase");
-   $base_of_object = preg_replace ('/^[^,]+,/i', '', $dn);
-   $new_base       = preg_replace("/".preg_quote($base, '/')."$/","",$base_of_object).$snap_base;
-   $tmp            = array(); 
-
-   /* Fetch all objects with  gosaSnapshotDN=$dn */
-   $ldap_to->cd($new_base);
-   $ldap_to->ls("(&(objectClass=gosaSnapshotObject)(gosaSnapshotDN=".$dn."))",$new_base,
-       array("gosaSnapshotType","gosaSnapshotTimestamp","gosaSnapshotDN","description")); 
-
-   /* Put results into a list and add description if missing */
-   while($entry = $ldap_to->fetch()){ 
-     if(!isset($entry['description'][0])){
-       $entry['description'][0]  = "";
-     }
-     $tmp[] = $entry; 
-   }
-
-   /* Return the raw array, or format the result */
-   if($raw){
-     return($tmp);
-   }else{  
-     $tmp2 = array();
-     foreach($tmp as $entry){
-       $tmp2[base64_encode($entry['dn'])] = $entry['description'][0]; 
-     }
-   }
-   return($tmp2);
- }
-
   /*! \brief Return plugin informations for acl handling */
   static function plInfo()
   {
@@ -1542,131 +1484,6 @@ class plugin
     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()){
-      if ($ui->allow_snapshot_restore($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;";
-        }
-      }
-      if($ui->allow_snapshot_create($base,$category)){
-        $str.= "<input class='center' type='image' src='images/snapshot.png'
-          alt='"._("Create snapshot")."' name='CreateSnapShotDialog_".base64_encode($base)."' 
-          title='"._("Create new snapshot for this object")."'>&nbsp;";
-      }else{
-        $str = "<img class='center' src='images/empty.png' alt=' '>&nbsp;";
-      }
-    }
-
-    return($str);
-  }
-
-
-  function get_copypaste_action($base,$category,$class,$copy = TRUE, $cut = TRUE)
-  {
-    $ui = get_userinfo();
-    $action = "";
-    if($this->CopyPasteHandler){
-      if($cut){
-        if($ui->is_cutable($base,$category,$class)){
-          $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($copy){
-        if($ui->is_copyable($base,$category,$class)){
-          $action.= "<input class='center' type='image'
-            src='images/lists/copy.png' alt='"._("Copy")."' name='copy_%KEY%' title='"._("Copy this entry")."'>&nbsp;";
-        }else{
-          $action.="<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
-        }
-      }
-    }
-
-    return($action); 
-  }
-
-
-  function get_copypaste_header($base,$category,$copy = TRUE, $cut = TRUE)
-  {
-    $s = "";
-    $ui =get_userinfo();
-
-    if(!is_array($category)){
-      $category = array($category);
-    }
-
-    /* Check permissions for each category, if there is at least one category which 
-        support read or paste permissions for the given base, then display the specific actions.
-     */
-    $readable = $pasteable = false;
-    foreach($category as $cat){
-      $readable= $readable || preg_match('/r/', $ui->get_category_permissions($base, $cat));
-      $pasteable= $pasteable || $ui->is_pasteable($base, $cat) == 1;
-    }
-  
-    if(($cut || $copy) && isset($this->CopyPasteHandler) && is_object($this->CopyPasteHandler)){
-      if($readable){
-        $s.= "..|---|\n";
-        if($copy){
-          $s.= "..|<img src='images/lists/copy.png' alt='' border='0' class='center'>".
-            "&nbsp;"._("Copy")."|"."multiple_copy_systems|\n";
-        }
-        if($cut){
-          $s.= "..|<img src='images/lists/cut.png' alt='' border='0' class='center'>".
-            "&nbsp;"._("Cut")."|"."multiple_cut_systems|\n";
-        }
-      }
-
-      if($pasteable){
-        if($this->CopyPasteHandler->entries_queued()){
-          $img = "<img border='0' class='center' src='images/lists/paste.png' alt=''>";
-          $s.="..|".$img."&nbsp;"._("Paste")."|editPaste|\n";
-        }else{
-          $img = "<img border='0' class='center' src='images/lists/paste-grey.png' alt=''>";
-          $s.="..|".$img."&nbsp;"._("Paste")."\n";
-        }
-      }
-    }
-    return($s);
-  }
-
-
   function get_used_snapshot_bases()
   {
      return(array());