Code

Updated device tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jul 2011 12:26:05 +0000 (12:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Jul 2011 12:26:05 +0000 (12:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20944 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 2256d3c7a5249caa6f3b01de643976a6510ee765..0a966a195b63f87029eb0a62616d9ebcabec3714 100644 (file)
@@ -5,7 +5,7 @@
             <h3>{t}Device{/t}</h3>
             <table>
                 <tr>
-                    <td><LABEL for='name'>{t}Name{/t}</LABEL></td>
+                    <td><LABEL for='name'>{t}Name{/t}</LABEL>{if $registeredRequired}{$must}{/if}</td>
                     <td>
                         {render acl=$cnACL}
                             <input type="text" name="cn" value="{$cn}" id="cn" value="{$cn}">
             <h3>{t}Registration{/t}</h3>
             <table>
                 <tr>
-                    <td><LABEL for='deviceUUID'>{t}Device UUID{/t}</LABEL></td>
+                    <td><LABEL for='deviceUUID'>{t}Device UUID{/t}{if $registeredRequired}{$must}{/if}</LABEL></td>
                     <td> 
                         {render acl=$deviceUUIDACL}
                             <input type="text" name="deviceUUID" value="{$deviceUUID}" id="deviceUUID" value="{$deviceUUID}">
         <td class='left-border' style='padding-left:5px; padding-top:10px;'>
             <table>
                 <tr>
-                    <td><LABEL for='deviceStatus'>{t}Status{/t}</LABEL>
+                    <td><LABEL for='deviceStatus'>{t}Status{/t}{if $registeredRequired}{$must}{/if}</LABEL>
                     </td>
                     <td>
                         {render acl=$deviceStatusACL}
                     </td>
                 </tr>
                 <tr>
-                    <td><LABEL for='manager'>{t}Manager{/t}</LABEL>
+                    <td><LABEL for='manager'>{t}Manager{/t}{if $registeredRequired}{$must}{/if}</LABEL>
                     </td>
                     <td>
                         {render acl=$managerACL}
index c2b102cd53d83502d79d67e9bdd6e5da73bbd753..30d276a342f5ec736c1a6fa0f141ed66a4860ffb 100644 (file)
@@ -100,6 +100,10 @@ class Device extends plugin
         foreach($this->attributes as $attr){
             $smarty->assign($attr, set_post($this->$attr));
         }
+
+        // If one attribute of the registered device is given, all others are required too.
+        $str = $this->manager.$this->deviceUUID.$this->deviceStatus;
+        $smarty->assign("registeredRequired", !empty($str));
         return($smarty->fetch(get_template_path('goto/Device/Device.tpl', TRUE)));
     }
 
@@ -114,11 +118,14 @@ class Device extends plugin
         //  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;
-                }
+            if(empty($this->deviceStatus)){
+                $message[] = msgPool::required(_("Status"));
+            }
+            if(empty($this->manager)){
+                $message[] = msgPool::required(_("Manager"));
+            }
+            if(empty($this->deviceUUID)){
+                $message[] = msgPool::required(_("Device UUID"));
             }
         }