integrate watches into search and the minifiche
authorx2000habouzit <x2000habouzit>
Fri, 5 Nov 2004 14:34:03 +0000 (14:34 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 5 Nov 2004 14:34:03 +0000 (14:34 +0000)
htdocs/advanced_search.php
htdocs/carnet/notifs.php
htdocs/search.php
include/notifs.inc.php
templates/carnet/notifs.tpl
templates/include/minifiche.tpl
templates/include/minifiche_pvt.tpl
templates/search.tpl

index 7cf1b9c..baca075 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: advanced_search.php,v 1.25 2004-11-04 13:50:44 x2000habouzit Exp $
+        $Id: advanced_search.php,v 1.26 2004-11-05 14:34:03 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -105,7 +105,7 @@ else {
    
     $where = $fields->get_where_statement();
     $sql = 'SELECT SQL_CALC_FOUND_ROWS
-                       DISTINCT u.matricule,u.matricule_ax,
+                       DISTINCT u.matricule,u.matricule_ax,u.user_id,
                        perms!=\'non-inscrit\' AS inscrit,
                        u.nom,
                        u.prenom,
index 22cb040..81e421c 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: notifs.php,v 1.3 2004-11-05 13:49:15 x2000habouzit Exp $
+        $Id: notifs.php,v 1.4 2004-11-05 14:34:04 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -44,6 +44,10 @@ foreach($_REQUEST as $key=>$val) {
            $notifs->del_promo($val);
            break;
 
+       case 'add_nonins':
+           $notifs->add_nonins($val);
+           break;
+
        case 'del_nonins':
            $notifs->del_nonins($val);
            break;
index 380fc1b..39b7324 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: search.php,v 1.45 2004-11-04 14:54:39 x2000habouzit Exp $
+        $Id: search.php,v 1.46 2004-11-05 14:34:03 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -47,18 +47,20 @@ if (array_key_exists('quick', $_REQUEST)) {
     $offset = new NumericSField('offset');
    
     $sql = 'SELECT SQL_CALC_FOUND_ROWS
-                       DISTINCT r.matricule,u.matricule_ax,
+                       DISTINCT r.matricule,u.matricule_ax,u.user_id,
                        u.perms!="non-inscrit" AS inscrit,
                        UPPER(IF(u.nom!="",u.nom,u.nom_ini)) AS nom,
                        IF(u.prenom!="",u.prenom,u.prenom_ini) AS prenom,
                        u.promo AS promo,
                        a.alias AS forlife,
                        '.$globals->search_result_fields.'
-                       c.uid AS contact
+                       c.uid AS contact,
+                      w.arg AS watch
                  FROM  auth_user_md5  AS r
             LEFT JOIN  auth_user_md5  AS u   ON (u.matricule=r.matricule)
             LEFT JOIN  aliases        AS a   ON (u.user_id = a.id AND a.type="a_vie")
             LEFT JOIN  contacts       AS c   ON (c.uid='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND c.contact=u.user_id)
+            LEFT JOIN  watch          AS w   ON (w.arg=u.user_id AND w.user_id='.((array_key_exists('uid',$_SESSION))?$_SESSION['uid']:0).' AND w.type="non-inscrit")
             '.$globals->search_result_where_statement.'
                 WHERE  '.$fields->get_where_statement().'
              ORDER BY  '.(logged() && !empty($_REQUEST['mod_date_sort']) ? 'date DESC,' :'')
index d4c9edc..e5725ad 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: notifs.inc.php,v 1.4 2004-11-05 13:49:16 x2000habouzit Exp $
+        $Id: notifs.inc.php,v 1.5 2004-11-05 14:34:04 x2000habouzit Exp $
  ***************************************************************************/
 
 require_once('diogenes.flagset.inc.php');
@@ -68,6 +68,14 @@ class Notifs {
        $globals->db->query("DELETE FROM watch WHERE user_id='{$this->uid}' AND type='non-inscrit' AND arg='$p'");
     }
 
+    function add_nonins($p) {
+       global $globals;
+       $globals->db->query("INSERT INTO watch (user_id,type,arg) VALUES('{$this->uid}','non-inscrit','$p')");
+       $res = $globals->db->query(" SELECT prenom,nom,promo,user_id FROM auth_user_md5 WHERE user_id='$p'");
+       $this->nonins[$p] = mysql_fetch_assoc($res);
+       mysql_free_result($res);
+    }
+
     function del_promo($p) {
        global $globals;
        unset($this->promos[$p]);
index 2c232bc..576387f 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: notifs.tpl,v 1.6 2004-11-05 13:49:16 x2000habouzit Exp $
+        $Id: notifs.tpl,v 1.7 2004-11-05 14:34:05 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -83,16 +83,12 @@ Pour les non-inscrits, tu es notifi
 <p>
 Si un non-inscrit que tu surveille s'inscrit, il sera automatiquement ajouté à tes contacts.
 </p>
-<!--
-<form action="{$smarty.server.PHP_SELF}" method="post">
-  <fieldset>
-    <legend>Ajouter un non-inscrit</legend>
-    <input type='text' name='' />
-    <input type='submit' value='ajouter' />
-    <span class='smaller'>Il faut entrer le "login" (prenom.nom ou prenom.nom.promo).</span>
-  </fieldset>
-</form>
--->
+
+<p>
+Pour surveiller des membres non-inscrits, il faut passer par la <a href="{"search.php"|url}" onclick='return popup(this)'>recherche</a>
+et cliquer sur les icones <img src="{"images/ajouter.gif"|url}" alt="Ajouter" /> pour les ajouter à cette liste
+</p>
+
 <table class='tinybicol' cellpadding="0" cellspacing="0">
   <tr>
     <td>
index e8b51bf..d7d5197 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: minifiche.tpl,v 1.10 2004-10-30 09:09:07 x2000bedo Exp $
+        $Id: minifiche.tpl,v 1.11 2004-11-05 14:34:05 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -36,6 +36,7 @@
     {/if}
     {/min_auth}
   </div>
+  {if $inscrit || $c.dcd}
   <div class="appli">
     {strip}
     {if $c.iso3166}
@@ -51,6 +52,7 @@
     {if $c.dcd}&nbsp;décédé le {$c.deces}{/if}
     {/strip}
   </div>
+  {/if}
   {min_auth level="cookie"}
   {include file="include/minifiche_pvt.tpl"}
   {/min_auth}
index 6495463..54c13cc 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: minifiche_pvt.tpl,v 1.11 2004-11-04 15:33:29 x2000habouzit Exp $
+        $Id: minifiche_pvt.tpl,v 1.12 2004-11-05 14:34:05 x2000habouzit Exp $
  ***************************************************************************}
 
 
-{if $inscrit==1}
+{if !$inscrit}
+  {if !$c.dcd}
+  <div class="appli">
+    &nbsp;<a href="javascript:x()" onclick="popWin('marketing/public.php?num={$c.matricule}')">
+      clique ici si tu connais son adresse email !
+    </a>
+  </div>
+  <div class='bits'>
+    {if $show_action eq ajouter}
+    <a href="{"carnet/notifs.php"|url}?add_nonins={$c.user_id}">{*
+      *}<img src="{"images"|url}/ajouter.gif" alt="Ajouter à la liste de mes surveillances" title="Ajouter à la liste de mes surveillances" />{*
+    *}</a>
+    {else}
+    <a href="{"carnet/notifs.php"|url}?del_nonins={$c.user_id}">{*
+      *}<img src="{"images"|url}/retirer.gif" alt="Retirer de la liste de mes surveillances" title="Retirer de la liste de mes surveillances" />{*
+    *}</a>
+    {/if}
+    {perms level='admin'}
+    <a href="javascript:x()" onclick="popWin('http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&amp;anc_id={$c.matricule_ax}')">{*
+      *}<img src="{"images/ax.png"|url}" alt='AX' title="fiche AX" />{*
+    *}</a>
+    {/perms}
+  </div>
+  {/if}
+  <div class="long"></div>
+{else}
   <div class="bits">
     <a href="javascript:x()"
     onclick="popupWin('fiche.php?user={$c.forlife}','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500')">{*
     {/perms}
     {/if}
   </div>
-{else}
-  {if $c.dcd neq 1}
-  <div>
-    &nbsp;<a href="javascript:x()" onclick="popWin('marketing/public.php?num={$c.matricule}')">
-      clique ici si tu connais son adresse email !
-    </a>
-    {perms level='admin'}
-    &nbsp;
-    <a href="javascript:x()" onclick="popWin('http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&amp;anc_id={$c.matricule_ax}')">{*
-      *}<img src="{"images/ax.png"|url}" alt='AX' title="fiche AX" />{*
-    *}</a>
-    {/perms}
-  </div>
-  {/if}
-  <div class="long"></div>
-{/if}
-{if $inscrit==1}
   <div class="long">
     {if $c.web || $c.mobile || $c.pays || $c.ville || $c.region || $c.entreprise || $c.libre}
     <table cellspacing="0" cellpadding="0">
index 0b1b03c..63fa012 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: search.tpl,v 1.24 2004-11-04 13:50:45 x2000habouzit Exp $
+        $Id: search.tpl,v 1.25 2004-11-05 14:34:04 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -36,7 +36,7 @@
   <div class="contact-list" style="clear:both">
     {section name=resultat loop=$resultats}
       {if !$resultats[resultat].inscrit || $resultats[resultat].decede}<div class='grayed'>{/if}
-      {if $resultats[resultat].contact!=""}
+        {if $resultats[resultat].contact || $resultats[resultat].watch}
         {assign var="show_action" value="retirer"}
       {else}
         {assign var="show_action" value="ajouter"}