mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
fix setting InfoLog primary link
This commit is contained in:
parent
00cf7cf56d
commit
d472c267b2
@ -2055,6 +2055,12 @@ class CalDAV extends HTTP_WebDAV_Server
|
|||||||
}
|
}
|
||||||
if (($handler = $this->app_handler($app)))
|
if (($handler = $this->app_handler($app)))
|
||||||
{
|
{
|
||||||
|
// handle links for all apps supporting links
|
||||||
|
if ($method === 'POST' && preg_match('#/'.$app.'/'.$id.'/links/#', $options['path']))
|
||||||
|
{
|
||||||
|
return $handler->createLink($options, $id);
|
||||||
|
}
|
||||||
|
|
||||||
$status = $handler->put($options, $id, $user, $prefix, $method, $_SERVER['HTTP_CONTENT_TYPE']);
|
$status = $handler->put($options, $id, $user, $prefix, $method, $_SERVER['HTTP_CONTENT_TYPE']);
|
||||||
|
|
||||||
// set default stati: true --> 204 No Content, false --> should be already handled
|
// set default stati: true --> 204 No Content, false --> should be already handled
|
||||||
|
@ -80,7 +80,7 @@ Location: https://example.org/egroupware/groupdav.php/<username>/<app>/<id>/link
|
|||||||
|
|
||||||
```
|
```
|
||||||
curl -i 'https://example.org/egroupware/groupdav.php/<username>/<app>/<id>/links/' -H "Content-Type: application/json" --data-binary @- --user <username> <<<EOF
|
curl -i 'https://example.org/egroupware/groupdav.php/<username>/<app>/<id>/links/' -H "Content-Type: application/json" --data-binary @- --user <username> <<<EOF
|
||||||
{"application":"<2nd-app>","id":<2nd-app-id>,"remark":"This is a test ;)"}
|
{"app":"<2nd-app>","id":<2nd-app-id>,"remark":"This is a test ;)"}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
HTTP/1.1 204 Created
|
HTTP/1.1 204 Created
|
||||||
@ -93,7 +93,7 @@ Location: https://example.org/egroupware/groupdav.php/<username>/<app>/<id>/link
|
|||||||
|
|
||||||
```
|
```
|
||||||
curl -i 'https://example.org/egroupware/groupdav.php/<username>/infolog/<id>/links/' -H "Content-Type: application/json" --data-binary @- --user <username> <<<EOF
|
curl -i 'https://example.org/egroupware/groupdav.php/<username>/infolog/<id>/links/' -H "Content-Type: application/json" --data-binary @- --user <username> <<<EOF
|
||||||
{"application":"<2nd-app>","id":<2nd-app-id>,"rel":"egroupware.org-primary"}
|
{"app":"<2nd-app>","id":<2nd-app-id>,"rel":"egroupware.org-primary"}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
HTTP/1.1 204 Created
|
HTTP/1.1 204 Created
|
||||||
@ -101,6 +101,9 @@ Location: https://example.org/egroupware/groupdav.php/<username>/infolog/<id>/li
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
> `<id>` is the numerical ID of the entry of application `<app>`, NOT the UUID some applications have!
|
||||||
|
> `<2nd-app-id>` is also the numerical ID of `<2nd-app>`, not the UUID
|
||||||
|
|
||||||
* **DELETE** request to remove a link or attachment
|
* **DELETE** request to remove a link or attachment
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
@ -76,8 +76,13 @@ class infolog_groupdav extends Api\CalDAV\Handler
|
|||||||
$this->bo = new infolog_bo();
|
$this->bo = new infolog_bo();
|
||||||
$this->vCalendar = new Horde_Icalendar;
|
$this->vCalendar = new Horde_Icalendar;
|
||||||
|
|
||||||
|
if (Api\CalDAV::isJSON())
|
||||||
|
{
|
||||||
|
self::$path_attr = 'info_id';
|
||||||
|
self::$path_extension = '';
|
||||||
|
}
|
||||||
// since 1.9.002 we allow clients to specify the URL when creating a new event, as specified by CalDAV
|
// since 1.9.002 we allow clients to specify the URL when creating a new event, as specified by CalDAV
|
||||||
if (version_compare($GLOBALS['egw_info']['apps']['calendar']['version'], '1.9.002', '>='))
|
elseif (version_compare($GLOBALS['egw_info']['apps']['calendar']['version'], '1.9.002', '>='))
|
||||||
{
|
{
|
||||||
self::$path_attr = 'caldav_name';
|
self::$path_attr = 'caldav_name';
|
||||||
self::$path_extension = '';
|
self::$path_extension = '';
|
||||||
@ -951,10 +956,13 @@ class infolog_groupdav extends Api\CalDAV\Handler
|
|||||||
throw new Api\Exception\NotFound();
|
throw new Api\Exception\NotFound();
|
||||||
}
|
}
|
||||||
$info['info_link_id'] = $link_id;
|
$info['info_link_id'] = $link_id;
|
||||||
$info['info_from'] = Link::titel($data['app'], $data['id']);
|
$info['info_from'] = Api\Link::title($data['app'], $data['id']);
|
||||||
$info['info_custom_from'] = false;
|
$info['info_custom_from'] = false;
|
||||||
|
|
||||||
if (!$this->bo->write($info))
|
// this is somehow required to update info_link_id, otherwise info_link_id get reset again to old value
|
||||||
|
$info['info_contact'] = array_intersect_key($data, array_flip(['app', 'id']));
|
||||||
|
|
||||||
|
if (!$this->bo->write($info, false, true, false))
|
||||||
{
|
{
|
||||||
throw new Api\Exception("Error storing InfoLog");
|
throw new Api\Exception("Error storing InfoLog");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user