Overview
Comment: | Gestion des champs privés et non modifiables en mode utilisateur |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a83adc021dcf111dcabe7946576b91f2 |
User & Date: | bohwaz on 2013-01-18 14:27:19 |
Other Links: | manifest | tags |
Context
2013-01-29
| ||
18:59 | Recherche indépendante de la liste des membres check-in: d03c32dd0c user: bohwaz tags: trunk | |
2013-01-18
| ||
14:27 | Gestion des champs privés et non modifiables en mode utilisateur check-in: a83adc021d user: bohwaz tags: trunk | |
14:05 | La configuration du mot de passe doit être minimale, car c'est un champ un peu dunmaique selon le contexte, ça serait donc trop compliqué check-in: f1290c6e52 user: bohwaz tags: trunk | |
Changes
Modified include/class.champs_membres.php from [8d723ee771] to [769331bd91].
︙ | ︙ | |||
117 118 119 120 121 122 123 | } public function getAll() { return $this->champs; } | < < < < < < < | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | } public function getAll() { return $this->champs; } /** * Vérifie la cohérence et la présence des bons éléments pour un champ * @param string $name Nom du champ * @param array $config Configuration du champ * @return boolean true */ protected function _checkField($name, &$config) |
︙ | ︙ |
Modified include/lib.template.php from [648ab66dd3] to [718186d8c6].
︙ | ︙ | |||
356 357 358 359 360 361 362 363 364 365 366 367 368 369 | function tpl_html_champ_membre($params) { if (empty($params['config']) || empty($params['name'])) throw new \BadFunctionCallException('Paramètres type et name obligatoires.'); $config = $params['config']; $type = $config['type']; if ($type == 'select') { if (empty($config['options'])) throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type select.'); } elseif ($type == 'country') | > > > > > | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | function tpl_html_champ_membre($params) { if (empty($params['config']) || empty($params['name'])) throw new \BadFunctionCallException('Paramètres type et name obligatoires.'); $config = $params['config']; $type = $config['type']; if ($params['name'] == 'passe' || (!empty($params['user_mode']) && !empty($config['private']))) { return ''; } if ($type == 'select') { if (empty($config['options'])) throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type select.'); } elseif ($type == 'country') |
︙ | ︙ | |||
383 384 385 386 387 388 389 390 391 392 393 394 395 396 | $attributes = 'name="' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" '; $attributes .= 'id="f_' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" '; if (!empty($params['disabled'])) { $attributes .= 'disabled="disabled" '; } if ($type == 'select') { $field .= '<select '.$attributes.'>'; foreach ($config['options'] as $k=>$v) { if (is_int($k)) | > > > > > > > | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | $attributes = 'name="' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" '; $attributes .= 'id="f_' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '" '; if (!empty($params['disabled'])) { $attributes .= 'disabled="disabled" '; } if (!empty($params['user_mode']) && empty($config['editable'])) { $out = '<dt>' . htmlspecialchars($config['title'], ENT_QUOTES, 'UTF-8') . '</dt>'; $out .= '<dd>' . htmlspecialchars($value, ENT_QUOTES, 'UTF-8') . '</dd>'; return $out; } if ($type == 'select') { $field .= '<select '.$attributes.'>'; foreach ($config['options'] as $k=>$v) { if (is_int($k)) |
︙ | ︙ | |||
460 461 462 463 464 465 466 | <dd>' . $field . '</dd>'; } return $out; } $tpl->register_compiler('continue', function() { return 'continue;'; }); | < | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | <dd>' . $field . '</dd>'; } return $out; } $tpl->register_compiler('continue', function() { return 'continue;'; }); $tpl->register_function('csrf_field', 'Garradin\tpl_csrf_field'); $tpl->register_function('form_field', 'Garradin\tpl_form_field'); $tpl->register_function('select_compte', 'Garradin\tpl_select_compte'); $tpl->register_function('format_droits', 'Garradin\tpl_format_droits'); |
︙ | ︙ |
Modified templates/admin/config/membres.tpl from [0a30b6cfc5] to [386555cfc4].
︙ | ︙ | |||
39 40 41 42 43 44 45 | </dd> {/if} {/foreach} </dl> </fieldset> <fieldset id="f_passe"> | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | </dd> {/if} {/foreach} </dl> </fieldset> <fieldset id="f_passe"> <legend>Connexion</legend> <dl> <dt><label for="f_passe">Mot de passe</label>{if !empty($champs.passe.mandatory)} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt> <dd><input type="password" id="f_passe" disabled="disabled" /></dd> {if empty($champs.passe.editable) || !empty($champs.passe.private)} <dd> {if !empty($champs.passe.private)} (Champ privé) |
︙ | ︙ |
Modified templates/admin/membres/ajouter.tpl from [e5b59b1613] to [dcd2170a7b].
︙ | ︙ | |||
15 16 17 18 19 20 21 | {if empty($champ.private) || $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} {html_champ_membre config=$champ name=$nom} {/if} {/foreach} </dl> </fieldset> | > | | | | | | | | | | | | | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | {if empty($champ.private) || $user.droits.membres >= Garradin\Membres::DROIT_ADMIN} {html_champ_membre config=$champ name=$nom} {/if} {/foreach} </dl> </fieldset> {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN || empty($champs.passe.private)} <fieldset> <legend>Connexion</legend> <dl> <dt><label for="f_passe">Mot de passe</label>{if $champs.passe.mandatory} <b title="(Champ obligatoire)">obligatoire</b>{/if}</dt> <dd class="help"> Pas d'idée ? Voici une suggestion choisie au hasard : <tt title="Cliquer pour utiliser cette suggestion comme mot de passe" onclick="fillPassword(this);">{$passphrase|escape}</tt> </dd> <dd><input type="password" name="passe" id="f_passe" value="{form_field name=passe}" /></dd> <dt><label for="f_repasse">Encore le mot de passe</label> (vérification)</dt> <dd><input type="password" name="repasse" id="f_repasse" value="{form_field name=repasse}" /></dd> </dl> </fieldset> {/if} {if $user.droits.membres == Garradin\Membres::DROIT_ADMIN} <fieldset> <legend>Général</legend> <dl> <dt><label for="f_cat">Catégorie du membre</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd> |
︙ | ︙ |
Modified templates/admin/mes_infos.tpl from [4d73b31814] to [7a3bc7dc66].
︙ | ︙ | |||
10 11 12 13 14 15 16 | <fieldset> <legend>Informations personnelles</legend> <dl> {foreach from=$champs item="champ" key="nom"} {if empty($champ.private) && $nom != 'passe'} | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <fieldset> <legend>Informations personnelles</legend> <dl> {foreach from=$champs item="champ" key="nom"} {if empty($champ.private) && $nom != 'passe'} {html_champ_membre config=$champ name=$nom data=$membre user_mode=true} {/if} {/foreach} </dl> </fieldset> <fieldset> <legend>Changer mon mot de passe</legend> |
︙ | ︙ |