Code

msgPool
[gosa.git] / gosa-plugins / dhcp / admin / systems / services / dhcp / class_servDHCP.inc
index c804ec2bc17a013aa45265ac27f7c736ff4608be..efca699cc797d6140cbb1a2b1d7aec2e448e167f 100644 (file)
@@ -100,15 +100,15 @@ class servdhcp extends goService
       $this->dialog = FALSE;
       $id = $this->take_over_id;
       $smarty->assign("dns_take_over",TRUE);
-      $warning = sprintf(_("You are going to migrate the DHCP setup from server '%s'."),
+      $warning = sprintf(_("You have requested a migration of the DHCP setup from server '%s' to the current one."),
         $this->dhcp_server_list['ENTRIES'][$id]['cn'][0]);
-      $warning.= " "._("The migration will be started when you save this system. To cancel this action, use the cancel button below.");
+      $warning.= " "._("The migration will be started when you save this system.");
 
       if($this->display_warning){
-        print_red($warning);
+        msg_dialog::display(_("Warning"), $warning, WARNING_DIALOG);
         $this->display_warning = FALSE;
       }
-      return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE)));
+      return($smarty->fetch(get_template_path('servdhcp.tpl', TRUE, dirname(__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 {
-        print_red(_("You're not allowed to remove DHCP sections!"));
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
       }
       $this->dialog= FALSE;
     }
@@ -252,8 +252,8 @@ 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));
-          return($smarty->fetch(get_template_path('remove_dhcp.tpl', TRUE)));
+          $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);
     }
 
@@ -362,7 +356,7 @@ class servdhcp extends goService
 
     /* Display tempalte */
     $smarty->assign("DhcpList",$DhcpList->DrawList());
-    $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE));
+    $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE, dirname(__FILE__)));
     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){
@@ -671,7 +677,7 @@ class servdhcp extends goService
 
     /* That should not happen... */
     if ($type == ""){
-      print_red(_("DHCP configuration set is unknown. Please contact your system administrator."));
+      msg_dialog::display(_("Error"), _("The DHCP configuration set is unkown. Please contact your system administrator."), ERROR_DIALOG);
     }
     
     return ($type);