Code

Added simple check to avoid missing values
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 13:21:16 +0000 (13:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 13:21:16 +0000 (13:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19716 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/Device.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_Device.inc

index 3eb9696ac2d816c8e2a812cfdaf02bb4fa342562..d4a3e45e900c05e9b2662bbb4bc79363c34583da 100644 (file)
                         {/render}
                     </td>
                 </tr>
+                <tr>
+                    <td><LABEL for='deviceType'>{t}Type{/t}</LABEL>
+                    </td>
+                    <td>
+                        {render acl=$deviceTypeACL}
+                            <input type="text" name="deviceType" value="{$deviceType}" id="deviceType" value="{$deviceType}">
+                        {/render}
+                    </td>
+                </tr>
             </table>
 
             <hr>
index f027ab1529f867887e8696f4a68c4f59bb6dd388..1a7eac72cd82973664d5691e7d8b046adef97ca6 100644 (file)
@@ -84,6 +84,28 @@ class Device extends plugin
         return($smarty->fetch(get_template_path('goto/Device/Device.tpl', TRUE)));
     }
 
+
+    /*! \brief  Validate the user input.
+     */ 
+    function check()
+    {   
+        $message = plugin::check();
+       
+        // If one of the registered user attributes is set, 
+        //  the others have to be set too.
+        $str = $this->manager.$this->deviceUUID.$this->deviceStatus;
+        if(!empty($str)){        
+            foreach($this->dynClasses['registeredDevice'] as $attr){
+                if(empty($this->$attr)){
+                    $message[] = "Please set all values for 'registered device' or leave all blank! {$attr}";
+                    break;
+                }
+            }
+        }
+        return($message);
+    }
+
    
     /*! \brief  Detect an object's name by querying the ldap
      *           for the object's cn.
@@ -210,7 +232,8 @@ class Device extends plugin
                         "description" => _("Description"),
                         "manager" => _("Manager"),
                         "deviceUUID" => _("Uuid"),
-                        "deviceStatus" => _("Stauts"),
+                        "deviceStatus" => _("Status"),
+                        "deviceType" => _("Type"),
                         "macAddress" => _("MAC address"),
                         "ipHostNumber" => _("IP address")
                         )