replace no longer used and existing <et2-tree-multiple.../> with <et2-tree multiple="true".../>

This commit is contained in:
ralf 2024-04-16 09:17:53 +02:00
parent 16b98ce4d1
commit 1913b66b2c
3 changed files with 14 additions and 7 deletions

View File

@ -420,22 +420,24 @@ function send_template()
return "<et2-date$matches[1] $matches[2]></et2-date$matches[1]>"; return "<et2-date$matches[1] $matches[2]></et2-date$matches[1]>";
}, $str); }, $str);
// replace <tree(-cat)? multiple="..." with <et2-tree(-cat)(-multiple) and fix attributes // replace <tree(-cat)? multiple="..." with <et2-tree(-cat) and fix attributes
$str = preg_replace_callback('#<tree(-cat)?\s(.*?)\s*/>#s', static function (array $matches) $str = preg_replace_callback('#<tree(-cat)?\s(.*?)\s*/>#s', static function (array $matches)
{ {
$tag = 'et2-tree'.($matches[1] ?? ''); $tag = 'et2-tree'.($matches[1] ?? '');
$attrs = parseAttrs($matches[2]); $attrs = parseAttrs($matches[2]);
if (!empty($attrs['multiple']) && $attrs['multiple'] !== 'false' || if (!empty($attrs['options']) && (int)$attrs['options'] > 1)
!empty($attrs['options']) && (int)$attrs['options'] > 1)
{ {
$tag .= '-multiple'; $attrs['multiple'] = 'true';
} }
// fix renamed attrs, thought regular under_score to camelCase happens later // fix renamed attrs, thought regular under_score to camelCase happens later
if (!empty($attrs['parent_node'])) $attrs['parentId'] = $attrs['parent_node']; if (!empty($attrs['parent_node'])) $attrs['parentId'] = $attrs['parent_node'];
unset($attrs['multiple'], $attrs['options'], $attrs['parent_node']); unset($attrs['options'], $attrs['parent_node']);
return "<$tag" . stringAttrs($attrs) . "></$tag>"; return "<$tag" . stringAttrs($attrs) . "></$tag>";
}, $str); }, $str);
// replace no longer used <et2-tree-multiple.../> with <et2-tree multiple="true".../>
$str = preg_replace('#<et2-tree-multiple ([^>]+)(/>|</et2-tree-multiple>)#', '<et2-tree multiple="true" $1></et2-tree>', $str);
if ($template === 'mobile') if ($template === 'mobile')
{ {
} }

View File

@ -6,7 +6,9 @@
<et2-description value="Folder Management" class="mail_folder_management_header"></et2-description> <et2-description value="Folder Management" class="mail_folder_management_header"></et2-description>
</et2-hbox> </et2-hbox>
<et2-hbox class="treeContainer"> <et2-hbox class="treeContainer">
<et2-tree-multiple id="tree" multiple="true" autoloading="mail_ui::ajax_folderMgmtTree_autoloading" multimarking="strict" oncheck="app.mail.folderMgmt_onCheck" onselect="app.mail.folderMgmt_onSelect" onopenstart="app.mail.folderMgmt_autoloadingStart" onopenend="app.mail.folderMgmt_autoloadingEnd" highlighting="true"/> <et2-tree id="tree" multiple="true" autoloading="mail_ui::ajax_folderMgmtTree_autoloading" multimarking="strict"
oncheck="app.mail.folderMgmt_onCheck" onselect="app.mail.folderMgmt_onSelect" onopenstart="app.mail.folderMgmt_autoloadingStart"
onopenend="app.mail.folderMgmt_autoloadingEnd" highlighting="true"></et2-tree>
</et2-hbox> </et2-hbox>
<et2-hbox class="dialogFooterToolbar"> <et2-hbox class="dialogFooterToolbar">
<et2-button statustext="Delete" label="Delete" id="button[delete]" onclick="app.mail.folderMgmt_deleteBtn"></et2-button> <et2-button statustext="Delete" label="Delete" id="button[delete]" onclick="app.mail.folderMgmt_deleteBtn"></et2-button>

View File

@ -6,7 +6,10 @@
<et2-description value="Subscription folders" class="mail_subscription_header"></et2-description> <et2-description value="Subscription folders" class="mail_subscription_header"></et2-description>
</et2-hbox> </et2-hbox>
<et2-hbox class="treeContainer"> <et2-hbox class="treeContainer">
<et2-tree-multiple id="foldertree" multiple="true" autoloading="mail_ui::ajax_tree_autoloading" onopenstart="app.mail.subscription_autoloadingStart" onopenend="app.mail.subscription_autoloadingEnd" multimarking="strict" highlighting="true" oncheck="app.mail.folderMgmt_onCheck" onselect="app.mail.folderMgmt_onSelect"/> <et2-tree id="foldertree" multiple="true" autoloading="mail_ui::ajax_tree_autoloading"
onopenstart="app.mail.subscription_autoloadingStart" onopenend="app.mail.subscription_autoloadingEnd"
multimarking="strict" highlighting="true" oncheck="app.mail.folderMgmt_onCheck"
onselect="app.mail.folderMgmt_onSelect"></et2-tree>
</et2-hbox> </et2-hbox>
<et2-hbox class="dialogFooterToolbar"> <et2-hbox class="dialogFooterToolbar">
<et2-button statustext="Saves subscription changes" label="Save" id="button[save]"></et2-button> <et2-button statustext="Saves subscription changes" label="Save" id="button[save]"></et2-button>