Migrates the PlSet views to hruid.
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 12 Oct 2008 03:48:13 +0000 (05:48 +0200)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 12 Oct 2008 03:48:13 +0000 (05:48 +0200)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
include/userset.inc.php
templates/gadgets/ig-minifiche.tpl
templates/gadgets/ig-search.tpl
templates/include/minifiche.tpl
templates/include/plview.referent.tpl
templates/include/plview.trombi.tpl

index e61507b..1fddfc3 100644 (file)
@@ -46,9 +46,7 @@ class UserSet extends PlSet
                             (!empty($GLOBALS['IS_XNET_SITE']) ?
                                 'INNER JOIN groupex.membres AS gxm ON (u.user_id = gxm.uid
                                                                        AND gxm.asso_id = ' . $globals->asso('id') . ') ' : '')
-                           . 'LEFT JOIN auth_user_quick AS q USING (user_id)
-                              LEFT JOIN aliases         AS a ON (a.id = u.user_id AND a.type = \'a_vie\')
-                              ' . $joins,
+                           . 'LEFT JOIN auth_user_quick AS q USING (user_id)' . $joins,
                             $where,
                             'u.user_id');
     }
@@ -172,8 +170,9 @@ class MinificheView extends MultipageView
 
     public function fields()
     {
-        return "u.user_id AS id,
-                u.*, a.alias AS forlife,
+        global $globals;
+        return "u.user_id AS id, u.*,
+                CONCAT(a.alias, '@{$globals->mail->domain}') AS bestemail,
                 u.perms != 'pending' AS inscrit,
                 u.perms != 'pending' AS wasinscrit,
                 u.deces != 0 AS dcd, u.deces, u.matricule_ax,
@@ -202,6 +201,7 @@ class MinificheView extends MultipageView
                                                       AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").")
                  LEFT JOIN  geoloc_pays    AS gp  ON (adr.country = gp.a2)
                  LEFT JOIN  geoloc_region  AS gr  ON (adr.country = gr.a2 AND adr.region = gr.region)
