mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Et2Image bugfixes
- No src or default_src gives nothing, not missing image - Fix etemplate.php parser so buttons that get converted to images still submit
This commit is contained in:
parent
75e573b6a1
commit
319bd51f80
@ -156,7 +156,16 @@ function send_template()
|
||||
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/', $matches[2], $attrs, PREG_PATTERN_ORDER);
|
||||
$attrs = array_combine($attrs[2], $attrs[3]);
|
||||
// replace buttononly tag with noSubmit="true" attribute
|
||||
if (!empty($matches[1])) $attrs['noSubmit'] = 'true';
|
||||
if(!empty($matches[1]))
|
||||
{
|
||||
$attrs['noSubmit'] = 'true';
|
||||
}
|
||||
// novalidation --> noValidation
|
||||
if(!empty($attrs['novalidation']) && in_array($attrs['novalidation'], ['true', '1'], true))
|
||||
{
|
||||
unset($attrs['novalidation']);
|
||||
$attrs['noValidation'] = 'true';
|
||||
}
|
||||
// replace not set background_image attribute with et2-image tag, if not in NM / lists
|
||||
if(!empty($attrs['image']) && (empty($attrs['background_image']) || $attrs['background_image'] === 'false') &&
|
||||
!preg_match('/^(index|list)/', $name))
|
||||
@ -164,12 +173,11 @@ function send_template()
|
||||
$tag = 'et2-image';
|
||||
$attrs['src'] = $attrs['image'];
|
||||
unset($attrs['image']);
|
||||
}
|
||||
// novalidation --> noValidation
|
||||
if (!empty($attrs['novalidation']) && in_array($attrs['novalidation'], ['true', '1'], true))
|
||||
// Was expected to submit. Images don't have noValidation, so add directly
|
||||
if(!array_key_exists('onclick', $attrs) && empty($attrs['noSubmit']))
|
||||
{
|
||||
unset($attrs['novalidation']);
|
||||
$attrs['noValidation'] = 'true';
|
||||
$attrs['onclick'] = 'this.getInstanceManager().submit(this, undefined, ' . $attrs['noValidation'] . ')';
|
||||
}
|
||||
}
|
||||
unset($attrs['background_image']);
|
||||
return "<$tag ".implode(' ', array_map(function($name, $value)
|
||||
|
@ -104,9 +104,15 @@ export class Et2Image extends Et2Widget(LitElement) implements et2_IDetachedDOM
|
||||
|
||||
render()
|
||||
{
|
||||
let src = this.parse_href(this.src) || this.parse_href(this.default_src);
|
||||
if(!src)
|
||||
{
|
||||
// Hide if no valid image
|
||||
return '';
|
||||
}
|
||||
return html`
|
||||
<img ${this.id ? html`id="${this.id}"` : ''}
|
||||
src="${this.parse_href(this.src) || this.parse_href(this.default_src)}"
|
||||
src="${src}"
|
||||
alt="${this.label}"
|
||||
title="${this.statustext || this.label}"
|
||||
>`;
|
||||
|
Loading…
Reference in New Issue
Block a user