Fixes vim mode line.
[platal.git] / templates / events / form.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2014 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|smarty:nodefaults}
25 {/if}
26 {if $smarty.request.titre}
27 {assign var=titre value=$smarty.request.titre|smarty:nodefaults}
28 {/if}
29 {if $smarty.request.promo_min}
30 {assign var=promo_min value=$smarty.request.promo_min|smarty:nodefaults}
31 {/if}
32 {if $smarty.request.promo_max}
33 {assign var=promo_max value=$smarty.request.promo_max|smarty:nodefaults}
34 {/if}
35 {if $smarty.request.expiration}
36 {assign var=expiration value=$smarty.request.expiration|smarty:nodefaults}
37 {/if}
38 {if $smarty.request.important}
39 {assign var=important value=$smarty.request.important|smarty:nodefaults}
40 {/if}
41
42 <script type="text/javascript">//<![CDATA[
43   {literal}
44   function updatePreview()
45   {
46     if (document.getElementById('image').value != '' || document.getElementById('image_url').value != '') {
47       return true;
48     }
49     var titre = document.getElementById('titre').value;
50     var texte = document.getElementById('texte').value;
51
52     if (titre == '' || texte == '') {
53       document.getElementById('valid').style.display = 'none';
54       document.getElementById('info').style.display = '';
55     } else {
56       document.getElementById('valid').style.display = '';
57       document.getElementById('info').style.display = 'none';
58     }
59     var page  = 'events/preview?titre=' + encodeURIComponent(titre) + '&texte=' + encodeURIComponent(texte);
60     $('#preview').updateHtml(page);
61     return false;
62   }
63   {/literal}
64 //]]></script>
65
66 <div id="preview">
67 {include file="events/preview.tpl"}
68 </div>
69 <br />
70
71 <form action="{$platal->path}" method="post" enctype="multipart/form-data">
72   {xsrf_token_field}
73   <table class="bicol">
74     <tr>
75       <th colspan="2">Contenu de l'annonce</th>
76     </tr>
77     <tr>
78       <td class="titre">Titre</td>
79       <td>
80         <input type="text" name="titre" id="titre" size="50" maxlength="200" value="{$titre}" />
81       </td>
82     </tr>
83     <tr>
84       <td class="titre">Texte</td>
85       <td>
86         <textarea name="texte" id="texte" rows="10" cols="60" onfocus="update_texte_count(this.form)">{$texte}</textarea>
87       </td>
88     </tr>
89     <tr>
90       <td></td>
91       <td class="smaller">
92         <a href="wiki_help/notitle" class="popup3">
93           {icon name=information title="Syntaxe wiki"} Voir la syntaxe wiki autorisée pour le texte de l'annonce
94         </a>
95       </td>
96     </tr>
97     <tr>
98       <td colspan="2" class="smaller">
99         <script type="text/javascript">//<![CDATA[
100           var form_propose_texte = false;
101           {literal}
102           function update_texte_count(f) {
103             if (!form_propose_texte && f) form_propose_texte = f;
104             form_propose_texte.texte_count.value=form_propose_texte.texte.value.length;
105             setTimeout("update_texte_count(0)", 100);
106           }
107           {/literal}
108         //]]></script>
109         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.
110         <script type="text/javascript">update_texte_count(document.getElementById('texte').form);</script>
111       </td>
112     </tr>
113     <tr class="pair">
114       <td class="titre">Illustration</td>
115       <td>
116         {if $eid && $img}
117         <div style="float: left; text-align: center">
118           <em>Image actuelle</em><br />
119           <img src="events/photo/{$eid}?{$smarty.now}" alt="Image actuelle" /><br />
120           <input type="submit" name="action" value="Pas d'image" />
121         </div>
122         {/if}
123         {if $upload && $upload->exists()}
124         <div style="float: right; text-align: center">
125           <em>Nouvelle image</em><br />
126           <img src="events/photo?{$smarty.now}" alt="Nouvelle Image" /><br />
127           <input type="submit" name="action" value="Supprimer l'image" />
128         </div>
129         {/if}
130         <div style="clear: both">
131           Choisir un fichier&nbsp;: <input type="file" name="image" id="image" /><br />
132           Indiquer une adresse&nbsp;: <input type="text" name="image_url" id="image_url" value="" />
133         </div>
134       </td>
135     </tr>
136   </table>
137
138   <div class="center">
139     <input type="submit" name="preview" value="Aperçu" onclick="return updatePreview();" />
140   </div>
141   <p id="info" {if trim($texte) && trim($titre)}style="display: none"{/if}>
142     Le bouton de confirmation n'apparaît que si l'aperçu est concluant.
143   </p>
144   <p class="erreur">
145     N'oublie pas de remplir les informations suivantes&nbsp;:
146   </p>
147
148   <table class="bicol">
149     <tr>
150       <th colspan="2">Informations complémentaires</th>
151     </tr>
152     <tr class="pair">
153       <td colspan="2">
154         Tu peux limiter la visibilité de ton annonce aux camarades de certaines promotions&nbsp;:
155       </td>
156     </tr>
157     {include file="include/field.promo.tpl"}
158     <tr class="pair">
159       <td colspan="2">
160         Choisis la date d'expiration de ton annonce&nbsp;:
161       </td>
162     </tr>
163     <tr>
164       <td class="titre">
165         Dernier jour d'affichage
166       </td>
167       <td>
168         {valid_date name="expiration" value=$expiration to=60}
169       </td>
170     </tr>
171     {if $admin_evts}
172     <tr>
173       <td class="titre">
174         Importance
175       </td>
176       <td>
177         <label><input type="checkbox" name="important" {if $important}checked="checked"{/if}/>
178         Marquer cette annonce comme très importante</label>
179       </td>
180     </tr>
181     {/if}
182   </table>
183
184   <div class="center" {if !trim($texte) || !trim($titre)}style="display: none"{/if} id="valid">
185     <input type="hidden" name="evt_id" value="{$smarty.post.evt_id}" />
186     <input type="submit" name="action" value="Proposer" />
187   </div>
188
189 </form>
190
191 {* vim:set et sw=2 sts=2 sws=2 fenc=utf-8: *}