- 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.
This commit is contained in:
Benjamin Renard 2009-02-20 14:05:22 +00:00
parent 323e560694
commit 16df350e74
21 changed files with 694 additions and 525 deletions

View file

@ -78,13 +78,13 @@ class LSform {
*/
function display(){
if ($this -> idForm == 'view') {
LSsession :: addJSscript('LSview.js');
LSsession :: addJSscript('LSform.js');
self :: loadDependenciesDisplayView();
}
else {
LSsession :: addJSscript('LSformElement_field.js');
LSsession :: addJSscript('LSformElement.js');
LSsession :: addJSscript('LSform.js');
LSsession :: addCssFile('LSform.css');
}
LSsession :: addHelpInfos(
@ -95,7 +95,6 @@ class LSform {
)
);
LSsession :: addCssFile('LSform.css');
$GLOBALS['Smarty'] -> assign('LSform_action',$_SERVER['PHP_SELF']);
$LSform_header = "\t<input type='hidden' name='validate' value='LSform'/>\n
\t<input type='hidden' name='idForm' id='LSform_idform' value='".$this -> idForm."'/>\n
@ -135,6 +134,25 @@ class LSform {
}
}
/*
* Méthode chargeant les dépendances d'affichage d'une LSview
*
* @retval void
*/
public static function loadDependenciesDisplayView() {
LSsession :: addCssFile('LSform.css');
LSsession :: addJSscript('LSform.js');
LSsession :: addJSconfigParam('LSview_labels', array(
'delete_confirm_text' => _("Do you really want to delete"),
'delete_confirm_title' => _("Caution"),
'delete_confirm_validate' => _("Delete")
));
if (LSsession :: loadLSclass('LSconfirmBox')) {
LSconfirmBox :: loadDependenciesDisplay();
}
LSsession :: addJSscript('LSview.js');
}
/**
* Affiche la vue
*
@ -143,12 +161,7 @@ class LSform {
* @retval void
*/
function displayView(){
LSsession :: addCssFile('LSform.css');
LSsession :: addJSscript('LSform.js');
LSsession :: addJSconfigParam('LSview_delete_confirm_text',_("Do you really want to delete"));
LSsession :: addJSconfigParam('LSview_delete_confirm_title',_("Caution"));
LSsession :: addJSconfigParam('LSview_delete_confirm_yes_btn_label',_("Delete"));
LSsession :: addJSconfigParam('LSview_delete_confirm_no_btn_label',_("Cancel"));
self :: loadDependenciesDisplayView();
$LSform_object = array(
'type' => $this -> ldapObject -> getType(),
@ -527,6 +540,24 @@ class LSform {
$this -> maxFileSize = $size;
}
public static function ajax_onAddFieldBtnClick(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$object -> loadData($_REQUEST['objectdn']);
$form = $object -> getForm($_REQUEST['idform']);
$emptyField=$form -> getEmptyField($_REQUEST['attribute']);
if ( $emptyField ) {
$data = array(
'html' => $form -> getEmptyField($_REQUEST['attribute']),
'fieldId' => $_REQUEST['fieldId'],
'fieldtype' => get_class($form -> getElement($_REQUEST['attribute']))
);
}
}
}
}
}
/**

View file

@ -73,6 +73,9 @@ class LSformElement_image extends LSformElement {
if ($this -> form -> definedError($this -> name)) {
$GLOBALS['Smarty'] -> assign('LSformElement_image_errors',true);
}
if (LSsession :: loadLSclass('LSsmoothbox')) {
LSsmoothbox :: loadDependenciesDisplay();
}
LSsession :: addJSscript('LSformElement_image.js');
}
return $return;

View file

@ -34,15 +34,8 @@ LSsession :: loadLSclass('LSformElement_text');
class LSformElement_mail extends LSformElement_text {
var $JSscripts = array(
'LSmail.js',
'LSsmoothbox.js',
'LSconfirmBox.js',
'LSformElement_mail.js'
);
var $CSSfiles = array(
'LSsmoothbox.css',
'LSconfirmBox.css'
);
var $fetchVariables = array(
'uriClass' => 'LSformElement_mail',
@ -58,6 +51,9 @@ class LSformElement_mail extends LSformElement_text {
'mail' => _("Send a mail from here.")
)
);
if (LSsession :: loadLSclass('LSmail')) {
LSmail :: loadDependenciesDisplay();
}
return parent :: getDisplay($return);
}
}

View file

@ -20,6 +20,7 @@
******************************************************************************/
LSsession :: loadLSclass('LSformElement');
/**
* Element password d'un formulaire pour LdapSaisie
@ -186,6 +187,43 @@ class LSformElement_password extends LSformElement {
}
return true;
}
public static function ajax_verifyPassword(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$object -> loadData($_REQUEST['objectdn']);
$field=$form -> getElement($_REQUEST['attribute']);
$val = $field -> verifyPassword($_REQUEST['fieldValue']);
$data = array(
'verifyPassword' => $val
);
}
}
}
public static function ajax_generatePassword(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
if ($object) {
$form = $object -> getForm($_REQUEST['idform']);
if ($form) {
$field=$form -> getElement($_REQUEST['attribute']);
if ($field) {
$val = $field -> generatePassword();
if ( $val ) {
$data = array(
'generatePassword' => $val
);
}
}
}
}
}
}
}
}
?>

View file

@ -20,6 +20,7 @@
******************************************************************************/
LSsession :: loadLSclass('LSformElement');
/**
* Element select d'un formulaire pour LdapSaisie
@ -84,14 +85,9 @@ class LSformElement_select_object extends LSformElement {
LSsession :: addJSscript('LSformElement_select_object_field.js');
LSsession :: addJSscript('LSformElement_select_object.js');
LSsession :: addJSscript('LSform.js');
LSsession :: addJSscript('LSselect.js');
LSsession :: addCssFile('LSselect.css');
LSsession :: addJSscript('LSsmoothbox.js');
LSsession :: addCssFile('LSsmoothbox.css');
LSsession :: addJSscript('LSconfirmBox.js');
LSsession :: addCssFile('LSconfirmBox.css');
if (LSsession :: loadLSclass('LSselect')) {
LSselect :: loadDependenciesDisplay();
}
}
$return['html'] = $this -> fetchTemplate(NULL,array('selectableObject' => $this -> selectableObject));
return $return;
@ -163,6 +159,33 @@ class LSformElement_select_object extends LSformElement {
}
return array();
}
public static function ajax_refresh(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
$val = $field -> getValuesFromSession();
if ( $val ) {
$data = array(
'objects' => $val
);
}
}
}
}
public static function ajax_searchAdd(&$data) {
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
$data['objects'] = $field -> searchAdd($_REQUEST['pattern']);
}
}
}
}
?>

View file

@ -0,0 +1,87 @@
<?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.
******************************************************************************/
class LSmail {
/*
* Méthode chargeant les dépendances d'affichage
*
* @retval void
*/
public static function loadDependenciesDisplay() {
if (LSsession :: loadLSclass('LSsmoothbox')) {
LSsmoothbox :: loadDependenciesDisplay();
}
LSsession :: addJSscript('LSmail.js');
LSsession :: addCssFile('LSmail.css');
}
public static function ajax_display(&$data) {
if (isset($_REQUEST['object']['type']) && isset($_REQUEST['object']['dn'])) {
if (LSsession ::loadLSobject($_REQUEST['object']['type'])) {
$obj = new $_REQUEST['object']['type']();
$obj -> loadData($_REQUEST['object']['dn']);
$msg = $obj -> getFData($_REQUEST['msg']);
$subject = $obj -> getFData($_REQUEST['subject']);
}
}
else {
$msg = $_REQUEST['msg'];
$subject = $_REQUEST['subject'];
}
$GLOBALS['Smarty'] -> assign('LSmail_msg',$msg);
$GLOBALS['Smarty'] -> assign('LSmail_subject',$subject);
if (is_array($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',$_REQUEST['mails']);
}
else if(empty($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',array($_REQUEST['mails']));
}
$GLOBALS['Smarty'] -> assign('LSmail_mail_label',_('Email'));
$GLOBALS['Smarty'] -> assign('LSmail_subject_label',_('Title'));
$GLOBALS['Smarty'] -> assign('LSmail_msg_label',_('Message'));
$data = array(
'html' => $GLOBALS['Smarty'] -> fetch('LSmail.tpl')
);
}
public static function ajax_send(&$data) {
if (isset($_REQUEST['infos'])) {
if (LSsession ::loadLSaddon('mail')) {
if(sendMail($_REQUEST['infos']['mail'],$_REQUEST['infos']['subject'],$_REQUEST['infos']['msg'])) {
$data = array(
'msgok' => _("Your message has been sent successfully.")
);
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
}
?>

View file

@ -0,0 +1,298 @@
<?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.
******************************************************************************/
class LSrelation {
/*
* Méthode chargeant les dépendances d'affichage
*
* @retval void
*/
public static function loadDependenciesDisplay() {
if (LSsession :: loadLSclass('LSselect')) {
LSselect :: loadDependenciesDisplay();
}
LSsession :: addJSscript('LSrelation.js');
LSsession :: addCssFile('LSrelation.css');
LSsession :: addJSconfigParam('LSrelation_labels', array(
'close_confirm_text' => _('Do you really want to delete'),
'close_confirm_title' => _('Warning'),
'close_confirm_validate' => _('Delete')
));
}
/*
* Méthode chargeant les informations des LSrelations d'un objet et définissant
* les variables templates pour l'affichage dans une LSview.
*
* @param[in] LSldapObject L'objet dont on cherche les LSrelations
*
* @retval void
*/
public static function displayInLSview($object) {
if (($object instanceof LSldapObject) && (is_array($object -> config['LSrelation']))) {
$LSrelations=array();
$LSrelations_JSparams=array();
foreach($object -> config['LSrelation'] as $relationName => $relationConf) {
if (LSsession :: relationCanAccess($object -> getValue('dn'),$object->getType(),$relationName)) {
$return=array(
'label' => $relationConf['label'],
'LSobject' => $relationConf['LSobject']
);
if (isset($relationConf['emptyText'])) {
$return['emptyText'] = $relationConf['emptyText'];
}
else {
$return['emptyText'] = _('No object.');
}
$id=rand();
$return['id']=$id;
$LSrelations_JSparams[$id]=array(
'emptyText' => $return['emptyText']
);
$_SESSION['LSrelation'][$id] = array(
'relationName' => $relationName,
'objectType' => $object -> getType(),
'objectDn' => $object -> getDn(),
);
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object->getType(),$relationName)) {
$return['actions'][] = array(
'label' => _('Modify'),
'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&amp;multiple=1',
'action' => 'modify'
);
}
if (LSsession :: loadLSclass('LSrelation')) {
LSrelation :: loadDependenciesDisplay();
}
if(LSsession :: loadLSobject($relationConf['LSobject'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) {
foreach($list as $o) {
$o_infos = array(
'text' => $o -> getDisplayName(NULL,true),
'dn' => $o -> getDn()
);
$return['objectList'][] = $o_infos;
}
}
else {
$return['objectList']=array();
}
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
$LSrelations[]=$return;
}
else {
LSerror :: addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
}
}
}
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
LSsession :: addJSconfigParam('LSrelations',$LSrelations_JSparams);
}
}
public static function ajax_refreshSession(&$return) {
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['href'])) ) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
$_SESSION['LSselect'][$relationConf['LSobject']]=array();
if (is_array($list)) {
foreach($list as $o) {
$_SESSION['LSselect'][$relationConf['LSobject']][] = $o -> getDn();
}
}
$return = array(
'href' => $_REQUEST['href'],
'id' => $_REQUEST['id']
);
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
}
public static function ajax_refreshList(&$data) {
if (isset($_REQUEST['id'])) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) {
$objRel = new $relationConf['LSobject']();
if($objRel -> $relationConf['update_function']($object,$_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)&&(!empty($list))) {
foreach($list as $o) {
$data['html'].= "<li class='LSrelation'><a href='view.php?LSobject=".$relationConf['LSobject']."&amp;dn=".$o -> getDn()."' class='LSrelation' id='".$o -> getDn()."'>".$o -> getDisplayName(NULL,true)."</a></li>\n";
}
}
else {
if (isset($relationConf['emptyText'])) {
$data['html'] = "<li>".$relationConf['emptyText']."</li>\n";
}
else {
$data['html'] = "<li>"._('No object.')."</li>\n";
}
}
$data['id'] = $_REQUEST['id'];
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
}
else {
LSerror :: addErrorCode('LSrelations_03',$relationName);
}
}
else {
LSerror :: addErrorCode('LSrelations_02',$relationName);
}
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
}
public static function ajax_deleteByDn(&$data) {
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['dn']))) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) {
$ok=false;
foreach($list as $o) {
if($o -> getDn() == $_REQUEST['dn']) {
if (!$o -> $relationConf['remove_function']($object)) {
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$ok = true;
}
}
}
if (!$ok) {
LSdebug($_REQUEST['value']." introuvé parmi la liste");
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$data=array(
'dn' => $_REQUEST['dn']
);
}
}
else {
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
}
else {
LSerror :: addErrorCode('LSrelations_01',$conf['relationName']);
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
}
}
?>

