From: Stéphane Jacob Date: Mon, 6 Jun 2011 14:37:42 +0000 (+0200) Subject: Factorises promo selection. X-Git-Tag: xorg/1.1.2~41 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9f4004f361f8d8654c0c0c7dd14d4dee616d1f8c;p=platal.git Factorises promo selection. Signed-off-by: Stéphane Jacob --- diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index 7cb04c8..c05ed85 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -839,6 +839,26 @@ function previewWiki(idFrom, idTo, withTitle, idShow) } // }}} +// {{{ updatepromofields + +function updatepromofields(egal1, egal2, promo2) { + var comparator = egal1.val(); + + if (comparator == '=') { + egal2.attr('disabled', 'disabled'); + promo2.attr('disabled', 'disabled'); + } else if (comparator == '<=' || comparator == '>=') { + egal2.removeAttr('disabled'); + promo2.removeAttr('disabled'); + if (comparator == '<=') { + egal2.val('>='); + } else { + egal2.val('<='); + } + } +} + +// }}} /*************************************************************************** * Quick search diff --git a/templates/include/select_promo.tpl b/templates/include/select_promo.tpl new file mode 100644 index 0000000..810137b --- /dev/null +++ b/templates/include/select_promo.tpl @@ -0,0 +1,38 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2011 Polytechnique.org *} +{* http://opensource.polytechnique.org/ *} +{* *} +{* This program is free software; you can redistribute it and/or modify *} +{* it under the terms of the GNU General Public License as published by *} +{* the Free Software Foundation; either version 2 of the License, or *} +{* (at your option) any later version. *} +{* *} +{* This program is distributed in the hope that it will be useful, *} +{* but WITHOUT ANY WARRANTY; without even the implied warranty of *} +{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} +{* GNU General Public License for more details. *} +{* *} +{* You should have received a copy of the GNU General Public License *} +{* along with this program; if not, write to the Free Software *} +{* Foundation, Inc., *} +{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} +{* *} +{**************************************************************************} + + + + et  + + + + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/newsletter/edit.tpl b/templates/newsletter/edit.tpl index 2b6bcc4..3e9abf3 100644 --- a/templates/newsletter/edit.tpl +++ b/templates/newsletter/edit.tpl @@ -149,35 +149,7 @@ Promotions - - - -  et  - - - + {include file="include/select_promo.tpl" promo_data=$smarty.request egal1="egal1" egal2="egal2" promo1="promo1" promo2="promo2" edu_type="edu_type"} {/if} diff --git a/templates/search/adv.form.tpl b/templates/search/adv.form.tpl index ba7e7a5..a26d835 100644 --- a/templates/search/adv.form.tpl +++ b/templates/search/adv.form.tpl @@ -335,35 +335,7 @@ function cleanForm(f) { Promotion - - - -  et  - - - + {include file="include/select_promo.tpl" promo_data=$smarty.request egal1="egal1" egal2="egal2" promo1="promo1" promo2="promo2" edu_type="edu_type"}