mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
Et2LinkString: Can now fetch its own link data, given application & entryId
Includes some fixes for only_app filter
This commit is contained in:
parent
38b507dcd1
commit
2ab7079f13
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
|
||||
import {css, html, LitElement, render, TemplateResult, until} from "@lion/core";
|
||||
import {css, html, LitElement, PropertyValues, render, TemplateResult, until} from "@lion/core";
|
||||
import {Et2Widget} from "../Et2Widget/Et2Widget";
|
||||
import {Et2Link, LinkInfo} from "./Et2Link";
|
||||
import {et2_IDetachedDOM} from "../et2_core_interfaces";
|
||||
@ -158,6 +158,19 @@ export class Et2LinkString extends Et2Widget(LitElement) implements et2_IDetache
|
||||
super.requestUpdate();
|
||||
}
|
||||
|
||||
public updated(changedProperties : PropertyValues)
|
||||
{
|
||||
super.updated(changedProperties);
|
||||
|
||||
if((changedProperties.has("application") || changedProperties.has("entryId") || changedProperties.has("onlyApp") || changedProperties.has("linkType")) &&
|
||||
this.application && this.entryId
|
||||
)
|
||||
{
|
||||
// Something changed, and we have the information needed to get the matching links
|
||||
this.get_links();
|
||||
}
|
||||
}
|
||||
|
||||
public render() : TemplateResult
|
||||
{
|
||||
// This shows loading template until loadingPromise resolves, then shows _listTemplate
|
||||
@ -253,8 +266,8 @@ export class Et2LinkString extends Et2Widget(LitElement) implements et2_IDetache
|
||||
let _value = {
|
||||
to_app: this.application,
|
||||
to_id: this.entryId,
|
||||
onlyApp: this.onlyApp,
|
||||
showDeleted: this.showDeleted
|
||||
only_app: this.onlyApp,
|
||||
show_deleted: this.showDeleted
|
||||
};
|
||||
if(this._loadingPromise)
|
||||
{
|
||||
|
@ -186,18 +186,31 @@ class Link extends Etemplate\Widget
|
||||
public static function ajax_link_list($value)
|
||||
{
|
||||
$app = $value['to_app'];
|
||||
$id = $value['to_id'];
|
||||
$id = $value['to_id'];
|
||||
|
||||
$links = Api\Link::get_links($app,$id,$value['only_app'],'link_lastmod DESC',true, $value['show_deleted']);
|
||||
foreach($links as &$link)
|
||||
$links = Api\Link::get_links($app, $id, $value['only_app'], 'link_lastmod DESC', true, $value['show_deleted']);
|
||||
$only_links = [];
|
||||
if($value['only_app'])
|
||||
{
|
||||
$link['title'] = Api\Link::title($link['app'],$link['id'],$link);
|
||||
if ($link['app'] == Api\Link::VFS_APPNAME)
|
||||
$only_links = Api\Link::get_links_multiple($value['only_app'], $links);
|
||||
}
|
||||
foreach($links as $link_id => &$link)
|
||||
{
|
||||
if(!is_array($link) && array_key_exists($link, $only_links))
|
||||
{
|
||||
$only_id = $link;
|
||||
$link = array_merge(
|
||||
$only_links[$link][$link_id],
|
||||
['id' => $only_id, 'app' => $value['only_app']]
|
||||
);
|
||||
}
|
||||
$link['title'] = Api\Link::title($link['app'], $link['id'], $link);
|
||||
if($link['app'] == Api\Link::VFS_APPNAME)
|
||||
{
|
||||
$link['target'] = '_blank';
|
||||
$link['help'] = lang('Delete this file');
|
||||
$link['title'] = Api\Vfs::decodePath($link['title']);
|
||||
$link['icon'] = Api\Link::vfs_path($link['app2'],$link['id2'],$link['id'],true);
|
||||
$link['icon'] = Api\Link::vfs_path($link['app2'], $link['id2'], $link['id'], true);
|
||||
|
||||
$link['download_url'] = Api\Vfs::download_url($link['icon']);
|
||||
// Make links to directories load in filemanager
|
||||
|
@ -536,7 +536,7 @@ class Link extends Link\Storage
|
||||
$app_ids = array();
|
||||
foreach($ids as $link)
|
||||
{
|
||||
$app_ids[$link['app']][] = $link['id'];
|
||||
$app_ids[$only_app ? $only_app : $link['app']][] = is_array($link) ? $link['id'] : $link;
|
||||
}
|
||||
foreach($app_ids as $appname => $a_ids)
|
||||
{
|
||||
@ -545,7 +545,7 @@ class Link extends Link\Storage
|
||||
// remove links, current user has no access, from result
|
||||
foreach($ids as $key => $link)
|
||||
{
|
||||
if (!self::title($link['app'],$link['id']))
|
||||
if(!self::title(is_array($link) ? $link['app'] : $only_app, is_array($link) ? $link['id'] : $link))
|
||||
{
|
||||
unset($ids[$key]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user