From 60ddbe60fb379f803b5a6e739d0d0cbc4d2dba1a Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 5 Nov 2004 14:34:03 +0000 Subject: [PATCH] integrate watches into search and the minifiche --- htdocs/advanced_search.php | 4 ++-- htdocs/carnet/notifs.php | 6 ++++- htdocs/search.php | 8 ++++--- include/notifs.inc.php | 10 +++++++- templates/carnet/notifs.tpl | 18 ++++++--------- templates/include/minifiche.tpl | 4 +++- templates/include/minifiche_pvt.tpl | 46 ++++++++++++++++++++++--------------- templates/search.tpl | 4 ++-- 8 files changed, 60 insertions(+), 40 deletions(-) diff --git a/htdocs/advanced_search.php b/htdocs/advanced_search.php index 7cf1b9c..baca075 100644 --- a/htdocs/advanced_search.php +++ b/htdocs/advanced_search.php @@ -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, diff --git a/htdocs/carnet/notifs.php b/htdocs/carnet/notifs.php index 22cb040..81e421c 100644 --- a/htdocs/carnet/notifs.php +++ b/htdocs/carnet/notifs.php @@ -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; diff --git a/htdocs/search.php b/htdocs/search.php index 380fc1b..39b7324 100644 --- a/htdocs/search.php +++ b/htdocs/search.php @@ -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,' :'') diff --git a/include/notifs.inc.php b/include/notifs.inc.php index d4c9edc..e5725ad 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -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]); diff --git a/templates/carnet/notifs.tpl b/templates/carnet/notifs.tpl index 2c232bc..576387f 100644 --- a/templates/carnet/notifs.tpl +++ b/templates/carnet/notifs.tpl @@ -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

Si un non-inscrit que tu surveille s'inscrit, il sera automatiquement ajouté à tes contacts.

- + +

+Pour surveiller des membres non-inscrits, il faut passer par la recherche +et cliquer sur les icones Ajouter pour les ajouter à cette liste +

+
diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index e8b51bf..d7d5197 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -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} + {if $inscrit || $c.dcd}
{strip} {if $c.iso3166} @@ -51,6 +52,7 @@ {if $c.dcd} décédé le {$c.deces}{/if} {/strip}
+ {/if} {min_auth level="cookie"} {include file="include/minifiche_pvt.tpl"} {/min_auth} diff --git a/templates/include/minifiche_pvt.tpl b/templates/include/minifiche_pvt.tpl index 6495463..54c13cc 100644 --- a/templates/include/minifiche_pvt.tpl +++ b/templates/include/minifiche_pvt.tpl @@ -17,11 +17,36 @@ * 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} + +
+ {if $show_action eq ajouter} + {* + *}Ajouter à la liste de mes surveillances{* + *} + {else} + {* + *}Retirer de la liste de mes surveillances{* + *} + {/if} + {perms level='admin'} + {* + *}AX{* + *} + {/perms} +
+ {/if} +
+{else} -{else} - {if $c.dcd neq 1} - - {/if} -
-{/if} -{if $inscrit==1}
{if $c.web || $c.mobile || $c.pays || $c.ville || $c.region || $c.entreprise || $c.libre} diff --git a/templates/search.tpl b/templates/search.tpl index 0b1b03c..63fa012 100644 --- a/templates/search.tpl +++ b/templates/search.tpl @@ -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 @@
{section name=resultat loop=$resultats} {if !$resultats[resultat].inscrit || $resultats[resultat].decede}
{/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"} -- 2.1.4