Fix missing admin default icons, tree icons had to be in dhtmlxtree

This commit is contained in:
nathan 2024-02-16 11:06:39 -07:00
parent 48ed89b76f
commit fd52ed1ffe
3 changed files with 13 additions and 7 deletions

View File

@ -566,7 +566,7 @@ class admin_ui
} }
if (!empty($data['icon'])) if (!empty($data['icon']))
{ {
$icon = Etemplate\Widget\Tree::imagePath($data['icon']); $icon = $data['icon'];
if (!empty($data['child']) || !empty($data[Tree::CHILDREN])) if (!empty($data['child']) || !empty($data[Tree::CHILDREN]))
{ {
$data[Tree::IMAGE_FOLDER_OPEN] = $data[Tree::IMAGE_FOLDER_CLOSED] = $icon; $data[Tree::IMAGE_FOLDER_OPEN] = $data[Tree::IMAGE_FOLDER_CLOSED] = $icon;
@ -576,6 +576,10 @@ class admin_ui
$data[Tree::IMAGE_LEAF] = $icon; $data[Tree::IMAGE_LEAF] = $icon;
} }
} }
else
{
// $data[Tree::IMAGE_LEAF] = Api\Image::find('api', 'bullet');
}
unset($data['icon']); unset($data['icon']);
$parent =& $tree[Tree::CHILDREN]; $parent =& $tree[Tree::CHILDREN];
$parts = explode('/', $data[Tree::ID]); $parts = explode('/', $data[Tree::ID]);
@ -587,8 +591,12 @@ class admin_ui
$path .= ($path == '/' ? '' : '/').$part; $path .= ($path == '/' ? '' : '/').$part;
if (!isset($parent[$path])) if (!isset($parent[$path]))
{ {
$icon = Etemplate\Widget\Tree::imagePath($part == 'apps' ? Api\Image::find('api', 'home') : $icon = $part == 'apps' ? Api\Image::find('api', 'home') :
(($i=Api\Image::find($part, 'navbar')) ? $i : Api\Image::find('api', 'nonav'))); (($i = Api\Image::find($part, 'navbar')) ? $i : Api\Image::find('api', 'nonav'));
if(!str_ends_with($icon, '.svg'))
{
$icon = Api\Image::find('api', 'navbar');
}
$parent[$path] = array( $parent[$path] = array(
Tree::ID => $path, Tree::ID => $path,
Tree::LABEL => $part == 'apps' ? lang('Applications') : lang($part), Tree::LABEL => $part == 'apps' ? lang('Applications') : lang($part),

View File

@ -606,8 +606,6 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
{ {
//sl-icon images need to be svgs if there is a png try to find the corresponding svg //sl-icon images need to be svgs if there is a png try to find the corresponding svg
img = img.endsWith(".png") ? img.replace(".png", ".svg") : img; img = img.endsWith(".png") ? img.replace(".png", ".svg") : img;
img = "api/templates/default/images/dhtmlxtree/" + img
} }
// Check to see if node is marked as open with no children. If autoloadable, load the children // Check to see if node is marked as open with no children. If autoloadable, load the children

View File

@ -87,7 +87,7 @@ class mail_tree
{ {
if (strpos($image, '.') === false) if (strpos($image, '.') === false)
{ {
$image = basename($img=Api\Image::find('mail', 'dhtmlxtree/'.$image)); $image = Api\Image::find('mail', 'dhtmlxtree/' . $image);
} }
} }
} }
@ -431,7 +431,7 @@ class mail_tree
//User defined folders icons //User defined folders icons
$data[Tree::IMAGE_LEAF] = $data[Tree::IMAGE_LEAF] =
$data[Tree::IMAGE_FOLDER_OPEN] = $data[Tree::IMAGE_FOLDER_OPEN] =
$data [Tree::IMAGE_FOLDER_CLOSED] = basename(Api\Image::find('mail', 'dhtmlxtree/'."MailFolder".$key)); $data [Tree::IMAGE_FOLDER_CLOSED] = Api\Image::find('mail', 'dhtmlxtree/' . "MailFolder" . $key);
} }
elseif(!empty($data['folderarray']['attributes']) && stripos(array2string($data['folderarray']['attributes']),'\noselect') !== false) elseif(!empty($data['folderarray']['attributes']) && stripos(array2string($data['folderarray']['attributes']),'\noselect') !== false)
{ {