View file

@ -0,0 +1,87 @@
<?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.
******************************************************************************/
class LSselect {
/*
* Méthode chargeant les dépendances d'affichage
*
* @retval void
*/
public static function loadDependenciesDisplay() {
if (LSsession :: loadLSclass('LSsmoothbox')) {
LSsmoothbox :: loadDependenciesDisplay();
}
LSsession :: addJSscript('LSselect.js');
LSsession :: addCssFile('LSselect.css');
}
public static function ajax_addItem(&$data) {
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['multiple']))) {
if (!$_REQUEST['multiple']) {
$_SESSION['LSselect'][$_REQUEST['objecttype']]=array($_REQUEST['objectdn']);
}
else if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
if (!in_array($_REQUEST['objectdn'],$_SESSION['LSselect'][$_REQUEST['objecttype']])) {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
}
}
else {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
}
}
}
public static function ajax_dropItem(&$data) {
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn']))) {
if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
$result=array();
foreach ($_SESSION['LSselect'][$_REQUEST['objecttype']] as $val) {
if ($val!=$_REQUEST['objectdn']) {
$result[]=$val;
}
}
$_SESSION['LSselect'][$_REQUEST['objecttype']]=$result;
}
}
}
public static function ajax_refreshSession(&$data) {
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['values'])) ) {
$_SESSION['LSselect'][$_REQUEST['objecttype']]=array();
$values=json_decode($_REQUEST['values'],false);
if (is_array($values)) {
foreach($values as $val) {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$val;
}
}
$data=array(
'values' => $values
);
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
}
?>

