Code

msgPool
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Mar 2008 14:59:26 +0000 (14:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Mar 2008 14:59:26 +0000 (14:59 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9749 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_servDHCP.inc

index e1bf7566fafe97228454b20cf846c0f19af3c502..ad7ed984263a09df28ff0c2cda2a96e8d51e12ca 100644 (file)
@@ -87,10 +87,10 @@ class dhcpGroup extends dhcpPlugin
 
     /* All required fields are set? */
     if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
+      $message[]= msgPool::required(_("Name"));
     }
     if (!preg_match('/^[a-z0-9_-]*$/i', $this->cn)){
-      $message[]= _("Field 'Name' contains illegal characters.");
+      $message[]= msgPool::invalid(_("Name"),$this->cn,"/[a-z0-9_-]/i");
     }
 
     /* cn already used? */
@@ -98,7 +98,7 @@ class dhcpGroup extends dhcpPlugin
 
       foreach($cache as $dn => $dummy){
         if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
+          $message[]= msgPool::duplicated(_("Name"));
           break;
         }
       }
index 4e0d3fdcd1d25e1afde42ba42b3ec5fd6dea01e2..87f4f247abb362aa0118bd658747defef2587426 100644 (file)
@@ -134,7 +134,7 @@ class dhcpHost extends dhcpPlugin
   
     /* All required fields are set? */
     if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
+      $message[]= msgPool::required(_("Name"));
     }
 
     /* cn already used? */
@@ -142,7 +142,7 @@ class dhcpHost extends dhcpPlugin
       
       foreach($cache as $dn => $dummy){
         if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
+          $message[]= msgPool::duplicated(_("Name"));
           break;
         }
       }
@@ -151,7 +151,7 @@ class dhcpHost extends dhcpPlugin
     /* Check syntax of MAC address */
     $check= preg_replace('/^[^\s]*\s/', '', $this->dhcpHWAddress);
     if (!preg_match('/^([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2}$/', $check)){
-      $message[]= _("The hardware address specified by you is not valid!");
+      $message[]= msgPool::invalid(_("Hardware address"));
     }
 
     /* Check external plugins */
index 47cd4875069bb40ade41b796a59ce315e288357c..1b945354238c060d073dc39fd6155b10ad47794a 100644 (file)
@@ -39,7 +39,7 @@ class dhcpNetwork extends plugin
     /* Check for iteraction */
     if (isset($_POST['add_dns']) && $_POST['addserver'] != ""){
       if (!preg_match('/^[0-9a-z.-]+$/', get_post('addserver'))){
-        msg_dialog::display(_("Error"), sprintf(_("'%s' is not a valid DNS server name!"), htmlentities(get_post('addserver'))), ERROR_DIALOG);
+        msg_dialog::display(_("Error"), msgPool::invalid(_("Name"),htmlentities(get_post('addserver')),"/[0-9a-z.-]/"), ERROR_DIALOG);
       } else {
         $servers= array();
         if (isset($this->options['domain-name-servers'])){
index f5d90af0fa79b5532cf9c471cae8ef35917a4321..40c2d78903f0b3689e14c6f3b2f20c4a75cd67f3 100644 (file)
@@ -103,7 +103,7 @@ class dhcpPool extends dhcpPlugin
 
     /* All required fields are set? */
     if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
+      $message[]= msgPool::required(_("Name"));
     }
 
     /* cn already used? */
@@ -111,22 +111,22 @@ class dhcpPool extends dhcpPlugin
 
       foreach($cache as $dn => $dummy){
         if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this section is already used!");
+          $message[]= msgPool::duplicated(_("Name"));
           break;
         }
       }
     }
 
     if ($this->dhcpRange == ""){
-      $message[]= _("Required field 'Range' is not filled.");
+      $message[]= msgPool::required(_("Range"));
     }
 
     if (!tests::is_ip($this->range_start) || !tests::is_ip($this->range_stop)){
-      $message[]= _("Field 'Range' contains invalid IP addresses.");
+      $message[]= msgPool::invalid(_("Range"));
     }
 
     if(!tests::is_ip_range($this->range_start,$this->range_stop)){
-      $message[] = _("Field 'Range' contains invalid IP range.");
+      $message[]= msgPool::invalid(_("Range"));
     }
 
     /* Check if range is in the network */
