From 0eb61b9f93a61129c8a14be900aac58c57d7a5b2 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 28 Apr 2010 12:52:45 +0000 Subject: [PATCH] Removed snapshot stuff from class plugin - it has nothing to do there. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17909 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_SnapShotDialog.inc | 8 +- gosa-core/include/class_plugin.inc | 183 --------------------- 2 files changed, 5 insertions(+), 186 deletions(-) diff --git a/gosa-core/include/class_SnapShotDialog.inc b/gosa-core/include/class_SnapShotDialog.inc index 315e9b451..315d1525d 100644 --- a/gosa-core/include/class_SnapShotDialog.inc +++ b/gosa-core/include/class_SnapShotDialog.inc @@ -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'); diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 2e12cab6c..86f04f7d2 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -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 = "..| "._("Restore"). "|RestoreDeletedSnapShot|\n"; - }else{ - $str = "..| "._("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.= " "; - } else { - $str = " "; - } - } - if($ui->allow_snapshot_create($base,$category)){ - $str.= " "; - }else{ - $str = "  "; - } - } - - 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 .= " "; - }else{ - $action.="  "; - } - } - if($copy){ - if($ui->is_copyable($base,$category,$class)){ - $action.= " "; - }else{ - $action.="  "; - } - } - } - - 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.= "..|". - " "._("Copy")."|"."multiple_copy_systems|\n"; - } - if($cut){ - $s.= "..|". - " "._("Cut")."|"."multiple_cut_systems|\n"; - } - } - - if($pasteable){ - if($this->CopyPasteHandler->entries_queued()){ - $img = ""; - $s.="..|".$img." "._("Paste")."|editPaste|\n"; - }else{ - $img = ""; - $s.="..|".$img." "._("Paste")."\n"; - } - } - } - return($s); - } - - function get_used_snapshot_bases() { return(array()); -- 2.30.2