Code

Updated license edit
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Sep 2009 09:52:35 +0000 (09:52 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 25 Sep 2009 09:52:35 +0000 (09:52 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14347 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_licenseGeneric.inc
gosa-plugins/opsi/admin/opsiLicenses/licenseGeneric.tpl

index 0443d7f389bf3e578897a466a534bc325abbfe5c..d1048ac17e895e17d74442519900cb9190ef63f1 100644 (file)
@@ -163,6 +163,29 @@ class licenseGeneric extends plugin
   function check()
   {
     $message = plugin::check();
+
+    // Very simple date input checks
+    if(!empty($this->expirationDate) && 
+       !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->expirationDate)){
+      $message[] = msgPool::invalid(_("Expiration date"),$this->expirationDate,"","2009-02-23");
+    }
+    if(!empty($this->conclusionDate) && 
+       !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->conclusionDate)){
+      $message[] = msgPool::invalid(_("Expiration date"),$this->conclusionDate,"","2009-02-23");
+    }
+    if(!empty($this->notificationDate) && 
+       !preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/",$this->notificationDate)){
+      $message[] = msgPool::invalid(_("Expiration date"),$this->notificationDate,"","2009-02-23");
+    }
+
+    if(empty($this->cn)){
+      $message[] = msgPool::required(_("Name"));
+    }
+
+    if(empty($this->licenseKey)){
+      $message[] = msgPool::required(_("License key"));
+    }
+
     return($message);
   }
   
index c375d2b24b55884ad04d59eeaed39a9e01d6e5b1..242365b3dde00a2e6a15efa0ddf4f69b5c6fb77d 100644 (file)
@@ -16,7 +16,7 @@
         <table>
           <tr>
             <td>
-              {t}Name{/t}
+              {t}Name{/t}{$must}
             </td>
             <td>
               {if $initially_was_account}
               {t}Model{/t}
             </td>
             <td>
-              <select name='licenseModel'>
+              <select name='licenseModel' onChange='document.mainform.submit();'>
                 {html_options options=$licenseModels values=$licenseModels selected=$licenseModel}
               </select>
             </td>
         <table>
           <tr>
             <td>
-              {t}License key{/t}
+              {t}License key{/t}{$must}
             </td>
             <td>
               <input type='text' name='licenseKey' value='{$licenseKey}'>
             </td>
           </tr>
+          {if $licenseModel == "VOLUME"}
           <tr>
             <td>
               {t}Maximum installations{/t}
               <input type='text' name='maximumInstallations' value='{$maximumInstallations}'>
             </td>
           </tr>
+          {/if}
+          {if $licenseModel == "OEM"}
           <tr>
             <td>
               {t}Reserved for Host{/t}
               </select>
             </td>
           </tr>
+          {/if}
         </table>
  
     </td> 
         <table width="100%">
           <tr>
             <td colspan="2">
-              <b>{t}Assigned to Host{/t}</b><br>
+              <b>{t}Used by Host{/t}</b><br>
               <select name='usedByHost[]' multiple size=4 style='width:100%;'>
                 {html_options options=$usedByHost}
               </select><br>