Always display warning about brokens in Xnet directory.
[platal.git] / templates / emails / send.tpl
index 4e9b0d3..3b4d0e1 100644 (file)
       saveMessage();
       return true;
     });
+  $(document).ready(
+    function() {
+      // Remove empty options in select (they were added only for HTML
+      // compatibility).
+      $('#to_contacts option[value=""]').remove();
+      $('#cc_contacts option[value=""]').remove();
+    });
   {/literal}
 //]]>
 </script>
         <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->hruid,$smarty.request.to_contacts)}
-          <option value="{$contact->hruid}">
+          {if in_array($contact->hrpid,$smarty.request.to_contacts)}
+          <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
+          {assign var="to_not_empty" value="true"}
           {/if}
           {/foreach}
-          </select><br />
+          {if !$to_not_empty}
+          {* HTML compatibility *}
+          <option value="">&nbsp;</option>
+          {/if}
+          </select>
+          {if !$to_not_empty}
+          {/if}
+          <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->forlife,$smarty.request.cc_contacts)}
-          <option value="{$contact->forlife}">
+          {if in_array($contact->hrpid,$smarty.request.cc_contacts)}
+          <option value="{$contact->hrpid}">
             {$contact->full_name}
           </option>
+          {assign var="cc_not_empty" value="true"}
           {/if}
           {/foreach}
+          {if !$cc_not_empty}
+          {* HTML compatibility *}
+          <option value="">&nbsp;</option>
+          {/if}
           </select>
         </div>
         <div style="width: 19%; text-align: center; height: 8em; float: right;">
           <div style="height: 4em">
               Destinataires<br />
-              <a href="" onclick="addTo(); return false" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
-              <a href="" onclick="removeTo(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</a>
+              <a href="emails/send/addTo" onclick="addTo(); return false" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
+              <a href="emails/send/removeTo" onclick="removeTo(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</a>
           </div>
           <div style="height: 4em">
               En copie<br />
-              <a href="" onclick="addCc(); return false" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
-              <a href="" onclick="removeCc(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</a>
+              <a href="emails/send/addCc" onclick="addCc(); return false" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
+              <a href="emails/send/removeCc" onclick="removeCc(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</a>
           </div>
         </div>
         <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->hruid,$smarty.request.to_contacts) && !in_array($contact->hruid,$smarty.request.cc_contacts)}
-            <option value="{$contact->hruid}">
+            {if !in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts)}
+            <option value="{$contact->hrpid}">
               {$contact->full_name}
             </option>
             {/if}
             {/foreach}
           </select>
         </div>
-        {foreach item=contact from=$contacts}
-        <input type="hidden" name="contacts[{$contact->hruid}]" value="{$contact->display_name} &lt;{$contact->forlife}&gt;" />
-        {/foreach}
       </td>
     </tr>
     {/if}