Code

Fixed FAI management.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 07:49:43 +0000 (07:49 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Feb 2008 07:49:43 +0000 (07:49 +0000)
-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

gosa-plugins/fai/admin/fai/class_divListFai.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/class_faiPackage.inc

index f8977130e3ec8110cdf0305f40247c42e978d21e..342c502c63edcf3acd324e055162114dc4336a78 100644 (file)
@@ -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 ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
 
     /* 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.=  "<img src='images/closedlock.png' alt='F' class='center'><img src='images/empty.png' width='38' height='2' class='center' alt=''>";
-         $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
-           name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+         $action.=  "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+                      name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+         $action.=  "<img src='images/closedlock.png' alt='F' class='center'>";
        }else{
          $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-
-#        if(preg_match("/(c)/",$value['acl']) && preg_match("/(w)/",$value['acl'])){
-#          $action.= $this->GetSnapShotActions($value['dn']);;
-#        }
-
          if(preg_match("/d/",$value['acl'])){
            $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
              name='entry_delete_%KEY%' title='"._("Delete class")."'>";
index 7dda040bf48cf5207e9f3ce02cce5d7091aa82a0..64b10d5b88e33ff09745e55f8654a48d2908b322 100644 (file)
@@ -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 = "<br><pre>";
-        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."),
+            "<br><br>".trim($errors,", ")),INFO_DIALOG);
         }
-        $dns_names .="</pre>";
 
-        /* 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 = "<br><pre>";
+          foreach($this->dns as $dn){
+            add_lock ($dn, $this->ui->dn);
+            $dns_names .= $dn."\n";
+          }
+          $dns_names .="</pre>";
+
+          /* 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)));
       }
     }
 
index 6d6826222ac9033f172d69f72a0825c457ed1687..277cf664685c64b67209284c5aa301c534f70811 100644 (file)
@@ -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;