Code

Fixed dhcp saving for renamed objects
[gosa.git] / plugins / admin / fai / class_faiPackage.inc
index 9e092309b90efa1bc32e34583db99db7af668586..32a26f91bb1bca327d91c72be94b119ca651a50d 100644 (file)
@@ -2,11 +2,6 @@
 
 class faiPackage extends plugin
 {
-  /* CLI vars */
-  var $cli_summary      = "Manage server basic objects";
-  var $cli_description  = "Some longer text\nfor help";
-  var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
   /* attribute list for save action */
   var $ignore_account   = TRUE;
 
@@ -200,8 +195,14 @@ class faiPackage extends plugin
 
       /* Assemble sections */
       $repos= $this->getServerInfos();
-      $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
-      $this->FAIdebianSection= array_unique($this->FAIdebianSection);
+
+      if(isset($repos[$this->FAIdebianRelease])){
+        $this->FAIdebianSection= $repos[$this->FAIdebianRelease];
+        $this->FAIdebianSection= array_unique($this->FAIdebianSection);
+      }else{
+        $this->FAIdebianSection = array();
+        print_red(sprintf(_("No repository server found that provide this release '%s'."), $this->FAIdebianRelease));
+      }
 
       /* Assign Repository settings*/ 
       $this->is_account     = true;
@@ -260,7 +261,8 @@ class faiPackage extends plugin
     }
 
     /* Configuration dialog open*/
-    if((isset($_POST['Conpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages']))){
+    if((isset($_POST['Conpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages'][0]))){
+
       $path = CONFIG_DIR."/fai/".$this->FAIdebianRelease."/debconf.d";
       $pkg_config = array();
       $pkg = $_POST['usedPackages'][0];
@@ -564,6 +566,17 @@ class faiPackage extends plugin
   {
     /* Ask for cn */
     $smarty = get_smarty();
+
+    /* Assemble release name */
+    $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']);
+    $tmp= preg_replace('/ou=/', '', $tmp);
+    $rev= array_reverse(split(',', $tmp));
+    $this->FAIdebianRelease= "";
+    foreach ($rev as $part){
+      $this->FAIdebianRelease.= "/$part";
+    }
+    $this->FAIdebianRelease= preg_replace('#^/#', '', $this->FAIdebianRelease);
+
     $smarty->assign("cn" ,$this->cn);
     $str = $smarty->fetch(get_template_path("paste_fai_object.tpl",TRUE));
     $ret = array();