Comment: | Passage du stockage des champs membres de JSON à INI, c'est plus intuitif quand même |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
21f2c46eb2eca1df7fc597f2cf9b5ec0 |
User & Date: | bohwaz on 2013-01-04 07:16:43 |
Other Links: | manifest | tags |
2013-01-04
| ||
07:33 | Renommage du fichier de base de données check-in: 25db7dcbc2 user: bohwaz tags: trunk | |
07:16 | Passage du stockage des champs membres de JSON à INI, c'est plus intuitif quand même check-in: 21f2c46eb2 user: bohwaz tags: trunk | |
2012-12-30
| ||
06:05 | Erreur de compréhension check-in: 923995506e user: bohwaz tags: trunk | |
Modified VERSION from [ec590956d1] to [5066b1a373].
|
| | | 1 | 0.5.0 |
Modified include/class.champs_membres.php from [e0994432f7] to [6cc5cf3775].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 'email' => 'Adresse E-Mail', 'url' => 'Adresse URL', 'checkbox' => 'Case à cocher', 'multiple' => 'Combinaison de cases à cocher', 'date' => 'Date', 'datetime' => 'Date et heure', 'file' => 'Fichier', 'number' => 'Numéro', 'tel' => 'Numéro de téléphone', 'select' => 'Sélecteur de choix', 'country' => 'Sélecteur de pays', 'text' => 'Texte', 'textarea' => 'Texte multi-lignes', ); protected $config_fields = array( 'type', 'title', 'help', 'editable', 'mandatory', 'private', | > | | > > > > > | | < > | | < < < < < < < < > > > > > > > > > > > > > > > > | | > > > > > > | > > > > > | > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > | 10 11 12 13 14 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | 'email' => 'Adresse E-Mail', 'url' => 'Adresse URL', 'checkbox' => 'Case à cocher', 'multiple' => 'Combinaison de cases à cocher', 'date' => 'Date', 'datetime' => 'Date et heure', 'file' => 'Fichier', 'password' => 'Mot de passe', 'number' => 'Numéro', 'tel' => 'Numéro de téléphone', 'select' => 'Sélecteur de choix', 'country' => 'Sélecteur de pays', 'text' => 'Texte', 'textarea' => 'Texte multi-lignes', ); protected $config_fields = array( 'type', 'title', 'help', 'editable', 'mandatory', 'private', 'options' ); static protected $presets = null; public function __toString() { return utils::write_ini_string($this->champs); } public function toString() { return utils::write_ini_string($this->champs); } static public function importInstall() { $champs = parse_ini_file(GARRADIN_ROOT . '/include/data/champs_membres.ini', true); $champs = array_filter($champs, function ($row) { return !empty($row['install']); }); return new Champs_Membres($champs); } static public function importPresets() { if (is_null(self::$presets)) { self::$presets = parse_ini_file(GARRADIN_ROOT . '/include/data/champs_membres.ini', true); } return self::$presets; } static public function listUnusedPresets(Champs_Membres $champs) { return array_diff_key(self::importPresets(), $champs->getAll()); } public function __construct($champs) { if ($champs instanceOf Champs_Membres) { $this->champs = $champs->getAll(); } elseif (is_array($champs)) { foreach ($champs as $key=>&$config) { $this->_checkField($key, $config); } $this->champs = $champs; } else { $champs = parse_ini_string((string)$champs, true); foreach ($champs as $key=>&$config) { $this->_checkField($key, $config); } $this->champs = $champs; } } public function getTypes() { return $this->types; } public function get($champ, $key = null) { if (!array_key_exists($champ, $this->champs)) return null; if ($key !== null) { if (array_key_exists($key, $this->champs[$champ])) return $this->champs[$champ][$key]; else return null; } return $this->champs[$champ]; } 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) { if (!preg_match('!^\w+(_\w+)*$!', $name)) { throw new UserException('Le nom du champ est invalide.'); } foreach ($config as $key=>&$value) { // Champ install non pris en compte if ($key == 'install') { unset($config[$key]); continue; } if (!in_array($key, $this->config_fields)) { throw new \BadMethodCallException('Champ '.$key.' non valide.'); } if ($key == 'editable' || $key == 'private' || $key == 'mandatory') { $value = (bool) (int) $value; } elseif ($key == 'help' || $key == 'title') { $value = trim((string) $value); } elseif ($key == 'options') { $value = (array) $value; } } if (empty($config['title'])) { throw new UserException('Champ "'.$name.'" : Le titre est obligatoire.'); } if (empty($config['type']) || !array_key_exists($config['type'], $this->types)) { throw new UserException('Champ "'.$name.'" : Le type est vide ou non valide.'); } if ($name == 'email' && $config['type'] != 'email') { throw new UserException('Le champ email ne peut être d\'un type différent de email.'); } if ($name == 'passe' && $config['type'] != 'password') { throw new UserException('Le champ mot de passe ne peut être d\'un type différent de email.'); } if (!array_key_exists('editable', $config)) { $config['editable'] = false; } if (!array_key_exists('mandatory', $config)) { $config['mandatory'] = false; } if (!array_key_exists('private', $config)) { $config['private'] = false; } return true; } /** * Ajouter un nouveau champ * @param string $name Nom du champ |
︙ | ︙ | |||
164 165 166 167 168 169 170 | * @param string $champ Nom du champ * @param string $key Nom de la clé à modifier * @param mixed $value Valeur à affecter * @return boolean true */ public function set($champ, $key, $value) { | > > > > > > > > > > | > > > > > | | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | * @param string $champ Nom du champ * @param string $key Nom de la clé à modifier * @param mixed $value Valeur à affecter * @return boolean true */ public function set($champ, $key, $value) { if (!isset($this->champs[$champ])) { throw new \LogicException('Champ "'.$champ.'" inconnu.'); } // Vérification $config = $this->champs[$champ]; $config[$key] = $value; $this->_checkField($champ, $config); $this->champs[$champ] = $config; return true; } /** * Modifie les champs en interne en vérifiant que tout va bien * @param array $champs Liste des champs * @return boolean true */ public function setAll($champs) { if (!array_key_exists('email', $champs)) { throw new UserException('Le champ E-Mail ne peut être supprimé des fiches membres.'); } if (!array_key_exists('passe', $champs)) { throw new UserException('Le champ Mot de passe ne peut être supprimé des fiches membres.'); } foreach ($champs as $name=>&$config) { $this->_checkField($name, $config); } $this->champs = $champs; return true; |
︙ | ︙ | |||
210 211 212 213 214 215 216 | $db = DB::getInstance(); $config = Config::getInstance(); // Champs à créer $create = array( 'id INTEGER PRIMARY KEY, -- Numéro attribué automatiquement', 'id_categorie INTEGER NOT NULL, -- Numéro de catégorie', | < < | > | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | $db = DB::getInstance(); $config = Config::getInstance(); // Champs à créer $create = array( 'id INTEGER PRIMARY KEY, -- Numéro attribué automatiquement', 'id_categorie INTEGER NOT NULL, -- Numéro de catégorie', 'date_connexion TEXT NULL, -- Date de dernière connexion', ); // Champs à recopier $copy = array( 'id', 'id_categorie', 'date_connexion' ); $anciens_champs = $config->get('champs_membres'); $anciens_champs = is_null($anciens_champs) ? $this->champs : $anciens_champs->getAll(); foreach ($this->champs as $key=>$cfg) { if ($cfg['type'] == 'number') $type = 'FLOAT'; elseif ($cfg['type'] == 'multiple' || $cfg['type'] == 'checkbox') $type = 'INTEGER'; |
︙ | ︙ |
Modified include/class.config.php from [011a7bee42] to [5bd2fdc1a1].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | private function __clone() { } protected function __construct() { $string = ''; $int = 0; $float = 0.0; $array = array(); $bool = false; $object = new \stdClass; | > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | private function __clone() { } protected function __construct() { // Définition des types de données stockées $string = ''; $int = 0; $float = 0.0; $array = array(); $bool = false; $object = new \stdClass; |
︙ | ︙ | |||
119 120 121 122 123 124 125 | $this->modified = array(); return true; } public function get($key) { | | > > > > > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | $this->modified = array(); return true; } public function get($key) { if (!array_key_exists($key, $this->fields_types)) { throw new \OutOfBoundsException('Ce champ est inconnu.'); } if (!array_key_exists($key, $this->config)) { return null; } return $this->config[$key]; } public function getVersion() { if (!array_key_exists('version', $this->config)) { |
︙ | ︙ |
Modified include/class.membres.php from [51fb833586] to [10533ef891].
︙ | ︙ | |||
517 518 519 520 521 522 523 | { if (is_null($date_verif)) $date_verif = time(); if (!$date_membre) return false; | | | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | { if (is_null($date_verif)) $date_verif = time(); if (!$date_membre) return false; $echeance = new \DateTime($date_membre); $echeance->setTime(0, 0); $echeance->modify('+'.$duree_cotisation.' months'); if ($echeance->getTimestamp() < $date_verif) return round(($date_verif - $echeance->getTimestamp()) / 3600 / 24); return true; |
︙ | ︙ |
Modified include/class.wiki.php from [35826ce07e] to [45ce812523].
︙ | ︙ | |||
224 225 226 227 228 229 230 | // Pas de révision if ($revision == 0 && !trim($data['contenu'])) { return true; } // Il faut obligatoirement fournir un ID d'auteur | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | // Pas de révision if ($revision == 0 && !trim($data['contenu'])) { return true; } // Il faut obligatoirement fournir un ID d'auteur if (empty($data['id_auteur']) && $data['id_auteur'] !== null) { throw new \BadMethodCallException('Aucun ID auteur de fourni.'); } $contenu = $db->simpleQuerySingle('SELECT contenu FROM wiki_revisions WHERE revision = ? AND id_page = ?;', false, (int)$revision, (int)$id); // Pas de changement au contenu, pas la peine d'enregistrer une nouvelle révision |
︙ | ︙ |
Added include/data/champs_membres.ini version [2a8de6fd6b].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | ; Ce fichier contient la configuration par défaut des champs des fiches membres. ; La configuration est ensuite enregistrée au format INI dans la table ; config de la base de données. ; ; Syntaxe : ; ; [nom_du_champ] ; Nom unique du champ, ne peut contenir que des lettres et des tirets bas ; type = text ; title = "Super champ trop cool" ; mandatory = true ; editable = false ; ; Description des options possibles pour chaque champ : ; ; type: (défaut: text) OBLIGATOIRE ; tous les types gérés par input type de HTML5 plus : ; + country = sélecteur de pays ; + checkbox = case à cocher ; + multiple = multiples cases à cocher (jusqu'à 32, binaire) ; + select = un choix parmis plusieurs ; title: OBLIGATOIRE ; Titre du champ ; help: ; Texte d'aide sur les fiches membres ; options[]: ; pour définir les options d'un champ de type select ou multiple ; editable: ; true = modifiable par le membre ; false = modifiable uniquement par un admin (défaut) ; mandatory: ; true = obligatoire, la fiche membre ne pourra être enregistrée si ce champ est vide ; false = facultatif (défaut) ; private: ; true = non visible par le membre lui-même ; false = visible par le membre (défaut) ; install: ; true = sera ajouté aux fiches membres à l'installation ; false = sera seulement présent dans les champs supplémentaires possibles (défaut) [nom] type = text title = "Nom & prénom" mandatory = true install = true editable = true [email] type = email title = "Adresse E-Mail" mandatory = true install = true editable = true [passe] type = password title = "Mot de passe" mandatory = true install = true editable = true [adresse] type = textarea title = "Adresse postale" help = "Indiquer ici le numéro, le type de voie, etc." install = true editable = true [code_postal] type = text title = "Code postal" install = true editable = true [ville] type = text title = "Ville" install = true editable = true [pays] type = country title = "Pays" install = true editable = true [telephone] type = tel title = "Numéro de téléphone" install = true editable = true [lettre_infos] type = checkbox title = "Inscription à la lettre d'information" install = true editable = true [groupe_travail] type = multiple title = "Groupes de travail" editable = false options[] = "Télécoms" options[] = "Trésorerie" options[] = "Relations publiques" options[] = "Communication presse" options[] = "Organisation d'événements" [date_naissance] type = date title = "Date de naissance" editable = true [notes] type = textarea title = "Notes" editable = false private = true [date_inscription] type = date title = "Date d'inscription" editable = false mandatory = true private = true |
Deleted include/data/champs_membres.json version [485bad1faa].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted include/data/champs_membres_supplementaires.json version [fab2d06093].
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Modified include/init.php from [860fa82406] to [758771e85c].
︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | */ static protected $loaded = array(); static protected $libs = array( 'utils', 'squelette_filtres', 'static_cache', ); /** * Loads a class from the $name * @param stringg $classname * @return bool true */ | > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | */ static protected $loaded = array(); static protected $libs = array( 'utils', 'squelette_filtres', 'static_cache', 'template' ); /** * Loads a class from the $name * @param stringg $classname * @return bool true */ |
︙ | ︙ |
Modified include/lib.template.php from [2877356567] to [8ff6a87056].
︙ | ︙ | |||
359 360 361 362 363 364 365 | throw new \BadFunctionCallException('Paramètres type et name obligatoires.'); $config = $params['config']; $type = $config['type']; if ($type == 'select') { | | | | | | | > | > > > > > > | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | throw new \BadFunctionCallException('Paramètres type et name obligatoires.'); $config = $params['config']; $type = $config['type']; if ($type == 'select') { if (empty($params['options'])) throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type select.'); } elseif ($type == 'country') { $type = 'select'; $params['options'] = utils::getCountryList(); $params['default'] = Config::getInstance()->get('pays'); } elseif ($type == 'multiple') { if (empty($params['options'])) throw new \BadFunctionCallException('Paramètre options obligatoire pour champ de type multiple.'); } $field = ''; $value = tpl_form_field($params); $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 ($params['options'] as $k=>$v) { if (is_int($k)) $k = $v; $field .= '<option value="' . htmlspecialchars($k, ENT_QUOTES, 'UTF-8') . '"'; if ($value == $k) $field .= ' selected="selected"'; $field .= '>' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</option>'; } $field .= '</select>'; } elseif ($type == 'multiple') { foreach ($params['options'] as $k=>$v) { $b = 0x01 << (int)$k; $field .= '<label><input type="checkbox" name="' . htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '[' . (int)$k . ']" value="1" ' . (($value & $b) ? 'checked="checked"' : '') . ' /> ' . htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</label><br />'; } } elseif ($type == 'textarea') { $field .= '<textarea ' . $attributes . 'cols="30" rows="5">' . $value . '</textarea>'; } else { |
︙ | ︙ |
Modified include/lib.utils.php from [8d453d0b79] to [611f01c8e1].
︙ | ︙ | |||
512 513 514 515 516 517 518 519 520 521 522 523 524 525 | if (!empty($out)) { $out = substr($out, 0, -2); } $out = str_repeat("\t", $indent) . "{\n" . $out; $out .= "\n" . str_repeat("\t", $indent) . "}"; return $out; } } ?> | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | if (!empty($out)) { $out = substr($out, 0, -2); } $out = str_repeat("\t", $indent) . "{\n" . $out; $out .= "\n" . str_repeat("\t", $indent) . "}"; return $out; } static public function write_ini_string($in) { $out = ''; $get_ini_line = function ($key, $value) use (&$get_ini_line) { if (is_bool($value)) { return $key . ' = ' . ($value ? 'true' : 'false'); } elseif (is_numeric($value)) { return $key . ' = ' . $value; } elseif (is_array($value)) { $out = ''; foreach ($value as $row) { $out .= $get_ini_line($key . '[]', $row) . "\n"; } return substr($out, 0, -1); } else { return $key . ' = "' . str_replace('"', '\\"', $value) . '"'; } }; foreach ($in as $key=>$value) { if (is_array($value) && is_string($key)) { $out .= '[' . $key . "]\n"; foreach ($value as $row_key=>$row_value) { $out .= $get_ini_line($row_key, $row_value) . "\n"; } $out .= "\n"; } else { $out .= $get_ini_line($key, $value) . "\n"; } } return $out; } } ?> |
Modified templates/admin/_head.tpl from [2c361b7758] to [0bb167f891].
︙ | ︙ | |||
60 61 62 63 64 65 66 | {*<li class="wiki_contribution{if $current == 'wiki/contribution'} current{/if}"><a href="{$www_url}admin/wiki/contributions.php">Mes contributions</a>*} </ul> </li> {/if} {if $user.droits.config >= Garradin\Membres::DROIT_ADMIN} <li class="config{if $current == 'config'} current{/if}"><a href="{$www_url}admin/config/">Configuration</a> {/if} | < | < | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | {*<li class="wiki_contribution{if $current == 'wiki/contribution'} current{/if}"><a href="{$www_url}admin/wiki/contributions.php">Mes contributions</a>*} </ul> </li> {/if} {if $user.droits.config >= Garradin\Membres::DROIT_ADMIN} <li class="config{if $current == 'config'} current{/if}"><a href="{$www_url}admin/config/">Configuration</a> {/if} <li class="mes_infos{if $current == 'mes_infos'} current{/if}"><a href="{$www_url}admin/mes_infos.php">Mes infos</a> <li class="logout"><a href="{$www_url}admin/logout.php">Déconnexion</a></li> </ul> {/if} </div> {/if} <div class="page"> |
Modified templates/admin/config/membres.tpl from [7a768e2969] to [109faa7d86].
︙ | ︙ | |||
61 62 63 64 65 66 67 | <legend>Champs non-personnalisables</legend> <dl> <dt>Numéro unique</dt> <dd>Ce numéro identifie de manière unique chacun des membres. Il est incrémenté à chaque nouveau membre ajouté.</dd> <dt>Catégorie</dt> <dd>Identifie la catégorie du membre.</dd> | < < | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <legend>Champs non-personnalisables</legend> <dl> <dt>Numéro unique</dt> <dd>Ce numéro identifie de manière unique chacun des membres. Il est incrémenté à chaque nouveau membre ajouté.</dd> <dt>Catégorie</dt> <dd>Identifie la catégorie du membre.</dd> <dt>Date de dernière connexion</dt> <dd>Enregistre la date de dernière connexion à l'administration de Garradin.</dd> </dl> </fieldset> {if !empty($presets)} <fieldset> |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | <legend>Ajouter un champ personnalisé</legend> <dl> <dt><label for="f_name">Nom unique</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd class="help">Ne peut comporter que des lettres minuscules et des tirets bas.</dd> <dd><input type="text" name="new" id="f_name" value="{form_field name=new}" size="30" /></dd> <dt><label for="f_title">Titre</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="new_title" id="f_title" value="{form_field name=new_title}" size="60" /></dd> </dl> <p><input type="submit" name="add" value="Ajouter ce champ à la fiche membre" /></p> </fieldset> <div id="orderFields"> {foreach from=$champs item="champ" key="nom"} <fieldset id="f_{$nom|escape}"> <legend>{$nom|escape}</legend> <dl> | > > > > > > > > | < < < < < < < < < < < | > > > > > > > > > > > > > > > > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | <legend>Ajouter un champ personnalisé</legend> <dl> <dt><label for="f_name">Nom unique</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd class="help">Ne peut comporter que des lettres minuscules et des tirets bas.</dd> <dd><input type="text" name="new" id="f_name" value="{form_field name=new}" size="30" /></dd> <dt><label for="f_title">Titre</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="new_title" id="f_title" value="{form_field name=new_title}" size="60" /></dd> <dt><label for="f_type">Type de champ</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd> <select name="new_type" id="f_type"> {foreach from=$types key="type" item="nom"} <option value="{$type|escape}" {form_field name=new_type selected=$type}>{$nom|escape}</option> {/foreach} </select> </dd> </dl> <p><input type="submit" name="add" value="Ajouter ce champ à la fiche membre" /></p> </fieldset> <div id="orderFields"> {foreach from=$champs item="champ" key="nom"} <fieldset id="f_{$nom|escape}"> <legend>{$nom|escape}</legend> <dl> <dt><label>Type</label></dt> <dd>{$champ.type|get_type}</dd> <dt><label for="f_{$nom|escape}_title">Titre</label> <b title="(Champ obligatoire)">obligatoire</b></dt> <dd><input type="text" name="champs[{$nom|escape}][title]" id="f_{$nom|escape}_title" value="{form_field data=$champs[$nom] name=title}" size="60" /></dd> <dt><label for="f_{$nom|escape}_help">Aide</label></dt> <dd><input type="text" name="champs[{$nom|escape}][help]" id="f_{$nom|escape}_help" value="{form_field data=$champs[$nom] name=help}" size="100" /></dd> <dt><label><input type="checkbox" name="champs[{$nom|escape}][editable]" value="1" {form_field data=$champs[$nom] name=editable checked="1"} /> Modifiable par les membres</label></dt> <dd class="help">Si coché, les membres pourront changer cette information depuis leur espace personnel.</dd> <dt><label><input type="checkbox" name="champs[{$nom|escape}][mandatory]" value="1" {form_field data=$champs[$nom] name=mandatory checked="1"} /> Champ obligatoire</label></dt> <dd class="help">Si coché, ce champ ne pourra rester vide.</dd> <dt><label><input type="checkbox" name="champs[{$nom|escape}][private]" value="1" {form_field data=$champs[$nom] name=private checked="1"} /> Champ privé</label></dt> <dd class="help">Si coché, ce champ ne sera visible et modifiable que par les personnes pouvant gérer les membres, mais pas les membres eux-même.</dd> {if $champ.type == 'select' || $champ.type == 'multiple'} <dt><label>Options disponibles</label></dt> {if $champ.type == 'multiple'} <dd class="help">Attention changer l'ordre des options peut avoir des effets indésirables.</dd> {else} <dd class="help">Attention renommer ou supprimer une option n'affecte pas ce qui a déjà été enregistré dans les fiches des membres.</dd> {/if} {foreach from=$champ.options key="key" item="opt"} <dd>{if $champ.type == 'multiple'}{math a=$key equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$key|escape}]" value="{$opt|escape}" size="50" /></dd> {/foreach} {assign var="more" value=$champ.options|@count} {if $champ.type == 'select' || $more < 32} <dd>{if $champ.type == 'multiple'}{math a=$more equation="a+1"}. {/if}<input type="text" name="champs[{$nom|escape}][options][{$more|escape}]" value="" size="50" /></dd> {/if} {/if} </dl> </fieldset> {/foreach} </div> <p class="submit"> {csrf_field key="config_membres"} |
︙ | ︙ | |||
204 205 206 207 208 209 210 | while (p.nodeType == 3) { p = p.nextSibling; } field.parentNode.insertBefore(field, p); } return false; }; actions.appendChild(down); | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | while (p.nodeType == 3) { p = p.nextSibling; } field.parentNode.insertBefore(field, p); } return false; }; actions.appendChild(down); if (field.id != 'f_email' && field.id != 'f_passe') { var rem = document.createElement('span'); rem.className = 'icn remove'; rem.innerHTML = '✕'; rem.title = 'Enlever ce champ de la fiche'; rem.onclick = function (e) { if (!window.confirm('Êtes-vous sûr de supprimer ce champ des fiches de membre ?')) |
︙ | ︙ |
Modified www/_inc.php from [30742e6275] to [64c1a92193].
1 2 3 4 | <?php namespace Garradin; require_once __DIR__ . '/../include/init.php'; | < | 1 2 3 4 5 6 | <?php namespace Garradin; require_once __DIR__ . '/../include/init.php'; ?> |
Modified www/admin/_inc.php from [ad2ed7d16f] to [b7b4d15400].
1 2 3 4 5 | <?php namespace Garradin; require_once __DIR__ . '/../../include/init.php'; | < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php namespace Garradin; require_once __DIR__ . '/../../include/init.php'; $tpl = Template::getInstance(); $tpl->assign('admin_url', WWW_URL . 'admin/'); $membres = new Membres; if (!defined('GARRADIN_LOGIN_PROCESS')) { if (!$membres->isLogged()) |
︙ | ︙ |
Modified www/admin/config/membres.php from [b205af7ce0] to [700b9b9b4e].
︙ | ︙ | |||
42 43 44 45 46 47 48 | { $membres->sessionStore('champs_membres', null); utils::redirect('/admin/config/membres.php'); } elseif (!empty($_POST['review'])) { try { | | > > > > > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | { $membres->sessionStore('champs_membres', null); utils::redirect('/admin/config/membres.php'); } elseif (!empty($_POST['review'])) { try { $nouveau_champs = utils::post('champs'); foreach ($nouveau_champs as $key=>&$cfg) { $cfg['type'] = $champs->get($key, 'type'); } $champs->setAll($nouveau_champs); $membres->sessionStore('champs_membres', (string)$champs); utils::redirect('/admin/config/membres.php?review'); } catch (UserException $e) { $error = $e->getMessage(); |
︙ | ︙ |
Modified www/admin/install.php from [45d33d3c32] to [225d41a52b].
︙ | ︙ | |||
42 43 44 45 46 47 48 | } namespace Garradin; define('GARRADIN_INSTALL_PROCESS', true); require_once __DIR__ . '/../../include/init.php'; | < | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | } namespace Garradin; define('GARRADIN_INSTALL_PROCESS', true); require_once __DIR__ . '/../../include/init.php'; if (file_exists(GARRADIN_DB_FILE)) { $tpl->assign('disabled', true); } else { |
︙ | ︙ |
Modified www/admin/upgrade.php from [9f60cf9682] to [21884f4944].
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | { $id_page = $wiki->create(array( 'titre' => 'Bienvenue', 'uri' => $page, )); $wiki->editRevision($id_page, 0, array( 'contenu' => "Bienvenue dans l'administration de ".$config->get('nom_asso')." !\n\n" . "Utilisez le menu à gauche pour accéder aux différentes rubriques.", )); } $config->set('accueil_connexion', $page); $config->save(); } if (version_compare($v, '0.5.0', '<')) { // Récupération de l'ancienne config $champs_modifiables_membre = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_modifiables_membre";'); | > | | | > | > | | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | { $id_page = $wiki->create(array( 'titre' => 'Bienvenue', 'uri' => $page, )); $wiki->editRevision($id_page, 0, array( 'id_auteur' => null, 'contenu' => "Bienvenue dans l'administration de ".$config->get('nom_asso')." !\n\n" . "Utilisez le menu à gauche pour accéder aux différentes rubriques.", )); } $config->set('accueil_connexion', $page); $config->save(); } if (version_compare($v, '0.5.0', '<')) { // Récupération de l'ancienne config $champs_modifiables_membre = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_modifiables_membre";'); $champs_modifiables_membre = !empty($champs_modifiables_membre) ? explode(',', $champs_modifiables_membre) : array(); $champs_obligatoires = $db->querySingle('SELECT valeur FROM config WHERE cle = "champs_obligatoires";'); $champs_obligatoires = !empty($champs_obligatoires) ? explode(',', $champs_obligatoires) : array(); // Import des champs membres par défaut $champs = Champs_Membres::importInstall(); // Application de l'ancienne config aux nouveaux champs membres foreach ($champs_obligatoires as $name) { if ($champs->get($name) !== null) $champs->set($name, 'mandatory', true); } foreach ($champs_modifiables_membre as $name) { if ($champs->get($name) !== null) $champs->set($name, 'editable', true); } $champs->save(); $config->set('champs_membres', $champs); $config->save(); |
︙ | ︙ |