05cb05c0 |
1 | {**************************************************************************} |
2 | {* *} |
179afa7f |
3 | {* Copyright (C) 2003-2008 Polytechnique.org *} |
05cb05c0 |
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 | var prefix = "{$prefix}"; |
25 | {literal} |
26 | function updateRange() |
27 | { |
28 | var range = document.getElementById(prefix + 'promo_range'); |
29 | min = document.getElementById(prefix + 'promo_min').value; |
30 | max = document.getElementById(prefix + 'promo_max').value; |
31 | if (isNaN(min) || (min != 0 && (min < 1900 || min > 2020))) { |
77af6562 |
32 | range.innerHTML = '<span class="erreur">La promotion minimum n\'est pas valide.</span>'; |
05cb05c0 |
33 | return false; |
34 | } else if (isNaN(max) || (max != 0 && (max < 1900 || max > 2020))) { |
77af6562 |
35 | range.innerHTML = '<span class="erreur">La promotion maximum n\'est pas valide.</span>'; |
05cb05c0 |
36 | return false; |
37 | } else if (max != 0 && min != 0 && max < min) { |
77af6562 |
38 | range.innerHTML = '<span class="erreur">L\'intervalle de promotion est inversé.</span>'; |
05cb05c0 |
39 | return false; |
40 | } else if (max == 0 && min == 0) { |
77af6562 |
41 | range.innerHTML = 'L\'annonce est destinée à toutes les promotions.'; |
05cb05c0 |
42 | } else if (max == 0) { |
77af6562 |
43 | range.innerHTML = 'L\'annonce est destinée aux promotions plus jeunes que ' + min + ' (incluse).'; |
05cb05c0 |
44 | } else if (min == 0) { |
77af6562 |
45 | range.innerHTML = "L\'annonce est destinée aux promotions plus anciennes que " + max + ' (incluse).'; |
05cb05c0 |
46 | } else if (min == max - 1) { |
77af6562 |
47 | range.innerHTML = "L\'annonce est destinée aux promotions " + min + " et " + max + "."; |
05cb05c0 |
48 | } else if (min == max) { |
77af6562 |
49 | range.innerHTML = "L\'annonce est destinée à la promotion " + min + "."; |
05cb05c0 |
50 | } else { |
77af6562 |
51 | range.innerHTML = "L\'annonce est destinée aux promotions de " + min + " à " + max + ' (incluses).'; |
05cb05c0 |
52 | } |
53 | return true; |
54 | } |
55 | {/literal} |
56 | //]]></script> |
57 | |
58 | {if $full} |
59 | <table class="bicol"> |
60 | {/if} |
61 | <tr id="{$prefix}promo_min_tr" class="impair"> |
62 | <td class="titre">Promotion la plus ancienne</td> |
63 | <td> |
64 | <input type="text" name="{$min_field_name|default:"promo_min"}" id="{$prefix}promo_min" |
65 | size="4" maxlength="4" value="{$promo_min|default:0}" |
66 | onkeyup="return updateRange();" onchange="return updateRange();" /> incluse |
e8439508 |
67 | <span class="smaller">(ex : 1980)</span> |
05cb05c0 |
68 | </td> |
69 | </tr> |
70 | <tr id="{$prefix}promo_max_tr" class="impair"> |
71 | <td class="titre">Promotion la plus jeune</td> |
72 | <td> |
73 | <input type="text" name="{$max_field_name|default:"promo_max"}" id="{$prefix}promo_max" |
74 | size="4" maxlength="4" value="{$promo_max|default:0}" |
75 | onkeyup="return updateRange();" onchange="return updateRange();" /> incluse |
e8439508 |
76 | <span class="smaller">(ex : 2000)</span> |
05cb05c0 |
77 | </td> |
78 | </tr> |
79 | <tr id="{$prefix}promo_range_tr" class="impair"> |
80 | <td colspan="2" id="promo_range" class="smaller"> |
81 | <script type="text/javascript">updateRange();</script> |
82 | </td> |
83 | </tr> |
84 | {if $full} |
85 | </table> |
86 | {/if} |
87 | |
88 | {* vim:set et sws=2 sts=2 sw=2 enc=utf-8: *} |