From b2e585b7c226dc1b089ca7d98011a43ca051f03b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 7 Jan 2009 23:06:05 +0000 Subject: [PATCH] - Uniformisation du nom LSrelation (relations -> LSrelation) --- .../LSobjects/config.LSobjects.LSeepeople.php | 2 +- trunk/includes/class/class.LSldapObject.php | 30 +++++++++---------- trunk/includes/class/class.LSsession.php | 6 ++-- trunk/index_ajax.php | 12 ++++---- trunk/view.php | 6 ++-- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php index 6c752efb..2356c62c 100644 --- a/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php +++ b/trunk/conf/LSobjects/config.LSobjects.LSeepeople.php @@ -49,7 +49,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array ( 'label' => _('Utilisateurs'), // LSrelation - 'relations' => array( + 'LSrelation' => array( 'groups' => array( 'label' => _('Appartient aux groupes...'), 'emptyText' => _("N'appartient à aucun groupe."), diff --git a/trunk/includes/class/class.LSldapObject.php b/trunk/includes/class/class.LSldapObject.php index 251e0135..ff35eaac 100644 --- a/trunk/includes/class/class.LSldapObject.php +++ b/trunk/includes/class/class.LSldapObject.php @@ -41,7 +41,7 @@ class LSldapObject { var $submitError=true; var $_whoami=NULL; var $_subDn_value=NULL; - var $_relationsCache=array(); + var $_LSrelationsCache=array(); /** * Constructeur @@ -1123,17 +1123,17 @@ class LSldapObject { /** * Methode créant la liste des objets en relations avec l'objet courant et qui - * la met en cache ($this -> _relationsCache) + * la met en cache ($this -> _LSrelationsCache) * * @retval True en cas de cas ce succès, False sinon. */ - function updateRelationsCache() { - $this -> _relationsCache=array(); - if (is_array($this->config['relations'])) { + function updateLSrelationsCache() { + $this -> _LSrelationsCache=array(); + if (is_array($this->config['LSrelation'])) { $type = $this -> getType(); $me = new $type(); $me -> loadData($this -> getDn()); - foreach($this->config['relations'] as $relation_name => $relation_conf) { + foreach($this->config['LSrelation'] as $relation_name => $relation_conf) { if ( isset($relation_conf['list_function']) ) { if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) { $obj = new $relation_conf['LSobject'](); @@ -1143,7 +1143,7 @@ class LSldapObject { // Key Value $key = $obj -> $relation_conf['getkeyvalue_function']($me); - $this -> _relationsCache[$relation_name] = array( + $this -> _LSrelationsCache[$relation_name] = array( 'list' => $list, 'keyvalue' => $key ); @@ -1177,7 +1177,7 @@ class LSldapObject { * @retval True en cas de cas ce succès, False sinon. */ function beforeRename() { - return $this -> updateRelationsCache(); + return $this -> updateLSrelationsCache(); } /** @@ -1198,10 +1198,10 @@ class LSldapObject { $GLOBALS['LSsession'] -> changeAuthUser($this); } - foreach($this -> _relationsCache as $relation_name => $objInfos) { - if ((isset($this->config['relations'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) { + foreach($this -> _LSrelationsCache as $relation_name => $objInfos) { + if ((isset($this->config['LSrelation'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) { foreach($objInfos['list'] as $obj) { - $meth = $this->config['relations'][$relation_name]['rename_function']; + $meth = $this->config['LSrelation'][$relation_name]['rename_function']; if (method_exists($obj,$meth)) { if (!($obj -> $meth($this,$objInfos['keyvalue']))) { $error=1; @@ -1226,7 +1226,7 @@ class LSldapObject { * @retval True en cas de cas ce succès, False sinon. */ function beforeDelete() { - return $this -> updateRelationsCache(); + return $this -> updateLSrelationsCache(); } /** @@ -1240,10 +1240,10 @@ class LSldapObject { */ function afterDelete() { $error = 0; - foreach($this -> _relationsCache as $relation_name => $objInfos) { - if ((isset($this->config['relations'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) { + foreach($this -> _LSrelationsCache as $relation_name => $objInfos) { + if ((isset($this->config['LSrelation'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) { foreach($objInfos['list'] as $obj) { - $meth = $this->config['relations'][$relation_name]['remove_function']; + $meth = $this->config['LSrelation'][$relation_name]['remove_function']; if (method_exists($obj,$meth)) { if (!($obj -> $meth($this))) { $error=1; diff --git a/trunk/includes/class/class.LSsession.php b/trunk/includes/class/class.LSsession.php index 206de5cf..66bf1c83 100644 --- a/trunk/includes/class/class.LSsession.php +++ b/trunk/includes/class/class.LSsession.php @@ -1363,14 +1363,14 @@ class LSsession { * @retval boolean True si l'utilisateur a accès, false sinon */ function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) { - if (!isset($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName])) + if (!isset($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName])) return; $whoami = $this -> whoami($dn); if (($right=='w') || ($right=='r')) { $r = 'n'; foreach($whoami as $who) { - $nr = $GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who]; + $nr = $GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who]; if($nr == 'w') { $r = 'w'; } @@ -1387,7 +1387,7 @@ class LSsession { } else { foreach($whoami as $who) { - if (($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who] == 'w') || ($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who] == 'r')) { + if (($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'w') || ($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'r')) { return true; } } diff --git a/trunk/index_ajax.php b/trunk/index_ajax.php index 31954844..797ea77a 100644 --- a/trunk/index_ajax.php +++ b/trunk/index_ajax.php @@ -138,8 +138,8 @@ if (!isset($_ERRORS)) { $conf = $_SESSION['LSrelation'][$_REQUEST['id']]; if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { $object = new $conf['objectType'](); - if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) { - $relationConf = $object->config['relations'][$conf['relationName']]; + if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { + $relationConf = $object->config['LSrelation'][$conf['relationName']]; if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { @@ -184,8 +184,8 @@ if (!isset($_ERRORS)) { $conf = $_SESSION['LSrelation'][$_REQUEST['id']]; if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { $object = new $conf['objectType'](); - if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) { - $relationConf = $object->config['relations'][$conf['relationName']]; + if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { + $relationConf = $object->config['LSrelation'][$conf['relationName']]; if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) { @@ -246,8 +246,8 @@ if (!isset($_ERRORS)) { $conf = $_SESSION['LSrelation'][$_REQUEST['id']]; if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) { $object = new $conf['objectType'](); - if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) { - $relationConf = $object->config['relations'][$conf['relationName']]; + if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) { + $relationConf = $object->config['LSrelation'][$conf['relationName']]; if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) { if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) { if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) { diff --git a/trunk/view.php b/trunk/view.php index 0bc4bdaf..9c35cb42 100644 --- a/trunk/view.php +++ b/trunk/view.php @@ -78,11 +78,11 @@ if($LSsession -> startLSsession()) { $view = $object -> getView(); $view -> displayView(); - // Relations - if (is_array($object -> config['relations'])) { + // LSrelations + if (is_array($object -> config['LSrelation'])) { $LSrelations=array(); $LSrelations_JSparams=array(); - foreach($object -> config['relations'] as $relationName => $relationConf) { + foreach($object -> config['LSrelation'] as $relationName => $relationConf) { if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) { $return=array( 'label' => $relationConf['label'],