From: Pierre Habouzit (MadCoder Date: Sat, 15 Jan 2005 12:58:26 +0000 (+0000) Subject: closes FS#204 : nicknames X-Git-Tag: xorg/old~417 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c6c656dd95c37e505f77ca4479cb4627339ba421;p=platal.git closes FS#204 : nicknames git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-339 --- diff --git a/ChangeLog b/ChangeLog index f7b1f94..bfe4c2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -70,6 +70,7 @@ Bug/Wish : * Profile : - #65 : Add professionnal cellphone. -Car - #170 : Remove region display for french departments. -Car + - #204 : Add nicknames (searchable too). -MC * Search : - #249, #251, #253 : Some tweaks to be more accurate. -MC diff --git a/htdocs/advanced_search.php b/htdocs/advanced_search.php index e63fbca..f932bbe 100644 --- a/htdocs/advanced_search.php +++ b/htdocs/advanced_search.php @@ -71,6 +71,7 @@ if (!Env::has('rechercher')) { $nameField = new NameSField('name',array('u.nom','u.epouse'),''); $firstnameField = new StringSField('firstname',array('u.prenom'),''); } + $nicknameField = new StringSField('nickname',array('q.profile_nick'),''); $promo1Field = new PromoSField('promo1','egal1',array('u.promo'),''); $promo2Field = new PromoSField('promo2','egal2',array('u.promo'),''); @@ -97,7 +98,7 @@ if (!Env::has('rechercher')) { $freeField = new RefSField('free',array('u.libre'),'','','',false); $offset = new NumericSField('offset'); - $fields = new SFieldGroup(true, array( $nameField, $firstnameField, $promo1Field, + $fields = new SFieldGroup(true, array( $nameField, $firstnameField, $nicknameField, $promo1Field, $promo2Field, $womanField, $subscriberField, $aliveField, $townField, $countryField, $regionField, $entrepriseField, $posteField, $secteurField, $cvField, $natField, $binetField, $groupexField, $sectionField, $schoolField, $diplomaField, $freeField) @@ -115,7 +116,8 @@ if (!Env::has('rechercher')) { '.$globals->search->result_fields.' c.uid AS contact, w.ni_id AS watch - FROM auth_user_md5 AS u + FROM auth_user_md5 AS u + INNER JOIN auth_user_quick AS q USING(user_id) '.$fields->get_select_statement().' '.(Env::has('only_referent') ? ' INNER JOIN mentor AS m ON (m.uid = u.user_id)' : '').' LEFT JOIN aliases AS a ON (u.user_id = a.id AND a.type="a_vie") diff --git a/include/profil/assign_general.inc.php b/include/profil/assign_general.inc.php index b5287ca..b690d57 100644 --- a/include/profil/assign_general.inc.php +++ b/include/profil/assign_general.inc.php @@ -44,4 +44,5 @@ $page->assign('appli_type1',$appli_type1); $page->assign('appli_type2',$appli_type2); $page->assign('nouvellephoto', $nouvellephoto); +$page->assign('surnom', $surnom); ?> diff --git a/include/profil/get_general.inc.php b/include/profil/get_general.inc.php index 8a88374..a755ac5 100644 --- a/include/profil/get_general.inc.php +++ b/include/profil/get_general.inc.php @@ -20,24 +20,19 @@ ***************************************************************************/ // on ramène les données du profil connecté (uid paramètre de session) -$sql = "SELECT u.nom, u.prenom". - ", u.promo, u.epouse, FIND_IN_SET('femme',u.flags), nationalite". - ", mobile". - ", web". - ", libre". - ", a1.aid, a1.type". - ", a2.aid, a2.type". - " FROM auth_user_md5 AS u". - " LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)". - " LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)". - " WHERE user_id = {?}"; +$sql = "SELECT u.nom, u.prenom, u.promo, u.epouse, FIND_IN_SET('femme',u.flags), u.nationalite, u.mobile, u.web, u.libre, + q.profile_nick, + a1.aid, a1.type, a2.aid, a2.type + FROM auth_user_md5 AS u + INNER JOIN auth_user_quick AS q USING(user_id) + LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0) + LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1) + WHERE u.user_id = {?}"; $result = $globals->xdb->query($sql, Session::getInt('uid', -1)); -list($nom, $prenom, - $promo, $epouse, $femme, $nationalite, - $mobile, $web, $libre, - $appli_id1,$appli_type1, - $appli_id2,$appli_type2) = $result->fetchOneRow(); +list($nom, $prenom, $promo, $epouse, $femme, + $nationalite, $mobile, $web, $libre, $surnom, + $appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow(); replace_ifset($nationalite,'nationalite'); replace_ifset($mobile,'mobile'); @@ -47,6 +42,7 @@ replace_ifset($appli_id1,"appli_id1"); replace_ifset($appli_id2,"appli_id2"); replace_ifset($appli_type1,"appli_type1"); replace_ifset($appli_type2,"appli_type2"); +replace_ifset($surnom,"surnom"); if(Env::has('modifier') || Env::has('suivant')) { $mobile_public = Env::has('mobile_public'); diff --git a/include/profil/update_general.inc.php b/include/profil/update_general.inc.php index dd20297..2282592 100644 --- a/include/profil/update_general.inc.php +++ b/include/profil/update_general.inc.php @@ -31,8 +31,7 @@ else $sql = "UPDATE auth_user_md5 SET nationalite= {?}, web= {?}, mobile= {?}, libre= {?} WHERE user_id= {?}"; - - $globals->xdb->execute($sql, $nationalite, $web, $mobile, $libre, Session::getInt('uid', -1)); +$globals->xdb->execute("UPDATE auth_user_quick SET profile_nick={?} WHERE user_id = {?}", $surnom, Session::getInt('uid', -1)); ?> diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 44a25d9..9829700 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -155,24 +155,24 @@ function get_user_forlife($data) { function &get_user_details($login, $from_uid = '') { global $globals; - $reqsql = "SELECT u.prenom, u.nom, u.epouse, + $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv, u.mobile, u.web, u.libre, + u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces, + q.profile_nick AS nickname, IF(gp.nat='',gp.pays,gp.nat) AS nationalite, gp.a2 AS iso3166, - u.user_id, a.alias AS forlife, a2.alias AS bestalias, - u.matricule, u.perms IN ('admin','user') AS inscrit, - FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces, - u.date, u.cv, sections.text AS section, u.mobile, u.web, - u.libre, u.promo, c.uid IS NOT NULL AS is_contact, p.x, p.y, - + a.alias AS forlife, a2.alias AS bestalias, + c.uid IS NOT NULL AS is_contact, + s.text AS section, p.x, p.y, m.expertise != '' AS is_referent - FROM auth_user_md5 AS u - INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie') - INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND FIND_IN_SET('bestalias',a2.flags)) - LEFT JOIN contacts AS c ON (c.uid = {?} and c.contact = u.user_id) - LEFT JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite) - INNER JOIN sections ON (sections.id = u.section) - LEFT JOIN photo AS p ON (p.uid = u.user_id) - LEFT JOIN mentor AS m ON (m.uid = u.user_id) + FROM auth_user_md5 AS u + INNER JOIN auth_user_quick AS q USING(user_id) + INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie') + INNER JOIN aliases AS a2 ON (u.user_id=a2.id AND FIND_IN_SET('bestalias',a2.flags)) + LEFT JOIN contacts AS c ON (c.uid = {?} and c.contact = u.user_id) + LEFT JOIN geoloc_pays AS gp ON (gp.a2 = u.nationalite) + INNER JOIN sections AS s ON (s.id = u.section) + LEFT JOIN photo AS p ON (p.uid = u.user_id) + LEFT JOIN mentor AS m ON (m.uid = u.user_id) WHERE a.alias = {?}"; $res = $globals->xdb->query($reqsql, $from_uid, $login); $user = $res->fetchOneAssoc(); diff --git a/templates/fiche.tpl b/templates/fiche.tpl index feefb32..6d47aa4 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -31,7 +31,8 @@ function chgMainWinLoc( strPage ) {
{if $x.sexe}•{/if} - {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if}  + {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if} + {if $x.nickname} (aka {$x.nickname}){/if}  Afficher la carte de visite diff --git a/templates/profil/general.tpl b/templates/profil/general.tpl index a5ea19a..1dddb8a 100644 --- a/templates/profil/general.tpl +++ b/templates/profil/general.tpl @@ -168,6 +168,28 @@ + + + +
+ + + privé +
+ + + + + Surnom + + + + + + + + + diff --git a/templates/search.adv.form.tpl b/templates/search.adv.form.tpl index b7d8662..a1de05c 100644 --- a/templates/search.adv.form.tpl +++ b/templates/search.adv.form.tpl @@ -47,6 +47,12 @@ + + + +
Surnom + +
Promotion