API: Allow custom category icons

This commit is contained in:
nathangray 2021-03-31 10:52:41 -06:00
parent 589b18b26f
commit ad1a34a6a6
3 changed files with 20 additions and 4 deletions

View File

@ -260,7 +260,7 @@ class admin_categories
if(!$content['appname']) $content['appname'] = $appname; if(!$content['appname']) $content['appname'] = $appname;
if($content['data']['icon']) if($content['data']['icon'])
{ {
$content['icon_url'] = $content['base_url'] . $content['data']['icon']; $content['icon_url'] = Api\Image::find('vfs',$content['data']['icon']) ?: self::icon_url($content['data']['icon']);
} }
$sel_options['icon'] = self::get_icons(); $sel_options['icon'] = self::get_icons();
@ -363,8 +363,18 @@ class admin_categories
} }
} }
$dir->close(); $dir->close();
asort($icons);
} }
// Get custom icons
$map = Api\Image::map();
if(array_key_exists('vfs', $map))
{
foreach($map['vfs'] as $name => $path)
{
$icons[$name] = $name;
}
}
asort($icons);
return $icons; return $icons;
} }
@ -420,7 +430,7 @@ class admin_categories
$row['level_spacer'] = str_repeat('    ',$row['level']); $row['level_spacer'] = str_repeat('    ',$row['level']);
} }
if ($row['data']['icon']) $row['icon_url'] = self::icon_url($row['data']['icon']); if ($row['data']['icon']) $row['icon_url'] = Api\Image::find('vfs',$row['data']['icon']) ?: self::icon_url($row['data']['icon']);
$row['subs'] = $row['children'] ? count($row['children']) : 0; $row['subs'] = $row['children'] ? count($row['children']) : 0;

View File

@ -179,6 +179,9 @@ select#admin-mailaccount_ident_id {
#admin-acl {width:99%;} #admin-acl {width:99%;}
#admin-categories-edit_owner {overflow-y: auto;} #admin-categories-edit_owner {overflow-y: auto;}
#admin-categories-edit_icon_url {
max-width: 32px;
}
/* /*
Admin command Admin command

View File

@ -187,6 +187,9 @@ select#admin-mailaccount_ident_id {
#admin-categories-edit_owner { #admin-categories-edit_owner {
overflow-y: auto; overflow-y: auto;
} }
#admin-categories-edit_icon_url {
max-width: 32px;
}
/* /*
Admin command Admin command
*/ */
@ -209,7 +212,7 @@ Admin command
@media all { @media all {
div.dhtmlxTree td.standartTreeRow span.selectedTreeRow { div.dhtmlxTree td.standartTreeRow span.selectedTreeRow {
background-color: rgba(102, 153, 204, 0.7); background-color: rgba(102, 153, 204, 0.7);
color: #1E1E1E; color: #1e1e1e;
} }
/* ############################################################################# /* #############################################################################
// iframe // iframe