View file

@ -1008,6 +1008,10 @@ class LSsession {
$JSscript_txt.="<script src='".$script['path'].$script['file']."' type='text/javascript'></script>\n";
}
if (!isset(self :: $ldapServer['keepLSsessionActive']) || (self :: $ldapServer['keepLSsessionActive'])) {
self :: addJSconfigParam('keepLSsessionActive',ini_get('session.gc_maxlifetime'));
}
$GLOBALS['Smarty'] -> assign('LSjsConfig',json_encode(self :: $_JSconfigParams));
if ($GLOBALS['LSdebug']['active']) {
@ -1867,6 +1871,35 @@ class LSsession {
_("LSrelation : Some parameters are missing in the invocation of the methods of handling relations standard (Methode : %{meth}).")
);
}
public static function ajax_onLdapServerChangedLogin(&$data) {
if ( isset($_REQUEST['server']) ) {
self :: setLdapServer($_REQUEST['server']);
$data = array();
if ( self :: LSldapConnect() ) {
session_start();
if (isset($_SESSION['LSsession_topDn'])) {
$sel = $_SESSION['LSsession_topDn'];
}
else {
$sel = NULL;
}
$list = self :: getSubDnLdapServerOptions($sel);
if (is_string($list)) {
$data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
$data['subDnLabel'] = self :: getSubDnLabel();
}
}
$data['recoverPassword'] = isset(self :: $ldapServer['recoverPassword']);
}
}
public static function ajax_onLdapServerChangedRecoverPassword(&$data) {
if ( isset($_REQUEST['server']) ) {
self :: setLdapServer($_REQUEST['server']);
$data=array('recoverPassword' => isset(self :: $ldapServer['recoverPassword']));
}
}
}
?>

