Code

Fixed loading of releases
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Apr 2011 14:08:37 +0000 (14:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Apr 2011 14:08:37 +0000 (14:08 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20776 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/class_ConfigManagementDataModel.inc
gosa-plugins/goto-ng/admin/newConfigManagement/class_newConfigManagement.inc

index 46ccd28862233e95355534c5fb21d8e24dd9939e..d50b3f71b8ce414d8261687a4795588f7fa71ee3 100644 (file)
@@ -69,7 +69,7 @@ class ConfigManagementDataModel
             $parentId = $this->data['linear'][$path]['id'];
             $parentDn = $this->data['linear'][$path]['dn'];
         }else{
-            echo "No parent";
+            trigger_error("Parent item ({$path}) does not exists!");
             return(FALSE);
         }
 
index d3efd96514ed3ab25751d363d74c427c9a06a51d..65172d44d761e3d76c109b3410ebf99d749c0dc4 100644 (file)
@@ -214,9 +214,13 @@ class newConfigManagement extends plugin
                         $rPath = "/root/{$dist['name']}/$rPath";
                         $rName = preg_replace("/^.*\//","", $rPath);
                         $rPath = preg_replace("/\/[^\/]*$/","", $rPath);
-
                         $values = array('name' => $rName);
-                        $this->dataModel->addItem('Release',$rPath, $rName, $values);
+
+                        if(!$this->dataModel->itemExistsByPath($rPath)){
+                            trigger_error("Invalid release name '{$rName}' in path '{$rPath}' received! Skipping entry!");
+                        }else{
+                            $id = $this->dataModel->addItem('Release',$rPath, $rName, $values);
+                        }
                     }
                 }
             }
@@ -546,7 +550,6 @@ class newConfigManagement extends plugin
                     $dist = $this->getDistributionPart($item['path']);
                     $rpc = $this->config->getRpcHandle();
                     $rpc->removeDistribution($dist, array('recursive' => TRUE));
-                    echo "Removing distribution '{$dist}'";
                     if(!$rpc->success()){
                         msg_dialog::display(_("Error"), sprintf(_("Failed to remove the distribution: %s. Error was: %s"), 
                                     $dist, $rpc->get_error()), ERROR_DIALOG);
@@ -560,7 +563,6 @@ class newConfigManagement extends plugin
                     $release = preg_replace("/^.*\//","", $this->getReleasePart($item['path']));
                     $rpc = $this->config->getRpcHandle();
                     $rpc->removeRelease($release, array('recursive' => TRUE));
-                    echo "Removing release '{$release}'";
                     if(!$rpc->success()){
                         msg_dialog::display(_("Error"), sprintf(_("Failed to remove the release: %s. Error was: %s"), 
                                     $release, $rpc->get_error()),ERROR_DIALOG);
@@ -570,7 +572,7 @@ class newConfigManagement extends plugin
                     }
 
                 }else{
-                    echo $item['type']." - are not handled yet!";
+                    trigger_error($item['type']." - are not handled yet!");
                 }
             }
         }
@@ -827,6 +829,8 @@ class newConfigManagement extends plugin
                             $this->dataModel->setItemValues($nP, $values);
                             $this->listing->clearDialogObject();
                         }
+                    }else{
+                        $this->listing->clearDialogObject();
                     }
                 
  
@@ -849,7 +853,7 @@ class newConfigManagement extends plugin
                     }else{
 
                         // We've successfully added/saved the item, now add it to the tree.
-                        $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],array(), '-' );
+                        $this->dataModel->addItem($type, $this->selectedContainer, $values['name'],$values, '-' );
                         $this->listing->clearDialogObject();
                     }
                 }