mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 00:09:06 +01:00
- LSformElement :
- Création d'un fichier css pour chacun des types - Ajout du type ssh_key
This commit is contained in:
parent
1ada7889e9
commit
22e6e9ad77
11 changed files with 261 additions and 78 deletions
54
trunk/includes/class/class.LSattr_html_ssh_key.php
Normal file
54
trunk/includes/class/class.LSattr_html_ssh_key.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2007 Easter-eggs
|
||||
* http://ldapsaisie.labs.libre-entreprise.org
|
||||
*
|
||||
* Author: See AUTHORS file in top-level directory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Type d'attribut HTML ssh_key
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*/
|
||||
class LSattr_html_ssh_key extends LSattr_html {
|
||||
|
||||
/**
|
||||
* Ajoute l'attribut au formualaire passer en paramètre
|
||||
*
|
||||
* @param[in] &$form LSform Le formulaire
|
||||
* @param[in] $idForm L'identifiant du formulaire
|
||||
* @param[in] $data Valeur du champs du formulaire
|
||||
*
|
||||
* @retval LSformElement L'element du formulaire ajouté
|
||||
*/
|
||||
function addToForm (&$form,$idForm,$data=NULL) {
|
||||
$element=$form -> addElement('ssh_key', $this -> name, $this -> config['label'], $this -> config, $this);
|
||||
if(!$element) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(206,$this -> name);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($data) {
|
||||
$element -> setValue($data);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -43,6 +43,7 @@ class LSformElement_image extends LSformElement {
|
|||
* @retval array
|
||||
*/
|
||||
function getDisplay(){
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSformElement_image');
|
||||
$return = true;
|
||||
if (!$this -> isFreeze()) {
|
||||
$id=$this -> name.'_'.rand();
|
||||
|
|
|
@ -65,6 +65,7 @@ class LSformElement_password extends LSformElement {
|
|||
* @retval array
|
||||
*/
|
||||
function getDisplay(){
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSformElement_password');
|
||||
$return = $this -> getLabelInfos();
|
||||
if (!$this -> isFreeze()) {
|
||||
$numberId=rand();
|
||||
|
|
|
@ -40,6 +40,7 @@ class LSformElement_select_object extends LSformElement {
|
|||
* @retval array
|
||||
*/
|
||||
function getDisplay($refresh=NULL){
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSformElement_select_object');
|
||||
if ($refresh) {
|
||||
$this -> values = $this -> attr_html -> getValuesFromSession();
|
||||
}
|
||||
|
|
91
trunk/includes/class/class.LSformElement_ssh_key.php
Normal file
91
trunk/includes/class/class.LSformElement_ssh_key.php
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2007 Easter-eggs
|
||||
* http://ldapsaisie.labs.libre-entreprise.org
|
||||
*
|
||||
* Author: See AUTHORS file in top-level directory.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Element ssh_key d'un formulaire pour LdapSaisie
|
||||
*
|
||||
* Cette classe définis les éléments ssh_key des formulaires.
|
||||
* Elle étend la classe basic LSformElement.
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*/
|
||||
|
||||
class LSformElement_ssh_key extends LSformElement {
|
||||
|
||||
/**
|
||||
* Retourne les infos d'affichage de l'élément
|
||||
*
|
||||
* Cette méthode retourne les informations d'affichage de l'élement
|
||||
*
|
||||
* @retval array
|
||||
*/
|
||||
function getDisplay(){
|
||||
$GLOBALS['LSsession'] -> addCssFile('LSformElement_ssh_key');
|
||||
$return = $this -> getLabelInfos();
|
||||
// value
|
||||
$return['html'] = "<ul class='LSform'>\n";
|
||||
if (!$this -> isFreeze()) {
|
||||
if (empty($this -> values)) {
|
||||
$return['html'] .= "<li class='LSform'>".$this -> getEmptyField()."</li>\n";
|
||||
}
|
||||
else {
|
||||
foreach($this -> values as $value) {
|
||||
$multiple = $this -> getMultipleData();
|
||||
$id = "LSform_".$this -> name."_".rand();
|
||||
$return['html'].="<li class='LSform LSformElement_ssh_key'><textarea name='".$this -> name."[]' id='".$id."' class='LSform LSformElement_ssh_key'>".$value."</textarea>\n".$multiple."</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (empty($this -> values)) {
|
||||
$return['html'].="<li class='LSform'>"._('Aucune valeur definie')."</li>\n";
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSsession'] -> addJSscript('LSformElement_ssh_key.js');
|
||||
foreach ($this -> values as $value) {
|
||||
if (ereg('^ssh-([a-z]+) (.*)== (.*)$',$value,$regs)) {
|
||||
$return['html'].="<li class='LSform'><span class='LSformElement_ssh_key_short_display' title='"._("Cliquer pour afficher la valeur complète")."'>".substr($regs[2],0,10)."...</span> (Type : ".$regs[1].") <a href='mailto:".$regs[3]."'>".$regs[3]."</a><p class='LSformElement_ssh_key_value'>".$value."</p></li>\n";
|
||||
}
|
||||
else {
|
||||
$return['html'].="<li class='LSform'><span class='LSformElement_ssh_key_short_display'>".substr($value,0,15)."...</span> ("._('Type non reconnu').")<p class='LSformElement_ssh_key_value'>".$value."</p></li>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$return['html'] .= "</ul>\n";
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le code HTML d'un champ vide
|
||||
*
|
||||
* @retval string Code HTML d'un champ vide.
|
||||
*/
|
||||
function getEmptyField() {
|
||||
$multiple = $this -> getMultipleData();
|
||||
return "<textarea name='".$this -> name."[]' id='LSform".$this -> name."_".rand()."' class='LSform LSformElement_ssh_key'></textarea>\n".$multiple;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
22
trunk/includes/js/LSformElement_ssh_key.js
Normal file
22
trunk/includes/js/LSformElement_ssh_key.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
var LSformElement_ssh_key = new Class({
|
||||
initialize: function(){
|
||||
$$('span.LSformElement_ssh_key_short_display').each(function(span) {
|
||||
span.addEvent('click',this.onShortDisplayClick.bind(this,span));
|
||||
}, this);
|
||||
},
|
||||
|
||||
onShortDisplayClick: function(span) {
|
||||
var p = span.getParent().getFirst('p.LSformElement_ssh_key_value');
|
||||
if (typeof(p)) {
|
||||
if (p.getStyle('display')=='none') {
|
||||
p.setStyle('display','block');
|
||||
}
|
||||
else {
|
||||
p.setStyle('display',' none');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
window.addEvent(window.ie ? 'load' : 'domready', function() {
|
||||
varLSformElement_ssh_key = new LSformElement_ssh_key();
|
||||
});
|
|
@ -42,7 +42,7 @@ li.LSform {
|
|||
* Champs du formulaire
|
||||
*/
|
||||
.LSform input, .LSform select, .LSform textarea {
|
||||
border: 1px inset #ccc;
|
||||
border: 1px solid #ccc;
|
||||
width: 300px;
|
||||
background-color: #b5e4f6;
|
||||
}
|
||||
|
@ -63,80 +63,3 @@ input[type='submit'].LSform {
|
|||
img.LSform-add-field-btn, img.LSform-remove-field-btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
************************
|
||||
* LSformElement
|
||||
************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* LSformElement_select_object
|
||||
*/
|
||||
a.LSformElement_select_object {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
font-weight: normal;
|
||||
|
||||
}
|
||||
|
||||
ul.LSformElement_select_object {
|
||||
border: 1px solid #b5e4f6;
|
||||
border-bottom: none;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
li.LSformElement_select_object {
|
||||
padding: 0.1em;
|
||||
border-bottom: 1px solid #b5e4f6;
|
||||
}
|
||||
|
||||
li.LSformElement_select_object_addBtn {
|
||||
background-color: #b5e4f6;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img.LSformElement_select_object_deleteBtn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
* LSformElement_password
|
||||
*/
|
||||
img.LSformElement_password_view_btn, img.LSformElement_password_generate_btn, img.LSformElement_password_verify_btn {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
* LSformElement_image
|
||||
*/
|
||||
div.LSformElement_image {
|
||||
float: right;
|
||||
clear: both;
|
||||
margin: 2em;
|
||||
background-color: #52bce5;
|
||||
width: 160px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
-moz-border-radius: 1em;
|
||||
}
|
||||
|
||||
img.LSformElement_image {
|
||||
width: 150px;
|
||||
border: 1px solid #fff;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
div.LSformElement_image_errors {
|
||||
background-color: #f59a67;
|
||||
}
|
||||
|
||||
ul.LSformElement_image_actions {
|
||||
list-style-type: none;
|
||||
position: absolute;
|
||||
margin-top: 8px;
|
||||
margin-left: 135px;
|
||||
padding: 0;
|
||||
visibility: hidden;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
33
trunk/templates/css/LSformElement_image.css
Normal file
33
trunk/templates/css/LSformElement_image.css
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* LSformElement_image
|
||||
*/
|
||||
div.LSformElement_image {
|
||||
float: right;
|
||||
clear: both;
|
||||
margin: 2em;
|
||||
background-color: #52bce5;
|
||||
width: 160px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
-moz-border-radius: 1em;
|
||||
}
|
||||
|
||||
img.LSformElement_image {
|
||||
width: 150px;
|
||||
border: 1px solid #fff;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
div.LSformElement_image_errors {
|
||||
background-color: #f59a67;
|
||||
}
|
||||
|
||||
ul.LSformElement_image_actions {
|
||||
list-style-type: none;
|
||||
position: absolute;
|
||||
margin-top: 8px;
|
||||
margin-left: 135px;
|
||||
padding: 0;
|
||||
visibility: hidden;
|
||||
cursor: pointer;
|
||||
}
|
6
trunk/templates/css/LSformElement_password.css
Normal file
6
trunk/templates/css/LSformElement_password.css
Normal file
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* LSformElement_password
|
||||
*/
|
||||
img.LSformElement_password_view_btn, img.LSformElement_password_generate_btn, img.LSformElement_password_verify_btn {
|
||||
cursor: pointer;
|
||||
}
|
29
trunk/templates/css/LSformElement_select_object.css
Normal file
29
trunk/templates/css/LSformElement_select_object.css
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* LSformElement_select_object
|
||||
*/
|
||||
a.LSformElement_select_object {
|
||||
text-decoration: none;
|
||||
color: #000;
|
||||
font-weight: normal;
|
||||
|
||||
}
|
||||
|
||||
ul.LSformElement_select_object {
|
||||
border: 1px solid #b5e4f6;
|
||||
border-bottom: none;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
li.LSformElement_select_object {
|
||||
padding: 0.1em;
|
||||
border-bottom: 1px solid #b5e4f6;
|
||||
}
|
||||
|
||||
li.LSformElement_select_object_addBtn {
|
||||
background-color: #b5e4f6;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img.LSformElement_select_object_deleteBtn {
|
||||
cursor: pointer;
|
||||
}
|
22
trunk/templates/css/LSformElement_ssh_key.css
Normal file
22
trunk/templates/css/LSformElement_ssh_key.css
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* LSformElement_ssh_key
|
||||
*/
|
||||
.LSformElement_ssh_key_value {
|
||||
display: none;
|
||||
width: 30em;
|
||||
font-style: italic;
|
||||
font-family: courier;
|
||||
background-color: #b5e4f6;
|
||||
border: 1px solid #ccc;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.LSformElement_ssh_key_short_display {
|
||||
font-style: italic;
|
||||
font-family: courier;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
textarea.LSformElement_ssh_key {
|
||||
height: 10em;
|
||||
}
|
Loading…
Reference in a new issue