From 908fd4f72e0309b7eb3f00804f03397304753ec2 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 5 Nov 2004 13:49:15 +0000 Subject: [PATCH] now have to work on : - the notification mail - how to add watches on non-ins --- htdocs/carnet/notifs.php | 7 ++++++- include/notifs.inc.php | 14 ++++++++++---- templates/carnet/notifs.tpl | 10 ++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/htdocs/carnet/notifs.php b/htdocs/carnet/notifs.php index af782bb..22cb040 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.2 2004-11-04 19:57:42 x2000habouzit Exp $ + $Id: notifs.php,v 1.3 2004-11-05 13:49:15 x2000habouzit Exp $ ***************************************************************************/ require("auto.prepend.inc.php"); @@ -39,10 +39,15 @@ foreach($_REQUEST as $key=>$val) { $notifs->add_promo($val); }; break; + case 'del_promo': $notifs->del_promo($val); break; + case 'del_nonins': + $notifs->del_nonins($val); + break; + case 'flags': $flags = new FlagSet(); if(isset($_REQUEST['contacts'])) $flags->addflag('contacts'); diff --git a/include/notifs.inc.php b/include/notifs.inc.php index 9f98284..d4c9edc 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.3 2004-11-05 13:41:31 x2000habouzit Exp $ + $Id: notifs.inc.php,v 1.4 2004-11-05 13:49:16 x2000habouzit Exp $ ***************************************************************************/ require_once('diogenes.flagset.inc.php'); @@ -48,20 +48,26 @@ class Notifs { mysql_free_result($res); $this->flags = new FlagSet($flags); - $res = $globals->db->query("SELECT type,arg,prenom,nom,promo + $res = $globals->db->query("SELECT type,arg,prenom,nom,promo,u.user_id FROM watch AS w LEFT JOIN auth_user_md5 AS u ON(u.user_id = w.arg) WHERE w.user_id = '$uid' ORDER BY promo,nom,arg"); - while(list($type, $arg, $prenom, $nom, $promo) = mysql_fetch_row($res)) { + while(list($type, $arg, $prenom, $nom, $promo, $uid) = mysql_fetch_row($res)) { if($type=='promo') { $this->promos[$arg] = $arg; } elseif($type =='non-inscrit') { - $this->nonins[$arg] = Array('prenom'=>$prenom, 'nom'=>$nom, 'promo'=>$promo); + $this->nonins[$arg] = Array('prenom'=>$prenom, 'nom'=>$nom, 'promo'=>$promo, 'uid'=>$uid); } } } + function del_nonins($p) { + global $globals; + unset($this->nonins[$p]); + $globals->db->query("DELETE FROM watch WHERE user_id='{$this->uid}' AND type='non-inscrit' AND arg='$p'"); + } + function del_promo($p) { global $globals; unset($this->promos[$p]); diff --git a/templates/carnet/notifs.tpl b/templates/carnet/notifs.tpl index cfd00f6..2c232bc 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.5 2004-11-05 13:41:31 x2000habouzit Exp $ + $Id: notifs.tpl,v 1.6 2004-11-05 13:49:16 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -83,7 +83,7 @@ Pour les non-inscrits, tu es notifi

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

- +
@@ -102,7 +102,9 @@ Si un non-inscrit que tu surveille s'inscrit, il sera automatiquement ajout

Tu surveilles {if $notifs->nonins|@count eq 1}le non-inscrit{else}les non-inscrits{/if} :

    {foreach from=$notifs->nonins item=p} -
  • {$p.prenom} {$p.nom} ({$p.promo})
  • +
  • + {$p.prenom} {$p.nom} ({$p.promo}) retirer +
  • {/foreach}
{/if} -- 2.1.4