Fix Et2Image did not double-transform src for as legacy image did

eg:
if $content[0][type] = "group"
${row}[type] => "0[type]" (single transform)
0[type] => "group" (double transform)

Also, fix type from addressbook list to not need double-transform
This commit is contained in:
nathan 2022-04-11 15:03:24 -06:00
parent 6ed888a80e
commit e3be42721e
3 changed files with 25 additions and 2 deletions

View File

@ -100,7 +100,7 @@
</vbox>
</row>
<row class="$row_cont[class] $row_cont[cat_id]" valign="top">
<image align="center" label="$row_cont[type_label]" src="${row}[type]" no_lang="1"/>
<et2-image align="center" label="$row_cont[type_label]" src="$row_cont[type]" no_lang="1"/>
<vbox id="${row}[id]">
<description id="${row}[line1]" no_lang="1"/>
<description id="${row}[line2]" no_lang="1"/>

View File

@ -13,7 +13,7 @@
use EGroupware\Api;
// add et2- prefix to following widgets/tags
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|textbox|textarea|button|colorpicker|description|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|textbox|textarea|button|colorpicker|description|image|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_LAST_GROUP = 5;
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression

View File

@ -155,6 +155,29 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM
}
}
transformAttributes(_attrs : any)
{
super.transformAttributes(_attrs);
// Expand src with additional stuff. Copy & paste from legacy.
if(typeof _attrs["src"] != "undefined")
{
let manager = this.getArrayMgr("content");
if(manager && _attrs["src"])
{
let src = manager.getEntry(_attrs["src"], false, true);
if(typeof src != "undefined" && src !== null)
{
if(typeof src == "object")
{
src = egw().link('/index.php', src);
}
this.src = src;
}
}
}
}
/**
* Code for implementing et2_IDetachedDOM
*