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 ******************************************************************************/
23 LSsession :: loadLSclass('LSformElement_text');
26 * Element maildir d'un formulaire pour LdapSaisie
28 * Cette classe définis les éléments maildir des formulaires.
29 * Elle étant la classe LSformElement_text.
32 * // *************************************
33 * 'html_options' => array (
35 * 'LSform' => array ( // To define if the user can active triggers for the LSform
36 * 'create' => 1, // Example : LSform 'create' => Triggers active by default
37 * 'modify' => 0 // Example : LSform 'modify' => Triggers disable by default
40 * 'remoteRootPathRegex' => "^\/home\/vmail\/([^\/]*)\/+$", // Regex to determine the path of
41 * // maildir from the attribute value
42 * 'archiveNameFormat' => "archives/%{old}" // To archive rather than destroyed :
43 * // At the elimination, the maildir is moved
44 * // rather than deleted. The new name / path
45 * // of the maildir is determined from the old
46 * // name and LSformat.
48 * // *************************************
50 * @author Benjamin Renard <brenard@easter-eggs.com>
53 class LSformElement_maildir extends LSformElement_text {
57 var $JSscripts = array(
58 'LSformElement_maildir_field.js',
59 'LSformElement_maildir.js'
62 var $fieldTemplate = 'LSformElement_maildir_field.tpl';
64 function getDisplay() {
65 LSsession :: addHelpInfos (
66 'LSformElement_maildir',
68 'do' => _("Maildir creation/modification on user creation/modification is enabled. Click to disable."),
69 'nodo' => _("Click to enable maildir creation/modification on user creation/modification.")
72 return parent :: getDisplay($return);
76 * Recupère la valeur de l'élement passée en POST
78 * Cette méthode vérifie la présence en POST de la valeur de l'élément et la récupère
79 * pour la mettre dans le tableau passer en paramètre avec en clef le nom de l'élément
81 * @param[] array Pointeur sur le tableau qui recupèrera la valeur.
83 * @retval boolean true si la valeur est présente en POST, false sinon
85 function getPostData(&$return) {
86 // Récupère la valeur dans _POST, et les vérifie avec la fonction générale
87 $retval = parent :: getPostData($return);
89 // Si une valeur est recupérée
90 if ($retval&&$_POST['LSformElement_maildir_'.$this -> name.'_do']) {
91 $cur = $this -> form -> ldapObject -> attrs[$this -> name] -> getValue();
93 $new = $return[$this -> name][0];
97 if( ($new=="") && ( $cur!="" ) ) {
100 else if ( ($new!="") && ( $cur!="" ) ) {
108 $new = $this -> attr_html -> getRemoteRootPathRegex($new);
109 $cur = $this -> attr_html -> getRemoteRootPathRegex($cur);
110 $this -> attr_html -> doOnModify($action,$cur,$new);