Use the same promo selector for Events, NL and Xnet
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 21 Apr 2007 10:20:18 +0000 (10:20 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 21 Apr 2007 10:20:18 +0000 (10:20 +0000)
 htdocs/css/xnet.css                 |    5 +++
 modules/profile.php                 |    4 +-
 modules/search.php                  |    2 -
 templates/axletter/edit.tpl         |   17 +---------
 templates/events/form.tpl           |   56 ------------------------------------
 templates/xnetgrp/announce-edit.tpl |   33 +++++++--------------
 6 files changed, 22 insertions(+), 95 deletions(-)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1722 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/css/xnet.css
modules/profile.php
modules/search.php
templates/axletter/edit.tpl
templates/events/form.tpl
templates/include/field.promo.tpl [new file with mode: 0644]
templates/include/field.select.tpl [moved from templates/include/select.field.tpl with 97% similarity]
templates/xnetgrp/announce-edit.tpl

index a070124..2513ab9 100644 (file)
@@ -63,6 +63,11 @@ td    { vertical-align: top; }
 h1    { font-size: 130%; }
 h2    { font-size: 115%; }
 
+.smaller {
+    font-size: smaller;
+    font-style: italic;
+}
+
 /***************************************************************************
  * DEBUG
  ***************************************************************************/
index 0967afa..f2dcaba 100644 (file)
@@ -549,7 +549,7 @@ class ProfileModule extends PLModule
     function handler_ref_sect(&$page, $sect) 
     {
         header('Content-Type: text/html; charset=utf-8');
-        $page->changeTpl('include/select.field.tpl', NO_SKIN);
+        $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('onchange', 'setSSecteurs()');
         $page->assign('id', 'ssect_field');
         $page->assign('name', 'ss_secteur');
@@ -562,7 +562,7 @@ class ProfileModule extends PLModule
     function handler_ref_country(&$page, $sect, $ssect = '')
     {
         header('Content-Type: text/html; charset=utf-8');
-        $page->changeTpl('include/select.field.tpl', NO_SKIN);
+        $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', 'pays_sel');
         $where = ($ssect ? ' AND ms.ss_secteur = {?}' : '');
         $it = XDB::iterator("SELECT  a2 AS id, pays AS field
index 9845509..09f2e63 100644 (file)
@@ -397,7 +397,7 @@ class SearchModule extends PLModule
             exit();
         }
         header('Content-Type: text/xml; charset="UTF-8"');
-        $page->changeTpl('include/select.field.tpl', NO_SKIN);
+        $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', $type);
         $page->assign('list', XDB::iterator('SELECT  '.$field.' AS field,
                                                      '.$id.' AS id
index e61a09f..cbffd84 100644 (file)
@@ -51,7 +51,7 @@
     </p>
   </fieldset>
 
-  <table class="tinybicol">
+  <table class="bicol">
     <tr>
       <th colspan="2">Options du message</th>
     </tr>
         <span class="smaller">(uniquement lettres, chiffres ou -)</span>
       </td>
     </tr>
-    <tr>
-      <td class="titre">Promo min</td>
-      <td>
-        <input type="text" name="promo_min" value="{$promo_min|default:0}" size="4" maxlength="4" />
-        <span class="smaller">(0 pour pas de minimum... ex: 1947)</span>
-      </td>
-    </tr>
-    <tr>
-      <td class="titre">Promo max</td>
-      <td>
-        <input type="text" name="promo_max" value="{$promo_max|default:0}" size="4" maxlength="4" />
-        <span class="smaller">(0 pour pas de maximum... ex: 2001)</span>
-      </td>
-    </tr>
+    {include file="include/field.promo.tpl" prefix=""}
     {if !$saved}
     <tr>
       <td class="titre">Echéance d'envoi</td>
index 9d7485d..8411cfc 100644 (file)
     N'oublie pas de remplir les informations suivantes&nbsp;:
   </p>
 
-  <script type="text/javascript">//<![CDATA[
-    {literal}
-    function updateRange(min, max)
-    {
-      var range = document.getElementById('range');
-      if (min == null) {
-        min = document.getElementById('promo_min').value;
-      }
-      if (max == null) {
-        max = document.getElementById('promo_max').value;
-      }
-      if (isNaN(min) || (min != 0 && (min < 1900 || min > 2020))) {
-        range.innerHTML = '<span class="erreur">La promotion minimum n\'est pas valide</span>';
-        return false;
-      } else if (isNaN(max) || (max != 0 && (max < 1900  || max > 2020))) {
-        range.innerHTML = '<span class="erreur">La promotion maximum n\'est pas valide</span>';
-        return false;
-      } else if (max != 0 && min != 0 && max < min) {
-        range.innerHTML = '<span class="erreur">L\'intervalle de promotion est inversé</span>';
-        return false;
-      } else if (max == 0 && min == 0) {
-        range.innerHTML = 'L\'annonce est destinée à toutes les promotions';
-      } else if (max == 0) {
-        range.innerHTML = 'L\'annonce sera affichée aux promotions plus jeunes que ' + min + ' (incluse)';
-      } else if (min == 0) {
-        range.innerHTML = "L\'annonce sera affichée aux promotions plus anciennes que " + max + ' (incluse)';
-      } else {
-        range.innerHTML = "L\'annonce sera affichées aux promotions de " + min + " à " + max + ' (incluses)';
-      }
-      return true;
-    }
-    {/literal}
-  //]]></script>
-
   <table class="bicol">
     <tr>
       <th colspan="2">Informations complémentaires</th>
         Tu peux limiter la visibilité de ton annonce aux camarades de certaines promotions :
       </td>
     </tr>
-    <tr class="impair">
-      <td class="titre">Promotion la plus ancienne</td>
-      <td>
-        <input type="text" name="promo_min" id="promo_min" size="4" maxlength="4" value="{$promo_min}"
-               onkeyup="return updateRange(null, null);" /> incluse
-        &nbsp;<em>(ex : 1980, 0 signifie pas de minimum)</em>
-      </td>
-    </tr>
-    <tr class="impair">
-      <td class="titre">Promotion la plus jeune</td>
-      <td>
-        <input type="text" name="promo_max" id="promo_max" size="4" maxlength="4" value="{$promo_max}"
-               onkeyup="return updateRange(null, null);" /> incluse
-        &nbsp;<em>(ex : 2000, 0 signifie pas de maximum)</em>
-      </td>
-    </tr>
-    <tr class="impair">
-      <td colspan="2" id="range" class="smaller">
-        <script type="text/javascript">updateRange({$promo_min}, {$promo_max});</script>
-      </td>
-    </tr>
+    {include file="include/field.promo.tpl"}
     <tr class="pair">
       <td colspan="2">
         Choisis la date d'expiration de ton annonce :
diff --git a/templates/include/field.promo.tpl b/templates/include/field.promo.tpl
new file mode 100644 (file)
index 0000000..0f9e4d0
--- /dev/null
@@ -0,0 +1,88 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2007 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<script type="text/javascript">//<![CDATA[ 
+    var prefix = "{$prefix}";
+    {literal} 
+    function updateRange() 
+    { 
+      var range = document.getElementById(prefix + 'promo_range'); 
+      min = document.getElementById(prefix + 'promo_min').value; 
+      max = document.getElementById(prefix + 'promo_max').value; 
+      if (isNaN(min) || (min != 0 && (min < 1900 || min > 2020))) { 
+        range.innerHTML = '<span class="erreur">La promotion minimum n\'est pas valide</span>'; 
+        return false; 
+      } else if (isNaN(max) || (max != 0 && (max < 1900  || max > 2020))) { 
+        range.innerHTML = '<span class="erreur">La promotion maximum n\'est pas valide</span>'; 
+        return false; 
+      } else if (max != 0 && min != 0 && max < min) { 
+        range.innerHTML = '<span class="erreur">L\'intervalle de promotion est inversé</span>'; 
+        return false; 
+      } else if (max == 0 && min == 0) { 
+        range.innerHTML = 'L\'annonce est destinée à toutes les promotions'; 
+      } else if (max == 0) { 
+        range.innerHTML = 'L\'annonce est destinée aux promotions plus jeunes que ' + min + ' (incluse)'; 
+      } else if (min == 0) { 
+        range.innerHTML = "L\'annonce est destinée aux promotions plus anciennes que " + max + ' (incluse)'; 
+      } else if (min == max - 1) {
+        range.innerHTML = "L\'annonce est destinée aux promotions " + min + " et " + max; 
+      } else if (min == max) {
+        range.innerHTML = "L\'annonce est destinée à la promotion " + min;
+      } else { 
+        range.innerHTML = "L\'annonce est destinée aux promotions de " + min + " à " + max + ' (incluses)'; 
+      } 
+      return true; 
+    } 
+    {/literal} 
+//]]></script> 
+
+{if $full}
+<table class="bicol">
+{/if}
+  <tr id="{$prefix}promo_min_tr" class="impair"> 
+    <td class="titre">Promotion la plus ancienne</td> 
+    <td> 
+      <input type="text" name="{$min_field_name|default:"promo_min"}" id="{$prefix}promo_min"
+             size="4" maxlength="4" value="{$promo_min|default:0}" 
+             onkeyup="return updateRange();" onchange="return updateRange();" /> incluse 
+      &nbsp;<span class="smaller">(ex : 1980)</span> 
+    </td> 
+  </tr> 
+  <tr id="{$prefix}promo_max_tr" class="impair"> 
+    <td class="titre">Promotion la plus jeune</td> 
+    <td> 
+      <input type="text" name="{$max_field_name|default:"promo_max"}" id="{$prefix}promo_max"
+             size="4" maxlength="4" value="{$promo_max|default:0}" 
+             onkeyup="return updateRange();" onchange="return updateRange();" /> incluse 
+      &nbsp;<span class="smaller">(ex : 2000)</span> 
+    </td> 
+  </tr> 
+  <tr id="{$prefix}promo_range_tr" class="impair"> 
+    <td colspan="2" id="promo_range" class="smaller"> 
+      <script type="text/javascript">updateRange();</script> 
+    </td> 
+  </tr> 
+{if $full}
+</table>
+{/if}
+
+{* vim:set et sws=2 sts=2 sw=2 enc=utf-8: *}
similarity index 97%
rename from templates/include/select.field.tpl
rename to templates/include/field.select.tpl
index 51a99be..d7cc678 100644 (file)
@@ -26,3 +26,5 @@
     <option value="{$option.id}">{$option.field|htmlspecialchars}</option>
   {/iterate}
 </select>
+
+{* vim:set et sws=2 sts=2 sw=2 enc=utf-8: *}
index e0546fc..7af72fe 100644 (file)
@@ -26,9 +26,9 @@ function visibilityChange(box)
 {
     var state = (box.checked ? 'none' : '');
     document.getElementById('promo_titre').style.display = state;
-    document.getElementById('promo_min').style.display = state;
-    document.getElementById('promo_max').style.display = state;
-    document.getElementById('promo_desc').style.display = state;
+    document.getElementById('promo_min_tr').style.display = state;
+    document.getElementById('promo_max_tr').style.display = state;
+    document.getElementById('promo_range_tr').style.display = state;
 }
 {/literal}
 </script>
@@ -140,25 +140,14 @@ function visibilityChange(box)
     <tr id="promo_titre" {if $art.public}style="display: none"{/if}>
       <th colspan="2">Promotions cibles</th>
     </tr>
-    <tr id="promo_min"  {if $art.public}style="display: none"{/if}>
-      <td class="titre">Promotion minimale :</td>
-      <td>
-        <input type="text" size="4" maxlength="4" name="promo_min" value="{$art.promo_min|default:0}" />
-        incluse*  (ex : 1980)
-      </td>
-    </tr>
-    <tr id="promo_max"  {if $art.public}style="display: none"{/if}>
-      <td class="titre">Promotion maximale :</td>
-      <td>
-        <input type="text" size="4" maxlength="4" name="promo_max" value="{$art.promo_max|default:0}" />
-        incluse*  (ex : 2000)
-      </td>
-    </tr>
-    <tr class="pair" id="promo_desc"  {if $art.public}style="display: none"{/if}>
-      <td colspan="2">
-        <small>* 0 signifie qu'il n'y a pas de limite</small>
-      </td>
-    </tr>
+    {include file="include/field.promo.tpl" promo_min=$art.promo_min promo_max=$art.promo_max}
+    {if $art.public}
+    <script type="text/javascript">//<![CDATA[
+      document.getElementById('promo_min_tr').style.display = 'none';
+      document.getElementById('promo_max_tr').style.display = 'none';
+      document.getElementById('promo_range_tr').style.display = 'none';
+    //]]></script>
+    {/if}
     {if $new}
     <tr>
       <th colspan="2">Demandes de publication</th>