Code

Added logging
[gosa.git] / plugins / admin / groups / class_groupApplication.inc
index edc3239b34d1a8465448bdaa888a90dc36caa1f2..b66f40e85ddb5c5ea2e86062735be8bc845e06d0 100644 (file)
@@ -156,6 +156,10 @@ class appgroup extends plugin
       $this->InitialFAIrelease  = $this->FAIrelease;
       $this->Releases           = $this->getReleases();
     }
+
+    if($this->is_account){
+      @log::log("view","groups/".get_class($this),$this->dn);
+    }
   }
 
 
@@ -388,7 +392,7 @@ class appgroup extends plugin
     }
 
     /* Check if category was selected */
-    if((isset($_GET['act']))&&($_GET['act']=="open") && isset($this->Categories[base64_decode($_GET['id'])])){
+    if((isset($_GET['act']))&&($_GET['act']=="open") && (empty($_GET['id']) || isset($this->Categories[base64_decode($_GET['id'])]))){
       $this->curCatDir = base64_decode($_GET['id']);
     }
 
@@ -598,6 +602,16 @@ class appgroup extends plugin
       }
     }
 
+    /* Add multiple */
+    if(isset($_POST['AddApps'])){
+      foreach($_POST as $name => $value){
+        if(preg_match("/AddApp_/",$name)){
+          $app = preg_replace("/AddApp_/","",$name);
+          $this->addApp($app);
+        }
+      }
+    }
+
     /* Add application with post */
     if((isset($_GET['act']))&&($_GET['act']=="add")){
       $this->used_apps[$_GET['id']]= $_GET['id'];
@@ -639,7 +653,9 @@ class appgroup extends plugin
     $departments = array();
     $res = get_list("(objectClass=gosaDepartment)", "application", $this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
     foreach($res as $value){
-      $fdn= @LDAP::fix(str_replace($this->curbase,"",$value['dn']));
+      $fdn = $value['dn'];
+      $fdn = preg_replace("/".normalizePreg($this->curbase)."/","",$fdn);
+      $fdn= @LDAP::fix($fdn);
       if($value["description"][0]!=".."){
         $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]";
       }else{
@@ -770,11 +786,11 @@ class appgroup extends plugin
             /*  release managent is active
              */
             if(!$this->enableReleaseManagement){
-              $image = "<img class='center' src='images/select_invalid_application.png' 
+              $image = "<img class='center' alt='R' src='images/select_invalid_application.png' 
                           title='"._("This application is no longer available.")."'>&nbsp;";
             }else{
-              $image = "<img class='center' src='images/select_invalid_application.png' 
-                          title='".sprintf(_("This application is not available in any release named %s."),$this->FAIrelease)."'>&nbsp;";
+              $image = "<img class='center' alt='F' src='images/select_invalid_application.png' 
+                          title=\"".sprintf(_("This application is not available in any release named %s."),$this->FAIrelease)."\">&nbsp;";
             }
       
           }elseif(isset($Differences[$entry['App']]) && ($Differences[$entry['App']] == true)) {
@@ -900,7 +916,7 @@ class appgroup extends plugin
     $this->cleanup();
     
     $ldap->modify ($this->attrs); 
-
+    @log::log("remove","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error());
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/applications with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -954,6 +970,12 @@ class appgroup extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    if($this->initially_was_account){
+      @log::log("modify","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","group/".get_class($this),$use_dn,array_keys($this->attrs),$ldap->get_error()); 
+    }   
+
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/applications with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -983,7 +1005,7 @@ class appgroup extends plugin
 
     /* Special handling for release managed apps */
     $tmp = search_config($this->config->data,"faiManagement","CLASS");
-    if(!empty($tmp)){
+    if(!empty($tmp) && count($this->Releases)){
       $this->enableReleaseManagement = true;
 
       /* Check if release is available */
@@ -1037,7 +1059,7 @@ class appgroup extends plugin
     }
 
     /* Get all apps ... */
-    $res = get_list("objectClass=gosaApplication","application",$this->config->current['BASE'],array("gosaApplicationParameter","cn")); 
+    $res = get_list("objectClass=gosaApplication","application",$this->config->current['BASE'],array("gosaApplicationParameter","cn"),GL_SUBSEARCH); 
     $tmp = search_config($this->config->data,"faiManagement","CLASS");
     $this->AllAppsForRelease = array();
     if(!empty($tmp)){
@@ -1146,6 +1168,14 @@ class appgroup extends plugin
   }
 
 
+  function PrepareForCopyPaste($source)
+  {
+    $this->FAIrelease = $this->InitialFAIrelease = $source->FAIrelease;
+    $this->gosaMemberApplication = $source->gosaMemberApplication;
+    $this->appoption = $source->appoption;
+  }
+
+
   /* Return plugin informations for acl handling  */ 
   function plInfo()
   {