+                 LEFT JOIN  aliases        AS a   ON (a.id = u.user_id AND FIND_IN_SET('bestalias', a.flags))
                  LEFT JOIN  emails         AS em  ON (em.uid = u.user_id AND em.flags = 'active')" .
                 (S::logged() ?
                  "LEFT JOIN  contacts       AS c   On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
@@ -245,9 +245,8 @@ class MentorView extends MultipageView
 
     public function fields()
     {
-        return "m.uid, u.prenom, u.nom, u.promo,
-                a.alias AS forlife, m.expertise, mp.pid,
-                ms.secteur, ms.ss_secteur";
+        return "m.uid, u.prenom, u.nom, u.promo, u.hruid,
+                m.expertise, mp.pid, ms.secteur, ms.ss_secteur";
     }
 
     public function bounds()
@@ -289,7 +288,7 @@ class TrombiView extends MultipageView
 
     public function fields()
     {
-        return "u.user_id, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, u.prenom, u.promo, a.alias AS forlife ";
+        return "u.user_id, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, u.prenom, u.promo, u.hruid ";
     }
 
     public function joins()
@@ -433,8 +432,7 @@ class GadgetView implements PlView
 
     public function fields()
     {
-        return "u.user_id AS id,
-                u.*, a.alias AS forlife," .
+        return "u.user_id AS id, u.*," .
                 (S::logged() ? "q.profile_mobile AS mobile, " : "IF(q.profile_mobile_pub = 'public', q.profile_mobile, NULL) as mobile, ") .
                "u.perms != 'pending' AS inscrit,
                 u.perms != 'pending' AS wasinscrit,
index 6ff4e13..2a403ee 100644 (file)
 {*                                                                        *}
 {**************************************************************************}
 
-{if !$c.inscrit || $c.dcd}<div class='grayed'>{/if}
+{if (!$c.inscrit && $smarty.session.auth ge AUTH_COOKIE) || $c.dcd}<div class='grayed'>{/if}
 <div class="contact" {if $c.inscrit}{if $smarty.session.auth ge AUTH_COOKIE}title="Fiche mise à jour le {$c.date|date_format}"{/if}{/if}>
   <div class="nom">
     {if $c.sexe}&bull;{/if}
-    {if !$c.dcd && $c.inscrit}<a href="profile/{$c.forlife}" class="popup2">{/if}
+    {if !$c.dcd && ($c.inscrit || $smarty.session.auth eq AUTH_PUBLIC)}<a href="profile/{$c.hruid}" class="popup2">{/if}
     {if $c.nom_usage}{$c.nom_usage} {$c.prenom}<br />({$c.nom}){else}{$c.nom} {$c.prenom}{/if}
-    {if !$c.dcd && $c.inscrit}</a>{/if}
+    {if !$c.dcd && ($c.inscrit || $smarty.session.auth eq AUTH_PUBLIC)}</a>{/if}
   </div>
   <div class="autre">
     {if $c.iso3166}
         *}{icon name=cross title="Retirer de la liste de mes surveillances"}</a>
       {/if}
     {elseif $c.wasinscrit && !$c.dcd}
-        <a href="vcard/{$c.forlife}.vcf">{*
+        <a href="vcard/{$c.hruid}.vcf">{*
         *}{icon name=vcard title="Afficher la carte de visite"}</a>
       {if $show_action eq ajouter}
-        <a href="carnet/contacts?action={$show_action}&amp;user={$c.forlife}&amp;token={xsrf_token}" target="_top">{*
+        <a href="carnet/contacts?action={$show_action}&amp;user={$c.hruid}&amp;token={xsrf_token}" target="_top">{*
         *}{icon name=add title="Ajouter à mes contacts"}</a>
       {else}
-        <a href="carnet/contacts?action={$show_action}&amp;user={$c.forlife}&amp;token={xsrf_token}" target="_top">{*
+        <a href="carnet/contacts?action={$show_action}&amp;user={$c.hruid}&amp;token={xsrf_token}" target="_top">{*
         *}{icon name=cross title="Retirer de mes contacts"}</a>
       {/if}
     {/if}
index 67fdd83..a1c469c 100644 (file)
 <div class="error">{$error}</div>
 {elseif $set}
 <div class="contact-list">
-{iterate from=$set item=res}
+{foreach from=$set item=res}
   {if $res.contact}
   {include file="gadgets/ig-minifiche.tpl" c=$res show_action="retirer"}
   {else}
   {include file="gadgets/ig-minifiche.tpl" c=$res show_action="ajouter"}
   {/if}
-{/iterate}
+{/foreach}
 </div>
 <div class="more">
   <a href="search?quick={$smarty.request.quick}" target="_blank">{$result_count} résultats au total</a> &gt;&gt;&gt;
index 26d428c..9efa2fc 100644 (file)
@@ -64,7 +64,7 @@
         {if !$c.dcd}
     <a href="vcard/{$c.hruid}.vcf">{*
     *}{icon name=vcard title="Afficher la carte de visite"}</a>
-    <a href="mailto:{$c.forlife}@{#globals.mail.domain#}">{*
+    <a href="mailto:{$c.bestemail}">{*
     *}{icon name=email title="Envoyer un email"}</a>
           {if $show_action eq ajouter}
     <a href="carnet/contacts?action={$show_action}&amp;user={$c.hruid}&amp;token={xsrf_token}">{*
index 76dce26..ebe8c1f 100644 (file)
@@ -31,9 +31,9 @@
     </div> 
     <div class="bits" style="width: 40%;"> 
       <span class='smaller'> 
-      <a href="profile/{$p.forlife}" class="popup2">
+      <a href="profile/{$p.hruid}" class="popup2">
         {icon name=user_suit title="Voir sa fiche"}</a> - 
-        <a href="referent/{$p.forlife}" class="popup2">Voir sa fiche référent</a>
+        <a href="referent/{$p.hruid}" class="popup2">Voir sa fiche référent</a>
       </span> 
     </div> 
     <div class="long"> 
index e09cab6..bdedf25 100644 (file)
   {if $smarty.section.trombi.index % 3 == 1}
   <tr>
     <td class="center" style="vertical-align: middle">
-      <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].forlife}" class="popup2">
-        <img src="photo/{$set[trombi.index_prev].forlife}" width="110" alt=" [ PHOTO ] " />
+      <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].hruid}" class="popup2">
+        <img src="photo/{$set[trombi.index_prev].hruid}" width="110" alt=" [ PHOTO ] " />
       </a>
       {if $trombi_with_admin && hasPerm('admin')}
       <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_prev].user_id}">{icon name=wrench title="[admin]"}</a>
       {/if}
     </td>
     <td class="center" style="vertical-align: middle">