index 13c5bccd3884a47bc1b2e7f4b535a736cf06b4b5..eb08362d76d482fff52cc01b99c0071dc439fe3f 100644 (file)
@@ -137,13 +137,13 @@ class dhcpService extends dhcpPlugin
     $message= array();
 
     if (!tests::is_id($this->statements['default-lease-time'])){
-      $message[]= _('Default lease time needs to be numeric.');
+      $message[]= msgPool::invalid(_("Lease time"),$this->statements['default-lease-time'],"/[0-9]/");
     }
     if (!tests::is_id($this->statements['max-lease-time'])){
-      $message[]= _('Maximum lease time needs to be numeric.');
+      $message[]= msgPool::invalid(_("May lease time"),$this->statements['max-lease-time'],"/[0-9]/");
     }
     if ($this->statements['default-lease-time'] > $this->statements['max-lease-time']){
-      $message[]= _('Default lease time needs to smaller than the maximum lease time.');
+      $message[]= msgPool::toobig(_("Default lease time"),_("Maximum lease time"));
     }
 
     /* Check external plugins */
index 047dd27d33b1296509e915be359afd60f82cff11..c521b30487569ed59ac6a46186683754daa834c9 100644 (file)
@@ -142,7 +142,7 @@ class dhcpSharedNetwork extends dhcpPlugin
 
     /* All required fields are set? */
     if ($this->cn == ""){
-      $message[]= _("Required field 'Name' is not filled.");
+      $message[]= msgPool::required(_("Name"));
     }
 
     /* Check lease times */
@@ -151,7 +151,7 @@ class dhcpSharedNetwork extends dhcpPlugin
           "min-lease-time" => _("Min. lease time")) as $key => $val){
       if (isset($this->statements[$key]) && $this->statements[$key] != "" && 
           !tests::is_id($this->statements[$key])){
-        $message[]= sprintf(_("The value specified as '%s' is not numeric!"), $val);
+        $message[]= msgPool::invalid($val,$this->statements[$key],"/[0-9]/");
       }
     }
 
@@ -160,7 +160,7 @@ class dhcpSharedNetwork extends dhcpPlugin
 
       foreach($cache as $dn => $dummy){
         if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this host section is already used!");
+          $message[]= msgPool::duplicated(_("Name"));
           break;
         }
       }
index dad9fd4dd596fd0de017c4d8fa6f5cb51d1e7bc9..04b9ceb8035af21bc79d3d41ac956dc1972cef9a 100644 (file)
@@ -133,10 +133,10 @@ class dhcpSubnet extends dhcpPlugin
 
     /* All required fields are set? */
     if ($this->cn == ""){
-      $message[]= _("Required field 'Network address' is not filled.");
+      $message[]= msgPool::required(_("Network address"));
     }
     if ($this->dhcpNetMask == ""){
-      $message[]= _("Required field 'Netmask' is not filled.");
+      $message[]= msgPool::required(_("Netmask"));
     }
 
     /* cn already used? */
@@ -144,7 +144,7 @@ class dhcpSubnet extends dhcpPlugin
 
       foreach($cache as $dn => $dummy){
         if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
-          $message[]= _("The name for this section is already used!");
+          $message[]= msgPool::duplicated(_("Name"));
           break;
         }
       }
@@ -153,14 +153,14 @@ class dhcpSubnet extends dhcpPlugin
     /* IP's? */
     foreach(array('dhcpNetMask' => _("Netmask"), 'cn' => _("Network address"), 'range_start' => _("Range"), 'range_stop' => _("Range")) as $attr => $str){
       if ($this->$attr != "" && !tests::is_ip($this->$attr)){
-        $message[]= sprintf(_("The field '%s' contains an invalid IP address"), $str);
+        $message[]= msgPool::invalid($str,"","","192.168.0.23");
       }
     }
 
     /* Check ip range */
     if ($this->use_range){
       if(!tests::is_ip_range($this->range_start,$this->range_stop)){
-        $message[] = _("Field 'Range' contains invalid IP range.");
+        $message[]= msgPool::invalid(_("Network range"));
       }
 
       /* Check if range is in the network */
index b59584a40198f24b2c6a8670f7f1c26fc88a6cde..efca699cc797d6140cbb1a2b1d7aec2e448e167f 100644 (file)
@@ -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;
     }
@@ -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);
     }