Code

Added hotfix for hotplug deletion.
[gosa.git] / plugins / personal / environment / class_hotplugDialog.inc
index bf243fffd9f74cab7fd526c062b6d3ef988292c9..22b11d98880c027770dc000a601b56d29f5678bf 100644 (file)
@@ -34,6 +34,9 @@ class hotplugDialog extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
@@ -64,8 +67,7 @@ class hotplugDialog extends plugin
       $smarty->assign("alphabet", generate_alphabet());
       $smarty->assign("search_image", get_template_path('images/search.png'));
       $smarty->assign("tree_image", get_template_path('images/tree.png'));
-      $smarty->assign("infoimage", get_template_path('images/info.png'));
-      $smarty->assign("launchimage", get_template_path('images/launch.png'));
+      $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
       $smarty->assign("deplist", $this->config->idepartments);
 
 
@@ -105,15 +107,22 @@ class hotplugDialog extends plugin
   {
     $message= array();
     if(!$this->use_existing){
-      if((empty($this->HOT_name))||(preg_match("/[^a-z0-9]/i",$this->HOT_name))){
-        $message[]=_("Please specify a valid name.");
+      if((empty($this->HOT_name))||(preg_match("/[^a-z0-9 ]/i",$this->HOT_name))){
+        $message[]=_("Please specify a valid name. Only 0-9 a-Z is allowed.");
       }
       if((empty($this->HOT_description))||(preg_match("/[^a-z0-9!\"?.,;:-_\(\) ]/i",$this->HOT_description))){
-        $message[]=_("Please specify a valid description.");
+        $message[]=_("Invalid character in description. Please specify a valid description.");
       }
       if((empty($this->HOT_id))||(preg_match("/[\|]/i",$this->HOT_id))){
         $message[]=_("Please specify a valid id.");
       }
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDevice=".$this->HOT_name."*))");
+    if($ldap->count()){
+      $message[]=_("An Entry with this name already exists.");
+    }
+
     }else{
       if((!isset($_POST['hotplugName']))||(empty($_POST['hotplugName']))){
         $message[] = _("Please select an entry or press cancel.");