Cleanup search page.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 14 Mar 2010 20:49:05 +0000 (21:49 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 14 Mar 2010 20:49:05 +0000 (21:49 +0100)
Don't display the 'Trombi promo' box anymore. It created a gap between the
search box and its documentation.

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
htdocs/css/keynote.css
modules/search.php
templates/search/quick.form.tpl
templates/search/quick.tpl

index 685cea6..7372142 100644 (file)
@@ -62,8 +62,9 @@ legend {
     border-left: 1px solid #fff;
     background: url('../images/skins/keynote_bg_verylighter.png') #bbbbaa top left repeat-x fixed;
     color: #000;
+    font-weight: bold;
 
-    padding: 2px 4px;
+    padding: 2px 8px 2px 4px;
     -webkit-border-top-left-radius: 5px;
     -moz-border-radius-topleft: 5px;
 }
index a0057ef..7b4b302 100644 (file)
@@ -47,15 +47,8 @@ class SearchModule extends PLModule
     {
         global $globals;
 
-        $res = XDB::query("SELECT  MIN(diminutif), MAX(diminutif)
-                             FROM  groups
-                            WHERE  cat = 'Promotions'");
-        list($min, $max) = $res->fetchOneRow();
-        $page->assign('promo_min', $min);
-        $page->assign('promo_max', $max);
-
         if (Env::has('quick') || $action == 'geoloc') {
-            $quick = trim(Env::v('quick'));
+            $quick = trim(Env::t('quick'));
             if (S::logged() && !Env::has('page')) {
                 S::logger()->log('search', 'quick=' . $quick);
             }
@@ -91,6 +84,17 @@ class SearchModule extends PLModule
                 $url .= 'action=search&q=' . urlencode(substr($quick, 4));
                 $url .= '&group=' . urlencode('-Equipe,-Main,-PmWiki,-Site,-Review');
                 pl_redirect($url);
+            } elseif (strpos($quick, 'trombi:') === 0) {
+                $promo = substr($quick, 7);
+                $res = XDB::query("SELECT  diminutif
+                                     FROM  groups
+                                    WHERE  cat = 'Promotions' AND diminutif = {?}",
+                                  $promo);
+                if ($res->numRows() == 0) {
+                    $page->trigWarning("La promotion demandée n'est pas valide: $promo");
+                } else {
+                    http_redirect('http://www.polytechnique.net/login/' . $promo . '/annuaire/trombi');
+                }
             }
 
             $page->assign('formulaire', 0);
index 7eff7bc..228ba81 100644 (file)
 <h1>Recherche dans l'annuaire</h1>
 
 <form action="search" method="get"{if $show_js} id="quick_form"{/if}>
-  <table class="bicol" cellspacing="0" cellpadding="4">
-    {if $smarty.session.auth ge AUTH_COOKIE}
-    <tr>
-      <th colspan="2">
-        Recherche simple
-      </th>
-    </tr>
-    <tr>
-      <td colspan="2">
-        <input type='text' name="quick" value="{$smarty.request.quick}" style="width: 98%" /><br />
-      </td>
-    </tr>
-    <tr class="noprint">
-      <td style="width: 70%">
-        <input type="checkbox" name="with_soundex" id="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} /> <label for="with_soundex">Activer la recherche par proximité sonore.</label>
-        <br /><input type='checkbox' name='order' id="order" value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} /> <label for="order">Mettre les fiches modifiées récemment en premier.</label>
-        <br /><input type='checkbox' name='nonins' id="nonins" {if $smarty.request.nonins}checked='checked'{/if} value='1' /> <label for="nonins">Chercher uniquement des non inscrits.</label>
-      </td>
-      <td class="right">
-        <br /><input type="submit" value="Chercher" />
-      </td>
-    {else}
+  {if $smarty.session.auth ge AUTH_COOKIE}
+  <fieldset>
+    <legend>{icon name=magnifier} Recherche simple</legend>
+
+    <table style="width: 100%">
+      <tr>
+        <td colspan="2">
+          <input type='text' name="quick" value="{$smarty.request.quick}" style="width: 98%" /><br />
+        </td>
+      </tr>
+      <tr class="noprint">
+        <td style="width: 70%">
+          <input type="checkbox" name="with_soundex" id="with_soundex" value="1" {if $smarty.request.with_soundex}checked="checked"{/if} /> <label for="with_soundex">Activer la recherche par proximité sonore.</label>
+          <br /><input type='checkbox' name='order' id="order" value='date_mod' {if $smarty.request.order eq "date_mod"}checked='checked'{/if} /> <label for="order">Mettre les fiches modifiées récemment en premier.</label>
+          <br /><input type='checkbox' name='nonins' id="nonins" {if $smarty.request.nonins}checked='checked'{/if} value='1' /> <label for="nonins">Chercher uniquement des non inscrits.</label>
+        </td>
+        <td class="right">
+          <br /><input type="submit" value="Chercher" />
+        </td>
+      </tr>
+    </table>
+    <hr />
+    <div class="center">
+      <a href="search/adv">Effectuer une recherche avancée</a>
+    </div>
+  </fieldset>
+  {else}
+  <table style="width: 100%">
     <tr class="noprint">
       <td style="width: 60%">
         <input type='text' name="quick" value="{$smarty.request.quick}" style="width: 98%" /><br />
       <td class="right">
         <input type="submit" value="Chercher" />
       </td>
-    {/if}
     </tr>
   </table>
+  {/if}
 </form>
-{if $smarty.session.auth ge AUTH_COOKIE}
-<p class="center">[<a href="search/adv">Effectuer une recherche avancée</a>]</p>
-{/if}
 
 {if $show_js}
 {literal}
 <script type="text/javascript">
-  <!--
-  // Activate the first search input field.
-  document.getElementById("quick_form").quick.focus();
-  // -->
+  $(document).ready(function() {
+    $("#quick_form input[name='quick']").focus();
+  });
 </script>
 {/literal}
 {/if}
index 1e5e1c4..cc3de24 100644 (file)
 
 {include file=search/quick.form.tpl show_js=1}
 
-{if hasPerm('user')}
-<h1>Voir le trombi d'une promotion</h1>
-
-<div id="message" style="position:absolute;"></div><br />
-
-<script type="text/javascript">
-  <!--
-  {literal}
-  function showPromo()
-  {
-      var value = document.getElementById('promo').value;
-      if (value < {/literal}{$promo_min}{literal} || value > {/literal}{$promo_max}{literal}) {
-        showTempMessage('message', "La promotion doit être entre {/literal}{$promo_min} et {$promo_max}{literal}.", false);
-        return false;
-      }
-      window.open("http://www.polytechnique.net/login/" + value + "/annuaire/trombi");
-      return false;
-  }
-  {/literal}
-  -->
-</script>
-
-<form action="" method="post" onsubmit="return showPromo();">
-<table class="tinybicol" style="width: auto; margin: auto">
-  <tr>
-    <td class="titre">Promotion&nbsp;:</td>
-    <td>
-      <input type="text" name="promo" id="promo" size="4" value="" />
-      <input type="submit" name="submit_promo" value="Voir" />
-    </td>
-  </tr>
-</table>
-</form>
-
-{/if}
-
 <h1>Comment faire une recherche&nbsp;?</h1>
 
 <h2>Nom, Prénom, Promotion&hellip;</h2>
@@ -98,6 +62,7 @@ notre base de données.
 </p>
 <ul>
   <li><code>fiche:prenom.nom.promo</code> ouvre la fiche du camarade indiquée&nbsp;;</li>
+  <li><code>trombi:promo</code> affiche le trombinoscope de la promotion indiquée&nbsp;;</li>
   <li><code>ref:prenom.nom.promo</code> ouvre la fiche référent du camarade indiquée&nbsp;;</li>
   <li><code>doc:phrase</code> recherche <em>phrase</em> dans la documentation du site&nbsp;;</li>
   {if hasPerm('admin')}