detect which type (gif, png or svg) of tree images are available by template

This commit is contained in:
Ralf Becker 2016-02-29 13:45:44 +00:00
parent 0637063660
commit c59442a576
3 changed files with 27 additions and 10 deletions

View File

@ -38,13 +38,13 @@ class mail_tree
* @var array * @var array
*/ */
static $leafImages = array( static $leafImages = array(
'folderNoSelectClosed' => "folderNoSelectClosed.png", 'folderNoSelectClosed' => "folderNoSelectClosed",
'folderNoSelectOpen' => "folderNoSelectOpen.png", 'folderNoSelectOpen' => "folderNoSelectOpen",
'folderOpen' => "folderOpen.png", 'folderOpen' => "folderOpen",
'folderClosed' => "MailFolderClosed.png", 'folderClosed' => "MailFolderClosed",
'folderLeaf' => "MailFolderPlain.png", 'folderLeaf' => "MailFolderPlain",
'folderHome' => "kfm_home.png", 'folderHome' => "kfm_home",
'folderAccount' => "thunderbird.png", 'folderAccount' => "thunderbird",
); );
/** /**
@ -52,8 +52,18 @@ class mail_tree
* *
* @param object $mail_ui * @param object $mail_ui
*/ */
function __construct($mail_ui) { function __construct($mail_ui)
{
$this->ui = $mail_ui; $this->ui = $mail_ui;
// check images available in png or svg
foreach(self::$leafImages as &$image)
{
if (strpos($image, '.') === false)
{
$image = basename($img=common::image('mail', 'dhtmlxtree/'.$image));
}
}
} }
/** /**
@ -73,7 +83,7 @@ class mail_tree
'text' => $_err, 'text' => $_err,
'tooltip' => $_err, 'tooltip' => $_err,
'im0' => self::$leafImages["folderNoSelectClosed"], 'im0' => self::$leafImages["folderNoSelectClosed"],
'im1' => self::$leafImages["folderNoSelectOpen.gif"], 'im1' => self::$leafImages["folderNoSelectOpen"],
'im2' => self::$leafImages["folderNoSelectClosed"], 'im2' => self::$leafImages["folderNoSelectClosed"],
'path'=> $_path, 'path'=> $_path,
'parent' => $_parent 'parent' => $_parent
@ -371,7 +381,14 @@ class mail_tree
if ($createMissingParents) if ($createMissingParents)
{ {
unset($item); unset($item);
$item = array('id' => $parent.$component, 'text' => $component, 'im0' => "folderNoSelectClosed.gif",'im1' => "folderNoSelectOpen.gif",'im2' => "folderNoSelectClosed.gif",'tooltip' => lang('no access')); $item = array(
'id' => $parent.$component,
'text' => $component,
'im0' => self::$leafImages["folderNoSelectClosed"],
'im1' => self::$leafImages["folderNoSelectOpen"],
'im2' => self::$leafImages["folderNoSelectClosed"],
'tooltip' => lang('no access')
);
$insert['item'][] =& $item; $insert['item'][] =& $item;
$insert =& $item; $insert =& $item;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B