2 /*******************************************************************************
3 * Copyright (C) 2007 Easter-eggs
4 * http://ldapsaisie.labs.libre-entreprise.org
6 * Author: See AUTHORS file in top-level directory.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
25 * Element ssh_key d'un formulaire pour LdapSaisie
27 * Cette classe définis les éléments ssh_key des formulaires.
28 * Elle étend la classe basic LSformElement.
30 * @author Benjamin Renard <brenard@easter-eggs.com>
33 class LSformElement_ssh_key extends LSformElement {
35 var $template = 'LSformElement_ssh_key.tpl';
36 var $fieldTemplate = 'LSformElement_ssh_key_field.tpl';
39 * Retourne les infos d'affichage de l'élément
41 * Cette méthode retourne les informations d'affichage de l'élement
45 function getDisplay(){
46 LSsession :: addCssFile('LSformElement_ssh_key.css');
47 $return = $this -> getLabelInfos();
49 if (!$this -> isFreeze()) {
50 $params['values_txt'] = $this -> values;
53 LSsession :: addJSscript('LSformElement_ssh_key.js');
54 LSsession :: addHelpInfos (
55 'LSformElement_ssh_key',
57 'display' => _("Display the full key.")
61 $values_txt = array();
62 foreach ($this -> values as $value) {
63 if (ereg('^ssh-([a-z]+) (.*)== (.*)$',$value,$regs)) {
64 $values_txt[] = array(
66 'shortTxt' => substr($regs[2],0,10),
72 $values_txt[] = array(
73 'shortTxt' => substr($value,0,15),
78 $params['values_txt'] = $values_txt;
79 $params['unknowTypeTxt'] = _('Unknown type');
81 $return['html'] = $this -> fetchTemplate(NULL,$params);