Adds the possibility to forge an url linking to a profile page from networking addresses
authorGuillaume Bandet <guillaume.bandet@polytechnique.org>
Fri, 20 Jun 2008 16:37:40 +0000 (18:37 +0200)
committerGuillaume Bandet <guillaume.bandet@polytechnique.org>
Thu, 10 Jul 2008 21:47:43 +0000 (23:47 +0200)
include/user.func.inc.php
modules/profile.php
templates/profile/profile.tpl
upgrade/fusionax-0.0.1/02_networking.sql

index 0f8b944..0fdd3ae 100644 (file)
@@ -499,13 +499,14 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
     }
 
     $user['networking'] = Array();
-    $res = XDB::iterator("SELECT  n.address, n.pub, m.network_type AS type, m.name, m.filter
+    $res = XDB::iterator("SELECT  n.address, n.pub, m.network_type AS type, m.name, m.filter, m.link
                             FROM  profile_networking AS n
                       INNER JOIN  profile_networking_enum AS m ON (n.network_type = m.network_type)
                            WHERE  n.uid = {?}", $uid);
     while($network = $res->next())
     {
         if (has_user_right($network['pub'], $view)) {
+            $network['link'] = str_replace('%s', $network['address'], $network['link']);
             $user['networking'][] = $network;
         }
     }
index 89a4d56..ba1a4f2 100644 (file)
@@ -826,7 +826,8 @@ class ProfileModule extends PLModule
         $table_editor = new PLTableEditor('admin/networking', 'profile_networking_enum', 'network_type');
         $table_editor->describe('name', 'intitulé', true);
         $table_editor->describe('icon', 'nom de l\'icône', false);
-        $table_editor->describe('filter', 'nom du filtre à appliquer', true);
+        $table_editor->describe('filter', 'filtre', true);
+        $table_editor->describe('link', 'lien web', true);
         $table_editor->apply($page, $action, $id);
     }
     function handler_admin_phones_format_display(&$page, $action = 'list', $id = null) {
index 9ddee57..a9fd049 100644 (file)
@@ -56,6 +56,8 @@ function chgMainWinLoc(strPage)
         <img style="width: auto; padding: 0" src="profile/networking/{$network.type}" alt="{$network.name}" title="{$network.name}"/>
         {if $network.filter == 'web'}
           <a href="{$network.address}">{$network.address}</a>
+        {elseif $network.link != ''}
+          <a href="{$network.link}">{$network.address}</a>
         {else}
           {$network.address}
         {/if}
index 64cbc8f..17172c9 100644 (file)
@@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking_enum` (
     `name` varchar(30) NOT NULL,
     `icon` varchar(50) NOT NULL COMMENT 'icon filename',
     `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses',
+    `link` varchar(255) NOT NULL COMMENT 'string used to forge an URL linking to the the profile page',
     PRIMARY KEY (`network_type`)
 ) CHARSET=utf8 COMMENT='types of networking addresses';