diff --git a/api/js/etemplate/Et2Link/Et2LinkList.ts b/api/js/etemplate/Et2Link/Et2LinkList.ts index b4105e9a22..aefc4049f9 100644 --- a/api/js/etemplate/Et2Link/Et2LinkList.ts +++ b/api/js/etemplate/Et2Link/Et2LinkList.ts @@ -152,9 +152,10 @@ export class Et2LinkList extends Et2LinkString */ protected _linkTemplate(link) : TemplateResult { + const id = typeof link.id === "string" ? link.id : link.link_id; return html` ${this._thumbnailTemplate(link)} - `; + src=${this.egw().image("" + link.icon)}>`; } /** diff --git a/api/js/etemplate/Et2Link/Et2LinkString.ts b/api/js/etemplate/Et2Link/Et2LinkString.ts index 1520005b5c..ada5db4755 100644 --- a/api/js/etemplate/Et2Link/Et2LinkString.ts +++ b/api/js/etemplate/Et2Link/Et2LinkString.ts @@ -123,22 +123,36 @@ export class Et2LinkString extends Et2Widget(LitElement) implements et2_IDetache { _value.to_app = this.application; } - if(typeof _value == 'object' && !Array.isArray(_value) && _value.to_app && _value.to_id) + + // We have app & ID - fetch list + if(typeof _value == 'object' && !Array.isArray(_value) && _value.to_app && _value.to_id && typeof _value.to_id === "string") { this.application = _value.to_app; this.entryId = _value.to_id; this.get_links(); return; } + + // CSV list of IDs for one app if(typeof _value === "string") { let ids = _value.split(","); ids.forEach((id) => (this._link_list).push({app: this.application, id: id})); } + // List of LinkInfo else if(Array.isArray(_value)) { this._link_list = _value; } + // List of LinkInfo stuffed into to_id - entry is not yet saved + else if(typeof _value.to_id !== "string") + { + this.entryId = _value.to_id; + Object.keys(_value.to_id).forEach((key) => + { + this._link_list.push(_value.to_id[key]); + }); + } this._addLinks(this._link_list); super.requestUpdate(); } @@ -170,10 +184,11 @@ export class Et2LinkString extends Et2Widget(LitElement) implements et2_IDetache * @returns {TemplateResult} * @protected */ - protected _linkTemplate(link) : TemplateResult + protected _linkTemplate(link : LinkInfo) : TemplateResult { + const id = typeof link.id === "string" ? link.id : link.link_id; return html` - `; + `; } /** diff --git a/api/src/Link.php b/api/src/Link.php index d821eb5bec..cf1c8103e1 100644 --- a/api/src/Link.php +++ b/api/src/Link.php @@ -426,10 +426,11 @@ class Link extends Link\Storage $link_id = self::temp_link_id($app2,$id2); $id1[$link_id] = array( - 'app' => $app2, - 'id' => $id2, - 'remark' => $remark, - 'owner' => $owner, + 'app' => $app2, + 'id' => $id2, + 'title' => $id2['title'] ?? $id2['name'], + 'remark' => $remark, + 'owner' => $owner, 'link_id' => $link_id, 'lastmod' => time() ); diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 506b19bbf5..ec6ad0ef38 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -1788,7 +1788,7 @@ class calendar_uiforms extends calendar_ui $content['participants']['status_date'] = $preserv['actual_date']; // set notify_externals in participants from cfs - if (!empty($event['##notify_externals'])) + if(!empty($event['##notify_externals'])) { $content['participants']['notify_externals'] = $event['##notify_externals']; } @@ -1796,17 +1796,19 @@ class calendar_uiforms extends calendar_ui { $content['participants']['notify_externals'] = $this->cal_prefs['notify_externals']; } - $preserved = array_merge($preserv,$content); + $preserved = array_merge($preserv, $content); + // Don't preserve link_to, it causes problems if user removes a link + unset($preserved['link_to']); $event['new_alarm']['options'] = $content['new_alarm']['options']; - if ($event['alarm']) + if($event['alarm']) { // makes keys of the alarm-array starting with 1 $content['alarm'] = array(false); foreach(array_values($event['alarm']) as $id => $alarm) { - if (!$alarm['all'] && !$this->bo->check_perms(Acl::READ,0,$alarm['owner'])) + if(!$alarm['all'] && !$this->bo->check_perms(Acl::READ, 0, $alarm['owner'])) { - continue; // no read rights to the calendar of the alarm-owner, dont show the alarm + continue; // no read rights to the calendar of the alarm-owner, dont show the alarm } $alarm['all'] = (int) $alarm['all']; // fix alarm time in case of alread run alarms, where the time will be their keep_time / when they will be cleaned up otherwise