-      <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
-        <img src="photo/{$set[trombi].forlife}" width="110" alt=" [ PHOTO ] " />
+      <a href="{$mainsiteurl}profile/{$set[trombi].hruid}" class="popup2">
+        <img src="photo/{$set[trombi].hruid}" width="110" alt=" [ PHOTO ] " />
       </a>
       {if $trombi_with_admin && hasPerm('admin')}
       <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
@@ -47,8 +47,8 @@
     </td>
     <td class="center" style="vertical-align: middle">
     {if $set[trombi.index_next]}
-      <a href="{$mainsiteurl}profile/{$set[trombi.index_next].forlife}" class="popup2">
-        <img src="photo/{$set[trombi.index_next].forlife}" width="110" alt=" [ PHOTO ] " />
+      <a href="{$mainsiteurl}profile/{$set[trombi.index_next].hruid}" class="popup2">
+        <img src="photo/{$set[trombi.index_next].hruid}" width="110" alt=" [ PHOTO ] " />
       </a>
       {if $trombi_with_admin && hasPerm('admin')}
       <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_next].user_id}">{icon name=wrench title="[admin]"}</a>
   </tr>
   <tr>
     <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
-      <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].forlife}" class="popup2">
+      <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].hruid}" class="popup2">
         {$set[trombi.index_prev].prenom} {$set[trombi.index_prev].nom}{if $trombi_with_promo} ({$set[trombi.index_prev].promo}){/if}
       </a>
     </td>
     <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
-      <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+      <a href="{$mainsiteurl}profile/{$set[trombi].hruid}" class="popup2">
         {$set[trombi].prenom} {$set[trombi].nom}{if $trombi_with_promo} ({$set[trombi].promo}){/if}
       </a>
     </td>
     <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
     {if $set[trombi.index_next]}
-      <a href="{$mainsiteurl}profile/{$set[trombi.index_next].forlife}" class="popup2">
+      <a href="{$mainsiteurl}profile/{$set[trombi.index_next].hruid}" class="popup2">
         {$set[trombi.index_next].prenom} {$set[trombi.index_next].nom}{if $trombi_with_promo} ({$set[trombi.index_next].promo}){/if}
       </a>
     {/if}
@@ -78,8 +78,8 @@
   {elseif ($smarty.section.trombi.index % 3 == 0) && ($smarty.section.trombi.last)}
   <tr>
     <td class="center" style="vertical-align: middle; padding-bottom: 15px">
-      <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
-        <img src="photo/{$set[trombi].forlife}" width="110" alt=" [ PHOTO ] " />
+      <a href="{$mainsiteurl}profile/{$set[trombi].hruid}" class="popup2">
+        <img src="photo/{$set[trombi].hruid}" width="110" alt=" [ PHOTO ] " />
       </a>
       {if $trombi_with_admin && hasPerm('admin')}
       <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
@@ -89,7 +89,7 @@
   </tr>
   <tr style="margin-top: 0; padding-top: 0">
     <td class="center" style="vertical-align: bottom">
-      <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+      <a href="{$mainsiteurl}profile/{$set[trombi].hruid}" class="popup2">
         {$set[trombi].prenom} {$set[trombi].nom}{if $trombi_with_promo} ({$set[trombi].promo}){/if}
       </a>
     </td>