mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
- LSsession :
-> Ajout de la methode redirect() -> Ajout d'une possibilité d'affichage d'infos à au chargement de la page -> methode addInfo() -> modification de la methode displayTemplate() en conséquence -> modification de LSdefault.js et LSdefault.css en conséquence - remove.php -> Redirection vers la liste des objets du même type que l'objet supprimé après sa suppression avec une demande de rafraichissement. - modify.php -> Redirection vers la fiche de l'objet après sa modification avec affichage d'un message. (Feature Request #1702) - LSaddons : -> FTP : support FTP a travers la librairie PEAR :: Net_FTP -> Maildir : Pour la création et la suppresion de la Maildir d'un utilisateur -> Posix : Ajout de la méthode createHomeDirectoryByFTP() et correction d'un bug dans l'affichage des erreurs -> Samba : Correction d'un bug dans l'affichage des erreurs - LSldapObject : -> Ajout d'une possibilité de trigger personnalisé à travers la configuration d'un LSobjet : -> after_create -> after_delete -> Renomage du trigger before_save et after_save en before_modify et after_modify.
This commit is contained in:
parent
5b7570fe12
commit
721eddd92f
16 changed files with 550 additions and 34 deletions
|
@ -38,8 +38,10 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
|||
'ou' => 'people'
|
||||
)
|
||||
),
|
||||
'before_save' => 'valid',
|
||||
'after_save' => 'valid',
|
||||
'before_modify' => 'valid',
|
||||
'after_modify' => 'valid',
|
||||
'after_create' => 'createMaildirByFTP',
|
||||
'after_delete' => 'removeMaildirByFTP',
|
||||
'select_display_attrs' => '%{cn}',
|
||||
'label' => _('Utilisateurs'),
|
||||
'relations' => array(
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
******************************************************************************/
|
||||
|
||||
$GLOBALS['LSaddons']['loads'] = array (
|
||||
'samba', 'posix'
|
||||
'samba',
|
||||
'posix',
|
||||
'ftp',
|
||||
'maildir'
|
||||
);
|
||||
|
||||
?>
|
||||
|
|
|
@ -85,19 +85,19 @@ $GLOBALS['LSerror_code'] = array (
|
|||
'level' => 'c'
|
||||
),
|
||||
27 => array (
|
||||
'msg' => _("LSldapObject : La fonction %{func} devant être executée avant l'enregistrement n'existe pas."),
|
||||
'msg' => _("LSldapObject : La fonction %{func} devant être executée avant la modification n'existe pas."),
|
||||
'level' => 'c'
|
||||
),
|
||||
28 => array (
|
||||
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée avant l'enregistrement a échouée."),
|
||||
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée avant la modification a échouée."),
|
||||
'level' => 'c'
|
||||
),
|
||||
29 => array (
|
||||
'msg' => _("LSldapObject : La fonction %{func} devant être executée après l'enregistrement n'existe pas."),
|
||||
'msg' => _("LSldapObject : La fonction %{func} devant être executée après la modification n'existe pas."),
|
||||
'level' => 'c'
|
||||
),
|
||||
30 => array (
|
||||
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée après l'enregistrement a échouée."),
|
||||
'msg' => _("LSldapObject : L'execution de la fonction %{func} devant être executée après la modification a échouée."),
|
||||
'level' => 'c'
|
||||
),
|
||||
31 => array (
|
||||
|
@ -136,10 +136,26 @@ $GLOBALS['LSerror_code'] = array (
|
|||
'msg' => _("LSldapObject : Erreur durant les actions après suppresion."),
|
||||
'level' => 'c'
|
||||
),
|
||||
40 => array (
|
||||
301 => array (
|
||||
'msg' => _("LSldapObject : Erreur durant les actions après la création. L'objet est pour autant créé."),
|
||||
'level' => 'c'
|
||||
),
|
||||
302 => array (
|
||||
'msg' => _("LSldapObject : La fonction %{fonction} devant être éxecutée après la création de l'objet n'existe pas."),
|
||||
'level' => 'c'
|
||||
),
|
||||
303 => array (
|
||||
'msg' => _("LSldapObject : Erreur durant l'exection de la fonction %{fonction} devant être éxecutée après la création de l'objet."),
|
||||
'level' => 'c'
|
||||
),
|
||||
304 => array (
|
||||
'msg' => _("LSldapObject : La fonction %{fonction} devant être éxecutée après la suppression de l'objet n'existe pas."),
|
||||
'level' => 'c'
|
||||
),
|
||||
305 => array (
|
||||
'msg' => _("LSldapObject : Erreur durant l'exection de la fonction %{fonction} devant être éxecutée après la suppression de l'objet."),
|
||||
'level' => 'c'
|
||||
),
|
||||
|
||||
// LSattribute
|
||||
41 => array (
|
||||
|
|
183
trunk/includes/addons/LSaddons.ftp.php
Normal file
183
trunk/includes/addons/LSaddons.ftp.php
Normal file
|
@ -0,0 +1,183 @@
|
|||
<?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.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Données de configuration pour le support FTP
|
||||
*/
|
||||
|
||||
// Pear :: NET_FTP
|
||||
define('NET_FTP','/usr/share/php/Net/FTP.php');
|
||||
|
||||
// Message d'erreur
|
||||
|
||||
$GLOBALS['LSerror_code']['FTP_SUPPORT_01']= array (
|
||||
'msg' => _("FTP Support : Pear::Net_FTP est introuvable."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
$GLOBALS['LSerror_code']['FTP_00']= array (
|
||||
'msg' => _("Net_FTP Error : %{msg}"),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
$GLOBALS['LSerror_code']['FTP_01']= array (
|
||||
'msg' => _("FTP Support : Impossible de se connecter au serveur FTP (Etape : %{etape})."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['LSerror_code']['FTP_02']= array (
|
||||
'msg' => _("FTP Support : Impossible de créer le dossier %{dir} sur le serveur distant."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['LSerror_code']['FTP_03']= array (
|
||||
'msg' => _("FTP Support : Impossible de supprimer le dossier %{dir} sur le serveur distant."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Fin des données de configuration
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Verification du support FTP par ldapSaisie
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @retval boolean true si FTP est pleinement supporté, false sinon
|
||||
*/
|
||||
function LSaddon_ftp_support() {
|
||||
$retval=true;
|
||||
|
||||
// Dependance de librairie
|
||||
if (!class_exists('Net_FTP')) {
|
||||
if(!@include(NET_FTP)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_SUPPORT_01');
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Connexion a un serveur FTP
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $host string Le nom ou l'IP du serveur FTP
|
||||
* @param[in] $port string Le port de connexion au serveur ftp
|
||||
* @param[in] $user string Le nom d'utilidateur de connexion
|
||||
* @param[in] $pwd string Le mot de passe de connexion
|
||||
*
|
||||
* @retval mixed Net_FTP object en cas de succès, false sinon
|
||||
*/
|
||||
function connectToFTP($host,$port,$user,$pwd) {
|
||||
$cnx = new Net_FTP();
|
||||
$do = $cnx -> connect($host,$port);
|
||||
if (! $do instanceof PEAR_Error){
|
||||
$do = $cnx -> login($user,$pwd);
|
||||
if (! $do instanceof PEAR_Error) {
|
||||
return $cnx;
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_01',"2");
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_01',"1");
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creation d'un ou plusieurs dossiers via FTP
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $host string Le nom ou l'IP du serveur FTP
|
||||
* @param[in] $port string Le port de connexion au serveur ftp
|
||||
* @param[in] $user string Le nom d'utilidateur de connexion
|
||||
* @param[in] $pwd string Le mot de passe de connexion
|
||||
* @param[in] $dirs array ou string Le(s) dossier(s) à ajouter
|
||||
*
|
||||
* @retval string True ou false si il y a un problème durant la création du/des dossier(s)
|
||||
*/
|
||||
function createDirsByFTP($host,$port,$user,$pwd,$dirs) {
|
||||
$cnx = connectToFTP($host,$port,$user,$pwd);
|
||||
if (! $cnx){
|
||||
return;
|
||||
}
|
||||
if (!is_array($dirs)) {
|
||||
$dirs = array($dirs);
|
||||
}
|
||||
foreach($dirs as $dir) {
|
||||
$do = $cnx -> mkdir($dir,true);
|
||||
if ($do instanceof PEAR_Error) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_02',$dir);
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression d'un ou plusieurs dossiers via FTP
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $host string Le nom ou l'IP du serveur FTP
|
||||
* @param[in] $port string Le port de connexion au serveur ftp
|
||||
* @param[in] $user string Le nom d'utilidateur de connexion
|
||||
* @param[in] $pwd string Le mot de passe de connexion
|
||||
* @param[in] $dirs array ou string Le(s) dossier(s) à supprimer
|
||||
*
|
||||
* @retval string True ou false si il y a un problème durant la suppression du/des dossier(s)
|
||||
*/
|
||||
function removeDirsByFTP($host,$port,$user,$pwd,$dirs) {
|
||||
$cnx = connectToFTP($host,$port,$user,$pwd);
|
||||
if (! $cnx){
|
||||
return;
|
||||
}
|
||||
if (!is_array($dirs)) {
|
||||
$dirs = array($dirs);
|
||||
}
|
||||
foreach($dirs as $dir) {
|
||||
if ($dir[strlen($dir)-1]!='/') {
|
||||
$dir.='/';
|
||||
}
|
||||
$do = $cnx -> rm($dir,true);
|
||||
if ($do instanceof PEAR_Error) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_03',$dir);
|
||||
$GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
139
trunk/includes/addons/LSaddons.maildir.php
Normal file
139
trunk/includes/addons/LSaddons.maildir.php
Normal file
|
@ -0,0 +1,139 @@
|
|||
<?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.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Données de configuration pour le support Maildir
|
||||
*/
|
||||
|
||||
// Serveur FTP - Host
|
||||
define('LS_MAILDIR_FTP_HOST','127.0.0.1');
|
||||
|
||||
// Serveur FTP - Port
|
||||
define('LS_MAILDIR_FTP_PORT',21);
|
||||
|
||||
// Serveur FTP - User
|
||||
define('LS_MAILDIR_FTP_USER','vmail');
|
||||
|
||||
// Serveur FTP - Passorwd
|
||||
define('LS_MAILDIR_FTP_PWD','password');
|
||||
|
||||
// Serveur FTP - Maildir Path
|
||||
define('LS_MAILDIR_FTP_MAILDIR_PATH','%{uid}');
|
||||
|
||||
// Message d'erreur
|
||||
|
||||
$GLOBALS['LSerror_code']['MAILDIR_SUPPORT_01']= array (
|
||||
'msg' => _("MAILDIR Support : Impossible de charger LSaddons::FTP."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['LSerror_code']['MAILDIR_SUPPORT_02']= array (
|
||||
'msg' => _("MAILDIR Support : La constante %{const} n'est pas définie."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['LSerror_code']['MAILDIR_01']= array (
|
||||
'msg' => _("MAILDIR Support : Erreur durant la création de la maildir sur le serveur distant."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['LSerror_code']['MAILDIR_02']= array (
|
||||
'msg' => _("MAILDIR Support : Erreur durant la création de la maildir sur le serveur distant."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
/**
|
||||
* Fin des données de configuration
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Verification du support Maildir par ldapSaisie
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @retval boolean true si Maildir est pleinement supporté, false sinon
|
||||
*/
|
||||
function LSaddon_maildir_support() {
|
||||
$retval=true;
|
||||
|
||||
// Dependance de librairie
|
||||
if (!function_exists('createDirsByFTP')) {
|
||||
if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('MAILDIR_SUPPORT_01');
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
||||
$MUST_DEFINE_CONST= array(
|
||||
'LS_MAILDIR_FTP_HOST',
|
||||
'LS_MAILDIR_FTP_USER',
|
||||
'LS_MAILDIR_FTP_MAILDIR_PATH'
|
||||
);
|
||||
|
||||
foreach($MUST_DEFINE_CONST as $const) {
|
||||
if ( constant($const) == '' ) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('MAILDIR_SUPPORT_02',$const);
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creation d'une Maildir via FTP
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $ldapObject L'objet ldap
|
||||
*
|
||||
* @retval string True ou false si il y a un problème durant la création de la Maildir
|
||||
*/
|
||||
function createMaildirByFTP($ldapObject) {
|
||||
$dir = getFData(LS_MAILDIR_FTP_MAILDIR_PATH,$ldapObject,'getValue');
|
||||
$dirs = array(
|
||||
$dir.'/cur',
|
||||
$dir.'/new',
|
||||
$dir.'/tmp'
|
||||
);
|
||||
if (!createDirsByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$dirs)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('MAILDIR_01');
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression d'une Maildir via FTP
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $ldapObject L'objet ldap
|
||||
*
|
||||
* @retval string True ou false si il y a un problème durant la suppression de la Maildir
|
||||
*/
|
||||
function removeMaildirByFTP($ldapObject) {
|
||||
$dir = getFData(LS_MAILDIR_FTP_MAILDIR_PATH,$ldapObject,'getValue');
|
||||
if (!removeDirsByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$dir)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('MAILDIR_02');
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -42,18 +42,37 @@
|
|||
|
||||
// Dossier contenant les homes des utilisateurs (defaut: /home/)
|
||||
define('LS_POSIX_HOMEDIRECTORY','/home/');
|
||||
|
||||
|
||||
// Create homeDirectory by FTP - Host
|
||||
define('LS_POSIX_HOMEDIRECTORY_FTP_HOST','127.0.0.1');
|
||||
|
||||
// Create homeDirectory by FTP - Port
|
||||
define('LS_POSIX_HOMEDIRECTORY_FTP_PORT',21);
|
||||
|
||||
// Create homeDirectory by FTP - User
|
||||
define('LS_POSIX_HOMEDIRECTORY_FTP_USER','admin');
|
||||
|
||||
// Create homeDirectory by FTP - Password
|
||||
define('LS_POSIX_HOMEDIRECTORY_FTP_PWD','password');
|
||||
|
||||
// Create homeDirectory by FTP - Path
|
||||
define('LS_POSIX_HOMEDIRECTORY_FTP_PATH','%{homeDirectory}');
|
||||
|
||||
|
||||
// -- Message d'erreur --
|
||||
// Support
|
||||
$GLOBALS['error_code']['POSIX_SUPPORT_01']= array (
|
||||
$GLOBALS['LSerror_code']['POSIX_SUPPORT_01']= array (
|
||||
'msg' => _("POSIX Support : La constante %{const} n'est pas définie."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
$GLOBALS['LSerror_code']['POSIX_SUPPORT_02']= array (
|
||||
'msg' => _("POSIX Support : Impossible de charger LSaddons::FTP."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
// Autres erreurs
|
||||
$GLOBALS['error_code']['POSIX_01']= array (
|
||||
$GLOBALS['LSerror_code']['POSIX_01']= array (
|
||||
'msg' => _("POSIX : L'attribut %{dependency} est introuvable. Impossible de générer l'attribut %{attr}."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
@ -73,6 +92,14 @@
|
|||
function LSaddon_posix_support() {
|
||||
|
||||
$retval=true;
|
||||
|
||||
// Dependance de librairie
|
||||
if (!function_exists('createDirsByFTP')) {
|
||||
if(!$GLOBALS['LSsession'] -> loadLSaddon('ftp')) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('POSIX_SUPPORT_02');
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
||||
$MUST_DEFINE_CONST= array(
|
||||
'LS_POSIX_UID_ATTR',
|
||||
|
@ -80,7 +107,12 @@
|
|||
'LS_POSIX_GIDNUMBER_ATTR',
|
||||
'LS_POSIX_UIDNUMBER_MIN_VAL',
|
||||
'LS_POSIX_GIDNUMBER_MIN_VAL',
|
||||
'LS_POSIX_HOMEDIRECTORY'
|
||||
'LS_POSIX_HOMEDIRECTORY',
|
||||
'LS_POSIX_HOMEDIRECTORY_FTP_HOST',
|
||||
'LS_POSIX_HOMEDIRECTORY_FTP_PORT',
|
||||
'LS_POSIX_HOMEDIRECTORY_FTP_USER',
|
||||
'LS_POSIX_HOMEDIRECTORY_FTP_PWD',
|
||||
'LS_POSIX_HOMEDIRECTORY_FTP_PATH'
|
||||
);
|
||||
|
||||
foreach($MUST_DEFINE_CONST as $const) {
|
||||
|
@ -167,5 +199,23 @@
|
|||
return $home;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Generation de homeDirectory
|
||||
*
|
||||
* @author Benjamin Renard <brenard@easter-eggs.com>
|
||||
*
|
||||
* @param[in] $ldapObject L'objet ldap
|
||||
*
|
||||
* @retval string homeDirectory ou false si il y a un problème durant la génération
|
||||
*/
|
||||
function createHomeDirectoryByFTP($ldapObject) {
|
||||
$dir = getFData(LS_POSIX_HOMEDIRECTORY_FTP_PATH,$ldapObject,'getValue');
|
||||
if (!createDirsByFTP(LS_POSIX_HOMEDIRECTORY_FTP_HOST,LS_POSIX_HOMEDIRECTORY_FTP_PORT,LS_POSIX_HOMEDIRECTORY_FTP_USER,LS_POSIX_HOMEDIRECTORY_FTP_PWD,$dir)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('POSIX_02');
|
||||
return;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -50,22 +50,22 @@
|
|||
|
||||
// Message d'erreur
|
||||
|
||||
$GLOBALS['error_code']['SAMBA_SUPPORT_01']= array (
|
||||
$GLOBALS['LSerror_code']['SAMBA_SUPPORT_01']= array (
|
||||
'msg' => _("SAMBA Support : la classe smHash ne peut pas être chargée."),
|
||||
'level' => 'c'
|
||||
);
|
||||
$GLOBALS['error_code']['SAMBA_SUPPORT_02']= array (
|
||||
$GLOBALS['LSerror_code']['SAMBA_SUPPORT_02']= array (
|
||||
'msg' => _("SAMBA Support : La constante %{const} n'est pas définie."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
$GLOBALS['error_code']['SAMBA_SUPPORT_03']= array (
|
||||
$GLOBALS['LSerror_code']['SAMBA_SUPPORT_03']= array (
|
||||
'msg' => _("SAMBA Support : Les constantes LS_SAMBA_SID_BASE_USER et LS_SAMBA_SID_BASE_GROUP ne doivent pas avoir la même parité pour l'unicité des sambaSID."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
||||
|
||||
$GLOBALS['error_code']['SAMBA_01']= array (
|
||||
$GLOBALS['LSerror_code']['SAMBA_01']= array (
|
||||
'msg' => _("SAMBA Support : L'attribut %{dependency} est introuvable. Impossible de générer l'attribut %{attr}."),
|
||||
'level' => 'c'
|
||||
);
|
||||
|
@ -89,7 +89,7 @@
|
|||
// Dependance de librairie
|
||||
if ( !class_exists('smbHash') ) {
|
||||
if ( ! @include_once(LS_LIB_DIR . 'class.smbHash.php') ) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_O1');
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_01');
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
@ -106,14 +106,14 @@
|
|||
|
||||
foreach($MUST_DEFINE_CONST as $const) {
|
||||
if ( constant($const) == '' ) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_O2',$const);
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_02',$const);
|
||||
$retval=false;
|
||||
}
|
||||
}
|
||||
|
||||
// Pour l'intégrité des SID
|
||||
if ( (LS_SAMBA_SID_BASE_USER % 2) == (LS_SAMBA_SID_BASE_GROUP % 2) ) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_O3');
|
||||
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_03');
|
||||
$retval=false;
|
||||
}
|
||||
|
||||
|
|
|
@ -304,15 +304,15 @@ class LSldapObject {
|
|||
}
|
||||
if($this -> validateAttrsData($idForm)) {
|
||||
debug("les données sont validées");
|
||||
if(isset($this -> config['before_save'])) {
|
||||
if(function_exists($this -> config['before_save'])) {
|
||||
if(!$this -> config['before_save']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(28,$this -> config['before_save']);
|
||||
if(isset($this -> config['before_modify'])) {
|
||||
if(function_exists($this -> config['before_modify'])) {
|
||||
if(!$this -> config['before_modify']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(28,$this -> config['before_modify']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(27,$this -> config['before_save']);
|
||||
$GLOBALS['LSerror'] -> addErrorCode(27,$this -> config['before_modify']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -325,15 +325,15 @@ class LSldapObject {
|
|||
else {
|
||||
return;
|
||||
}
|
||||
if((isset($this -> config['after_save']))&&(!$this -> submitError)) {
|
||||
if(function_exists($this -> config['after_save'])) {
|
||||
if(!$this -> config['after_save']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(30,$this -> config['after_save']);
|
||||
if((isset($this -> config['after_modify']))&&(!$this -> submitError)) {
|
||||
if(function_exists($this -> config['after_modify'])) {
|
||||
if(!$this -> config['after_modify']($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(30,$this -> config['after_modify']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(29,$this -> config['after_save']);
|
||||
$GLOBALS['LSerror'] -> addErrorCode(29,$this -> config['after_modify']);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ class LSldapObject {
|
|||
}
|
||||
if ($new) {
|
||||
if (!$this -> afterCreate()) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(40);
|
||||
$GLOBALS['LSerror'] -> addErrorCode(301);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1149,6 +1149,28 @@ class LSldapObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this -> config['after_delete'])) {
|
||||
if (is_array($this -> config['after_delete'])) {
|
||||
$config = $this -> config['after_delete'];
|
||||
}
|
||||
else {
|
||||
$config = array($this -> config['after_delete']);
|
||||
}
|
||||
foreach($config as $action) {
|
||||
if(function_exists($action)) {
|
||||
if(!$action($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(305,$action);
|
||||
$error=true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(304,$action);
|
||||
$error=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !$error;
|
||||
}
|
||||
|
||||
|
@ -1189,6 +1211,28 @@ class LSldapObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this -> config['after_create'])) {
|
||||
if (is_array($this -> config['after_create'])) {
|
||||
$config = $this -> config['after_create'];
|
||||
}
|
||||
else {
|
||||
$config = array($this -> config['after_create']);
|
||||
}
|
||||
foreach($config as $action) {
|
||||
if(function_exists($action)) {
|
||||
if(!$action($this)) {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(303,$action);
|
||||
$error=true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(302,$action);
|
||||
$error=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !$error;
|
||||
}
|
||||
|
||||
|
|
|
@ -909,6 +909,17 @@ class LSsession {
|
|||
$GLOBALS['Smarty'] -> assign('LSsession_subDn',$this -> topDn);
|
||||
$GLOBALS['Smarty'] -> assign('LSsession_subDnName',$this -> getSubDnName());
|
||||
}
|
||||
|
||||
// Infos
|
||||
if((!empty($_SESSION['LSsession_infos']))&&(is_array($_SESSION['LSsession_infos']))) {
|
||||
$txt_infos="<ul>\n";
|
||||
foreach($_SESSION['LSsession_infos'] as $info) {
|
||||
$txt_infos.="<li>$info</li>\n";
|
||||
}
|
||||
$txt_infos.="</ul>\n";
|
||||
$GLOBALS['Smarty'] -> assign('LSinfos',$txt_infos);
|
||||
$_SESSION['LSsession_infos']=array();
|
||||
}
|
||||
|
||||
if ($this -> ajaxDisplay) {
|
||||
$GLOBALS['Smarty'] -> assign('LSerror_txt',$GLOBALS['LSerror']->getErrors());
|
||||
|
@ -1444,6 +1455,33 @@ class LSsession {
|
|||
function haveSubDn() {
|
||||
return (is_array($this -> ldapServer['subDn']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajoute une information à afficher
|
||||
*
|
||||
* @param[in] $msg string Le message à afficher
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
function addInfo($msg) {
|
||||
$_SESSION['LSsession_infos'][]=$msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirection de l'utilisateur vers une autre URL
|
||||
*
|
||||
* @param[in] $url string L'URL
|
||||
* @param[in] $exit boolean Si true, l'execution script s'arrête après la redirection
|
||||
*
|
||||
* @retval void
|
||||
*/
|
||||
function redirect($url,$exit=true) {
|
||||
$GLOBALS['Smarty'] -> assign('url',$url);
|
||||
$GLOBALS['Smarty'] -> display('redirect.tpl');
|
||||
if ($exit) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -9,6 +9,8 @@ var LSdefault = new Class({
|
|||
|
||||
this.LSerror = $('LSerror');
|
||||
this.LSerror.setOpacity(0);
|
||||
|
||||
this.LSinfos = $('LSinfos');
|
||||
|
||||
this.LSjsConfigEl = $('LSjsConfig');
|
||||
if ($type(this.LSjsConfigEl)) {
|
||||
|
@ -28,7 +30,8 @@ var LSdefault = new Class({
|
|||
|
||||
this.fx = {
|
||||
LSdebug: new Fx.Tween(this.LSdebug,{property: 'opacity',duration:600}),
|
||||
LSerror: new Fx.Tween(this.LSerror,{property: 'opacity',duration:500})
|
||||
LSerror: new Fx.Tween(this.LSerror,{property: 'opacity',duration:500}),
|
||||
LSinfos: new Fx.Tween(this.LSinfos,{property: 'opacity',duration:500})
|
||||
};
|
||||
|
||||
if (this.LSdebugInfos.innerHTML != '') {
|
||||
|
@ -38,6 +41,10 @@ var LSdefault = new Class({
|
|||
if (this.LSerror.innerHTML != '') {
|
||||
this.displayErrorBox();
|
||||
}
|
||||
|
||||
if (this.LSinfos.innerHTML != '') {
|
||||
this.displayInfosBox();
|
||||
}
|
||||
},
|
||||
|
||||
onLSsession_topDnChange: function() {
|
||||
|
@ -92,6 +99,12 @@ var LSdefault = new Class({
|
|||
(function(){this.fx.LSerror.start(0.8,0);}).delay(10000, this);
|
||||
},
|
||||
|
||||
displayInfosBox: function() {
|
||||
this.LSinfos.setStyle('top',getScrollTop()+10);
|
||||
this.fx.LSinfos.start(0,0.9);
|
||||
(function(){this.fx.LSinfos.start(0.9,0);}).delay(5000, this);
|
||||
},
|
||||
|
||||
displayDebugBox: function() {
|
||||
this.LSdebug.setStyle('top',getScrollTop()+10);
|
||||
this.fx.LSdebug.start(0,0.8);
|
||||
|
|
|
@ -53,7 +53,8 @@ if($LSsession -> startLSsession()) {
|
|||
if ($form->validate()) {
|
||||
// MàJ des données de l'objet LDAP
|
||||
if ($object -> updateData('modify')) {
|
||||
debug('ok');
|
||||
$GLOBALS['LSsession'] -> addInfo(_("L'objet a bien été modifié."));
|
||||
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ if($LSsession -> startLSsession()) {
|
|||
$objectname=$object -> getDisplayValue();
|
||||
$GLOBALS['Smarty'] -> assign('pagetitle',_('Suppression').' : '.$objectname);
|
||||
if ($object -> remove()) {
|
||||
$GLOBALS['Smarty'] -> assign('question',$objectname.' '._('a bien été supprimé').'.');
|
||||
$GLOBALS['LSsession'] -> addInfo($objectname.' '._('a bien été supprimé').'.');
|
||||
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$_GET['LSobject'].'&refresh');
|
||||
}
|
||||
else {
|
||||
$GLOBALS['LSerror'] -> addErrorCode(35,$objectname);
|
||||
|
|
|
@ -38,3 +38,16 @@
|
|||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#LSinfos {
|
||||
position: absolute;
|
||||
width: 50%;
|
||||
left: 25%;
|
||||
background-color: #bee2f0;
|
||||
border: 1px solid #4096b8;
|
||||
visibility: hidden;
|
||||
color: #4096b8;
|
||||
z-index: 100;
|
||||
top: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
|
|
@ -182,7 +182,8 @@ a.LSobject-list-actions:hover {
|
|||
}
|
||||
|
||||
td.LSobject-list-actions {
|
||||
width: 5em;
|
||||
text-align: center;
|
||||
width: 7em;
|
||||
}
|
||||
|
||||
/* Name */
|
||||
|
|
11
trunk/templates/redirect.tpl
Normal file
11
trunk/templates/redirect.tpl
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<META http-equiv="refresh" content="0; URL={$url}">
|
||||
<title>LdapSaisie - Redirection</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -13,6 +13,7 @@
|
|||
<div id='LSjsConfig'>
|
||||
{$LSjsConfig}
|
||||
</div>
|
||||
<div id='LSinfos'>{$LSinfos}</div>
|
||||
<div id='LSerror'>
|
||||
{$LSerrors}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue