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