Code

Changed release tag saving. It is now saved within a new Attribute.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 07:18:27 +0000 (07:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 27 Apr 2006 07:18:27 +0000 (07:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3139 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/application.tpl
plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupGeneric.inc

index 368ef147c2bbb213edbc0bb62cecb4b78c6c85bd..31f015199aa8d57df06bb58e8394c96353255af2 100644 (file)
@@ -2,8 +2,8 @@
        <br>
        <b>{t}Release focus{/t}</b>&nbsp;
        {if $ReleaseSelectAble}
-               <select name="Release" title="{t}Select release name{/t}" onChange="javascript: document.mainform.submit();">
-                       {html_options output=$Releases values=$Releases selected=$Release}
+               <select name="FAIrelease" title="{t}Select release name{/t}" onChange="javascript: document.mainform.submit();">
+                       {html_options output=$Releases values=$Releases selected=$FAIrelease}
                </select>
        {else}
                {$Release}
index d95e2801df74fcce92d9bc801a9020edd4255a58..7024f1a491f72a4a5091cbb0dcd4b8ce67038c4b 100644 (file)
@@ -27,8 +27,8 @@ class appgroup extends plugin
   var $attributes               = array("gosaMemberApplication");
   var $objectclasses            = array("gosaApplicationGroup");
 
-  var $Release                  = "/";
-  var $InitialRelease           = "/";
+  var $FAIrelease               = "/";
+  var $InitialFAIrelease           = "/";
   var $Releases                 = array();
   var $enableReleaseManagement  = false;
 
@@ -40,8 +40,31 @@ class appgroup extends plugin
 
   function appgroup ($config, $dn= NULL)
   {
+   
+    /* prepare group app for release management */ 
+    $tmp = search_config($config->data,"faiManagement","CLASS");
+    if(!empty($tmp)){
+      $this->enableReleaseManagement = true;
+      $this->objectclasses [] = "FAIreleaseTag";
+      $this->attributes[] =  "FAIrelease";
+    }
+
     plugin::plugin ($config, $dn);
 
+    /* In some case of old applikations with old release tag saving, we 
+        must reassign is_account state.
+       (Or if release management wasn't activated before creating this app) */
+    if($this->enableReleaseManagement){
+  
+      /* Release management is activated && this is a valid group app account,
+          but no release class was found, so activate is_account flag  */
+      if(( in_array("gosaApplicationGroup",$this->attrs['objectClass'])) && 
+         (!in_array("FAIreleaseTag",$this->attrs['objectClass']))){
+        $this->is_account =true;
+      }
+    }
+    
+
     /* Load member applications */
     if (isset ($this->attrs["gosaMemberApplication"][0])){
       $this->gosaMemberApplication = array();
@@ -120,13 +143,9 @@ class appgroup extends plugin
     $this->gosaMemberApplication = $tmp;
     $this->curbase = $this->config->current['BASE'];
     
-    /* Check if we should enable the release selection 
-     */
-    $tmp = search_config($config->data,"faiManagement","CLASS");
-    if(!empty($tmp)){
-      $this->enableReleaseManagement = true;
-      $this->Release        = $this->getReleaseName();
-      $this->InitialRelease = $this->Release;
+    /* Get required release informations */
+    if($this->enableReleaseManagement){
+      $this->InitialFAIrelease = $this->FAIrelease;
       $this->Releases       = $this->getReleases();
     }
   }
@@ -170,7 +189,7 @@ class appgroup extends plugin
     $ret =array();
   
     /* If current release has changed */
-    if($this->Release != $this->InitialRelease){
+    if($this->FAIrelease != $this->InitialFAIrelease){
   
       /* Walk through all apps which are currently displayed */
       foreach($this->gosaMemberApplication[$this->curCatDir] as $entry){
@@ -182,12 +201,12 @@ class appgroup extends plugin
           $new = array();   // New parameters 
 
           /* There are possibly no parameters specified */
-          if(isset($this->AllAppsForReleaseParameter[$this->InitialRelease][$entry['App']])){
-            $old = $this->AllAppsForReleaseParameter[$this->InitialRelease][$entry['App']];
+          if(isset($this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']])){
+            $old = $this->AllAppsForReleaseParameter[$this->InitialFAIrelease][$entry['App']];
           }
 
-          if(isset($this->AllAppsForReleaseParameter[$this->Release][$entry['App']])){
-            $new = $this->AllAppsForReleaseParameter[$this->Release][$entry['App']];
+          if(isset($this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']])){
+            $new = $this->AllAppsForReleaseParameter[$this->FAIrelease][$entry['App']];
           }
 
           /*  Both (old & new) have no gosaApplicationParameter
@@ -471,7 +490,7 @@ class appgroup extends plugin
         $tmp = search_config($this->config->data,"faiManagement","CLASS");
         if(!empty($tmp)){
           $tmp = array_flip($this->Releases);
-          $base = $tmp[$this->Release];
+          $base = $tmp[$this->FAIrelease];
 
           $ldap->cd($this->config->current['BASE']);
           $ldap->search("(&(objectClass=gosaApplication)(cn=$appname))",array("gosaApplicationParameter"));
@@ -724,7 +743,7 @@ class appgroup extends plugin
                           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->Release)."'>&nbsp;";
+                          title='".sprintf(_("This application is not available in any release named %s."),$this->FAIrelease)."'>&nbsp;";
             }
       
           }elseif(isset($Differences[$entry['App']]) && ($Differences[$entry['App']] == true)) {
@@ -749,7 +768,7 @@ class appgroup extends plugin
     $smarty->assign("enableReleaseManagement",$this->enableReleaseManagement);
  
     if($this->enableReleaseManagement){
-      $smarty->assign("Release",  $this->Release);
+      $smarty->assign("FAIrelease",  $this->FAIrelease);
       $smarty->assign("Releases", $this->Releases);
 
       if(count($this->used_apps)){
@@ -802,9 +821,7 @@ class appgroup extends plugin
 
   function save_object()
   {
-    if(isset($_POST ['Release'])){
-      $this->Release = $_POST['Release'];
-    }
+    plugin::save_object();
   }
  
 
@@ -861,7 +878,7 @@ $ldap->modify ($this->attrs);
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
     $this->cleanup();
-$ldap->modify ($this->attrs); 
+    $ldap->modify ($this->attrs); 
 
     show_ldap_error($ldap->get_error());
 
@@ -897,15 +914,15 @@ $ldap->modify ($this->attrs);
       $this->enableReleaseManagement = true;
 
       $tmp = array_flip($this->Releases);
-      if(isset($tmp[$this->Release])){
-        $base =  $tmp[$this->Release];
+      if(isset($tmp[$this->FAIrelease])){
+        $base =  $tmp[$this->FAIrelease];
       }else{
         $k = key($tmp);
         $r = $tmp[$k];
-        $this->Release = $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->Release,$k));
+        print_red(sprintf(_("Can't resolve the release name '%s', setting release name to '%s'. Possibly the objects base has changed."),$this->FAIrelease,$k));
       }
 
       $base = preg_replace("/ou=apps,.*$/","ou=apps,".$this->curbase,$base);
@@ -944,9 +961,9 @@ $ldap->modify ($this->attrs);
         $testdn = preg_replace("/^[^,]+/","",$testdn);
         $testdn = preg_replace("/^,/","",$testdn);
 
-        if($testdn == preg_replace("/ou=apps,.*$/","ou=apps",$tmp[$this->Release])){
+        if($testdn == preg_replace("/ou=apps,.*$/","ou=apps",$tmp[$this->FAIrelease])){
           $this->AllAppsForRelease[$attrs['dn']] = $attrs['cn'][0];
-          $this->AllAppsForReleaseParameter[$this->Release][$attrs['cn'][0]] = $attrs;
+          $this->AllAppsForReleaseParameter[$this->FAIrelease][$attrs['cn'][0]] = $attrs;
         }
       }
     }else{
@@ -1019,34 +1036,6 @@ $ldap->modify ($this->attrs);
     }
   return($ret);
   }
-
-
-  /* Get selected release name.
-   *  it is written in the description tag 
-   *  within ... (.*)$
-   */
-  function getReleaseName()
-  {
-  
-    if(isset($this->parent)){
-      $base = $this->parent->by_object['group'];
-    }else{
-      $base = $this;
-    }
-
-    if(isset($base->attrs['description'][0])){
-      $desc = $base->attrs['description'][0];
-    }else{
-      $desc = "";
-    }
-    if(preg_match("/\(.*\)$/",$desc)){
-      $str = preg_replace("/^.*\((.*)\)$/","\\1",$desc);
-    }else{
-      $str = "/";
-    }
-    return($str);  
-  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 05d8181e44474bd8f1def33ad977af4391966f21..61a63131439c63402c0361fbb53458343999457d 100644 (file)
@@ -48,13 +48,6 @@ class group extends plugin
   {
     plugin::plugin ($config, $dn);
 
-    /* remove Release Tag if we have release management enabled 
-     */
-    $tmp = search_config($config->data,"faiManagement","CLASS");
-    if(!empty($tmp)){
-      $this->description = preg_replace("/\(.*\)$/","",$this->description);
-    }
-  
     /* Load attributes depending on the samba version */
     $this->samba3= ($config->current['SAMBAVERSION'] == 3);
     $this->orig_dn= $dn;
@@ -581,24 +574,6 @@ class group extends plugin
       }
     }
   
-    /* If release management is enabled .... 
-        Append release name to description tag ..
-       #FIXME release name within description is a very bad solution, use ldap attribute instead
-     */
-    $tmp = search_config($this->config->data,"faiManagement","CLASS");
-    if(!empty($tmp)){
-      if(isset($this->parent)){
-        if(isset($this->parent->by_object['appgroup'])){
-          $baseObj = $this->parent->by_object['appgroup'];
-          if($baseObj->is_account){
-            if(isset($baseObj->Release)){
-              $this->description .= " (".trim($baseObj->Release).")";
-            }
-          }
-        }
-      }
-    }
-
     plugin::save(); 
 
     /* Remove objectClass for samba/phone support */