Added feature that will allow custom icons on the dashboard of component to use custom links - resolved gh-240. Tweaked the compiler messages.

This commit is contained in:
2018-03-05 02:13:42 +02:00
parent 0c243d75c8
commit a39289ac9c
10 changed files with 197 additions and 136 deletions

View File

@ -3713,7 +3713,9 @@ class Get
// set key
$key = '[EXTERNA'.'LCODE='.$target.']';
// set the notice
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Warning</h3>'), 'Warning');
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> is not a valid url/path!', $key), 'Warning');
$this->app->enqueueMessage('<hr />', 'Warning');
// remove the placeholder
$bucket[$key] = '';
}
@ -3765,7 +3767,9 @@ class Get
// update local hash
$this->db->updateObject('#__componentbuilder_external_code', $object, 'target');
// give notice of the change
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Warning</h3>'), 'Warning');
$this->app->enqueueMessage(JText::sprintf('The code/string from <b>%s</b> has been <b>changed</b> since the last compilation, please investigate to insure the changes are safe!', $key), 'Warning');
$this->app->enqueueMessage('<hr />', 'Warning');
}
}
else
@ -3777,13 +3781,17 @@ class Get
// insert local hash
$this->db->insertObject('#__componentbuilder_external_code', $object);
// give notice the first time this is added
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Notice</h3>'), 'Notice');
$this->app->enqueueMessage(JText::sprintf('The code/string from <b>%s</b> has been added for the <b>first time</b>, please investigate to insure the correct code/string was used!', $key), 'Notice');
$this->app->enqueueMessage('<hr />', 'Notice');
}
}
else
{
// set notice that we could not get a valid string from the target
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Warning</h3>'), 'Warning');
$this->app->enqueueMessage(JText::sprintf('The <b>%s</b> returned an invalid string!', $key), 'Warning');
$this->app->enqueueMessage('<hr />', 'Warning');
}
}
// add to local bucket

View File

@ -12356,69 +12356,80 @@ class Interpretation extends Fields
$nameUpper = ComponentbuilderHelper::safeString($menu['name_code'], 'U');
if (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && $view['adminview'] == $menu['before'])
{
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
if ($type)
{
// TODO must look at adding custom links to icons aswell
return '';
// icon builder loader
$this->iconBuilder[$type .".". $nameList] = 'images/' . $menu['icon'];
}
else
{
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
if ($type)
{
$type = $type . ".";
// icon builder loader
$this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon'];
}
else
{
$type = 'png.';
}
// build lang
$langName = $menu['name'] . '<br /><br />';
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
// add to lang
$this->langContent[$this->lang][$langKey] = $langName;
$type = 'png';
}
// build lang
$langName = $menu['name'] . '<br /><br />';
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
// add to lang
$this->langContent[$this->lang][$langKey] = $langName;
// if this is a link build the icon values with pipe
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
{
// set icon
if ($counter == 0)
{
$counter++;
$icon .= "'" . $type . $nameList . "'";
$icon .= "'".$type."||".$nameList."||".$menu['link']."'";
}
else
{
$counter++;
$icon .= ", '" . $type . $nameList . "'";
$icon .= ", '".$type."||".$nameList."||".$menu['link']."'";
}
}
else
{
// set icon
if ($counter == 0)
{
$counter++;
$icon .= "'" . $type .".". $nameList . "'";
}
else
{
$counter++;
$icon .= ", '" . $type .".". $nameList . "'";
}
}
}
elseif (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && empty($menu['before']))
{
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
if ($type)
{
// TODO must look at adding custom links to icons aswell
return '';
// icon builder loader
$this->iconBuilder[$type .".". $nameList] = 'images/' . $menu['icon'];
}
else
{
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
if ($type)
{
$type = $type . ".";
// icon builder loader
$this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon'];
}
else
{
$type = 'png.';
}
// build lang
$langName = $menu['name'] . '<br /><br />';
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
// add to lang
$this->langContent[$this->lang][$langKey] = $langName;
$type = 'png';
}
// build lang
$langName = $menu['name'] . '<br /><br />';
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
// add to lang
$this->langContent[$this->lang][$langKey] = $langName;
// if this is a link build the icon values with pipe
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
{
// set icon
$this->lastCustomDashboardIcon[$nr] = ", '" . $type . $nameList . "'";
$this->lastCustomDashboardIcon[$nr] = ", '".$type."||".$nameList."||".$menu['link']."'";
}
else
{
// set icon
$this->lastCustomDashboardIcon[$nr] = ", '" . $type .".". $nameList . "'";
}
}
}