Code

Added NBD as a "share" type
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Sep 2008 13:33:43 +0000 (13:33 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Sep 2008 13:33:43 +0000 (13:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12567 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc

index 158f055f6233e7c353f4f056866889d09258e07e..105d9565db00261eca8d23d45608b98ad50171e0 100644 (file)
@@ -31,10 +31,11 @@ class servnfs extends plugin
     $dn = $parent->dn;
     plugin::plugin ($config, $dn);
 
-    $this->types   = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
+    $this->types   = array("NBD" => "NBD", "CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
     if($dn){
       $this->host = substr($dn, 3, strpos($dn, ',')-3);
     }
+    asort($this->types);
 
     $this->charsets = array();
 
@@ -178,8 +179,14 @@ class servnfs extends plugin
       $message[]= msgPool::required(_("Path"));
     }
 
-    if(!tests::is_path($this->path)){
-      $message[]= _("'Path / Volume' must contain at least one '/'!");
+    if($this->type == "NBD") {
+      if (!preg_match('/^[a-z0-9-]+:[0-9]+$/', $this->path)){
+        $message[]= _("'Path / Volume' must be of format 'server:port'!");
+      }
+    } else {
+      if (!tests::is_path($this->path)){
+        $message[]= _("'Path / Volume' must contain at least one '/'!");
+      }
     }
 
     if(!in_array($this->type,$this->types)){