{**************************************************************************}
{* *}
-{* Copyright (C) 2003-2008 Polytechnique.org *}
+{* Copyright (C) 2003-2011 Polytechnique.org *}
{* http://opensource.polytechnique.org/ *}
{* *}
{* This program is free software; you can redistribute it and/or modify *}
{* *}
{**************************************************************************}
-<h1>Envoyer un mail</h1>
+<h1>Envoyer un email</h1>
-{javascript name="jquery"}
<script type="text/javascript">//<![CDATA[
{literal}
function _selectAll(id) {
{
_selectAll('to_contacts');
_selectAll('cc_contacts');
- if(form.sujet.value == "" && !confirm("Le sujet du mail est vide, veux-tu continuer ?")) {
+ if(form.sujet.value == "" && !confirm("Le sujet de l'email est vide, veux-tu continuer ?")) {
form.sujet.focus();
return false;
}
if (form.to.value == "" && form.cc.value == ""
&& document.getElementById('to_contacts').length == 0 && document.getElementById('cc_contacts').length == 0) {
if (form.bcc.value == "") {
- alert("Il faut définir au moins un destinataire au mail.");
+ alert("Il faut définir au moins un destinataire.");
return false;
}
if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer ?")) {
for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) {
ccc += form['cc_contacts[]'].options[i].value + ";";
}
- $.post(platal_baseurl + "emails/send",
+ $.xpost("emails/send",
{ save: true,
+ token: '{xsrf_token}',
from: form.from.value,
to_contacts: toc,
cc_contacts: ccc,
saveMessage();
return true;
});
+ $(
+ function() {
+ // Remove empty options in select (they were added only for HTML
+ // compatibility).
+ $('#to_contacts option[value=""]').remove();
+ $('#cc_contacts option[value=""]').remove();
+ });
+
+ $(function() {
+ $("[name='to']").focus();
+ });
{/literal}
//]]>
</script>
+<p>
+ <small>{icon name=information title="Envoi d'email"} Pour envoyer un email, tu peux soit le faire depuis l'interface
+ ci-dessous, soit utiliser <a href="Xorg/SMTPSecurise">notre serveur d'envoi SMTP</a>.</small>
+</p>
+
<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 :</td>
<td>
<input type='hidden' name='signature' value='1' />
<input type='text' name='from' size='60' value='{if $smarty.request.from}
{$smarty.request.from}
{else}
-"{$smarty.session.prenom} {$smarty.session.nom_usage|default:$smarty.session.nom}" <{$smarty.session.bestalias}@{#globals.mail.domain#}>
+"{$user->fullName()}" <{$user->bestEmail()}>
{/if}' />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">à :</td>
<td>
<input type='text' name='to' size='60' value="{$smarty.request.to}" />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">copie :</td>
<td>
<input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">copie cachée :</td>
<td>
<input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
<tr class="pair">
<td colspan="2" class="smaller">
• Les destinataires sont simplement séparés par des virgules.<br />
- • Pense à te mettre en copie cachée du mail pour en avoir une trace.
+ • Pense à te mettre en copie cachée de l'email pour en avoir une trace.
</td>
</tr>
{if $contacts|@count}
<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.forlife, $smarty.request.to_contacts)}
- <option value="{$contact.forlife}">
- {$contact.prenom} {$contact.nom} (X{$contact.promo})
+ {if t($smarty.request.to_contacts) && 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=""> </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}">
- {$contact.prenom} {$contact.nom} (X{$contact.promo})
+ {if t($smarty.request.cc_contacts) && 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=""> </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">>> >></a><br />
- <a href="" onclick="removeTo(); return false" style="text-decoration: none"><< <<</a>
+ <a href="emails/send/addTo" onclick="addTo(); return false" style="text-decoration: none">>> >></a><br />
+ <a href="emails/send/removeTo" onclick="removeTo(); return false" style="text-decoration: none"><< <<</a>
</div>
<div style="height: 4em">
En copie<br />
- <a href="" onclick="addCc(); return false" style="text-decoration: none">>> >></a><br />
- <a href="" onclick="removeCc(); return false" style="text-decoration: none"><< <<</a>
+ <a href="emails/send/addCc" onclick="addCc(); return false" style="text-decoration: none">>> >></a><br />
+ <a href="emails/send/removeCc" onclick="removeCc(); return false" style="text-decoration: none"><< <<</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.forlife, $smarty.request.to_contacts) && !in_array($contact.forlife, $smarty.request.cc_contacts)}
- <option value="{$contact.forlife}">
- {$contact.prenom} {$contact.nom} (X{$contact.promo})
+ {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>
{/if}
{/foreach}
</select>
</div>
- {foreach item=contact from=$contacts}
- <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" />
- {/foreach}
</td>
</tr>
{/if}
<legend>Sujet : <input type='text' name='sujet' size='60' value="{$smarty.request.sujet}" /></legend>
<div class="center">
Tu peux utiliser des <a href="wiki_help" class="popup3">{icon name=information title="Syntaxe wiki"} marqueurs wiki</a> pour formatter ton texte.<br />
- <small><input type="checkbox" name="nowiki" value="1" {if $smarty.request.nowiki}checked="checked"{/if} onchange="updateWikiView(this);" />
- coche cette case pour envoyer le mail en texte brut, sans formattage</small>
+ <small><label><input type="checkbox" name="nowiki" value="1" {if $smarty.request.nowiki}checked="checked"{/if} onchange="updateWikiView(this);" />
+ coche cette case pour envoyer l'email en texte brut, sans formattage</label></small>
</div>
<div id="preview">
<div id="preview_pv" style="display: none">
- <strong>Aperçu du mail :</strong>
+ <strong>Aperçu de l'email :</strong>
<div id="mail_preview">
</div>
<div class="center">
{$smarty.request.contenu}
{if !$smarty.request.contenu}
--
-{$smarty.session.prenom} {$smarty.session.nom}
+{$smarty.session.user->full_name}
{/if}</textarea>
<script type="text/javascript">//<![CDATA[
{literal}
function removeAttachments()
{
- Ajax.update_html(null, 'emails/send', null);
- document.getElementById('att_already').style.display = 'none';
- document.getElementById('att_form').style.display = '';
+ $.xget('email/send');
+ $('#att_already').hide();
+ $('#att_form').show();
}
{/literal}
//]]></script>