- Uniformisation du nom LSrelation (relations -> LSrelation)

This commit is contained in:
Benjamin Renard 2009-01-07 23:06:05 +00:00
parent fc9ebc382a
commit b2e585b7c2
5 changed files with 28 additions and 28 deletions

View file

@ -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."),

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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'])) {

View file

@ -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'],