Code

Fixed Terminal/Workstation -template string in mangement list.
[gosa.git] / plugins / admin / groups / class_groupApplication.inc
index 17aabaf41f75d3a39831e63898a458e132eed112..df6f8c094fa44ec231f94f5bc2b0978c49ce3534 100644 (file)
@@ -39,7 +39,7 @@ class appgroup extends plugin
   var $gosaApplicationParameter ;
 
 
-  function appgroup ($config, $dn= NULL)
+  function appgroup ($config, $dn= NULL, $parent= NULL)
   {
    
     /* prepare group app for release management */ 
@@ -50,7 +50,7 @@ class appgroup extends plugin
       $this->attributes[] =  "FAIrelease";
     }
 
-    plugin::plugin ($config, $dn);
+    plugin::plugin ($config, $dn, $parent);
 
     /* In some case of old applikations with old release tag saving, we 
         must reassign is_account state.
@@ -615,11 +615,14 @@ class appgroup extends plugin
     $departments = array();
     $res = get_list("(objectClass=gosaDepartment)",$ui->subtreeACL,$this->curbase,array("description","cn","ou"),GL_SIZELIMIT);
     foreach($res as $value){
-      $fdn= @LDAP::fix($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{
-        $departments[$value['dn']]=convert_department_dn($fdn);
+        $departments[$value['dn']]= convert_department_dn($fdn);
       }
     }
 
@@ -787,12 +790,11 @@ class appgroup extends plugin
   function getReleases()
   {
     $dn   = $this->config->current['BASE'];
-    $ui   = get_userinfo();
     $ldap = $this->config->get_ldap_link();
-    $returned = get_list("(&(objectClass=organizationalUnit)(objectClass=FAIbranch))",$ui->subtreeACL,$dn,array("ou"));
+    $ldap->cd($dn);
+    $ldap->search("(&(objectClass=organizationalUnit)(objectClass=FAIbranch))",array("ou"));
     $ret =array();
-    
-    foreach($returned as $attrs){
+    while($attrs = $ldap->fetch()){
       if(preg_match("/ou=apps,/",$attrs['dn'])){
         $bb = preg_replace("/ou=apps,.*/","",$attrs['dn']);
         $parts = array_reverse(split("ou=",$bb));
@@ -811,6 +813,12 @@ class appgroup extends plugin
         $ret[$attrs['dn']] = $name;
       }
     }
+
+    /* Set releases to / id nor presenet */
+    if (!count($ret)){
+      $ret['/']= '/';
+    }
+
     return($ret);
   }
 
@@ -905,19 +913,20 @@ 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;
 
       $tmp = array_flip($this->Releases);
       if(isset($tmp[$this->FAIrelease])){
         $base =  $tmp[$this->FAIrelease];
       }else{
+        $old_r =  $this->FAIrelease;
         $k = key($tmp);
         $r = $tmp[$k];
         $this->FAIrelease = $k;
         $base = $r; 
     
-        print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$this->FAIrelease,$k));
+        print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$old_r,$k));
       }
 
       $base = preg_replace("/ou=apps,.*$/","ou=apps,".$this->curbase,$base);