* Admin:
- Can add sorting key in Table Editor. -FRU
+ * Carnet:
+ - Add a vcard of all the contacts -FRU
+
+ * Xnet:
+ - Add a vcard of all the members of a group -FRU
+
Bug/Wish:
* Admin:
function handlers()
{
return array(
- 'carnet' => $this->make_hook('index', AUTH_COOKIE),
- 'carnet/panel' => $this->make_hook('panel', AUTH_COOKIE),
- 'carnet/notifs' => $this->make_hook('notifs', AUTH_COOKIE),
+ 'carnet' => $this->make_hook('index', AUTH_COOKIE),
+ 'carnet/panel' => $this->make_hook('panel', AUTH_COOKIE),
+ 'carnet/notifs' => $this->make_hook('notifs', AUTH_COOKIE),
- 'carnet/contacts' => $this->make_hook('contacts', AUTH_COOKIE),
- 'carnet/contacts/pdf' => $this->make_hook('pdf', AUTH_COOKIE),
+ 'carnet/contacts' => $this->make_hook('contacts', AUTH_COOKIE),
+ 'carnet/contacts/pdf' => $this->make_hook('pdf', AUTH_COOKIE),
+ 'carnet/contacts/ical' => $this->make_hook('ical', AUTH_COOKIE),
+ 'carnet/contacts/vcard' => $this->make_hook('vcard', AUTH_COOKIE),
- 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC),
- 'carnet/ical' => $this->make_hook('ical', AUTH_PUBLIC),
+ 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC),
);
}
header('Content-Type: text/calendar; charset=utf-8');
}
+
+ function handler_vcard(&$page)
+ {
+ $res = XDB::query('SELECT contact
+ FROM contacts
+ WHERE uid = {?}', S::v('uid'));
+ require_once('vcard.inc.php');
+ $vcard = new VCard($res->fetchColumn());
+ $vcard->do_page(&$page);
+ }
}
?>
}
}
- function vcard_escape($text)
- {
- return preg_replace('/[,;]/', '\\\\$0', $text);
- }
-
- function format_adr($params, &$smarty)
- {
- // $adr1, $adr2, $adr3, $postcode, $city, $region, $country
- extract($params['adr']);
- $adr = trim($adr1);
- $adr = trim("$adr\n$adr2");
- $adr = trim("$adr\n$adr3");
- return $this->vcard_text_encode(';;'
- . $this->vcard_escape($adr) . ';'
- . $this->vcard_escape($city) . ';'
- . $this->vcard_escape($region) . ';'
- . $this->vcard_escape($postcode) . ';'
- . $this->vcard_escape($country), false);
- }
-
- function vcard_text_encode($text, $escape = true)
- {
- if ($escape) {
- $text = $this->vcard_escape($text);
- }
- return str_replace("\n", "\\n", $text); //implode('\n', explode("\n", $text));
- }
-
function handler_vcard(&$page, $x = null)
{
if (is_null($x)) {
$x = substr($x, 0, strlen($x) - 4);
}
- $page->changeTpl('vcard.tpl', NO_SKIN);
- require_once 'xorg.misc.inc.php';
- require_once 'user.func.inc.php';
-
- $page->register_modifier('vcard_enc', array($this, 'vcard_text_encode'));
- $page->register_function('format_adr', array($this, 'format_adr'));
-
- $login = get_user_forlife($x);
- $user = get_user_details($login);
-
- if (strlen(trim($user['freetext']))) {
- $user['freetext'] = html_entity_decode($user['freetext']);
- }
-
- // alias virtual
- $res = XDB::query(
- "SELECT alias
- FROM virtual
- INNER JOIN virtual_redirect USING(vid)
- INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' )
- WHERE ( redirect={?} OR redirect={?} )
- AND alias LIKE '%@{$globals->mail->alias_dom}'",
- S::v('uid'),
- $user['forlife'].'@'.$globals->mail->domain,
- $user['forlife'].'@'.$globals->mail->domain2);
-
- $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();
- }
- $page->assign('users', array($user));
-
- header("Pragma: ");
- header("Cache-Control: ");
- header("Content-type: text/x-vcard; charset=iso-8859-15");
- header("Content-Transfer-Encoding: 8bit");
+ require_once('vcard.inc.php');
+ $vcard = new VCard($x);
+ $vcard->do_page($page);
}
function handler_admin_trombino(&$page, $uid = null, $action = null) {
function handlers()
{
return array(
- '%grp' => $this->make_hook('index', AUTH_PUBLIC),
- '%grp/asso.php' => $this->make_hook('index', AUTH_PUBLIC),
- '%grp/logo' => $this->make_hook('logo', AUTH_PUBLIC),
- '%grp/edit' => $this->make_hook('edit', AUTH_MDP),
- '%grp/mail' => $this->make_hook('mail', AUTH_MDP),
- '%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP),
- '%grp/subscribe' => $this->make_hook('subscribe', AUTH_MDP),
- '%grp/paiement' => $this->make_hook('paiement', AUTH_MDP),
+ '%grp' => $this->make_hook('index', AUTH_PUBLIC),
+ '%grp/asso.php' => $this->make_hook('index', AUTH_PUBLIC),
+ '%grp/logo' => $this->make_hook('logo', AUTH_PUBLIC),
+ '%grp/edit' => $this->make_hook('edit', AUTH_MDP),
+ '%grp/mail' => $this->make_hook('mail', AUTH_MDP),
+ '%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP),
+ '%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_MDP),
+ '%grp/subscribe' => $this->make_hook('subscribe', AUTH_MDP),
+ '%grp/paiement' => $this->make_hook('paiement', AUTH_MDP),
'%grp/admin/annuaire'
=> $this->make_hook('admin_annuaire', AUTH_MDP),
$page->assign('ann', $ann);
}
+ function handler_vcard(&$page)
+ {
+ global $globals;
+
+ if (($globals->asso('pub') == 'public' && is_member()) || may_update()) {
+ $res = XDB::query('SELECT uid
+ 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->do_page($page);
+ } else {
+ return PL_NOTALLOWED;
+ }
+ }
+
function handler_subscribe(&$page, $u = null)
{
global $globals;
[<a href="carnet/contacts/pdf/mescontacts.pdf" class='popup'><strong>tri par noms</strong></a>]
</li>
</ul>
-<table style="width: 100%">
- <tr>
- <td>
- Tu peux récupérer un calendrier iCal avec l'anniversaire de tes contacts.
- </td>
- <td class="right">
- <a href="carnet/ical/anniv-x.ics">
- {icon name=calendar_view_day title='Anniversaires'}
- </a>
- </td>
- </tr>
-</table>
+
+<p>
+ Tu peux télécharger une de tes contacts :
+</p>
+<ul>
+ <li>
+ {icon name=calendar_view_day title='Anniversaires'}
+ <a href="carnet/contacts/ical/anniv-x.ics">
+ Le calendrier des anniversaires
+ </a>
+ </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>
+ </li>
+</ul>
{if $trombi}
{/if}
SORT-STRING:{$vcard.nom|vcard_enc}
REV:{$vcard.date|date_format:"%Y%m%dT000000Z"}
-END:VCARD
+END:VCARD{"\n"}
{/foreach}
{* vim:set et sw=2 sts=2 sws=2: *}
Les membres extérieurs du groupe sont intégrés à cette liste, et repérés par l'inscription 'extérieur' dans la colonne promotion.
</p>
-{if $admin}
<p class="descr">
-Fonctionnalités visibles uniquement par les administrateurs :
+Tu peux également :
</p>
<ul class="descr">
- <li><a href="{$platal->ns}member/new">Ajouter un membre</a></li>
- <li><a href="{$platal->ns}admin/annuaire">Synchroniser annuaire et Listes de diffusion</a></li>
+ <li>
+ <a href="{$platal->ns}annuaire/vcard/{$asso.diminutif}.vcf">
+ {icon name=vcard title="Carte de visite"}
+ Ajouter les membres à ton carnet d'adresse
+ </a>
+ </li>
+ {if $admin}
+ <li>
+ <a href="{$platal->ns}member/new">
+ {icon name=add title="Ajouter un membre"}
+ Ajouter un membre
+ </a>
+ </li>
+ <li>
+ <a href="{$platal->ns}admin/annuaire">
+ {icon name=wand title="Synchroniser"}
+ Synchroniser annuaire et Listes de diffusion
+ </a>
+ </li>
+ {/if}
</ul>
-{/if}
<p class="center">
[<a href="{$platal->ns}annuaire?order={$smarty.request.order}" {if !$request_group}class="erreur"{/if}>tout</a>]