even simpler way to set primary link: "relatedTo/egroupware.org-primary:<app>[:<field>]":"<value>"

if the client only supports a static part as attribute-name, and the straight form-value as attribute-value
This commit is contained in:
ralf 2025-02-25 12:37:09 +01:00
parent cf698f9127
commit cdac041941
2 changed files with 8 additions and 0 deletions

View File

@ -1240,6 +1240,7 @@ class JsCalendar extends JsBase
* - "<app>:<id>": {"@Type":"Relation","relation":"egroupware.org-primary"}
* - "addressbook:<value>:<field>": {"@Type":"Relation","relation":"egroupware.org-primary"}
* - you can use null, instead of the relation object, to unset a relation in a PATCH command
* - "egroupware.org-primary:<app>[:<field>]": "<id-or-value>"
*
* <uid>: InfoLog UID
* <app>: EGroupware app the current user has access to, which participates in linking
@ -1260,6 +1261,12 @@ class JsCalendar extends JsBase
{
throw new \InvalidArgumentException("Missing or invalid @Type!");
}
// allow to use {"egroupware.org-primary:<app>[:<field>]":"<id-or-value>"}
if (str_starts_with($uid, 'egroupware.org-primary:'))
{
$uid = substr($uid, 23).':'.$relation;
$relation = 'egroupware.org-primary';
}
switch($relation['relation'] ?? $relation ?? (strpos($uid, ':') === false ? 'parent' : 'egroupware.org-primary'))
{
case 'parent':

View File

@ -42,6 +42,7 @@ Following RFCs / drafts used/planned for JSON encoding of InfoLog entries
* `"<app>:<id>"` or
* `"addressbook:<value>:<field>"` with addressbook field like `id` or `email` (no `contact_` prefix), or `egroupware.org:customfields/<name>`
* if you client only allows to send a 1-dimensional object you can use `"relatedTo/addressbook:<value>:#<name>":"egroupware.org-primary"`, to specify the contact to link to via a (unique!) custom-field value
* `"egroupware.org-primary:<app>[:<field>]":"<value>"` e.g. `"relatedTo/egroupware.org-primary:addressbook:#myUID":"12345"`
* you can use `null` instead of a Relation-object to delete the existing value (not sending the attribute will NOT delete it!)
* you can use the [`links` sub-collection](Links-and-attachments.md) of each entry to add relations/links to other application-entries
* InfoLogs primary link can also be created via the [`links` sub-collection](Links-and-attachments.md) with a`rel` of `egroupware.org-primary`