- Deplacement du require de functions.php dans le fichier de classe de LSsession

pour ne pas obliger sa recopie.
- LSlog : Début d'ecriture d'une possibilité de fichiers de logs
- Ajout d'une fonction de test validPas() retournant false
- LSformElement : Ajout d'un type de LSformElement gérant les attributs maildir.
  Il fonctionne en frontend du LSaddon Maildir.
- LSsession :
  -> Ajout de la méthode statique includeFile() utilisé à la place de la fonction
     php include_once()
  -> displayAjaxReturn() : Gestion du LSredirect
  -> Ajout d'un require_once() sur functions.php
- LSaddon::FTP : Ajout de la fonction renameDirByFTP()
- LSaddon::Maildir :
  -> Ajout de la fonction renameMaildirByFTP()
  -> Modification des fonctions createMaildirByFTP() et removeMaildirByFTP() pour
     pour pouvoir leur passé en deuxième paramètre le chemin de la maildir à utlisé
- LSdefault :
  -> LSdebugHidde() devient hideLSdebug()
  -> Ajout de la méthode hideLSerror() accroché sur l'événement double-clique de la
     LSerrorsBox
  -> displayErrorBox() : plus de timeout d'affichage des erreurs
  -> checkAjaxReturn() : Gestion des LSredirect
- LSform :
  -> plus de LSformRedirect : utilisation de LSdefault::LSredirect
- modify.php et create.php : Utilisation des LSdefault::LSredirect et affichages des
  erreurs non-bloquant sur la page suivante.
- LSerror :
  -> Utilisation d'une variable de session pour stocké les erreurs
  -> Ajout de la méthode resetError() exécutée à chaque exécution de 
     LSerror::getErrors()
- LSldapObject :
  -> Correction de la gestion des binding
    -> Event before_modify : bloquant en cas d'échec
    -> Event after_modify : non-bloquant en cas d'échec
This commit is contained in:
Benjamin Renard 2009-01-21 17:08:09 +00:00
parent 6df5963a9c
commit 6f52489a59
25 changed files with 421 additions and 63 deletions

View file