View file

@ -65,6 +65,11 @@ var LSdefault = new Class({
document.addEvent('keyup',this.onWantMoo.bindWithEvent(this));
this.LStips = new Tips('.LStips');
if ($type(this.LSjsConfig['keepLSsessionActive'])) {
this.LSjsConfig['keepLSsessionActive'] = (Math.round(this.LSjsConfig['keepLSsessionActive']*0.70)*1000);
this.keepLSsession.delay(this.LSjsConfig['keepLSsessionActive'],this);
}
},
onWantMoo: function(event) {
@ -288,6 +293,17 @@ var LSdefault = new Class({
removeTip: function(el) {
this.LStips.detach(el);
},
keepLSsession: function() {
LSdebug('Keep LSsession');
data: {}
new Request({url: 'index_ajax.php', data: {}, onSuccess: this.keepLSsessionComplete.bind(this)}).send();
},
keepLSsessionComplete: function() {
LSdebug('Keep LSsession OK');
this.keepLSsession.delay(this.LSjsConfig['keepLSsessionActive'],this);
}
});

View file

@ -136,7 +136,7 @@ var LSformElement_password_field = new Class({
onGenerateBtnClick: function() {
var data = {
template: 'LSform',
template: 'LSformElement_password',
action: 'generatePassword',
attribute: this.name,
objecttype: varLSform.objecttype,
@ -183,7 +183,7 @@ var LSformElement_password_field = new Class({
onVerifyBtnClick: function() {
var data = {
template: 'LSform',
template: 'LSformElement_password',
action: 'verifyPassword',
attribute: this.name,
objecttype: varLSform.objecttype,

View file

@ -114,8 +114,8 @@ var LSformElement_select_object_field = new Class({
onLSsmoothboxValid: function() {
var data = {
template: 'LSform',
action: 'LSformElement_select_object_refresh',
template: 'LSformElement_select_object',
action: 'refresh',
attribute: this.name,
objecttype: varLSform.objecttype,
objectdn: varLSform.objectdn,
@ -321,8 +321,8 @@ var LSformElement_select_object_field = new Class({
if (this._lastSearch!=this.searchAddInput.value) {
this._lastSearch=this.searchAddInput.value;
var data = {
template: 'LSform',
action: 'LSformElement_select_object_searchAdd',
template: 'LSformElement_select_object',
action: 'searchAdd',
attribute: this.name,
objecttype: varLSform.objecttype,
idform: varLSform.idform,

View file

@ -1,5 +1,14 @@
var LSrelation = new Class({
initialize: function(){
this.labels = varLSdefault.LSjsConfig['LSrelation_labels'];
if (!$type(this.labels)) {
this.labels = {
close_confirm_text: 'Do you really want to delete',
close_confirm_title: 'Warning',
close_confirm_validate: 'Delete'
};
}
this.edit = 0;
this.deleteBtn = [];
this.deleteBtnId = 0;
@ -35,10 +44,9 @@ var LSrelation = new Class({
if (this._confirmDelete) {
var a = img.getPrevious('a');
this.confirmBox = new LSconfirmBox({
text: 'Do you really want to delete "'+a.innerHTML+'" ?',
title: 'Warning',
validate_label: 'Delete',
cancel_label: 'Cancel',
text: this.labels.close_confirm_text + ' "'+a.innerHTML+'" ?',
title: this.labels.close_confirm_title,
validate_label: this.labels.close_confirm_validate,
startElement: img,
onConfirm: this.deleteFromImg.bind(this,img)
});

View file

@ -52,7 +52,7 @@ var LSselect = new Class({
if (checkbox.checked) {
var data = {
template: 'LSselect',
action: 'addLSselectobject-item',
action: 'addItem',
objectdn: checkbox.value,
objecttype: $('LSselect-object').getProperties('caption').caption,
multiple: this.multiple
@ -61,7 +61,7 @@ var LSselect = new Class({
else {
var data = {
template: 'LSselect',
action: 'dropLSselectobject-item',
action: 'dropItem',
objectdn: checkbox.value,
objecttype: $('LSselect-object').getProperties('caption').caption,
multiple: this.multiple

View file

@ -26,10 +26,11 @@ var LSsession_login = new Class({
var imgload = varLSdefault.loadingImgDisplay(this.loading_zone,'inside','big');
var server = this.select_ldapserver.value;
var data = {
template: 'login',
action: 'onLdapServerChanged',
server: server,
imgload: imgload
noLSsession: 1,
template: 'LSsession',
action: 'onLdapServerChangedLogin',
server: server,
imgload: imgload
};
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send();
},

View file

@ -25,10 +25,11 @@ var LSsession_recoverPassword = new Class({
var imgload = varLSdefault.loadingImgDisplay(this.loading_zone,'inside','big');
var server = this.select_ldapserver.value;
var data = {
template: 'recoverPassword',
action: 'onLdapServerChanged',
server: server,
imgload: imgload
noLSsession: 1,
template: 'LSsession',
action: 'onLdapServerChangedRecoverPassword',
server: server,
imgload: imgload
};
new Request({url: 'index_ajax.php', data: data, onSuccess: this.onLdapServerChangedComplete.bind(this)}).send();
},

View file

@ -1,5 +1,14 @@
var LSview = new Class({
initialize: function(){
this.labels = varLSdefault.LSjsConfig['LSview_labels'];
if (!$type(this.labels)) {
this.labels = {
delete_confirm_text: "Do you really want to delete",
delete_confirm_title: "Caution",
delete_confirm_validate: "Delete"
};
}
$$('td.LSobject-list-names').each(function(el) {
el.addEvent('click',this.onTdLSobjectListNamesClick.bind(this,el));
}, this);
@ -43,7 +52,7 @@ var LSview = new Class({
this._confirmBoxOpen = 1;
var name = a.getParent().getPrevious('td').getElement('a').innerHTML;
this.confirmBox = new LSconfirmBox({
text: varLSdefault.LSjsConfig['LSview_delete_label'] + ' "'+name+'" ?',
text: this.labels.delete_confirm_text + ' "'+name+'" ?',
startElement: a,
onConfirm: this.removeFromA.bind(this,a),
onClose: this.onConfirmBoxClose.bind(this)
@ -57,13 +66,12 @@ var LSview = new Class({
this._confirmBoxOpen = 1;
var name = $('LSview_title').innerHTML;
this.confirmBox = new LSconfirmBox({
text: varLSdefault.LSjsConfig['LSview_delete_confirm_text'] + ' "'+name+'" ?',
title: varLSdefault.LSjsConfig['LSview_delete_confirm_title'],
validate_label: varLSdefault.LSjsConfig['LSview_delete_confirm_yes_btn_label'],
cancel_label: varLSdefault.LSjsConfig['LSview_delete_confirm_no_btn_label'],
startElement: a,
onConfirm: this.removeFromA.bind(this,a),
onClose: this.onConfirmBoxClose.bind(this)
text: this.labels.delete_confirm_text + ' "'+name+'" ?',
title: this.labels.delete_confirm_title,
validate_label: this.labels.delete_confirm_yes_btn,
startElement: a,
onConfirm: this.removeFromA.bind(this,a),
onClose: this.onConfirmBoxClose.bind(this)
});
}
},

View file

@ -2,7 +2,7 @@
require_once 'includes/class/class.LSsession.php';
if (($_REQUEST['template'] != 'login')&&($_REQUEST['template'] != 'recoverPassword')) {
if (!isset($_REQUEST['noLSsession'])) {
if ( !LSsession :: startLSsession() ) {
LSerror :: addErrorCode('LSsession_22');
$_ERRORS = true;
@ -14,392 +14,12 @@ else {
$data=NULL;
if (!isset($_ERRORS)) {
switch($_REQUEST['template']) {
case 'login':
switch($_REQUEST['action']) {
case 'onLdapServerChanged':
if ( isset($_REQUEST['server']) ) {
LSsession :: setLdapServer($_REQUEST['server']);
$data = array();
if ( LSsession :: LSldapConnect() ) {
session_start();
if (isset($_SESSION['LSsession_topDn'])) {
$sel = $_SESSION['LSsession_topDn'];
}
else {
$sel = NULL;
}
$list = LSsession :: getSubDnLdapServerOptions($sel);
if (is_string($list)) {
$data['list_topDn'] = "<select name='LSsession_topDn' id='LSsession_topDn'>".$list."</select>";
$data['subDnLabel'] = LSsession :: getSubDnLabel();
}
}
$data['recoverPassword'] = isset(LSsession::$ldapServer['recoverPassword']);
}
break;
}
break;
case 'recoverPassword':
switch($_REQUEST['action']) {
case 'onLdapServerChanged':
if ( isset($_REQUEST['server']) ) {
LSsession :: setLdapServer($_REQUEST['server']);
$data=array('recoverPassword' => isset(LSsession::$ldapServer['recoverPassword']));
}
break;
}
break;
case 'LSform':
switch($_REQUEST['action']) {
case 'onAddFieldBtnClick':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['fieldId'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$object -> loadData($_REQUEST['objectdn']);
$form = $object -> getForm($_REQUEST['idform']);
$emptyField=$form -> getEmptyField($_REQUEST['attribute']);
if ( $emptyField ) {
$data = array(
'html' => $form -> getEmptyField($_REQUEST['attribute']),
'fieldId' => $_REQUEST['fieldId'],
'fieldtype' => get_class($form -> getElement($_REQUEST['attribute']))
);
}
}
}
break;
case 'LSformElement_select_object_refresh':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
$val = $field -> getValuesFromSession();
if ( $val ) {
$data = array(
'objects' => $val
);
}
}
}
break;
case 'LSformElement_select_object_searchAdd':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['pattern'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$field=$form -> getElement($_REQUEST['attribute']);
$data['objects'] = $field -> searchAdd($_REQUEST['pattern']);
}
}
break;
case 'generatePassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['idform'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
if ($object) {
$form = $object -> getForm($_REQUEST['idform']);
if ($form) {
$field=$form -> getElement($_REQUEST['attribute']);
if ($field) {
$val = $field -> generatePassword();
if ( $val ) {
$data = array(
'generatePassword' => $val
);
}
}
}
}
}
}
break;
case 'verifyPassword':
if ((isset($_REQUEST['attribute'])) && (isset($_REQUEST['objecttype'])) && (isset($_REQUEST['fieldValue'])) && (isset($_REQUEST['idform'])) && (isset($_REQUEST['objectdn'])) ) {
if (LSsession ::loadLSobject($_REQUEST['objecttype'])) {
$object = new $_REQUEST['objecttype']();
$form = $object -> getForm($_REQUEST['idform']);
$object -> loadData($_REQUEST['objectdn']);
$field=$form -> getElement($_REQUEST['attribute']);
$val = $field -> verifyPassword($_REQUEST['fieldValue']);
$data = array(
'verifyPassword' => $val
);
}
}
break;
}
break;
case 'LSrelation':
switch($_REQUEST['action']) {
case 'refreshSession':
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['href'])) ) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
$_SESSION['LSselect'][$relationConf['LSobject']]=array();
if (is_array($list)) {
foreach($list as $o) {
$_SESSION['LSselect'][$relationConf['LSobject']][] = $o -> getDn();
}
}
$data = array(
'href' => $_REQUEST['href'],
'id' => $_REQUEST['id']
);
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
break;
case 'refreshList':
if (isset($_REQUEST['id'])) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['update_function'])) {
$objRel = new $relationConf['LSobject']();
if($objRel -> $relationConf['update_function']($object,$_SESSION['LSselect'][$relationConf['LSobject']])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)&&(!empty($list))) {
foreach($list as $o) {
$data['html'].= "<li class='LSrelation'><a href='view.php?LSobject=".$relationConf['LSobject']."&amp;dn=".$o -> getDn()."' class='LSrelation' id='".$o -> getDn()."'>".$o -> getDisplayName(NULL,true)."</a></li>\n";
}
}
else {
if (isset($relationConf['emptyText'])) {
$data['html'] = "<li>".$relationConf['emptyText']."</li>\n";
}
else {
$data['html'] = "<li>"._('No object.')."</li>\n";
}
}
$data['id'] = $_REQUEST['id'];
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
}
else {
LSerror :: addErrorCode('LSrelations_03',$relationName);
}
}
else {
LSerror :: addErrorCode('LSrelations_02',$relationName);
}
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
break;
case 'deleteByDn':
if ((isset($_REQUEST['id'])) && (isset($_REQUEST['dn']))) {
if (isset($_SESSION['LSrelation'][$_REQUEST['id']])) {
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
if (LSsession ::loadLSobject($conf['objectType'])) {
$object = new $conf['objectType']();
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
$relationConf = $object->config['LSrelation'][$conf['relationName']];
if (LSsession ::loadLSobject($relationConf['LSobject'])) {
if (LSsession :: relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) {
$ok=false;
foreach($list as $o) {
if($o -> getDn() == $_REQUEST['dn']) {
if (!$o -> $relationConf['remove_function']($object)) {
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$ok = true;
}
}
}
if (!$ok) {
LSdebug($_REQUEST['value']." introuvé parmi la liste");
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
else {
$data=array(
'dn' => $_REQUEST['dn']
);
}
}
else {
LSerror :: addErrorCode('LSrelations_03',$conf['relationName']);
}
}
else {
LSerror :: addErrorCode('LSrelations_01',$conf['relationName']);
}
}
else {
LSerror :: addErrorCode('LSsession_11');
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
break;
}
break;
case 'LSselect':
switch($_REQUEST['action']) {
case 'addLSselectobject-item':
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn'])) && (isset($_REQUEST['multiple']))) {
if (!$_REQUEST['multiple']) {
$_SESSION['LSselect'][$_REQUEST['objecttype']]=array($_REQUEST['objectdn']);
}
else if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
if (!in_array($_REQUEST['objectdn'],$_SESSION['LSselect'][$_REQUEST['objecttype']])) {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
}
}
else {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$_REQUEST['objectdn'];
}
}
break;
case 'dropLSselectobject-item':
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['objectdn']))) {
if (is_array($_SESSION['LSselect'][$_REQUEST['objecttype']])) {
$result=array();
foreach ($_SESSION['LSselect'][$_REQUEST['objecttype']] as $val) {
if ($val!=$_REQUEST['objectdn']) {
$result[]=$val;
}
}
$_SESSION['LSselect'][$_REQUEST['objecttype']]=$result;
}
}
break;
case 'refreshSession':
if ((isset($_REQUEST['objecttype'])) && (isset($_REQUEST['values'])) ) {
$_SESSION['LSselect'][$_REQUEST['objecttype']]=array();
$values=json_decode($_REQUEST['values'],false);
if (is_array($values)) {
foreach($values as $val) {
$_SESSION['LSselect'][$_REQUEST['objecttype']][]=$val;
}
}
$data=array(
'values' => $values
);
}
else {
LSerror :: addErrorCode('LSsession_12');
}
break;
}
break;
case 'LSmail':
switch($_REQUEST['action']) {
case 'display':
if (isset($_REQUEST['object']['type']) && isset($_REQUEST['object']['dn'])) {
if (LSsession ::loadLSobject($_REQUEST['object']['type'])) {
$obj = new $_REQUEST['object']['type']();
$obj -> loadData($_REQUEST['object']['dn']);
$msg = $obj -> getFData($_REQUEST['msg']);
$subject = $obj -> getFData($_REQUEST['subject']);
}
}
else {
$msg = $_REQUEST['msg'];
$subject = $_REQUEST['subject'];
}
$GLOBALS['Smarty'] -> assign('LSmail_msg',$msg);
$GLOBALS['Smarty'] -> assign('LSmail_subject',$subject);
if (is_array($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',$_REQUEST['mails']);
}
else if(empty($_REQUEST['mails'])) {
$GLOBALS['Smarty'] -> assign('LSmail_mails',array($_REQUEST['mails']));
}
$GLOBALS['Smarty'] -> assign('LSmail_mail_label',_('Email'));
$GLOBALS['Smarty'] -> assign('LSmail_subject_label',_('Title'));
$GLOBALS['Smarty'] -> assign('LSmail_msg_label',_('Message'));
$data = array(
'html' => $GLOBALS['Smarty'] -> fetch('LSmail.tpl')
);
break;
case 'send':
if (isset($_REQUEST['infos'])) {
if (LSsession ::loadLSaddon('mail')) {
if(sendMail($_REQUEST['infos']['mail'],$_REQUEST['infos']['subject'],$_REQUEST['infos']['msg'])) {
$data = array(
'msgok' => _("Your message has been sent successfully.")
);
}
}
}
else {
LSerror :: addErrorCode('LSsession_12');
}
}
break;
$class = $_REQUEST['template'];
if (LSsession :: loadLSclass($class)) {
$meth = 'ajax_'.$_REQUEST['action'];
if (method_exists($class,$meth)) {
call_user_func(array($class,$meth),&$data);
}
}
}

View file

@ -108,8 +108,6 @@ if(LSsession :: startLSsession()) {
);
}
LSsession :: addJSscript('LSsmoothbox.js');
LSsession :: addCssFile('LSsmoothbox.css');
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
LSsession :: setTemplate('modify.tpl');
$form -> display();

View file

@ -285,8 +285,6 @@ if(LSsession :: startLSsession()) {
$searchData['objectList'][$i]['select']=$select;
}
LSsession :: addJSscript('LSview.js');
$GLOBALS['Smarty']->assign('LSview_search',array(
'action' => $_SERVER['PHP_SELF'],
'submit' => _('Search'),

View file

@ -76,88 +76,11 @@ if(LSsession :: startLSsession()) {
$view -> displayView();
// LSrelations
if (is_array($object -> config['LSrelation'])) {
$LSrelations=array();
$LSrelations_JSparams=array();
foreach($object -> config['LSrelation'] as $relationName => $relationConf) {
if (LSsession :: relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) {
$return=array(
'label' => $relationConf['label'],
'LSobject' => $relationConf['LSobject']
);
if (isset($relationConf['emptyText'])) {
$return['emptyText'] = $relationConf['emptyText'];
}
else {
$return['emptyText'] = _('No object.');
}
$id=rand();
$return['id']=$id;
$LSrelations_JSparams[$id]=array(
'emptyText' => $return['emptyText']
);
$_SESSION['LSrelation'][$id] = array(
'relationName' => $relationName,
'objectType' => $object -> getType(),
'objectDn' => $object -> getDn(),
);
if (LSsession :: relationCanEdit($object -> getValue('dn'),$LSobject,$relationName)) {
$return['actions'][] = array(
'label' => _('Modify'),
'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&amp;multiple=1',
'action' => 'modify'
);
}
LSsession :: addJSscript('LSselect.js');
LSsession :: addCssFile('LSselect.css');
LSsession :: addJSscript('LSsmoothbox.js');
LSsession :: addCssFile('LSsmoothbox.css');
LSsession :: addJSscript('LSrelation.js');
LSsession :: addCssFile('LSrelation.css');
LSsession :: addJSscript('LSconfirmBox.js');
LSsession :: addCssFile('LSconfirmBox.css');
LSsession :: addJSscript('LSview.js');
if(LSsession :: loadLSobject($relationConf['LSobject'])) {
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
$objRel = new $relationConf['LSobject']();
$list = $objRel -> $relationConf['list_function']($object);
if (is_array($list)) {
foreach($list as $o) {
$o_infos = array(
'text' => $o -> getDisplayName(NULL,true),
'dn' => $o -> getDn()
);
$return['objectList'][] = $o_infos;
}
}
else {
$return['objectList']=array();
}
}
else {
LSerror :: addErrorCode('LSrelations_01',$relationName);
}
$LSrelations[]=$return;
}
else {
LSerror :: addErrorCode('LSrelations_04',array('relation' => $relationName,'LSobject' => $relationConf['LSobject']));
}
}
}
LSsession :: addJSscript('LSconfirmBox.js');
LSsession :: addCssFile('LSconfirmBox.css');
$GLOBALS['Smarty'] -> assign('LSrelations',$LSrelations);
LSsession :: addJSconfigParam('LSrelations',$LSrelations_JSparams);
if (LSsession :: loadLSclass('LSrelation')) {
LSrelation :: displayInLSview($object);
}
$GLOBALS['Smarty'] -> assign('LSview_actions',$LSview_actions);
LSsession :: addJSscript('LSsmoothbox.js');
LSsession :: addCssFile('LSsmoothbox.css');
LSsession :: setTemplate('view.tpl');
}
else {
@ -440,9 +363,9 @@ if(LSsession :: startLSsession()) {
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
} // Fin Pagination
LSsession :: addJSscript('LSconfirmBox.js');
LSsession :: addCssFile('LSconfirmBox.css');
LSsession :: addJSscript('LSview.js');
if (LSsession :: loadLSclass('LSform')) {
LSform :: loadDependenciesDisplayView();
}
$GLOBALS['Smarty']->assign('LSview_search',array(
'action' => $_SERVER['PHP_SELF'],