Closes #677: Wiki syntax for announces even after validation, and wiki
[platal.git] / templates / events / form.tpl
index 418b1de..13afdaa 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
+{if $smarty.request.texte}
+{assign var=texte value=$smarty.request.texte}
+{/if}
+{assign var=titre value=$smarty.request.titre|default:$titre}
+{assign var=promo_min value=$smarty.request.promo_min|default:$promo_min}
+{assign var=promo_max value=$smarty.request.promo_max|default:$promo_max}
+{assign var=peremption value=$smarty.request.peremption|default:$peremption}
+{assign var=important value=$smarty.request.important|default:$important}
+
 <script type="text/javascript">//<![CDATA[
   {literal}
   function updatePreview()
     </tr>
     <tr>
       <td class="titre">Texte</td>
-      <td><textarea name="texte" id="texte" rows="10" cols="60" onfocus="update_texte_count(this.form)">{$texte}</textarea></td>
+      <td>
+        <textarea name="texte" id="texte" rows="10" cols="60" onfocus="update_texte_count(this.form)">{$texte}</textarea>
+      </td>
+    </tr>
+    <tr>
+      <td></td>
+      <td class="smaller">
+        <a href="wiki_help/notitle" class="popup3">
+          {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour le texte de l'annonce
+        </a>
+      </td>
     </tr>
     <tr>
       <td colspan="2" class="smaller">
           {/literal}
         //]]></script>
         Essaie de faire un <strong>texte court</strong>, une annonce ne doit pas excéder 800 caractères soit une douzaine de ligne. Tu en es déjà à <input type='text' name='texte_count' size="4" /> caractères.
+        <script type="text/javascript">update_texte_count(document.getElementById('texte').form);</script>
       </td>
     </tr>
     <tr class="pair">
     N'oublie pas de remplir les informations suivantes&nbsp;:
   </p>
 
-  <script type="text/javascript">//<![CDATA[
-    {literal}
-    function updateRange(min, max)
-    {
-      var range = document.getElementById('range');
-      if (min == null) {
-        min = document.getElementById('promo_min').value;
-      }
-      if (max == null) {
-        max = document.getElementById('promo_max').value;
-      }
-      if (isNaN(min) || (min != 0 && (min < 1900 || min > 2020))) {
-        range.innerHTML = '<span class="erreur">La promotion minimum n\'est pas valide</span>';
-        return false;
-      } else if (isNaN(max) || (max != 0 && (max < 1900  || max > 2020))) {
-        range.innerHTML = '<span class="erreur">La promotion maximum n\'est pas valide</span>';
-        return false;
-      } else if (max != 0 && min != 0 && max < min) {
-        range.innerHTML = '<span class="erreur">L\'intervalle de promotion est inversé</span>';
-        return false;
-      } else if (max == 0 && min == 0) {
-        range.innerHTML = 'L\'annonce est destinée à toutes les promotions';
-      } else if (max == 0) {
-        range.innerHTML = 'L\'annonce sera affichée aux promotions plus jeunes que ' + min + ' (incluse)';
-      } else if (min == 0) {
-        range.innerHTML = "L\'annonce sera affichée aux promotions plus anciennes que " + max + ' (incluse)';
-      } else {
-        range.innerHTML = "L\'annonce sera affichées aux promotions de " + min + " à " + max + ' (incluses)';
-      }
-      return true;
-    }
-    {/literal}
-  //]]></script>
-
   <table class="bicol">
     <tr>
       <th colspan="2">Informations complémentaires</th>
         Tu peux limiter la visibilité de ton annonce aux camarades de certaines promotions :
       </td>
     </tr>
-    <tr class="impair">
-      <td class="titre">Promotion la plus ancienne</td>
-      <td>
-        <input type="text" name="promo_min" id="promo_min" size="4" maxlength="4" value="{$promo_min}"
-               onkeyup="return updateRange(null, null);" /> incluse
-        &nbsp;<em>(ex : 1980, 0 signifie pas de minimum)</em>
-      </td>
-    </tr>
-    <tr class="impair">
-      <td class="titre">Promotion la plus jeune</td>
-      <td>
-        <input type="text" name="promo_max" id="promo_max" size="4" maxlength="4" value="{$promo_max}"
-               onkeyup="return updateRange(null, null);" /> incluse
-        &nbsp;<em>(ex : 2000, 0 signifie pas de maximum)</em>
-      </td>
-    </tr>
-    <tr class="impair">
-      <td colspan="2" id="range" class="smaller">
-        <script type="text/javascript">updateRange({$promo_min}, {$promo_max});</script>
-      </td>
-    </tr>
+    {include file="include/field.promo.tpl"}
     <tr class="pair">
       <td colspan="2">
         Choisis la date d'expiration de ton annonce :
         Dernier jour d'affichage
       </td>
       <td>
-        <select name="peremption">
-          {$select|smarty:nodefaults}
-        </select>
+        {valid_date name="peremption" value=$peremption to=60}
       </td>
     </tr>
     {if $admin_evts}