Only uses autoload to require validation classes.
[platal.git] / templates / emails / send.tpl
index 3b4d0e1..a0d501a 100644 (file)
       $('#to_contacts option[value=""]').remove();
       $('#cc_contacts option[value=""]').remove();
     });
+
+    $(document).ready(function() {
+      $("[name='to']").focus();
+    });
   {/literal}
 //]]>
 </script>
 <form action="emails/send" method="post" enctype="multipart/form-data" id="form_mail" onsubmit="return check(this);">
   {xsrf_token_field}
   <table class="bicol" cellpadding="2" cellspacing="0">
-    <tr> 
+    <tr>
       <th colspan="2">Destinataires</th>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">de&nbsp;:</td>
       <td>
         <input type='hidden' name='signature' value='1' />
 {/if}' />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">à&nbsp;:</td>
       <td>
         <input type='text' name='to' size='60' value="{$smarty.request.to}" />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">copie&nbsp;:</td>
       <td>
         <input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
       </td>
     </tr>
-    <tr> 
+    <tr>
       <td class="titre">copie cachée&nbsp;:</td>
       <td>
         <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
         <div style="float: right; width: 40%;">
           <select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->hrpid,$smarty.request.to_contacts)}
+          {if t($smarty.request.to_contacts) && in_array($contact->hrpid,$smarty.request.to_contacts)}
           <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
           <br />
           <select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
           {foreach key=key item=contact from=$contacts}
-          {if in_array($contact->hrpid,$smarty.request.cc_contacts)}
+          {if t($smarty.request.cc_contacts) && in_array($contact->hrpid,$smarty.request.cc_contacts)}
           <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
         <div style="float: right; width: 40%">
           <select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%">
             {foreach item=contact from=$contacts}
-            {if !in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts)}
+            {if !(isset($smarty.request.to_contacts|smarty:nodefaults) && isset($smarty.request.cc_contacts|smarty:nodefaults)) ||
+                (!in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts))}
             <option value="{$contact->hrpid}">
               {$contact->full_name}
             </option>