Closes #1283 : restricts second operation on promo search
authorPascal Corpet <pascal.corpet@m4x.org>
Mon, 25 Oct 2010 20:55:45 +0000 (22:55 +0200)
committerPascal Corpet <pascal.corpet@m4x.org>
Mon, 25 Oct 2010 21:49:24 +0000 (23:49 +0200)
ChangeLog
templates/search/adv.form.tpl

index 68f5dde..e849520 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,8 +34,9 @@ Bug/Wish:
         - #1261: Fix wrong join between user and profile                   -JAC
 
     * Search:
-        - #1177: clean url in advanced search                              -Car
+        - #1177: Clean url in advanced search                              -Car
         - #1251: More intuitive networking search                          -Xel
+        - #1283: Restrict second operation on promo search                 -Car
 
     * Survey:
         - #964: The creator of a survey can get early results              -FRU
index 7ba93b5..4bd8fa1 100644 (file)
@@ -248,18 +248,29 @@ function cleanForm(f) {
     <tr>
       <td>Promotion</td>
       <td>
-        <select name="egal1">
+        <script type="text/javascript">/*<![CDATA[*/
+          {literal}
+          function updatepromofields(egal1) {
+            var f = egal1.form;
+            f.egal2.disabled = f.promo2.disabled = egal1.value == '=';
+            f.egal2.readOnly = true;
+            if (f.egal1.value == '>=') {
+              f.egal2.value = '<=';
+            } else {
+              f.egal2.value = '>=';
+            }
+          }
+          $(document).ready(function() { updatepromofields($('select[name=egal1]')[0]); });
+          {/literal}
+        /*]]>*/</script>
+        <select name="egal1" onchange="updatepromofields(this)" style="text-align:center">
           <option value="=" {if $smarty.request.egal1 eq "="}selected="selected"{/if}>&nbsp;=&nbsp;</option>
           <option value="&gt;=" {if $smarty.request.egal1 eq "&gt;="}selected="selected"{/if}>&nbsp;&gt;=&nbsp;</option>
           <option value="&lt;=" {if $smarty.request.egal1 eq "&lt;="}selected="selected"{/if}>&nbsp;&lt;=&nbsp;</option>
         </select>
         <input type="text" name="promo1" size="4" maxlength="4" value="{$smarty.request.promo1}" />
         &nbsp;et&nbsp;
-        <select name="egal2">
-          <option value="=" {if $smarty.request.egal2 eq "="}selected="selected"{/if}>&nbsp;=&nbsp;</option>
-          <option value="&gt;=" {if $smarty.request.egal2 eq "&gt;="}selected="selected"{/if}>&nbsp;&gt;=&nbsp;</option>
-          <option value="&lt;=" {if $smarty.request.egal2 neq "&gt;=" && $smarty.request.egal2 neq "="}selected="selected"{/if}>&nbsp;&lt;=&nbsp;</option>
-        </select>
+        <input type="text" name="egal2" size="1" style="text-align:center" value="{if t($smarty.request.egal2) eq '&lt;'}&lt;{else}&gt;{/if}" readonly="readonly" />
         <input type="text" name="promo2" size="4" maxlength="4" value="{$smarty.request.promo2}" />
       </td>
     </tr>