@ -171,6 +171,10 @@ define('LS_CSS_DIR', 'css/'.LS_THEME);
//Debug
$GLOBALS['LSdebug']['active'] = true;
// Logs
$GLOBALS['LSlog']['filename'] = 'tmp/LS.log';
$GLOBALS['LSlog']['enable'] = true;
define('NB_LSOBJECT_LIST',20);
define('NB_LSOBJECT_LIST_SELECT',11);

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();
@ -55,13 +54,13 @@ if($LSsession -> startLSsession()) {
if (isset($_REQUEST['ajax'])) {
$GLOBALS['LSsession'] -> displayAjaxReturn (
array(
'LSformRedirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
)
);
exit();
}
else {
if ((!LSdebugDefined()) && !$GLOBALS['LSerror']->errorsDefined()) {
if (!LSdebugDefined()) {
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

View file

@ -56,6 +56,10 @@ $GLOBALS['LSerror_code']['FTP_04']= array (
'msg' => _("FTP Support : Impossible de modifier les droits du dossier %{dir} sur le serveur distant."),
'level' => 'c'
);
$GLOBALS['LSerror_code']['FTP_05']= array (
'msg' => _("FTP Support : Impossible de renomer le dossier %{old} en %{new} sur le serveur distant."),
'level' => 'c'
);
/**
* Verification du support FTP par ldapSaisie
@ -72,7 +76,7 @@ $GLOBALS['LSerror_code']['FTP_04']= array (
if (!defined('NET_FTP')) {
$GLOBALS['LSerror'] -> addErrorCode('FTP_SUPPORT_02','NET_FTP');
$retval=false;
} else if(!@include(NET_FTP)) {
} else if(!LSsession::includeFile(NET_FTP)) {
$GLOBALS['LSerror'] -> addErrorCode('FTP_SUPPORT_01');
$retval=false;
}
@ -158,6 +162,14 @@ $GLOBALS['LSerror_code']['FTP_04']= array (
/**
* Suppression d'un ou plusieurs dossiers via FTP
*
* Note : Attention : suppression récursive. Cela veut dire que les sous-dossiers
* lister par un LS FTP seront supprimé d'abord. Attention : Si votre serveur
* FTP est configuré pour caché certains fichiers ou dossiers (dont le nom
* commence par un '.' par exempl), ces fichiers ne seront pas supprimés et la
* suppression du dossier parent échoura.
*
* Pour VsFTPd : Ajouter force_dot_files=1 dans la configuration.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $host string Le nom ou l'IP du serveur FTP
@ -189,3 +201,31 @@ $GLOBALS['LSerror_code']['FTP_04']= array (
}
return true;
}
/**
* Renomage d'un dossier 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] $old string Le dossier à renomer
* @param[in] $new string Le nouveau nom du dossier à renomer
*
* @retval string True ou false si il y a un problème durant le renomage du/des dossier(s)
*/
function renameDirByFTP($host,$port,$user,$pwd,$old,$new) {
$cnx = connectToFTP($host,$port,$user,$pwd);
if (! $cnx){
return;
}
$do = $cnx -> rename($old,$new);
if ($do instanceof PEAR_Error) {
$GLOBALS['LSerror'] -> addErrorCode('FTP_05',array('old' => $old,'new' => $new));
$GLOBALS['LSerror'] -> addErrorCode('FTP_00',$do -> getMessage());
return;
}
return true;
}

View file

@ -51,7 +51,7 @@ $GLOBALS['LSerror_code']['MAIL_01']= array (
// Dependance de librairie
if (!class_exists('Mail')) {
if(!@include(PEAR_MAIL)) {
if(!LSsession::includeFile(PEAR_MAIL)) {
$GLOBALS['LSerror'] -> addErrorCode('MAIL_SUPPORT_01');
$retval=false;
}

View file

@ -24,22 +24,21 @@
// Support
$GLOBALS['LSerror_code']['MAILDIR_SUPPORT_01']= array (
'msg' => _("MAILDIR Support : Impossible de charger LSaddons::FTP."),
'level' => 'c'
'msg' => _("MAILDIR Support : Impossible de charger LSaddons::FTP.")
);
$GLOBALS['LSerror_code']['MAILDIR_SUPPORT_02']= array (
'msg' => _("MAILDIR Support : La constante %{const} n'est pas définie."),
'level' => 'c'
'msg' => _("MAILDIR Support : La constante %{const} n'est pas définie.")
);
// Autres erreurs
$GLOBALS['LSerror_code']['MAILDIR_01']= array (
'msg' => _("MAILDIR Support : Erreur durant la création de la maildir sur le serveur distant."),
'level' => 'c'
'msg' => _("MAILDIR Support : Erreur durant la création de la maildir sur le serveur distant.")
);
$GLOBALS['LSerror_code']['MAILDIR_02']= array (
'msg' => _("MAILDIR Support : Erreur durant la création de la maildir sur le serveur distant."),
'level' => 'c'
'msg' => _("MAILDIR Support : Erreur durant la suppression de la maildir sur le serveur distant.")
);
$GLOBALS['LSerror_code']['MAILDIR_03']= array (
'msg' => _("MAILDIR Support : Erreur durant le renomage de la maildir sur le serveur distant.")
);
/**
@ -81,11 +80,15 @@ $retval=true;
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
* @param[in] $dir Le chemin de la maildir. Si défini, la valeur ne sera pas
* récupérée dans le ldapObject
*
* @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');
function createMaildirByFTP($ldapObject,$dir=null) {
if (!$dir) {
$dir = getFData(LS_MAILDIR_FTP_MAILDIR_PATH,$ldapObject,'getValue');
}
$dirs = array(
$dir.'/cur',
$dir.'/new',
@ -104,14 +107,36 @@ $retval=true;
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $ldapObject L'objet ldap
* @param[in] $dir Le chemin de la maildir. Si défini, la valeur ne sera pas
* récupérée dans le ldapObject
*
* @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');
function removeMaildirByFTP($ldapObject,$dir=null) {
if (!$dir) {
$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;
}
/**
* Rename Maildir via FTP
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param[in] $old L'ancien chemin de la maildir
* @param[in] $new Le nouveau chemin de la maildir
*
* @retval string True ou false si il y a un problème durant le renomage de la Maildir
*/
function renameMaildirByFTP($old,$new) {
if (!renameDirByFTP(LS_MAILDIR_FTP_HOST,LS_MAILDIR_FTP_PORT,LS_MAILDIR_FTP_USER,LS_MAILDIR_FTP_PWD,$old,$new)) {
$GLOBALS['LSerror'] -> addErrorCode('MAILDIR_03');
return;
}
return true;
}

View file

@ -56,7 +56,7 @@ $GLOBALS['LSerror_code']['SAMBA_01']= array (
// Dependance de librairie
if ( !class_exists('smbHash') ) {
if ( ! @include_once(LS_LIB_DIR . 'class.smbHash.php') ) {
if ( !LSsession::includeFile(LS_LIB_DIR . 'class.smbHash.php') ) {
$GLOBALS['LSerror'] -> addErrorCode('SAMBA_SUPPORT_01');
$retval=false;
}

View file

@ -0,0 +1,34 @@
<?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 maildir
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSattr_html_maildir extends LSattr_html {
var $LSformElement_type = 'maildir';
}
?>

View file

@ -29,18 +29,6 @@
*/
class LSerror {
var $errors;
/**
* Constructeur
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval void
*/
function LSerror() {
$errors = array();
}
/**
* Ajoute une erreur
*
@ -55,7 +43,7 @@ class LSerror {
* @retval void
*/
function addErrorCode($code=-1,$msg='') {
$this -> errors[]=array($code,$msg);
$_SESSION['LSerror'][] = array($code,$msg);
}
/**
@ -88,7 +76,7 @@ class LSerror {
* @retval void
*/
function stop($code=-1,$msg='') {
if(!empty($this -> errors)) {
if(!empty($_SESSION['LSerror'])) {
print "<h1>"._('Errors')."</h1>\n";
print $this -> display(true);
}
@ -104,10 +92,11 @@ class LSerror {
* @retvat string Le texte des erreurs
*/
function getErrors() {
if(!empty($this -> errors)) {
foreach ($this -> errors as $error) {
if(!empty($_SESSION['LSerror'])) {
foreach ($_SESSION['LSerror'] as $error) {
$txt.=$this -> getError($error);
}
$this -> resetError();
return $txt;
}
return;
@ -132,7 +121,19 @@ class LSerror {
* @retvat boolean
*/
function errorsDefined() {
return !empty($this -> errors);
return !empty($_SESSION['LSerror']);
}
/**
* Efface les erreurs sotckés
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retvat void
*/
function resetError() {
LSlog('reset');
unset ($_SESSION['LSerror']);
}
}

View file

@ -0,0 +1,144 @@
<?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.
******************************************************************************/
$GLOBALS['LSsession'] -> loadLSclass('LSformElement_text');
$GLOBALS['LSsession'] -> loadLSaddon('maildir');
/**
* Element maildir d'un formulaire pour LdapSaisie
*
* Cette classe définis les éléments maildir des formulaires.
* Elle étant la classe LSformElement_text.
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*/
class LSformElement_maildir extends LSformElement_text {
var $_toDo=null;
var $JSscripts = array(
'LSformElement_maildir_field.js',
'LSformElement_maildir.js'
);
var $fieldTemplate = 'LSformElement_maildir_field.tpl';
function getDisplay() {
$GLOBALS['LSsession'] -> addHelpInfos (
'LSformElement_maildir',
array(
'do' => _("La création ou modification de la maildir en même temps que l'utilisateur est activée. Cliquer sur ce bouton pour la désactiver."),
'nodo' => _("Cliquer sur ce bouton pour activer la création/modification de la maildir en même temps que l'utilisateur.")
)
);
return parent :: getDisplay($return);
}
/**
* Recupère la valeur de l'élement passée en POST
*
* Cette méthode vérifie la présence en POST de la valeur de l'élément et la récupère
* pour la mettre dans le tableau passer en paramètre avec en clef le nom de l'élément
*
* @param[] array Pointeur sur le tableau qui recupèrera la valeur.
*
* @retval boolean true si la valeur est présente en POST, false sinon
*/
function getPostData(&$return) {
// Récupère la valeur dans _POST, et les vérifie avec la fonction générale
$retval = parent :: getPostData($return);
// Si une valeur est recupérée
if ($retval&&$_POST['LSformElement_maildir_description_do']) {
$cur = $this -> form -> ldapObject -> attrs[$this -> name] -> getValue();
$cur=$cur[0];
$new = $return[$this -> name][0];
$action=null;
if ( $new != $cur ) {
if( ($new=="") && ( $cur!="" ) ) {
$action='delete';
}
else if ( ($new!="") && ( $cur!="" ) ) {
$action='modify';
}
else {
$action='create';
}
if ($action) {
if ($this -> params['html_options']['remoteRootPathRegex']) {
if (
(ereg($this -> params['html_options']['remoteRootPathRegex'],$new,$r_new) ||empty($new))
&&
(ereg($this -> params['html_options']['remoteRootPathRegex'],$cur,$r_cur)||empty($cur))
)
{
$new = $r_new[1];
$cur = $r_cur[1];
}
else {
LSdebug('Pbl remoteRootPathRegex');
}
}
$this -> _toDo = array (
'action' => $action,
'old' => $cur,
'new' => $new
);
$this -> attr_html -> attribute -> addObjectEvent('after_modify',$this,'toDo');
}
}
}
return $retval;
}
function toDo() {
if (is_array($this -> _toDo)) {
switch($this -> _toDo['action']) {
case 'delete':
if ($this -> params['html_options']['archiveNameFormat']) {
$newname=getFData($this -> params['html_options']['archiveNameFormat'],$this -> _toDo['old']);
if ($newname) {
return renameMaildirByFTP($this -> _toDo['old'],$newname);
}
LSdebug($this -> name." - LSformElement_maildir->toDo() : Nom d'archivage incorrect.");
return;
}
break;
case 'modify':
return renameMaildirByFTP($this -> _toDo['old'],$this -> _toDo['new']);
break;
case 'create':
return createMaildirByFTP(null,$this -> _toDo['new']);
break;
default:
LSdebug($this -> name.' - LSformElement_maildir->toDo() : Action inconnu.');
}
}
LSdebug($this -> name.' - LSformElement_maildir->toDo() : Rien à faire.');
return true;
}
}
?>

View file

@ -318,7 +318,9 @@ class LSldapObject {
}
// $this -> attrs[*] => before_modify
foreach($new_data as $attr_name => $attr_val) {
$this -> attrs[$attr_name] -> fireEvent('before_modify');
if (!$this -> attrs[$attr_name] -> fireEvent('before_modify')) {
return;
}
}
if ($this -> submitChange($idForm)) {
@ -334,12 +336,10 @@ class LSldapObject {
if(function_exists($this -> config['after_modify'])) {
if(!$this -> config['after_modify']($this)) {
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_10',$this -> config['after_modify']);
return;
}
}
else {
$GLOBALS['LSerror'] -> addErrorCode('LSldapObject_09',$this -> config['after_modify']);
return;
}
}

View file

@ -21,6 +21,7 @@
******************************************************************************/
define('LS_DEFAULT_CONF_DIR','conf');
require_once 'includes/functions.php';
/**
* Gestion des sessions
@ -65,6 +66,26 @@ class LSsession {
}
}
/**
* Include un fichier PHP
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval true si tout c'est bien passé, false sinon
*/
function includeFile($file) {
if (!file_exists($file)) {
return;
}
if ($GLOBALS['LSdebug']['active']) {
return include_once($file);
}
else {
return @include_once($file);
}
return;
}
/**
* Chargement de la configuration
*
@ -76,7 +97,7 @@ class LSsession {
*/
function loadConfig() {
if (loadDir($this -> confDir, '^config\..*\.php$')) {
if ( include_once $GLOBALS['LSconfig']['Smarty'] ) {
if ( self::includeFile($GLOBALS['LSconfig']['Smarty']) ) {
$GLOBALS['Smarty'] = new Smarty();
$GLOBALS['Smarty'] -> template_dir = LS_TEMPLATES_DIR;
$GLOBALS['Smarty'] -> compile_dir = LS_TMP_DIR;
@ -131,7 +152,7 @@ class LSsession {
return true;
if($type!='')
$type=$type.'.';
return @include_once LS_CLASS_DIR .'class.'.$type.$class.'.php';
return self::includeFile(LS_CLASS_DIR .'class.'.$type.$class.'.php');
}
/**
@ -147,7 +168,7 @@ class LSsession {
if (!$this -> loadLSclass($object,'LSobjects')) {
$error = 1;
}
if (!include_once( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
if (!self::includeFile( LS_OBJECTS_DIR . 'config.LSobjects.'.$object.'.php' )) {
$error = 1;
}
if ($error) {
@ -167,8 +188,8 @@ class LSsession {
* @retval boolean true si le chargement a réussi, false sinon.
*/
function loadLSaddon($addon) {
if(include_once LS_ADDONS_DIR .'LSaddons.'.$addon.'.php') {
@include_once(LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php");
if(self::includeFile(LS_ADDONS_DIR .'LSaddons.'.$addon.'.php')) {
self::includeFile(LS_CONF_DIR."LSaddons/config.LSaddons.".$addon.".php");
if (!call_user_func('LSaddon_'. $addon .'_support')) {
$GLOBALS['LSerror'] -> addErrorCode('LSsession_02',$addon);
return;
@ -562,7 +583,7 @@ class LSsession {
*/
function LSldapConnect() {
if ($this -> ldapServer) {
@include_once($GLOBALS['LSconfig']['NetLDAP2']);
self::includeFile($GLOBALS['LSconfig']['NetLDAP2']);
if (!$this -> loadLSclass('LSldap')) {
return;
}
@ -965,6 +986,11 @@ class LSsession {
* @retval void
*/
function displayAjaxReturn($data=array()) {
if (isset($data['LSredirect']) && (!LSdebugDefined()) ) {
echo json_encode($data);
return;
}
$data['LSjsConfig'] = $this -> _JSconfigParams;
// Infos

View file

@ -185,6 +185,11 @@ function valid($obj) {
return true;
}
function validPas($obj=null) {
LSdebug('Validation : nok');
return false;
}
function return_data($data) {
return $data;
}
@ -401,4 +406,13 @@ function LSdebugDefined() {
return 1;
}
function LSlog($msg) {
if ($GLOBALS['LSlog']['enable']) {
global $LSlogFile;
if (!$LSlogFile) {
$LSlogFile=fopen($GLOBALS['LSlog']['filename'],'a');
}
fwrite($LSlogFile,$_SERVER['REQUEST_URI']." : ".$msg."\n");
}
}
?>

View file

@ -1,15 +1,16 @@
var LSdefault = new Class({
initialize: function(){
this.LSdebug = $('LSdebug');
this.LSdebug.addEvent('dblclick',this.LSdebugHidde.bind(this));
this.LSdebug.addEvent('dblclick',this.hideLSdebug.bind(this));
this.LSdebugInfos = $('LSdebug_infos');
this.LSdebug.setOpacity(0);
this.LSdebugHidden = $('LSdebug_hidden');
this.LSdebugHidden.addEvent('click',this.LSdebugHidde.bind(this));
this.LSdebugHidden.addEvent('click',this.hideLSdebug.bind(this));
this.LSerror = $('LSerror');
this.LSerror.setOpacity(0);
this.LSerror.addEvent('dblclick',this.hideLSerror.bind(this));
this.LSinfos = $('LSinfos');
@ -71,12 +72,21 @@ var LSdefault = new Class({
$('LSsession_topDn_form').submit();
},
LSdebugHidde: function(){
hideLSdebug: function(){
this.fx.LSdebug.start(0.8,0);
},
hideLSerror: function(){
this.fx.LSerror.start(0.9,0);
},
checkAjaxReturn: function(data) {
if ($type(data) == 'object') {
if (($type(data.LSredirect)) && (!$type(data.LSdebug)) ) {
document.location = data.LSredirect;
return true;
}
if ($type(data.imgload)) {
this.loadingImgHide(data.imgload);
}
@ -124,7 +134,6 @@ var LSdefault = new Class({
displayErrorBox: function() {
this.LSerror.setStyle('top',getScrollTop()+10);
this.fx.LSerror.start(0,0.8);
(function(){this.fx.LSerror.start(0.8,0);}).delay(10000, this);
},
displayInfosBox: function() {

View file

@ -176,12 +176,7 @@ var LSform = new Class({
onAjaxSubmitComplete: function(responseText, responseXML) {
var data = JSON.decode(responseText);
if ( varLSdefault.checkAjaxReturn(data) ) {
if ($type(data.LSformRedirect)) {
if (!$type(data.LSdebug)) {
(function(addr){document.location = addr;}).delay(1000,this,data.LSformRedirect);
}
}
else if ($type(data.LSformErrors) == 'object') {
if ($type(data.LSformErrors) == 'object') {
data.LSformErrors = new Hash(data.LSformErrors);
data.LSformErrors.each(this.addError,this);
}

View file

@ -0,0 +1,17 @@
var LSformElement_maildir = new Class({
initialize: function(){
this.fields=new Hash();
this.initialiseLSformElement_maildir();
},
initialiseLSformElement_maildir: function() {
var getName = /^(.*)\[\]$/
$$('input.LSformElement_maildir').each(function(input) {
var name = getName.exec(input.name)[1];
this.fields[name] = new LSformElement_maildir_field(name,input);
}, this);
}
});
window.addEvent(window.ie ? 'load' : 'domready', function() {
varLSformElement_maildir = new LSformElement_maildir();
});

View file

@ -0,0 +1,50 @@
var LSformElement_maildir_field = new Class({
initialize: function(name,input){
this.name = name;
this.input = input;
this.params = varLSdefault.getParams(this.name);
this.initialiseLSformElement_maildir_field();
},
initialiseLSformElement_maildir_field: function() {
if (!$type(varLSform.idform)) {
return true;
}
if ($type(this.params.LSform[varLSform.idform])) {
this.doBtn = new Element('img');
this.doBtn.addClass('btn');
this.doBtn.addEvent('click',this.onDoBtnClick.bind(this));
this.doInput = new Element('input');
this.doInput.setProperties({
name: 'LSformElement_maildir_' + this.name + '_do',
type: 'hidden'
});
if (this.params.LSform[varLSform.idform]) {
this.doInput.value = 1;
this.doBtn.src = varLSdefault.imagePath('maildir_do.png');
varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','do');
}
else {
this.doInput.value = 0;
this.doBtn.src = varLSdefault.imagePath('maildir_nodo.png');
varLSdefault.addHelpInfo(this.doBtn,'LSformElement_maildir','nodo');
}
this.doBtn.injectAfter(this.input);
this.doInput.injectAfter(this.doBtn);
}
},
onDoBtnClick: function() {
if (this.doInput.value==0) {
this.doInput.value = 1;
this.doBtn.src = varLSdefault.imagePath('maildir_do.png');
varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','do');
}
else {
this.doInput.value = 0;
this.doBtn.src = varLSdefault.imagePath('maildir_nodo.png');
varLSdefault.setHelpInfo(this.doBtn,'LSformElement_maildir','nodo');
}
}
});

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();

View file

@ -1,6 +1,5 @@
<?php
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();
@ -62,12 +61,13 @@ if($LSsession -> startLSsession()) {
if (isset($_REQUEST['ajax'])) {
$GLOBALS['LSsession'] -> displayAjaxReturn (
array(
'LSformRedirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
'LSredirect' => 'view.php?LSobject='.$LSobject.'&dn='.$object -> getDn()
)
);
exit();
}
else {
if ((!LSdebugDefined()) && !$GLOBALS['LSerror']->errorsDefined()) {
if (!LSdebugDefined()) {
$GLOBALS['LSsession'] -> redirect('view.php?LSobject='.$LSobject.'&dn='.$object -> getDn());
}
else {

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();

View file

@ -0,0 +1,5 @@
{if $freeze}
<span class='LSformElement_text LSformElement_maildir'>{if $value}{$value}{else}{$noValueTxt}{/if}</span><input type='hidden' name='{$attr_name}[]' class='LSformElement_text LSformElement_maildir' value="{$value}"/>
{else}
<input type='text' name='{$attr_name}[]' class='LSformElement_text LSformElement_maildir' value="{$value}"/>
{/if}

View file

@ -20,7 +20,6 @@
******************************************************************************/
require_once 'includes/functions.php';
require_once 'includes/class/class.LSsession.php';
$GLOBALS['LSsession'] = new LSsession();