Code

Updated FAI
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 16:41:52 +0000 (16:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 16:41:52 +0000 (16:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15064 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/faiGroupHandle.tpl
gosa-plugins/fai/admin/fai/remove.tpl

index fb7d3091dd8baab2d76d59a738b1aa232bed5aaa..73652a2db9b26c6a65169a30a12f676a1bb8adb1 100644 (file)
@@ -92,6 +92,18 @@ class faiManagement extends management
   }
 
 
+  function removeEntryRequested($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    $headpage = $this->getHeadpage();
+    if(count($target) == 1){
+      $entry = $headpage->getEntry($target[0]);
+      if($entry){
+        $this->dialogObject = new faiGroupHandle($entry['GROUPS'],"remove");
+      }
+    }
+  }
+
+
   function editByGroup()
   {
     if($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "edit"){
@@ -101,6 +113,68 @@ class faiManagement extends management
       $data = array_pop($entry);
       $type = $this->get_type($data);
       management::editEntry('editEntry',array($data['dn']),array(),$type[0],$type[2],$type[1]);
+    }elseif($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "remove"){
+      $this->dialogObject->save_object();
+      $to_delete = $entry = $this->dialogObject->get_selected();
+      $dns = array();
+
+
+      // Check FAIstate to ensure that we do not remove frozen objects
+      //  additionally check ACLs
+      $locked = array();
+      $disallowed = array();
+      foreach($to_delete as $obj){
+        if(isset($obj['FAIstate']) && preg_match('/^freeze/', $obj['FAIstate'])){
+          $locked[] = $obj['dn'];
+        }else{
+          $type = $this->get_type($obj);
+          $acl = $this->ui->get_permissions($obj['dn'], 'acl/'.$type[1]);
+          if(!preg_match("/d/",$acl)){
+            $disallowed[] = $obj['dn']; 
+          }else{
+            $dns[] = $obj['dn'];
+          }
+        }
+      }
+
+      // Display info dialog about locked and not removeable entries
+      if(count($locked)){
+        msg_dialog::display(_("Branch locked"),sprintf(_("The following entries are locked, you can't remove them %s."),
+            msgPool::buildList($locked)));
+      }
+
+      // Display info dialog about not removeable entries due to permissions
+      if(count($disallowed)){
+        msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
+      }
+
+      // There are entries left to be removed
+      if(count($dns)){  
+        $this->closeDialogs();
+        $this->dns = $dns;
+
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel requested!");
+
+        // check locks
+        if ($user= get_multiple_locks($this->dns)){
+          return(gen_locked_message($user,$this->dns));
+        }
+
+        // Add locks
+        $dns_names = array();
+        foreach($this->dns as $dn){
+          $dns_names[] =LDAP::fix($dn);
+        }
+        add_lock ($this->dns, $this->ui->dn);
+
+        // Display confirmation dialog.
+        $smarty = get_smarty();
+        $smarty->assign("info", msgPool::deleteInfo($dns_names,_($this->objectName)));
+        $smarty->assign("multiple", true);
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+      }else{
+        $this->closeDialogs();
+      }
     }
   }
 
index c9794b2d46d5215617635822327839f8b6cdb33a..7410399e4dc612fb67fbfac49a869238cd7114db 100644 (file)
@@ -20,7 +20,7 @@
                </td>
                <td style='width:150px;'>{$types.$key.NAME}</td>
                <td style='width:80px;'>{if $item.freezed}<i>({t}Freezed{/t})</i>{/if}</td>
-               <td><i>({$item.description})</i></td>
+               <td><i>({$item.description.0})</i></td>
        </tr>
 {/foreach}
 </table>
index d63f86d1467102d017b2502c4110207749d0ff85..f60f42d2599ceb8022bb7afa36d693eabe23924d 100644 (file)
@@ -1,24 +1,18 @@
 <div style="font-size:18px;">
-<img alt="" src="images/warning.png" align=top>&nbsp;{t}Warning{/t}
+ <img alt="" src="images/warning.png" align=top>&nbsp;{t}Warning{/t}
 </div>
-
 <p>
{$warning}
{t}This includes 'all' object information. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
 {$info}
 {t}This includes all account data, system access rules, imap settings, etc. for this user. Please double check if your really want to do this since there is no way for GOsa to get your data back.{/t}
 </p>
 
 <p>
- {t}Best thing to do before performing this action would be to save the current contents of your LDAP tree in a file. So - if you've done so - press 'Delete' to continue or 'Cancel' to abort.{/t}
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
 </p>
 
 <p class="plugbottom">
-{if $multiple}
-       <input type=submit name="delete_multiple_fai_object_confirm" value="{msgPool type=delButton}">
-       &nbsp;
-       <input type=submit name="delete_multiple_fai_object_cancel" value="{msgPool type=cancelButton}">
-{else}
-       <input type=submit name="delete_terminal_confirm" value="{msgPool type=delButton}">
-       &nbsp;
-       <input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
-{/if}
+  <input type=submit name="delete_confirmed" value="{msgPool type=delButton}">
+  <input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
+  &nbsp;
 </p>
+