mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-18 08:19:05 +01:00
LSrelation : Add create action button
This commit is contained in:
parent
9b90dadaee
commit
486f33ccf9
6 changed files with 139 additions and 66 deletions
|
@ -41,6 +41,28 @@ if(LSsession :: startLSsession()) {
|
|||
$form = $object -> getForm('create',urldecode($_GET['load']));
|
||||
}
|
||||
else {
|
||||
if (isset($_GET['LSrelation']) && isset($_GET['relatedLSobject']) && isset($_GET['relatedLSobjectDN'])) {
|
||||
if (LSsession :: loadLSobject($_GET['relatedLSobject']) && LSsession :: loadLSclass('LSrelation')) {
|
||||
$obj = new $_GET['relatedLSobject']();
|
||||
if ($obj -> loadData(urldecode($_GET['relatedLSobjectDN']))) {
|
||||
$relation = new LSrelation($obj, $_GET['LSrelation']);
|
||||
if ($relation -> exists()) {
|
||||
$attr = $relation -> getRelatedEditableAttribute();
|
||||
if (isset($object -> attrs[$attr])) {
|
||||
$value = $relation -> getRelatedKeyValue();
|
||||
if (is_array($value)) $value=$value[0];
|
||||
$object -> attrs[$attr] -> data = array($value);
|
||||
}
|
||||
else {
|
||||
LSerror :: addErrorCode('LSrelations_06',array('relation' => $relation -> getName(),'LSobject' => $obj -> getType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LSerror :: addErrorCode('LSsession_24');
|
||||
}
|
||||
}
|
||||
}
|
||||
$form = $object -> getForm('create');
|
||||
}
|
||||
|
||||
|
@ -116,5 +138,3 @@ else {
|
|||
LSsession :: setTemplate('login.tpl');
|
||||
}
|
||||
LSsession :: displayTemplate();
|
||||
|
||||
?>
|
||||
|
|
|
@ -37,10 +37,28 @@ class LSrelation {
|
|||
}
|
||||
}
|
||||
|
||||
public function exists(&$obj=null,$relationName=null) {
|
||||
if ($obj && $relationName) {
|
||||
return (isset($obj->config['LSrelation'][$relationName]) && is_array($obj->config['LSrelation'][$relationName]));
|
||||
}
|
||||
else {
|
||||
return is_array($this -> config);
|
||||
}
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this -> relationName;
|
||||
}
|
||||
|
||||
public function canEdit() {
|
||||
return LSsession :: relationCanEdit($this -> obj -> getValue('dn'),$this -> obj -> getType(),$this -> relationName);
|
||||
}
|
||||
|
||||
public function canCreate() {
|
||||
return LSsession :: canCreate($this -> config['LSobject']);
|
||||
}
|
||||
|
||||
|
||||
public function listRelatedObjects() {
|
||||
if (LSsession :: loadLSobject($this -> config['LSobject'])) {
|
||||
$objRel = new $this -> config['LSobject']();
|
||||
|
@ -242,6 +260,13 @@ class LSrelation {
|
|||
'url' => 'select.php?LSobject='.$relationConf['LSobject'].'&multiple=1'.($relation -> getRelatedEditableAttribute()?'&editableAttr='.$relation -> getRelatedEditableAttribute():''),
|
||||
'action' => 'modify'
|
||||
);
|
||||
if ($relation -> canCreate()) {
|
||||
$return['actions'][] = array(
|
||||
'label' => _('New'),
|
||||
'url' => 'create.php?LSobject='.$relationConf['LSobject'].'&LSrelation='.$relationName.'&relatedLSobject='.$object->getType().'&relatedLSobjectDN='.urlencode($object -> getValue('dn')),
|
||||
'action' => 'create'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$list = $relation -> listRelatedObjects();
|
||||
|
@ -424,17 +449,20 @@ class LSrelation {
|
|||
* Error Codes
|
||||
**/
|
||||
LSerror :: defineError('LSrelations_01',
|
||||
_("LSrelation : The function %{function} for action '%{action}' on the relation %{relation} is unknow.")
|
||||
_("LSrelation : The function %{function} for action '%{action}' on the relation %{relation} is unknown.")
|
||||
);
|
||||
LSerror :: defineError('LSrelations_02',
|
||||
_("LSrelation : Relation %{relation} of object type %{LSobject} unknow.")
|
||||
_("LSrelation : Relation %{relation} of object type %{LSobject} unknown.")
|
||||
);
|
||||
LSerror :: defineError('LSrelations_03',
|
||||
_("LSrelation : Error during relation update of the relation %{relation}.")
|
||||
);
|
||||
LSerror :: defineError('LSrelations_04',
|
||||
_("LSrelation : Object type %{LSobject} unknow (Relation : %{relation}).")
|
||||
_("LSrelation : Object type %{LSobject} unknown (Relation : %{relation}).")
|
||||
);
|
||||
LSerror :: defineError('LSrelations_05',
|
||||
_("LSrelation : Incomplete configuration for LSrelation %{relation} of object type %{LSobject} for action : %{action}.")
|
||||
);
|
||||
LSerror :: defineError('LSrelations_06',
|
||||
_("LSrelation : Invalid editable attribute for LSrelation %{relation} with LSobject %{LSobject}.")
|
||||
);
|
||||
|
|
|
@ -2454,6 +2454,9 @@ class LSsession {
|
|||
LSerror :: defineError('LSsession_23',
|
||||
_("LSsession : view function %{func} for LSaddon %{addon} doet not exist.")
|
||||
);
|
||||
LSerror :: defineError('LSsession_24',
|
||||
_("LSsession : invalid related object's DN pass in parameter.")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: LdapSaisie\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-06-15 18:19+0200\n"
|
||||
"PO-Revision-Date: 2017-06-15 18:21+0100\n"
|
||||
"POT-Creation-Date: 2017-08-02 11:53+0200\n"
|
||||
"PO-Revision-Date: 2017-08-02 11:56+0100\n"
|
||||
"Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
|
||||
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
|
||||
"org>\n"
|
||||
|
@ -22,7 +22,7 @@ msgstr ""
|
|||
|
||||
#: view.php:44 modify.php:54
|
||||
#: includes/class/class.LSformElement_supannCompositeAttribute.php:106
|
||||
#: includes/class/class.LSrelation.php:241
|
||||
#: includes/class/class.LSrelation.php:259
|
||||
#: includes/class/class.LSformElement_select_object.php:68
|
||||
#: includes/class/class.LSformElement_supannLabeledValue.php:62
|
||||
#: includes/class/class.LSsearchEntry.php:163
|
||||
|
@ -33,7 +33,7 @@ msgstr "Modifier"
|
|||
msgid "Copy"
|
||||
msgstr "Copier"
|
||||
|
||||
#: view.php:60 modify.php:111 includes/class/class.LSrelation.php:198
|
||||
#: view.php:60 modify.php:111 includes/class/class.LSrelation.php:216
|
||||
#: includes/class/class.LSform.php:218
|
||||
#: includes/class/class.LSformElement_select_object.php:69
|
||||
#: includes/class/class.LSformElement_select_object.php:85
|
||||
|
@ -78,15 +78,15 @@ msgstr "Voir"
|
|||
msgid "Import"
|
||||
msgstr "Importer"
|
||||
|
||||
#: create.php:53
|
||||
#: create.php:75
|
||||
msgid "Data entry form"
|
||||
msgstr "Masque de saisie"
|
||||
|
||||
#: create.php:59
|
||||
#: create.php:81
|
||||
msgid "Object has been added."
|
||||
msgstr "L'objet a été ajouté."
|
||||
|
||||
#: create.php:98
|
||||
#: create.php:120 includes/class/class.LSrelation.php:265
|
||||
msgid "New"
|
||||
msgstr "Nouveau"
|
||||
|
||||
|
@ -813,6 +813,10 @@ msgid "LSsession : view function %{func} for LSaddon %{addon} doet not exist."
|
|||
msgstr ""
|
||||
"LSsession : la fonction de vue %{func} du LSaddon %{addon} n'existe pas."
|
||||
|
||||
#: includes/class/class.LSsession.php:2458
|
||||
msgid "LSsession : invalid related object's DN pass in parameter."
|
||||
msgstr "LSsession : DN d'objet en relation incorrect dans les paramètres."
|
||||
|
||||
#: includes/class/class.LSldapObject.php:470
|
||||
msgid "The attribute %{attr} is not valid."
|
||||
msgstr "L'attribut %{attr} n'est pas valide."
|
||||
|
@ -1084,81 +1088,81 @@ msgstr "LSldap : Erreur durant la suppression des attributs vides."
|
|||
msgid "LSldap : Error while changing the DN of the object."
|
||||
msgstr "LSldap : Erreur pendant la modification du DN de l'objet."
|
||||
|
||||
#: includes/class/class.LSrelation.php:51
|
||||
#: includes/class/class.LSrelation.php:58
|
||||
#: includes/class/class.LSrelation.php:69
|
||||
#: includes/class/class.LSrelation.php:76
|
||||
msgid "listing related objects"
|
||||
msgstr "énumaration des objets liés"
|
||||
|
||||
#: includes/class/class.LSrelation.php:85
|
||||
#: includes/class/class.LSrelation.php:91
|
||||
#: includes/class/class.LSrelation.php:103
|
||||
#: includes/class/class.LSrelation.php:109
|
||||
msgid "getting key value"
|
||||
msgstr "récupération de la valeur clé"
|
||||
|
||||
#: includes/class/class.LSrelation.php:116
|
||||
#: includes/class/class.LSrelation.php:123
|
||||
#: includes/class/class.LSrelation.php:156
|
||||
#: includes/class/class.LSrelation.php:134
|
||||
#: includes/class/class.LSrelation.php:141
|
||||
#: includes/class/class.LSrelation.php:174
|
||||
msgid "checking right on relation with specific object"
|
||||
msgstr "vérification des droits sur la relation avec un objet en particulier"
|
||||
|
||||
#: includes/class/class.LSrelation.php:132
|
||||
#: includes/class/class.LSrelation.php:150
|
||||
msgid "deleting"
|
||||
msgstr "suppression"
|
||||
|
||||
#: includes/class/class.LSrelation.php:139
|
||||
#: includes/class/class.LSrelation.php:157
|
||||
msgid "removing relation with specific object"
|
||||
msgstr "suppression de la relation avec un object en particulier"
|
||||
|
||||
#: includes/class/class.LSrelation.php:149
|
||||
#: includes/class/class.LSrelation.php:167
|
||||
msgid "renaming"
|
||||
msgstr "renommage"
|
||||
|
||||
#: includes/class/class.LSrelation.php:168
|
||||
#: includes/class/class.LSrelation.php:186
|
||||
msgid "updating"
|
||||
msgstr "mise à jour"
|
||||
|
||||
#: includes/class/class.LSrelation.php:174
|
||||
#: includes/class/class.LSrelation.php:192
|
||||
msgid "updating relations"
|
||||
msgstr "mise à jour des relations"
|
||||
|
||||
#: includes/class/class.LSrelation.php:196 includes/class/class.LSform.php:216
|
||||
#: includes/class/class.LSrelation.php:214 includes/class/class.LSform.php:216
|
||||
#: remove.php:49
|
||||
msgid "Do you really want to delete"
|
||||
msgstr "Voulez-vous vraiment supprimer"
|
||||
|
||||
#: includes/class/class.LSrelation.php:197
|
||||
#: includes/class/class.LSrelation.php:215
|
||||
msgid "Warning"
|
||||
msgstr "Attention"
|
||||
|
||||
#: includes/class/class.LSrelation.php:225
|
||||
#: includes/class/class.LSrelation.php:339
|
||||
#: includes/class/class.LSrelation.php:243
|
||||
#: includes/class/class.LSrelation.php:364
|
||||
msgid "No object."
|
||||
msgstr "Aucun objet."
|
||||
|
||||
#: includes/class/class.LSrelation.php:427
|
||||
#: includes/class/class.LSrelation.php:452
|
||||
msgid ""
|
||||
"LSrelation : The function %{function} for action '%{action}' on the relation "
|
||||
"%{relation} is unknow."
|
||||
"%{relation} is unknown."
|
||||
msgstr ""
|
||||
"LSrelation : La fonction %{function} pour l'action '%{action}' sur la "
|
||||
"relation %{relation} est inconnue."
|
||||
|
||||
#: includes/class/class.LSrelation.php:430
|
||||
msgid "LSrelation : Relation %{relation} of object type %{LSobject} unknow."
|
||||
#: includes/class/class.LSrelation.php:455
|
||||
msgid "LSrelation : Relation %{relation} of object type %{LSobject} unknown."
|
||||
msgstr ""
|
||||
"LSrelation : La relation %{relation} du type d'objet %{LSobject} est "
|
||||
"inconnue."
|
||||
|
||||
#: includes/class/class.LSrelation.php:433
|
||||
#: includes/class/class.LSrelation.php:458
|
||||
msgid "LSrelation : Error during relation update of the relation %{relation}."
|
||||
msgstr "LSsession : Erreur durant la mise à jour de la relation %{relation}"
|
||||
|
||||
#: includes/class/class.LSrelation.php:436
|
||||
msgid "LSrelation : Object type %{LSobject} unknow (Relation : %{relation})."
|
||||
#: includes/class/class.LSrelation.php:461
|
||||
msgid "LSrelation : Object type %{LSobject} unknown (Relation : %{relation})."
|
||||
msgstr ""
|
||||
"LSsession : La fonction de mise à jour de la relation %{relation} est "
|
||||
"inconnue."
|
||||
|
||||
#: includes/class/class.LSrelation.php:439
|
||||
#: includes/class/class.LSrelation.php:464
|
||||
msgid ""
|
||||
"LSrelation : Incomplete configuration for LSrelation %{relation} of object "
|
||||
"type %{LSobject} for action : %{action}."
|
||||
|
@ -1166,6 +1170,14 @@ msgstr ""
|
|||
"LSrelation : Configuration incomplète de la LSrelation %{relation} du type "
|
||||
"d'objet %{LSobject} pour l'action : %{action}."
|
||||
|
||||
#: includes/class/class.LSrelation.php:467
|
||||
msgid ""
|
||||
"LSrelation : Invalid editable attribute for LSrelation %{relation} with "
|
||||
"LSobject %{LSobject}."
|
||||
msgstr ""
|
||||
"LSrelation : Attribut éditable invalide pour la LSrelation %{relation} du "
|
||||
"type d'objet %{LSobject}."
|
||||
|
||||
#: includes/class/class.LSformElement_password.php:134
|
||||
msgid "Generate a password."
|
||||
msgstr "Générer un mot de passe."
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-06-15 18:19+0200\n"
|
||||
"POT-Creation-Date: 2017-08-02 11:53+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -19,7 +19,7 @@ msgstr ""
|
|||
|
||||
#: view.php:44 modify.php:54
|
||||
#: includes/class/class.LSformElement_supannCompositeAttribute.php:106
|
||||
#: includes/class/class.LSrelation.php:241
|
||||
#: includes/class/class.LSrelation.php:259
|
||||
#: includes/class/class.LSformElement_select_object.php:68
|
||||
#: includes/class/class.LSformElement_supannLabeledValue.php:62
|
||||
#: includes/class/class.LSsearchEntry.php:163
|
||||
|
@ -30,7 +30,7 @@ msgstr ""
|
|||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
#: view.php:60 modify.php:111 includes/class/class.LSrelation.php:198
|
||||
#: view.php:60 modify.php:111 includes/class/class.LSrelation.php:216
|
||||
#: includes/class/class.LSform.php:218
|
||||
#: includes/class/class.LSformElement_select_object.php:69
|
||||
#: includes/class/class.LSformElement_select_object.php:85
|
||||
|
@ -75,15 +75,15 @@ msgstr ""
|
|||
msgid "Import"
|
||||
msgstr ""
|
||||
|
||||
#: create.php:53
|
||||
#: create.php:75
|
||||
msgid "Data entry form"
|
||||
msgstr ""
|
||||
|
||||
#: create.php:59
|
||||
#: create.php:81
|
||||
msgid "Object has been added."
|
||||
msgstr ""
|
||||
|
||||
#: create.php:98
|
||||
#: create.php:120 includes/class/class.LSrelation.php:265
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
|
@ -707,6 +707,10 @@ msgstr ""
|
|||
msgid "LSsession : view function %{func} for LSaddon %{addon} doet not exist."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSsession.php:2458
|
||||
msgid "LSsession : invalid related object's DN pass in parameter."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSldapObject.php:470
|
||||
msgid "The attribute %{attr} is not valid."
|
||||
msgstr ""
|
||||
|
@ -920,80 +924,86 @@ msgstr ""
|
|||
msgid "LSldap : Error while changing the DN of the object."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:51
|
||||
#: includes/class/class.LSrelation.php:58
|
||||
#: includes/class/class.LSrelation.php:69
|
||||
#: includes/class/class.LSrelation.php:76
|
||||
msgid "listing related objects"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:85
|
||||
#: includes/class/class.LSrelation.php:91
|
||||
#: includes/class/class.LSrelation.php:103
|
||||
#: includes/class/class.LSrelation.php:109
|
||||
msgid "getting key value"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:116
|
||||
#: includes/class/class.LSrelation.php:123
|
||||
#: includes/class/class.LSrelation.php:156
|
||||
#: includes/class/class.LSrelation.php:134
|
||||
#: includes/class/class.LSrelation.php:141
|
||||
#: includes/class/class.LSrelation.php:174
|
||||
msgid "checking right on relation with specific object"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:132
|
||||
#: includes/class/class.LSrelation.php:150
|
||||
msgid "deleting"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:139
|
||||
#: includes/class/class.LSrelation.php:157
|
||||
msgid "removing relation with specific object"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:149
|
||||
#: includes/class/class.LSrelation.php:167
|
||||
msgid "renaming"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:168
|
||||
#: includes/class/class.LSrelation.php:186
|
||||
msgid "updating"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:174
|
||||
#: includes/class/class.LSrelation.php:192
|
||||
msgid "updating relations"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:196 includes/class/class.LSform.php:216
|
||||
#: includes/class/class.LSrelation.php:214 includes/class/class.LSform.php:216
|
||||
#: remove.php:49
|
||||
msgid "Do you really want to delete"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:197
|
||||
#: includes/class/class.LSrelation.php:215
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:225
|
||||
#: includes/class/class.LSrelation.php:339
|
||||
#: includes/class/class.LSrelation.php:243
|
||||
#: includes/class/class.LSrelation.php:364
|
||||
msgid "No object."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:427
|
||||
#: includes/class/class.LSrelation.php:452
|
||||
msgid ""
|
||||
"LSrelation : The function %{function} for action '%{action}' on the relation "
|
||||
"%{relation} is unknow."
|
||||
"%{relation} is unknown."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:430
|
||||
msgid "LSrelation : Relation %{relation} of object type %{LSobject} unknow."
|
||||
#: includes/class/class.LSrelation.php:455
|
||||
msgid "LSrelation : Relation %{relation} of object type %{LSobject} unknown."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:433
|
||||
#: includes/class/class.LSrelation.php:458
|
||||
msgid "LSrelation : Error during relation update of the relation %{relation}."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:436
|
||||
msgid "LSrelation : Object type %{LSobject} unknow (Relation : %{relation})."
|
||||
#: includes/class/class.LSrelation.php:461
|
||||
msgid "LSrelation : Object type %{LSobject} unknown (Relation : %{relation})."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:439
|
||||
#: includes/class/class.LSrelation.php:464
|
||||
msgid ""
|
||||
"LSrelation : Incomplete configuration for LSrelation %{relation} of object "
|
||||
"type %{LSobject} for action : %{action}."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSrelation.php:467
|
||||
msgid ""
|
||||
"LSrelation : Invalid editable attribute for LSrelation %{relation} with "
|
||||
"LSobject %{LSobject}."
|
||||
msgstr ""
|
||||
|
||||
#: includes/class/class.LSformElement_password.php:134
|
||||
msgid "Generate a password."
|
||||
msgstr ""
|
||||
|
|
Loading…
Reference in a new issue