fix et2-button attribute hideOnReadonly was removed from the template

add hideOnReadonly to timesheet.edit buttons
also move link widgets to legacy-regexp, so we can drop the old expose code
This commit is contained in:
ralf 2022-05-12 18:14:21 +02:00
parent b9d145a40b
commit 485fa5e857
2 changed files with 12 additions and 12 deletions

View File

@ -13,11 +13,11 @@
use EGroupware\Api;
// add et2- prefix to following widgets/tags, if NO <overlay legacy="true"
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|date(-time[^\s]*|-duration|-since)?|textbox|textarea|button|colorpicker|description|image|link|link-string|link-list|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_REGEXP = '#<((/?)([vh]?box|date(-time[^\s]*|-duration|-since)?|textbox|textarea|button|colorpicker|description|image|url(-email|-phone|-fax)?))(/?|\s[^>]*)>#m';
const ADD_ET2_PREFIX_LAST_GROUP = 6;
// unconditional of legacy add et2- prefix to this widgets
const ADD_ET2_PREFIX_LEGACY_REGEXP = '#<(vfs-mime)\s([^/>]+)/>#m';
const ADD_ET2_PREFIX_LEGACY_REGEXP = '#<(vfs-mime|link|link-string|link-list)\s([^/>]+)/>#m';
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
ini_set('zlib.output_compression', 0);
@ -70,7 +70,7 @@ function send_template()
// Change splitter dockside -> primary + vertical
$str = preg_replace_callback('#<split([^>]*?)>(.*)</split>#su', static function ($matches) use ($name) {
$tag = 'et2-split';
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/', $matches[1], $attrs, PREG_PATTERN_ORDER);
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/i', $matches[1], $attrs, PREG_PATTERN_ORDER);
$attrs = array_combine($attrs[2], $attrs[3]);
$attrs['vertical'] = $attrs['orientation'] === 'h' ? "true" : "false";
@ -192,7 +192,7 @@ function send_template()
// fix <button(only)?.../> --> <et2-button(-image)? noSubmit="true".../>
$str = preg_replace_callback('#<button(only)?\s(.*?)/>#u', function ($matches) use ($name) {
$tag = 'et2-button';
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/', $matches[2], $attrs, PREG_PATTERN_ORDER);
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/i', $matches[2], $attrs, PREG_PATTERN_ORDER);
$attrs = array_combine($attrs[2], $attrs[3]);
// replace buttononly tag with noSubmit="true" attribute
if (!empty($matches[1]))
@ -234,7 +234,7 @@ function send_template()
// handling of date and partially implemented select widget (no search or tags attribute), incl. removing of type attribute
$str = preg_replace_callback('#<(select)(-[^ ]+)? ([^>]+)/>#', static function (array $matches) {
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/', $matches[3], $attrs, PREG_PATTERN_ORDER);
preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/i', $matches[3], $attrs, PREG_PATTERN_ORDER);
$attrs = array_combine($attrs[2], $attrs[3]);
// add et2-prefix for <date-* and <select-* without search or tags attribute

View File

@ -156,18 +156,18 @@
<row class="dialogFooterToolbar">
<hbox orient="0" span="all">
<hbox>
<button statustext="Edit this entry" label="Edit" id="button[edit]" image="edit" background_image="1"/>
<button statustext="Saves this entry and add a new one" label="Save &amp; New" id="button[save_new]" image="save_new" background_image="1"/>
<button statustext="Saves the changes made" label="Save" id="button[save]" image="save" background_image="1"/>
<button statustext="Applies the changes made" label="Apply" id="button[apply]" image="apply" background_image="1"/>
<button hideOnReadonly="true" statustext="Edit this entry" label="Edit" id="button[edit]" image="edit" background_image="1"/>
<button hideOnReadonly="true" statustext="Saves this entry and add a new one" label="Save &amp; New" id="button[save_new]" image="save_new" background_image="1"/>
<button hideOnReadonly="true" statustext="Saves the changes made" label="Save" id="button[save]" image="save" background_image="1"/>
<button hideOnReadonly="true" statustext="Applies the changes made" label="Apply" id="button[apply]" image="apply" background_image="1"/>
<button statustext="closes the window without saving the changes" label="Cancel" id="button[cancel]" onclick="window.close();" image="cancel" background_image="1"/>
<html id="js"/>
</hbox>
<button align="right" statustext="Delete this entry" label="Delete" id="button[delete]" onclick="et2_dialog.confirm(widget,'Delete this entry','Delete')" image="delete" background_image="1"/>
<button align="right" statustext="Restore this entry" label="Undelete" id="button[undelete]" image="undelete" background_image="1"/>
<button hideOnReadonly="true" align="right" statustext="Delete this entry" label="Delete" id="button[delete]" onclick="et2_dialog.confirm(widget,'Delete this entry','Delete')" image="delete" background_image="1"/>
<button hideOnReadonly="true" align="right" statustext="Restore this entry" label="Undelete" id="button[undelete]" image="undelete" background_image="1"/>
</hbox>
</row>
</rows>
</grid>
</template>
</overlay>
</overlay>