Closes #677: Wiki syntax for announces even after validation, and wiki
[platal.git] / templates / events / form.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2007 Polytechnique.org                             *}
4 {*  http://opensource.polytechnique.org/                                  *}
5 {*                                                                        *}
6 {*  This program is free software; you can redistribute it and/or modify  *}
7 {*  it under the terms of the GNU General Public License as published by  *}
8 {*  the Free Software Foundation; either version 2 of the License, or     *}
9 {*  (at your option) any later version.                                   *}
10 {*                                                                        *}
11 {*  This program is distributed in the hope that it will be useful,       *}
12 {*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}
13 {*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}
14 {*  GNU General Public License for more details.                          *}
15 {*                                                                        *}
16 {*  You should have received a copy of the GNU General Public License     *}
17 {*  along with this program; if not, write to the Free Software           *}
18 {*  Foundation, Inc.,                                                     *}
19 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
20 {*                                                                        *}
21 {**************************************************************************}
22
23 {if $smarty.request.texte}
24 {assign var=texte value=$smarty.request.texte}
25 {/if}
26 {assign var=titre value=$smarty.request.titre|default:$titre}
27 {assign var=promo_min value=$smarty.request.promo_min|default:$promo_min}
28 {assign var=promo_max value=$smarty.request.promo_max|default:$promo_max}
29 {assign var=peremption value=$smarty.request.peremption|default:$peremption}
30 {assign var=important value=$smarty.request.important|default:$important}
31
32 <script type="text/javascript">//<![CDATA[
33   {literal}
34   function updatePreview()
35   {
36     if (document.getElementById('image').value != '' || document.getElementById('image_url').value != '') {
37       return true;
38     }
39     var titre = document.getElementById('titre').value;
40     var texte = document.getElementById('texte').value;
41
42     if (titre == '' || texte == '') {
43       document.getElementById('valid').style.display = 'none';
44       document.getElementById('info').style.display = '';
45     } else {
46       document.getElementById('valid').style.display = '';
47       document.getElementById('info').style.display = 'none';
48     }
49     var page  = 'events/preview?titre=' + encodeURIComponent(titre) + '&texte=' + encodeURIComponent(texte);
50     if (is_IE) {
51       {/literal}
52       page = "{$globals->baseurl}/" + page;
53       {literal}
54     }
55     Ajax.update_html('preview', page, null);
56     return false;
57   }
58   {/literal}
59 //]]></script>
60
61 <div id="preview">
62 {include file="events/preview.tpl"}
63 </div>
64 <br />
65
66 <form action="{$platal->path}" method="post" enctype="multipart/form-data">
67   <table class="bicol">
68     <tr>
69       <th colspan="2">Contenu de l'annonce</th>
70     </tr>
71     <tr>
72       <td class="titre">Titre</td>
73       <td>
74         <input type="text" name="titre" id="titre" size="50" maxlength="200" value="{$titre}" />
75       </td>
76     </tr>
77     <tr>
78       <td class="titre">Texte</td>
79       <td>
80         <textarea name="texte" id="texte" rows="10" cols="60" onfocus="update_texte_count(this.form)">{$texte}</textarea>
81       </td>
82     </tr>
83     <tr>
84       <td></td>
85       <td class="smaller">
86         <a href="wiki_help/notitle" class="popup3">
87           {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour le texte de l'annonce
88         </a>
89       </td>
90     </tr>
91     <tr>
92       <td colspan="2" class="smaller">
93         <script type="text/javascript">//<![CDATA[
94           var form_propose_texte = false;
95           {literal}
96           function update_texte_count(f) {
97             if (!form_propose_texte && f) form_propose_texte = f;
98             form_propose_texte.texte_count.value=form_propose_texte.texte.value.length;
99             setTimeout("update_texte_count(0)", 100);
100           }
101           {/literal}
102         //]]></script>
103         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.
104         <script type="text/javascript">update_texte_count(document.getElementById('texte').form);</script>
105       </td>
106     </tr>
107     <tr class="pair">
108       <td class="titre">Illustration</td>
109       <td>
110         {if $eid && $img}
111         <div style="float: left; text-align: center">
112           <em>Image actuelle</em><br />
113           <img src="events/photo/{$eid}" alt="Image actuelle" /><br />
114           <input type="submit" name="action" value="Pas d'image" />
115         </div>
116         {/if}
117         {if $upload && $upload->exists()}
118         <div style="float: right; text-align: center">
119           <em>Nouvelle image</em><br />
120           <img src="events/photo" alt="Nouvelle Image" /><br />
121           <input type="submit" name="action" value="Supprimer l'image" />
122         </div>
123         {/if}
124         <div style="clear: both">
125           Choisir un fichier : <input type="file" name="image" id="image" /><br />
126           Indiquer une adresse : <input type="text" name="image_url" id="image_url" value="" />
127         </div>
128       </td>
129     </tr>
130   </table>
131
132   <div class="center">
133     <input type="submit" name="preview" value="Aperçu" onclick="return updatePreview();" />
134   </div>
135   <p id="info" {if trim($texte) && trim($titre)}style="display: none"{/if}>
136     Le bouton de confirmation n'apparaît que si l'aperçu est concluant.
137   </p>
138   <p class="erreur">
139     N'oublie pas de remplir les informations suivantes&nbsp;:
140   </p>
141
142   <table class="bicol">
143     <tr>
144       <th colspan="2">Informations complémentaires</th>
145     </tr>
146     <tr class="pair">
147       <td colspan="2">
148         Tu peux limiter la visibilité de ton annonce aux camarades de certaines promotions :
149       </td>
150     </tr>
151     {include file="include/field.promo.tpl"}
152     <tr class="pair">
153       <td colspan="2">
154         Choisis la date d'expiration de ton annonce :
155       </td>
156     </tr>
157     <tr>
158       <td class="titre">
159         Dernier jour d'affichage
160       </td>
161       <td>
162         {valid_date name="peremption" value=$peremption to=60}
163       </td>
164     </tr>
165     {if $admin_evts}
166     <tr>
167       <td class="titre">
168         Importance
169       </td>
170       <td>
171         <input type="checkbox" name="important" {if $important}checked="checked"{/if}/> Marquer cette annonce comme très importante
172       </td>
173     </tr>
174     {/if}
175   </table>
176
177   <div class="center" {if !trim($texte) || !trim($titre)}style="display: none"{/if} id="valid">
178     <input type="hidden" name="evt_id" value="{$smarty.post.evt_id}" />
179     <input type="submit" name="action" value="Proposer" />
180   </div>
181
182 </form>
183
184 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}