ldapsaisie/src/includes/class/class.LSformElement_mail.php

121 lines
4.4 KiB
PHP
Raw Normal View History

<?php
/*******************************************************************************
* Copyright (C) 2007 Easter-eggs
* https://ldapsaisie.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.
******************************************************************************/
LSsession :: loadLSclass('LSformElement_text');
/**
* Element mail d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments textes des formulaires.
* Elle étant la classe basic LSformElement.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_mail extends LSformElement_text {
var $JSscripts = array(
'LSformElement_mail.js'
);
var $fetchVariables = array(
'additionalCssClass' => array('LSformElement_mail'),
'uriPrefix' => 'mailto:'
);
var $fieldTemplate = 'LSformElement_uri_field.tpl';
// Flag to trigger warning about old Autocomplete config style
// (detect in constructor and show on getDisplay())
private $warnOldAutocompleteConfigStyle = false;
/**
* Constructor
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param LSform &$form The LSform parent object
* @param string $name The name of the element
* @param string $label The label of the element
* @param array $params The parameters of the element
* @param LSattr_html &$attr_html The LSattr_html object of the corresponding attribute
*
* @return void
*/
public function __construct(&$form, $name, $label, $params, &$attr_html){
parent::__construct($form, $name, $label, $params, $attr_html);
// Handle autocomplete retro-compatibility & default value attributes
if ($this -> getParam('html_options.autocomplete')) {
$mail_attributes = $this -> getParam('html_options.autocomplete.mail_attributes');
if ($mail_attributes) {
$this -> params['html_options']['autocomplete']['value_attributes'] = $mail_attributes;
$this -> warnOldAutocompleteConfigStyle = true;
}
elseif (!$this -> getParam('html_options.autocomplete.value_attributes')) {
if (!is_array($this -> params['html_options']['autocomplete']))
$this -> params['html_options']['autocomplete'] = array();
$this -> params['html_options']['autocomplete']['value_attributes'] = array('mail');
$this -> warnOldAutocompleteConfigStyle = true;
}
}
}
public function getDisplay() {
LStemplate :: addHelpInfo(
'LSformElement_mail',
array(
2009-02-14 00:06:58 +01:00
'mail' => _("Send a mail from here.")
)
);
- LSmail : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSrelation : - Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - Modification du JS pour faire appels à ces méthodes - La méthode displayInLSview() remplace le bloc du fichier view.php pour l'affichage des relations d'un objet. - Internationalisation. - LSselect : Création d'une classe PHP gérant les dépendances d'affichage et les requêtes Ajax. - LSformElement_password : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_select_object : - Ajout de méthodes statiques gérant les appels Ajax. - Modification du JS pour faire appels à ces méthodes - LSformElement_mail : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSformElement_image : Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - LSsession : - Ajout de méthodes statiques gérant les appels Ajax des formulaires de login et de recupération de mot de passe. - Modification des JS pour faire appels à ces méthodes - Ajout d'un mécanisme permettant de garder la session PHP active - Modification de LSdefault.js pour gérer ce mécanisme - LSform : - Ajout de méthodes statiques gérant les appels Ajax des formulaires - Ajout de la méthode loadDependenciesDisplayView() gérant les dépendances d'affichage d'une LSview. - Utilisation des nouvelles fonctionnalités pour gérer les dépendances. - view.php / modify.php /select.php : Utilisation des nouvelles fonctionnalités pour gérer les dépendances et les LSrelations. - LSview : Modification de l'internationnalisation.
2009-02-20 15:05:22 +01:00
if (LSsession :: loadLSclass('LSmail')) {
LSmail :: loadDependenciesDisplay();
}
if ($this -> warnOldAutocompleteConfigStyle)
LSerror :: addErrorCode('LSformElement_mail_01');
return parent :: getDisplay();
}
/**
* Return HTML code of the LSformElement based on its (smarty) template file
*
* @param string $template The template filename (optional, default: $this -> template)
* @param array $variables Array of template variables to assign before template compilation (optional)
*
* @return string HTML code of the LSformElement
*/
public function fetchTemplate($template=NULL,$variables=array()) {
if ($this -> getParam('html_options.disableMailSending', false, 'bool')) {
$this -> fetchVariables['additionalCssClass'][] = " LSformElement_mail_disableMailSending";
}
return parent :: fetchTemplate($template,$variables);
}
}
/**
* Error Codes
**/
LSerror :: defineError('LSformElement_mail_01',
___("LSformElement_mail: the autocomplete feature was moved to parent LSformElement_text class and you still use old configuration style with parameter mail_attributes (and its default value). Please upgrade your configuration by renaming (or setting) this parameter to value_attributes.")
);