replace et2-tree-cat with et2-select-cat and remove (now unnecessary) et2-tree-cat code from addressbook

This commit is contained in:
ralf 2024-08-24 09:11:47 +02:00
parent 17afd11990
commit d587d3e321
3 changed files with 5 additions and 13 deletions

View File

@ -2282,7 +2282,6 @@ class addressbook_ui extends addressbook_bo
unset($content['button']); unset($content['button']);
$content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p'); $content['private'] = (int) ($content['owner'] && substr($content['owner'],-1) == 'p');
$content['owner'] = (string) (int) $content['owner']; $content['owner'] = (string) (int) $content['owner'];
$content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $content['cat_id_tree'] : $content['cat_id'];
switch($button) switch($button)
{ {
@ -2650,9 +2649,6 @@ class addressbook_ui extends addressbook_bo
// Registry has view_id as contact_id, so set it (custom fields uses it) // Registry has view_id as contact_id, so set it (custom fields uses it)
$content['contact_id'] = $content['id']; $content['contact_id'] = $content['id'];
// Avoid ID conflict with tree & selectboxes
$content['cat_id_tree'] = $content['cat_id'];
// how to display addresses // how to display addresses
$content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']); $content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']);
$content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']); $content['addr_format2'] = $this->addr_format_by_country($content['adr_two_countryname']);
@ -3161,7 +3157,6 @@ class addressbook_ui extends addressbook_bo
{ {
$content['cat_id'] = $this->categories->check_list(Acl::READ,$content['cat_id']); $content['cat_id'] = $this->categories->check_list(Acl::READ,$content['cat_id']);
} }
$content['cat_id_tree'] = $content['cat_id'];
$content['view'] = true; $content['view'] = true;
$content['link_to'] = array( $content['link_to'] = array(
@ -3356,9 +3351,6 @@ class addressbook_ui extends addressbook_bo
{ {
if(!empty($_content)) if(!empty($_content))
{ {
$_content['cat_id'] = $this->config['cat_tab'] === 'Tree' ? $_content['cat_id_tree'] : $_content['cat_id'];
$response = Api\Json\Response::get(); $response = Api\Json\Response::get();
$query = Api\Cache::getSession('addressbook', 'index'); $query = Api\Cache::getSession('addressbook', 'index');
@ -3408,8 +3400,6 @@ class addressbook_ui extends addressbook_bo
$this->tmpl->read('addressbook.edit'); $this->tmpl->read('addressbook.edit');
$content = Api\Cache::getSession('addressbook', 'advanced_search'); $content = Api\Cache::getSession('addressbook', 'advanced_search');
$content['n_fn'] = $this->fullname($content); $content['n_fn'] = $this->fullname($content);
// Avoid ID conflict with tree & selectboxes
$content['cat_id_tree'] = $content['cat_id'];
for($i = -23; $i<=23; $i++) for($i = -23; $i<=23; $i++)
{ {

View File

@ -148,8 +148,7 @@
</columns> </columns>
<rows> <rows>
<row valign="top"> <row valign="top">
<et2-tree-cat id="cat_id_tree" multiple="true" placeholder="Category"/> <et2-select-cat id="cat_id" multiple="true" placeholder="Category"></et2-select-cat>
<et2-select-cat id="cat_id" width="100%" height="195" multiple="true" placeholder="Category"></et2-select-cat>
<et2-description></et2-description> <et2-description></et2-description>
<grid width="100%"> <grid width="100%">
<columns> <columns>

View File

@ -365,7 +365,10 @@ function send_template()
}, $str); }, $str);
// use et2-email instead of et2-select-email // use et2-email instead of et2-select-email
$str = preg_replace('#<et2-select-email\s(.*?")\s*></et2-select-email>#s', '<et2-email $1></et2-email>', $str); $str = preg_replace('#<et2-select-email\s(.*?")\s*/?>(</et2-select-email>)?#s', '<et2-email $1></et2-email>', $str);
// use et2-select-cat instead of et2-tree-cat
$str = preg_replace('#<et2-tree-cat\s(.*?")\s*/?>(</et2-tree-cat>)?#s', '<et2-select-cat $1></et2-select-cat>', $str);
// nextmatch headers // nextmatch headers
$str = preg_replace_callback('#<(nextmatch-)([^ ]+)(header|filter) ([^>]+?)/>#s', static function (array $matches) $str = preg_replace_callback('#<(nextmatch-)([^ ]+)(header|filter) ([^>]+?)/>#s', static function (array $matches)