now have to work on :
authorx2000habouzit <x2000habouzit>
Fri, 5 Nov 2004 13:49:15 +0000 (13:49 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 5 Nov 2004 13:49:15 +0000 (13:49 +0000)
 - the notification mail
 - how to add watches on non-ins

htdocs/carnet/notifs.php
include/notifs.inc.php
templates/carnet/notifs.tpl

index af782bb..22cb040 100644 (file)
@@ -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');
index 9f98284..d4c9edc 100644 (file)
@@ -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]);
index cfd00f6..2c232bc 100644 (file)
@@ -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
 <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>
@@ -92,7 +92,7 @@ Si un non-inscrit que tu surveille s'inscrit, il sera automatiquement ajout
     <span class='smaller'>Il faut entrer le "login" (prenom.nom ou prenom.nom.promo).</span>
   </fieldset>
 </form>
-
+-->
 <table class='tinybicol' cellpadding="0" cellspacing="0">
   <tr>
     <td>
@@ -102,7 +102,9 @@ Si un non-inscrit que tu surveille s'inscrit, il sera automatiquement ajout
       <p>Tu surveilles {if $notifs->nonins|@count eq 1}le non-inscrit{else}les non-inscrits{/if} :</p>
       <ul>
         {foreach from=$notifs->nonins item=p}
-        <li>{$p.prenom} {$p.nom} ({$p.promo})</li>
+        <li>
+        {$p.prenom} {$p.nom} ({$p.promo}) <a href="?del_nonins={$p.uid}"><img src="{"images/retirer.gif"|url}" alt="retirer" /></a>
+        </li>
         {/foreach}
       </ul>
       {/if}