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