}
}
+function addSearchName()
+{
+ var i = 0;
+ while (document.getElementById('search_name_' + i) != null) {
+ i++;
+ }
+ $('#add_search_name').before('<div id="search_name_' + i + '" style="padding:2px" class="center"></div>');
+ Ajax.update_html('search_name_' + i, 'profile/ajax/searchname/' + i,function(){
+ $('#search_name_'+i+' input')[1].focus();
+ });
+}
+function removeSearchName(i)
+{
+ if (document.getElementById('search_name_'+i+'_new') != null) {
+ $('#search_name_'+i).remove();
+ } else {
+ removeObject('search_name_'+i, 'search_name['+i+']');
+ }
+}
// Addresses
'profile/ajax/job' => $this->make_hook('ajax_job', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/secteur' => $this->make_hook('ajax_secteur', AUTH_COOKIE, 'user', NO_AUTH),
'profile/ajax/skill' => $this->make_hook('ajax_skill', AUTH_COOKIE, 'user', NO_AUTH),
+ 'profile/ajax/searchname' => $this->make_hook('ajax_searchname', AUTH_COOKIE, 'user', NO_AUTH),
'javascript/applis.js' => $this->make_hook('applis_js', AUTH_COOKIE),
'javascript/grades.js' => $this->make_hook('grades_js', AUTH_COOKIE),
'profile/medal' => $this->make_hook('medal', AUTH_PUBLIC),
}
}
+ function handler_ajax_searchname(&$page, $snid)
+ {
+ header('Content-Type: text/html; charset=utf-8');
+ $page->changeTpl('profile/general.searchname.tpl', NO_SKIN);
+ $page->assign('i', $snid);
+ $page->assign('sn', array());
+ $page->assign('newsn', true);
+ }
+
function handler_p_orange(&$page)
{
$page->changeTpl('profile/orange.tpl');
}
}
+class ProfileSearchName implements ProfileSetting
+{
+
+ public function __construct()
+ {
+ }
+
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ }
+
+ public function save(ProfilePage &$page, $field, $new_value)
+ {
+ }
+}
+
class ProfileAppli implements ProfileSetting
{
public function value(ProfilePage &$page, $field, $value, &$success)
$this->settings['freetext']
= $this->settings['nationalite']
= $this->settings['nick']
+ = $this->settings['yourself']
+ = $this->settings['display_name']
+ = $this->settings['sort_name']
+ = $this->settings['tooltip_name']
= null;
$this->settings['synchro_ax']
= new ProfileBool();
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,
- IF(a2.aid IS NULL, -1, a2.aid) as appli_id2, a2.type as appli_type2
+ IF(a2.aid IS NULL, -1, a2.aid) as appli_id2, a2.type as appli_type2,
+ n.yourself, n.display AS display_name, n.sort AS sort_name,
+ n.tooltip AS tooltip_name
FROM auth_user_md5 AS u
- INNER JOIN auth_user_quick AS q USING(user_id)
+ INNER JOIN auth_user_quick AS q ON(u.user_id = q.user_id)
+ INNER JOIN profile_names_display AS n ON(n.user_id = u.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 = {?}", S::v('uid', -1));
WHERE type='photo' AND user_id = {?}",
S::v('uid'));
$this->values['nouvellephoto'] = $res->fetchOneCell();
+
+ // Retreive search names info
+ $this->values['search_names'] = XDB::iterator("
+ SELECT sn.search_name, sn.name_type, sn.pub, sn.sn_id
+ FROM profile_names_search AS sn
+ WHERE sn.user_id = {?}
+ ORDER BY sn.name_type, search_score, search_name",
+ S::v('uid'));
}
protected function _saveData()
WHERE uid = {?}",
$this->values['photo_pub'], S::v('uid'));
}
+ if ($this->changed['yourself'] || $this->changed['sort_name'] ||
+ $this-> changed['display_name'] || $this->changed['tooltip_name']) {
+ XDB::execute("UPDATE profile_names_display AS n
+ SET n.yourself = {?},
+ n.sort = {?}, ". // SET
+ "n.display = {?}, ". // SET
+ "n.tooltip = {?} ". // SET
+ "WHERE n.user_id = {?}",
+ $this->values['yourself'],
+ $this->values['sort_name'],
+ $this->values['display_name'],
+ $this->values['tooltip_name'],
+ S::v('uid'));
+ }
}
public function _prepare(PlatalPage &$page, $id)
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2008 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+<span class="flags">
+ <input type="checkbox"
+ {if $sn.pub neq 'private'} checked="checked"{/if}
+ {if $sn.pub eq 'always public'} disabled="disabled"{else} name="search_name[{$i}][pub]"{/if}/>
+ {icon name="flag_green" title="site public"}
+</span>
+<input type="text" name="search_name[{$i}][name]" value="{$sn.search_name}" size="30"/>
+<select name="search_name[{$i}][type]">
+ <option value="firstname"{if $sn.name_type eq 'firstname'} selected="selected"{/if}>Prénom</option>
+ <option value="lastname"{if $sn.name_type eq 'lastname'} selected="selected"{/if}>Nom de famille</option>
+ <option value="surname"{if $sn.name_type eq 'surname'} selected="selected"{/if}>Surnom</option>
+</select>
+{if $sn.pub neq 'always public'}
+ <a href="javascript:removeSearchName({$i})">
+ {icon name=cross title="Supprimer ce nom de recherche"}
+ </a>
+ {if $newsn}
+ <span style="display:none" id="search_name_{$i}_new">Nouveau</span>
+ {else}
+ <input type="hidden" name="search_name[{$i}][removed]" value=""/>
+ {/if}
+{else}
+ {icon name="null"}
+{/if}
</tr>
<tr>
<td>
- <span class="titre">Nom</span>
- <span class="comm"></span>
+ <span class="titre">Nom</span><br/>
</td>
<td>
- <input type='text' name='nom' {if $errors.nom}class="error"{/if} value="{$nom}" />
+ {$nom}
+ <input type='hidden' name='nom' {if $errors.nom}class="error"{/if} value="{$nom}" />
</td>
</tr>
<tr>
<td>
- <span class="titre">Prénom</span>
- <span class="comm"></span>
+ <span class="titre">Prénom</span><br/>
</td>
<td>
- <input type='text' name='prenom' {if $errors.prenom}class="error"{/if} value="{$prenom}" />
+ {$prenom}
+ <input type='hidden' name='prenom' {if $errors.prenom}class="error"{/if} value="{$prenom}" />
</td>
</tr>
<tr>
<td>
- <span class="titre">Promotion</span>
+ <span class="titre">Affichage de ton nom</span>
</td>
<td>
- <span class="nom">X{$promo}{if ($promo != $promo_sortie - 3)} - X{math equation="a - b" a=$promo_sortie b=3}{/if}</span>
- <span class="lien"><a href="profile/orange">modifier</a>{if ($promo_sortie -3 == $promo)} pour les oranges{/if}</span>
+ {if $tooltip_name}<span title="{$tooltip_name}" style="border-bottom: 1px dashed black;">{$display_name}</span>{else}{$display_name}{/if}
+ <a href="profile/edit#names_advanced" onclick="$('#names_advanced').show('normal', {literal}function(){document.location = document.location + '#names_advanced';}{/literal});return false">
+ {icon name="page_edit" title="Plus de détail"}
+ </a>
</td>
</tr>
<tr>
<td>
- <span class="titre">Nom d'usage</span><br />
- {if $smarty.session.sexe}
- <span class="comm">(Notamment nom d'épouse)</span>
- {else}
- <span class="comm">(si différent de {$nom} seulement)</span>
- {/if}
+ <span class="titre">Promotion</span>
</td>
<td>
- <span class="nom">{$nom_usage|default:"Aucun"}</span>
- <span class="lien"><a href="profile/usage">modifier</a></span>
+ <span class="nom">X{$promo}{if ($promo != $promo_sortie - 3)} - X{math equation="a - b" a=$promo_sortie b=3}{/if}</span>
+ <span class="lien"><a href="profile/orange" {if ($promo_sortie -3 == $promo)} {popup text="pour les oranges"}{/if}>{icon name="page_edit" title="modifier"}</a></span>
</td>
</tr>
<tr>
</tr>
</table>
+<table class="bicol" style="margin-bottom: 1em;display:none"
+ summary="Profil : Noms" id="names_advanced">
+ <tr>
+ <th colspan="2">
+ Noms
+ </th>
+ </tr>
+ <tr class="impair" {popup caption="Affichage courant de ton nom" text="Ceci
+est le nom qui s'affichera partout sur le site quand ton nom est mentionné dans
+une liste, en haut de ta fiche ou lorsque tu proposes une annonce. On utilise
+généralement le prénom usuel suivi du nom usuel avec des majuscules seulement
+pour les premières lettres : <strong>Alfred de Musset</strong>" width="400"}>
+ <td>
+ <span class="flags">
+ <input type="checkbox" checked="checked" disabled="disabled" />
+ {icon name="flag_green" title="site public"}
+ </span>
+ <span class="titre">Affichage courant de ton nom</span>
+ </td>
+ <td>
+ <input type="text" name="display_name" value="{$display_name}" size="40"/>
+ </td>
+ </tr>
+ <tr class="impair" {popup caption="Explication du nom" text="Tu peux rajouter une
+ brêve explication de ton nom si par exemple il arrive qu'on confonde ton prénom
+ et ton nom, ou bien que vous êtes deux de la même promo à porter le même nom.
+ <strong>Prénom : Martin - Nom : Bernard</strong>" width="400"}>
+ <td>
+ <span class="titre">explication</span>
+ </td>
+ <td>
+ <input type="text" name="tooltip_name" value="{$tooltip_name}" size="40"/>
+ </td>
+ </tr>
+ <tr class="impair" {popup caption="Rangement du nom" text="Dans une liste d'anciens
+ ton nom sera rangé selon l'ordre alphabétique grâce à ce champs. On utilise
+ généralement le nom (sans particule) suivi d'une virgule et du prénom : <strong>
+ Dupont, Georges</strong>" width="400"}>
+ <td>
+ <span class="titre">ranger ce nom à</span>
+ </td>
+ <td>
+ <input type="text" name="sort_name" value="{$sort_name}" size="40"/>
+ </td>
+ </tr>
+ <tr class="impair" {popup caption="Comment doit-on t'appeler ?" text="Lorsque
+ nous t'envoyons un e-mail, nous nous adressons à toi par ton prénom. Le champs
+ suivant permet de changer cela. C'est surtout utile lorsque les e-mails sont
+ envoyés à une tierce personne (veuf ou veuve par exemple)" width="400"}>
+ <td>
+ <span class="flags">
+ <input type="checkbox" checked="checked" disabled="disabled" />
+ {icon name="flag_red" title="privé"}
+ </span>
+ <span class="titre">Comment on doit t'appeller</span>
+ <div class="smaller">dans les mails que nous t'envoyons</div>
+ </td>
+ <td>
+ <input type="text" name="yourself" value="{$yourself}" size="40"/>
+ </td>
+ </tr>
+ <tr class="impair" {popup caption="Noms de recherche" text="Tu peux ajouter ici
+ des noms pour apparaître dans les recherches. Tu peux par exemple ajouter le
+ nom que tu portais à l'école si tu as changé depuis ou bien un nom de scène, un
+ surnom ou encore le nom de ton conjoint. Les recherches ne fonctionneront que
+ sur la partie privée du site sauf si tu coches la case verte." width="400"}>
+ <td colspan="2">
+ <span class="titre">Recherche</span>
+ <span class="smaller">, ta fiche apparaît quand on cherche un de ces noms</span>
+ {iterate from=$search_names item="sn"}
+ <div id="search_name_{$sn.sn_id}" style="padding:2px" class="center">
+ {include file="profile/general.searchname.tpl" i=$sn.sn_id sn=$sn}
+ </div>
+ {/iterate}
+ <div id="add_search_name" class="center" style="clear: both">
+ <a href="javascript:addSearchName()">
+ {icon name=add title="Ajouter un nom de recherche"} Ajouter un nom
+ </a>
+ </div>
+ </td>
+</table>
+
{if !$no_private_key}
<table class="bicol" style="margin-bottom: 1em"
summary="Profil : Informations générales">
</tr>
<tr>
<td>
- <span class="flags">
- <input type="checkbox" checked="checked" disabled="disabled" />
- {icon name="flag_red" title="privé"}
- </span>
- <span class="titre">Surnom</span>
- </td>
- <td>
- <input type="text" size="35" maxlength="64"
- {if $errors.nick}class="error"{/if} name="nick" value="{$nick}" />
- </td>
- </tr>
- <tr>
- <td>
<span class="titre">Téléphone mobile</span>
</td>
<td>