Code

msgPool
[gosa.git] / gosa-plugins / dhcp / admin / systems / services / dhcp / class_servDHCP.inc
index 6fa4628cac0dfd3285a264af0b8367824adb5bf7..efca699cc797d6140cbb1a2b1d7aec2e448e167f 100644 (file)
@@ -138,7 +138,7 @@ class servdhcp extends goService
       $this->dialog->save_object();
       $messages= $this->dialog->check();
       if (count($messages)){
-        show_errors($messages);
+        msg_dialog::displayChecks($messages);
       } else {
         $dn= $this->dialog->dn;
         $class= get_class($this->dialog);
@@ -218,7 +218,7 @@ class servdhcp extends goService
           }
         }
       } else {
-        msg_dialog::display(_("Permission error"), _("You have no permission to remove DHCP sections!"), ERROR_DIALOG);
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
       }
       $this->dialog= FALSE;
     }
@@ -252,7 +252,7 @@ class servdhcp extends goService
         if (isset($this->dhcpObjectCache[$dn])){
           $this->current_object= $dn;
           $this->dialog= 1;
-          $smarty->assign("warning", sprintf(_("You're about to delete the DHCP section '%s'."), $dn));
+          $smarty->assign("warning", msgPool::deleteInfo(@LDAP::fix($dn),_("DHCP section")));
           return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE, dirname(__FILE__))));
         }
       }
@@ -286,9 +286,6 @@ class servdhcp extends goService
 
     /* Show tab dialog headers */
     if ($this->is_account){
-#      $display= $this->show_header(_("Remove DHCP service"),
-#          _("This server has DHCP features enabled. You can disable them by clicking below."));
-
       if (!count($this->dhcpObjectCache)){
         $attrs= array();
         $attrs['dn']= 'cn=dhcp,'.$this->dn;
@@ -305,9 +302,6 @@ class servdhcp extends goService
       }
 
     } else {
-#      $display= $this->show_header(_("Add DHCP service"),
-
-#          _("This server has DHCP features disabled. You can enable them by clicking below."));
       return ($display);
     }
 
@@ -379,7 +373,9 @@ class servdhcp extends goService
     foreach ($this->dhcpObjectCache as $dn => $content){
       if ($this->objectType($dn) == 'dhcpService'){
         $ldap->rmdir_recursive($dn);
-        show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
+        if (!$ldap->success()){
+          msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_DEL, get_class()));
+        }
       }
     }
 
@@ -394,7 +390,9 @@ class servdhcp extends goService
     $this->cleanup();
     $ldap->modify ($this->attrs);
 
-    show_ldap_error($ldap->get_error(), _("Removing DHCP entries failed"));
+    if (!$ldap->success()){
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+    }
 
     /* Optionally execute a command after we're done */
     $this->handle_post_events("remove");
@@ -447,7 +445,9 @@ class servdhcp extends goService
         /* Check if exists, then remove... */
         if($ldap->cat($dn)){
           $ldap->rmdir_recursive($dn);
-          show_ldap_error($ldap->get_error(), _("Can't remove DHCP object!"));
+          if (!$ldap->success()){
+            msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
+          }
         }
         continue;
       }
@@ -521,13 +521,17 @@ class servdhcp extends goService
         $ldap->cd($dn);
         if ($modify){
           $ldap->modify($attrs);
-          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
+          if (!$ldap->success()){
+            msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
+          }
 
           /* Optionally execute a command after we're done */
           $this->handle_post_events("modify");
         } else {
           $ldap->add($attrs);
-          show_ldap_error($ldap->get_error(), _("Can't save DHCP object!"));
+          if (!$ldap->success()){
+            msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_ADD, get_class()));
+          }
 
           /* Optionally execute a command after we're done */
           $this->handle_post_events("create");
@@ -552,7 +556,9 @@ class servdhcp extends goService
     $this->cleanup();
     $ldap->modify ($this->attrs);
 
-    show_ldap_error($ldap->get_error(), _("Saving DHCP service failed"));
+    if (!$ldap->success()){
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_MOD, get_class()));
+    }
 
     /* Optionally execute a command after we're done */
     if ($this->initially_was_account == $this->is_account){