Removes references to old user web URL
authorGuillaume Bandet <guillaume.bandet@polytechnique.org>
Tue, 10 Jun 2008 13:04:08 +0000 (15:04 +0200)
committerGuillaume Bandet <guillaume.bandet@polytechnique.org>
Thu, 12 Jun 2008 12:18:33 +0000 (14:18 +0200)
bin/cron/checkdb.php
include/notifs.inc.php
include/profil.func.inc.php
include/user.func.inc.php
modules/profile/general.inc.php
modules/search/classes.inc.php
templates/core/vcard.tpl
templates/profile/general.tpl
upgrade/fusionax-0.0.1/02_networking.sql

index f32ad00..818cf2a 100755 (executable)
@@ -73,17 +73,17 @@ if ( PEAR::isError($opts) ) {
 
 /* Validite des flags de transmission */
 check("SELECT  u.user_id, nom, prenom, promo,
-               profile_mobile_pub, emails_alias_pub, profile_web_pub, profile_freetext_pub, profile_medals_pub
+               profile_mobile_pub, emails_alias_pub, profile_freetext_pub, profile_medals_pub
          FROM  auth_user_md5 AS u
    INNER JOIN  auth_user_quick AS q USING(user_id)
         WHERE  (profile_mobile_pub != 'private' AND profile_mobile_pub != 'ax' AND profile_mobile_pub != 'public')
            OR  (emails_alias_pub != 'private' AND emails_alias_pub != 'public')
-           OR  (profile_web_pub != 'private' AND profile_web_pub != 'public')
            OR  (profile_freetext_pub != 'private' AND profile_freetext_pub != 'public')
            OR  (profile_medals_pub != 'private' AND profile_medals_pub != 'public')",
     "Utilisateur n'ayant pas de flag de publicite pour leurs donnees de profil");
 check("select uid from adresses where pub != 'private' and pub !='ax' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicite pour une adresse");
 check("select uid from tels where tel_pub != 'private' and tel_pub !='ax' and tel_pub != 'public'", "Utiliseur n'ayant pas de flag de publicite pour un numero de telephone");
+check("select uid from profile_networking where pub != 'private' and pub != 'public'", "Utiliseur n'ayant pas de flag de publicité pour une adresse de networking");
 
 /* validite de aliases */
 check("SELECT a.*
index 0bcf655..9466aa7 100644 (file)
@@ -144,7 +144,7 @@ $prf_desc = array('nom' => 'Son patronyme',
                   'mobile' => 'Son numéro de téléphone portable',
                   'nationalite' => 'Sa nationalité',
                   'nick' => 'Son surnom',
-                  'web' => 'L\'adresse de son site web',
+                  'networking' => 'La liste de ses adresses de networking',
                   'appli1' => 'Son école d\'application',
                   'appli2' => 'Son école de post-application',
                   'addresses' => 'Ses adresses',
index 8a5edbf..40fa9c6 100644 (file)
@@ -70,8 +70,6 @@ function diff_user_details(&$a, &$b, $view = 'private') { // compute $c = $a - $
     // don't modify mobile if you don't have the right
     if (isset($b['mobile_pub']) && !has_user_right($b['mobile_pub'], $view) && isset($c['mobile']))
         unset($c['mobile']);
-    if (isset($b['web_pub']) && !has_user_right($b['web_pub'], $view) && isset($c['web']))
-        unset($c['web']);
     if (isset($b['freetext_pub']) && !has_user_right($b['freetext_pub'], $view) && isset($c['freetext']))
         unset($c['freetext']);
     if (!count($c))
index c05aabb..4ff11ca 100644 (file)
@@ -390,8 +390,8 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
 {
     $reqsql = "SELECT  u.user_id, u.promo, u.promo_sortie, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
                        u.perms IN ('admin','user','disabled') AS inscrit,  FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
-                       q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext,
-                       q.profile_mobile_pub AS mobile_pub, q.profile_web_pub AS web_pub, q.profile_freetext_pub AS freetext_pub,
+                       q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_freetext AS freetext,
+                       q.profile_mobile_pub AS mobile_pub, q.profile_freetext_pub AS freetext_pub,
                        q.profile_medals_pub AS medals_pub,
                        IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166,
                        a.alias AS forlife, a2.alias AS bestalias,
@@ -429,13 +429,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
         else
             $user['mobile'] = '';
     }
-    // hide web
-    if (!has_user_right($user['web_pub'], $view)) {
-        if ($user['web'] == '')
-            $user['web_pub'] = $view;
-        else
-            $user['web'] = '';
-    }
+
     // hide freetext
     if (!has_user_right($user['freetext_pub'], $view)) {
         if ($user['freetext'] == '')
index 87b1707..066eac6 100644 (file)
@@ -191,7 +191,6 @@ class ProfileGeneral extends ProfilePage
                                = new ProfileNom();
         $this->settings['naissance'] = new ProfileDate();
         $this->settings['mobile_pub']
-                                  = $this->settings['web_pub']
                                   = $this->settings['freetext_pub']
                                   = $this->settings['photo_pub']
                                   = new ProfilePub();
@@ -206,12 +205,11 @@ class ProfileGeneral extends ProfilePage
         $this->settings['synchro_ax']
                                   = new ProfileBool();
         $this->settings['mobile'] = new ProfileTel();
-        $this->settings['web'] = new ProfileWeb();
         $this->settings['networking'] = new ProfileNetworking();
         $this->settings['appli1']
                                   = $this->settings['appli2']
                                   = new ProfileAppli();
-        $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true, 'web' => true,
+        $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true, 'networking' => true,
                        'appli1' => true, 'appli2' => true, 'nationalite' => true, 'nick' => true);
     }
 
@@ -220,7 +218,6 @@ class ProfileGeneral extends ProfilePage
         // Checkout all data...
         $res = XDB::query("SELECT  u.promo, u.promo_sortie, u.nom_usage, u.nationalite, u.naissance,
                                    q.profile_mobile as mobile, q.profile_mobile_pub as mobile_pub,
-                                   q.profile_web as web, q.profile_web_pub as web_pub,
                                    q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
                                    q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax,
                                    IF(a1.aid IS NULL, -1, a1.aid) as appli_id1, a1.type as appli_type1,
@@ -278,15 +275,14 @@ class ProfileGeneral extends ProfilePage
                          S::v('uid'));
         }
         if ($this->changed['nick'] || $this->changed['mobile'] || $this->changed['mobile_pub']
-            || $this->changed['web'] || $this->changed['web_pub'] || $this->changed['freetext']
+            || $this->changed['freetext']
             || $this->changed['freetext_pub'] || $this->changed['synchro_ax']) {
             XDB::execute("UPDATE  auth_user_quick
                              SET  profile_nick= {?}, profile_mobile={?}, profile_mobile_pub={?}, 
-                                  profile_web={?}, profile_web_pub={?}, profile_freetext={?}, 
+                                  profile_freetext={?},
                                   profile_freetext_pub={?}, profile_from_ax = {?} 
                            WHERE  user_id = {?}", 
                          $this->values['nick'], $this->values['mobile'], $this->values['mobile_pub'],
-                         $this->values['web'], $this->values['web_pub'],
                          $this->values['freetext'], $this->values['freetext_pub'],
                          $this->values['synchro_ax'], S::v('uid'));
         }
index 5ef9fd6..abb6e54 100644 (file)
@@ -40,7 +40,6 @@ require_once("xorg.misc.inc.php");
 // hide private information if not logged
 if (S::logged())
     $globals->search->result_fields .='
-        q.profile_web AS web,
         q.profile_mobile AS mobile,
         q.profile_freetext AS freetext,
         adr.city, gp.pays AS countrytxt, gr.name AS region,
@@ -49,7 +48,6 @@ if (S::logged())
         nwe.name AS networking_name,';
 else
     $globals->search->result_fields .="
-    IF(q.profile_web_pub='public', q.profile_web, '') AS web,
         IF(q.profile_mobile_pub='public', q.profile_mobile, '') AS mobile,
         IF(q.profile_freetext_pub='public', q.profile_freetext, '') AS freetext,
         IF(adr.pub='public', adr.city, '') AS city,
index c3e3097..f6bef39 100644 (file)
@@ -69,9 +69,11 @@ ADR;TYPE=home{if $adr.courier},postal{/if}:{format_adr adr=$adr}
 {/if}
 {/foreach}
 {/foreach}
-{if $vcard.web}
-URL:{$vcard.web}
+{foreach from=$vcard.networking item=nw}
+{if $nw.filter eq 'web'}
+URL:{$nw.address}
 {/if}
+{/foreach}
 {if strlen(trim($vcard.freetext)) == 0}
 NOTE:(X{$vcard.promo})
 {else}
index 1cbf27f..1128ae3 100644 (file)
@@ -327,8 +327,7 @@ pour les premières lettres : <strong>Alfred&nbsp;de&nbsp;Musset</strong>" width
           <input type="checkbox" name="freetext_pub" {if $freetext_pub eq 'public'}checked="checked"{/if} />
           {icon name="flag_green" title="site public"}
         </span>&nbsp;
-        <span class="titre">Complément libre</span><br />
-        <span class="comm">Commentaire ? ICQ ? etc...</span>
+        <span class="titre">Commentaire</span>
       </div>
       <div class="smaller" style="margin-top: 30px">
         <a href="wiki_help/notitle" class="popup3">
index cf368ff..0da8e66 100644 (file)
@@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking` (
     PRIMARY KEY (`uid`, `nwid`)
 ) CHARSET=utf8 COMMENT='networking addresses';
 
-
+-- Insert a first address type for old URLs
 INSERT INTO `profile_networking_enum` (`network_type`, `name`, `icon`, `filter`)
      VALUES (0, 'Page web', 'web.gif', 'web');
 
@@ -24,3 +24,20 @@ INSERT INTO `profile_networking` (`uid`, `nwid`, `network_type`, `address`, `pub
        FROM `auth_user_quick`
       WHERE `profile_web` <> "";
 
+-- Modify watch_profile to update 'field' from web to networking
+ALTER TABLE `watch_profile`
+     MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick',
+                         'web', 'networking', 'appli1', 'appli2', 'addresses',
+                         'section', 'binets', 'medals', 'cv', 'jobs', 'photo');
+
+UPDATE `watch_profile` SET `field` = 'networking' WHERE `field` = 'web';
+
+ALTER TABLE `watch_profile`
+     MODIFY `field` enum('nom', 'freetext', 'mobile', 'nationalite', 'nick',
+                         'networking', 'appli1', 'appli2', 'addresses',
+                         'section', 'binets', 'medals', 'cv', 'jobs', 'photo');
+
+-- Drop old web URL columns
+ALTER TABLE `auth_user_quick` DROP COLUMN `profile_web`;
+ALTER TABLE `auth_user_quick` DROP COLUMN `profile_web_pub`;
+