Add link to download the vcards without the photos
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 23 Oct 2006 07:56:13 +0000 (07:56 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 23 Oct 2006 07:56:13 +0000 (07:56 +0000)
Also fix validation page

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1018 839d8a87-29fc-0310-9880-83ba4fa771e5

include/validations.inc.php
include/validations/listes.inc.php
include/vcard.inc.php
modules/carnet.php
modules/xnetgrp.php
templates/carnet/mescontacts.tpl
templates/xnet/groupe/annuaire.tpl

index b7b0f66..6af52e8 100644 (file)
@@ -32,7 +32,7 @@ class ValidateIterator extends XOrgDBIterator
 
     function ValidateIterator ()
     {
-        parent::XOrgDBIterator('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM);
+        parent::__construct('SELECT data,stamp FROM requests ORDER BY stamp', MYSQL_NUM);
     }
 
     // }}}
index 1152185..6171a24 100644 (file)
@@ -104,7 +104,7 @@ class ListeReq extends Validate
 
     function commit()
     {
-        $list = new List(S::v('uid'), S::v('password'));
+        $list = new MMList(S::v('uid'), S::v('password'));
         $ret = $list->create_list($this->liste, $this->desc, $this->advertise,
                                   $this->modlevel, $this->inslevel,
                                   $this->owners, $this->members);
index 749af3d..f876f4d 100644 (file)
@@ -25,9 +25,11 @@ require_once('user.func.inc.php');
 class VCard
 {
     var $users = array();
+    var $photos;
 
-    function VCard($users, $freetext = null)
+    function VCard($users, $photos = true, $freetext = null)
     {
+        $this->photos = $photos;
         if (is_array($users)) {
             foreach ($users as $user) {
                 $this->add_user($user, $freetext);
@@ -98,13 +100,15 @@ class VCard
         $user['virtualalias'] = $res->fetchOneCell();
 
         // get photo
-        $res = XDB::query(
-                "SELECT attach, attachmime
-                   FROM photo   AS p
-             INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie')
-                  WHERE a.alias = {?}", $login);
-        if ($res->numRows()) {
-            $user['photo'] = $res->fetchOneAssoc();
+        if ($this->photos) {
+            $res = XDB::query(
+                    "SELECT attach, attachmime
+                       FROM photo   AS p
+                 INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie')
+                      WHERE a.alias = {?}", $login);
+            if ($res->numRows()) {
+                $user['photo'] = $res->fetchOneAssoc();
+            }
         }
         $this->users[] = $user;
     }
index 4cafae1..91a145a 100644 (file)
@@ -372,13 +372,14 @@ class CarnetModule extends PLModule
         header('Content-Type: text/calendar; charset=utf-8');
     }
 
-    function handler_vcard(&$page)
+    function handler_vcard(&$page, $photos = null)
     {
         $res = XDB::query('SELECT contact
                              FROM contacts
                             WHERE uid = {?}', S::v('uid'));
+
         require_once('vcard.inc.php');
-        $vcard = new VCard($res->fetchColumn());
+        $vcard = new VCard($res->fetchColumn(), $photos == 'photos');
         $vcard->do_page(&$page);
     }
 }
index a287dc5..2378958 100644 (file)
@@ -324,7 +324,7 @@ class XnetGrpModule extends PLModule
         $page->assign('ann', $ann);
     }
 
-    function handler_vcard(&$page)
+    function handler_vcard(&$page, $photos = null)
     {
         global $globals;
 
@@ -333,7 +333,7 @@ class XnetGrpModule extends PLModule
                                  FROM groupex.membres
                                 WHERE asso_id = {?}', $globals->asso('id'));
             require_once('vcard.inc.php');
-            $vcard = new VCard($res->fetchColumn(), 'Membre du groupe ' . $globals->asso('nom'));
+            $vcard = new VCard($res->fetchColumn(), $photos == 'photos', 'Membre du groupe ' . $globals->asso('nom'));
             $vcard->do_page($page);
         } else {
             return PL_NOTALLOWED;
index d72736c..a92d111 100644 (file)
@@ -67,9 +67,8 @@ Pour r
   </li>
   <li>
     {icon name=vcard title='Carte de visite'} 
-    <a href="carnet/contacts/vcard/MesContactsXorg.vcf">
-      La carte de visite permettant de les insérer dans ton carnet d'adresse
-    </a>
+    <a href="carnet/contacts/vcard/photos/MesContactsXorg.vcf">La carte de visite électronique</a>
+    (<a href="carnet/contacts/vcard/MesContactsXorg.vcf">sans les photos</a>)
   </li>
 </ul>
 
index 83279bd..c95f304 100644 (file)
@@ -35,10 +35,11 @@ Tu peux 
 </p>
 <ul class="descr">
   <li>
-    <a href="{$platal->ns}annuaire/vcard/{$asso.diminutif}.vcf">
+    <a href="{$platal->ns}annuaire/vcard/photos/{$asso.diminutif}.vcf">
       {icon name=vcard title="Carte de visite"} 
       Ajouter les membres à ton carnet d'adresse
     </a>
+    (<a href="{$platal->ns}annuaire/vcard/{$asso.diminutif}.vcf">sans les photos</a>)
   </li>
   {if $admin}
   <li>