From a78a38e2d9eca8fc560be8434b7b22054fd80b65 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 21 Feb 2008 07:49:43 +0000 Subject: [PATCH] Fixed FAI management. -Allow remove of packages again. -Updated multiple remove, exclude freezed entries. -Fixed problem with locked entries. -Delete: Display an info message showing all canceled objects due to FAItstate=freezed git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8999 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_divListFai.inc | 15 ++---- .../fai/admin/fai/class_faiManagement.inc | 46 ++++++++++++------- .../fai/admin/fai/class_faiPackage.inc | 1 + 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index f8977130e..342c502c6 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -54,7 +54,7 @@ class divListFai extends MultiSelectWindow $this->EnableSaveButton (false); /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 80; + $action_col_size = 120; # if($this->parent->snapshotEnabled()){ # $action_col_size += 32; # } @@ -279,7 +279,7 @@ class divListFai extends MultiSelectWindow $editlink ="%NAME%"; /* Dynamic action col, depending on snapshot icons */ - $action_col_size = 80; + $action_col_size = 120; # if($this->parent->snapshotEnabled()){ # $action_col_size += 32; # } @@ -329,17 +329,12 @@ class divListFai extends MultiSelectWindow } if($value['FAIstate'] == "freeze"){ - $action.= "F"; - $action.= ""; + $action.= ""; + $action.= "F"; }else{ $action.= ""; - -# if(preg_match("/(c)/",$value['acl']) && preg_match("/(w)/",$value['acl'])){ -# $action.= $this->GetSnapShotActions($value['dn']);; -# } - if(preg_match("/d/",$value['acl'])){ $action.= ""; diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 7dda040bf..64b10d5b8 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -84,7 +84,7 @@ class faiManagement extends plugin $s_entry = ""; /* If an entry was locked, these vars will be stored in a session to allow direct edit */ - session::set('LOCK_VARS_TO_USE',array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/")); + session::set('LOCK_VARS_TO_USE',array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/","/^menu_action/")); /**************** @@ -232,29 +232,43 @@ class faiManagement extends plugin if(count($ids)){ + $errors = ""; foreach($ids as $id){ $dn = $this->objects[$id]['dn']; - if (($user= get_lock($dn)) != ""){ - return(gen_locked_message ($user, $dn)); + $cn = $this->objects[$id]['cn']; + if($this->objects[$id]['FAIstate'] != "freeze"){ + $this->dns[$id] = $dn; + }else{ + $errors .= $cn.", "; } - $this->dns[$id] = $dn; + } + if ($user= get_multiple_locks($this->dns)){ + return(gen_locked_message($user,$this->dns)); } - $dns_names = "
";
-        foreach($this->dns as $dn){
-          add_lock ($dn, $this->ui->dn);
-          $dns_names .= $dn."\n";
+        if($errors != ""){
+          msg_dialog::display(_("Branch locked"),sprintf(_("The following entries are locked, you can't remove them %s."),
+            "

".trim($errors,", ")),INFO_DIALOG); } - $dns_names .="
"; - /* Lock the current entry, so nobody will edit it during deletion */ - if (count($this->dns) == 1){ - $smarty->assign("warning", sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names))); - } else { - $smarty->assign("warning", sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names))); + if(count($this->dns)){ + + $dns_names = "
";
+          foreach($this->dns as $dn){
+            add_lock ($dn, $this->ui->dn);
+            $dns_names .= $dn."\n";
+          }
+          $dns_names .="
"; + + /* Lock the current entry, so nobody will edit it during deletion */ + if (count($this->dns) == 1){ + $smarty->assign("warning", sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names))); + } else { + $smarty->assign("warning", sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names))); + } + $smarty->assign("multiple", true); + return($smarty->fetch(get_template_path('remove.tpl', TRUE))); } - $smarty->assign("multiple", true); - return($smarty->fetch(get_template_path('remove.tpl', TRUE))); } } diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 6d6826222..277cf6646 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -336,6 +336,7 @@ class faiPackage extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); + $faifilter = session::get('faifilter'); $use_dn = preg_replace("/".normalizePreg(FAI::get_release_dn($this->dn))."/i", $faifilter['branch'], $this->dn); if($faifilter['branch'] == "main"){ $use_dn = $this->dn; -- 2.30.2