Can set events as being important
[platal.git] / templates / events / form.tpl
CommitLineData
0337d704 1{**************************************************************************}
2{* *}
5ddeb07c 3{* Copyright (C) 2003-2007 Polytechnique.org *}
0337d704 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
4550539f 23<script type="text/javascript">//<![CDATA[
db3bd146 24 {literal}
25 function updatePreview()
26 {
27 var titre = document.getElementById('titre').value;
28 var texte = document.getElementById('texte').value;
29
30 if (titre == '' || texte == '') {
31 document.getElementById('valid').style.display = 'none';
32 document.getElementById('info').style.display = '';
33 } else {
34 document.getElementById('valid').style.display = '';
35 document.getElementById('info').style.display = 'none';
36 }
4550539f 37 var page = 'events/preview?titre=' + encodeURIComponent(titre) + '&texte=' + encodeURIComponent(texte);
db3bd146 38 if (is_IE) {
39 {/literal}
40 page = "{$globals->baseurl}/" + page;
41 {literal}
42 }
43 Ajax.update_html('preview', page, null);
44 return false;
45 }
46 {/literal}
4550539f 47//]]></script>
db3bd146 48
49<div id="preview">
50{include file="events/preview.tpl"}
51</div>
52<br />
53
7b2413f6 54<form action="{$platal->path}" method="post">
0337d704 55 <table class="bicol">
56 <tr>
db3bd146 57 <th colspan="2">Contenu de l'annonce</th>
09e37980 58 </tr>
0337d704 59 <tr>
09e37980 60 <td class="titre">Titre</td>
0337d704 61 <td>
db3bd146 62 <input type="text" name="titre" id="titre" size="50" maxlength="200" value="{$titre}" />
0337d704 63 </td>
64 </tr>
65 <tr>
09e37980 66 <td class="titre">Texte</td>
db3bd146 67 <td><textarea name="texte" id="texte" rows="10" cols="60" onfocus="update_texte_count(this.form)">{$texte}</textarea></td>
7095511f 68 </tr>
69 <tr>
09e37980 70 <td colspan="2" class="smaller">
ea1fdc8c 71 <script type="text/javascript">//<![CDATA[
7095511f 72 var form_propose_texte = false;
73 {literal}
74 function update_texte_count(f) {
75 if (!form_propose_texte && f) form_propose_texte = f;
76 form_propose_texte.texte_count.value=form_propose_texte.texte.value.length;
77 setTimeout("update_texte_count(0)", 100);
78 }
79 {/literal}
ea1fdc8c 80 //]]></script>
db3bd146 81 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.
09e37980 82 </td>
0337d704 83 </tr>
09e37980 84 </table>
85
db3bd146 86 <div class="center">
87 <input type="submit" name="preview" value="Aperçu" onclick="updatePreview(); return false;" />
88 </div>
89 <p id="info" {if trim($texte) && trim($titre)}style="display: none"{/if}>
90 Le bouton de confirmation n'apparaît que si l'aperçu est concluant.
91 </p>
92 <p class="erreur">
ea1fdc8c 93 N'oublie pas de remplir les informations suivantes&nbsp;:
db3bd146 94 </p>
95
ea1fdc8c 96 <script type="text/javascript">//<![CDATA[
97 {literal}
98 function updateRange(min, max)
99 {
100 var range = document.getElementById('range');
101 if (min == null) {
102 min = document.getElementById('promo_min').value;
103 }
104 if (max == null) {
105 max = document.getElementById('promo_max').value;
106 }
107 if (isNaN(min) || (min != 0 && (min < 1900 || min > 2020))) {
108 range.innerHTML = '<span class="erreur">La promotion minimum n\'est pas valide</span>';
109 return false;
110 } else if (isNaN(max) || (max != 0 && (max < 1900 || max > 2020))) {
111 range.innerHTML = '<span class="erreur">La promotion maximum n\'est pas valide</span>';
112 return false;
113 } else if (max != 0 && min != 0 && max < min) {
114 range.innerHTML = '<span class="erreur">L\'intervalle de promotion est inversé</span>';
115 return false;
116 } else if (max == 0 && min == 0) {
117 range.innerHTML = 'L\'annonce est destinée à toutes les promotions';
118 } else if (max == 0) {
119 range.innerHTML = 'L\'annonce sera affichée aux promotions plus jeunes que ' + min + ' (incluse)';
120 } else if (min == 0) {
121 range.innerHTML = "L\'annonce sera affichée aux promotions plus anciennes que " + max + ' (incluse)';
122 } else {
123 range.innerHTML = "L\'annonce sera affichées aux promotions de " + min + " à " + max + ' (incluses)';
124 }
125 return true;
126 }
127 {/literal}
128 //]]></script>
129
09e37980 130 <table class="bicol">
db3bd146 131 <tr>
132 <th colspan="2">Informations complémentaires</th>
133 </tr>
09e37980 134 <tr class="pair">
2f5102a0 135 <td colspan="2">
a7de4ef7 136 Tu peux limiter la visibilité de ton annonce aux camarades de certaines promotions :
2f5102a0 137 </td>
138 </tr>
139 <tr class="impair">
140 <td class="titre">Promotion la plus ancienne</td>
0337d704 141 <td>
ea1fdc8c 142 <input type="text" name="promo_min" id="promo_min" size="4" maxlength="4" value="{$promo_min}"
143 onkeyup="return updateRange(null, null);" /> incluse
2f5102a0 144 &nbsp;<em>(ex : 1980, 0 signifie pas de minimum)</em>
0337d704 145 </td>
146 </tr>
2f5102a0 147 <tr class="impair">
148 <td class="titre">Promotion la plus jeune</td>
0337d704 149 <td>
ea1fdc8c 150 <input type="text" name="promo_max" id="promo_max" size="4" maxlength="4" value="{$promo_max}"
151 onkeyup="return updateRange(null, null);" /> incluse
9df2476f 152 &nbsp;<em>(ex : 2000, 0 signifie pas de maximum)</em>
0337d704 153 </td>
154 </tr>
ea1fdc8c 155 <tr class="impair">
156 <td colspan="2" id="range" class="smaller">
157 <script type="text/javascript">updateRange({$promo_min}, {$promo_max});</script>
158 </td>
159 </tr>
09e37980 160 <tr class="pair">
2f5102a0 161 <td colspan="2">
162 Choisis la date d'expiration de ton annonce :
0337d704 163 </td>
164 </tr>
165 <tr>
2f5102a0 166 <td class="titre">
167 Dernier jour d'affichage
0337d704 168 </td>
169 <td>
170 <select name="peremption">
171 {$select|smarty:nodefaults}
172 </select>
173 </td>
174 </tr>
9ed396c0 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}
0337d704 185 </table>
186
db3bd146 187 <div class="center" {if !trim($texte) || !trim($titre)}style="display: none"{/if} id="valid">
0337d704 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
a7de4ef7 194{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}