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