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:
parent
0c243d75c8
commit
a39289ac9c
@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 3rd March, 2018
|
+ *Last Build*: 5th March, 2018
|
||||||
+ *Version*: 2.6.17
|
+ *Version*: 2.6.17
|
||||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
+ *Line count*: **183567**
|
+ *Line count*: **183587**
|
||||||
+ *Field count*: **1645**
|
+ *Field count*: **1645**
|
||||||
+ *File count*: **1169**
|
+ *File count*: **1169**
|
||||||
+ *Folder count*: **189**
|
+ *Folder count*: **189**
|
||||||
|
@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 3rd March, 2018
|
+ *Last Build*: 5th March, 2018
|
||||||
+ *Version*: 2.6.17
|
+ *Version*: 2.6.17
|
||||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
+ *Line count*: **183567**
|
+ *Line count*: **183587**
|
||||||
+ *Field count*: **1645**
|
+ *Field count*: **1645**
|
||||||
+ *File count*: **1169**
|
+ *File count*: **1169**
|
||||||
+ *Folder count*: **189**
|
+ *Folder count*: **189**
|
||||||
|
@ -48,6 +48,7 @@ class ###Component###Model###Component### extends JModelList
|
|||||||
$viewGroups = array(
|
$viewGroups = array(
|
||||||
'main' => array(###DASHBOARDICONS###)
|
'main' => array(###DASHBOARDICONS###)
|
||||||
);###DASHBOARDICONACCESS###
|
);###DASHBOARDICONACCESS###
|
||||||
|
// loop over the $views
|
||||||
foreach($viewGroups as $group => $views)
|
foreach($viewGroups as $group => $views)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -56,7 +57,22 @@ class ###Component###Model###Component### extends JModelList
|
|||||||
foreach($views as $view)
|
foreach($views as $view)
|
||||||
{
|
{
|
||||||
$add = false;
|
$add = false;
|
||||||
if (strpos($view,'.') !== false)
|
// external views (links)
|
||||||
|
if (strpos($view,'||') !== false)
|
||||||
|
{
|
||||||
|
$dwd = explode('||', $view);
|
||||||
|
if (count($dwd) == 3)
|
||||||
|
{
|
||||||
|
list($type, $name, $url) = $dwd;
|
||||||
|
$viewName = $name;
|
||||||
|
$alt = $name;
|
||||||
|
$url = $url;
|
||||||
|
$image = $name.'.'.$type;
|
||||||
|
$name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// internal views
|
||||||
|
elseif (strpos($view,'.') !== false)
|
||||||
{
|
{
|
||||||
$dwd = explode('.', $view);
|
$dwd = explode('.', $view);
|
||||||
if (count($dwd) == 3)
|
if (count($dwd) == 3)
|
||||||
@ -74,7 +90,7 @@ class ###Component###Model###Component### extends JModelList
|
|||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case 'add':
|
case 'add':
|
||||||
$url ='index.php?option=com_###component###&view='.$name.'&layout=edit';
|
$url = 'index.php?option=com_###component###&view='.$name.'&layout=edit';
|
||||||
$image = $name.'_'.$action.'.'.$type;
|
$image = $name.'_'.$action.'.'.$type;
|
||||||
$alt = $name.' '.$action;
|
$alt = $name.' '.$action;
|
||||||
$name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD';
|
$name = 'COM_###COMPONENT###_DASHBOARD_'.###Component###Helper::safeString($name,'U').'_ADD';
|
||||||
|
@ -88,18 +88,22 @@ class ###Component###Controller extends JControllerLegacy
|
|||||||
|
|
||||||
protected function getViewRelation($view)
|
protected function getViewRelation($view)
|
||||||
{
|
{
|
||||||
|
// check the we have a value
|
||||||
if (###Component###Helper::checkString($view))
|
if (###Component###Helper::checkString($view))
|
||||||
{
|
{
|
||||||
|
// the view relationships
|
||||||
$views = array(###VIEWARRAY###
|
$views = array(###VIEWARRAY###
|
||||||
);
|
);
|
||||||
// check if this is a list view
|
// check if this is a list view
|
||||||
if (in_array($view,$views))
|
if (in_array($view, $views))
|
||||||
{
|
{
|
||||||
|
// this is a list view
|
||||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||||
}
|
}
|
||||||
// check if it is an edit view
|
// check if it is an edit view
|
||||||
elseif (array_key_exists($view,$views))
|
elseif (array_key_exists($view, $views))
|
||||||
{
|
{
|
||||||
|
// this is a edit view
|
||||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,10 @@ class ComponentbuilderController extends JControllerLegacy
|
|||||||
|
|
||||||
protected function getViewRelation($view)
|
protected function getViewRelation($view)
|
||||||
{
|
{
|
||||||
|
// check the we have a value
|
||||||
if (ComponentbuilderHelper::checkString($view))
|
if (ComponentbuilderHelper::checkString($view))
|
||||||
{
|
{
|
||||||
|
// the view relationships
|
||||||
$views = array(
|
$views = array(
|
||||||
'joomla_component' => 'joomla_components',
|
'joomla_component' => 'joomla_components',
|
||||||
'admin_view' => 'admin_views',
|
'admin_view' => 'admin_views',
|
||||||
@ -120,13 +122,15 @@ class ComponentbuilderController extends JControllerLegacy
|
|||||||
'library_files_folders_urls' => 'libraries_files_folders_urls'
|
'library_files_folders_urls' => 'libraries_files_folders_urls'
|
||||||
);
|
);
|
||||||
// check if this is a list view
|
// check if this is a list view
|
||||||
if (in_array($view,$views))
|
if (in_array($view, $views))
|
||||||
{
|
{
|
||||||
|
// this is a list view
|
||||||
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view);
|
||||||
}
|
}
|
||||||
// check if it is an edit view
|
// check if it is an edit view
|
||||||
elseif (array_key_exists($view,$views))
|
elseif (array_key_exists($view, $views))
|
||||||
{
|
{
|
||||||
|
// this is a edit view
|
||||||
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
return array('edit' => true, 'view' => $view, 'views' => $views[$view]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,9 @@ class Compiler extends Infusion
|
|||||||
// the correct string
|
// the correct string
|
||||||
$externalCodeString = ($externalCount == 1) ? JText::_('code/string') : JText::_('code/strings');
|
$externalCodeString = ($externalCount == 1) ? JText::_('code/string') : JText::_('code/strings');
|
||||||
// the notice
|
// the notice
|
||||||
|
$this->app->enqueueMessage(JText::_('<hr /><h3>External Code Notice</h3>'), 'Notice');
|
||||||
$this->app->enqueueMessage(JText::sprintf('There has been <b>%s - %s</b> added to this component as EXTERNALCODE. To avoid shipping your component with malicious %s always make sure that the correct <b>code/string values</b> were used.', $externalCount, $externalCodeString, $externalCodeString), 'Notice');
|
$this->app->enqueueMessage(JText::sprintf('There has been <b>%s - %s</b> added to this component as EXTERNALCODE. To avoid shipping your component with malicious %s always make sure that the correct <b>code/string values</b> were used.', $externalCount, $externalCodeString, $externalCodeString), 'Notice');
|
||||||
|
$this->app->enqueueMessage('<hr />', 'Notice');
|
||||||
}
|
}
|
||||||
// end the timer here
|
// end the timer here
|
||||||
$this->time_end = microtime(true);
|
$this->time_end = microtime(true);
|
||||||
|
@ -3713,7 +3713,9 @@ class Get
|
|||||||
// set key
|
// set key
|
||||||
$key = '[EXTERNA'.'LCODE='.$target.']';
|
$key = '[EXTERNA'.'LCODE='.$target.']';
|
||||||
// set the notice
|
// 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(JText::sprintf('The <b>%s</b> is not a valid url/path!', $key), 'Warning');
|
||||||
|
$this->app->enqueueMessage('<hr />', 'Warning');
|
||||||
// remove the placeholder
|
// remove the placeholder
|
||||||
$bucket[$key] = '';
|
$bucket[$key] = '';
|
||||||
}
|
}
|
||||||
@ -3765,7 +3767,9 @@ class Get
|
|||||||
// update local hash
|
// update local hash
|
||||||
$this->db->updateObject('#__componentbuilder_external_code', $object, 'target');
|
$this->db->updateObject('#__componentbuilder_external_code', $object, 'target');
|
||||||
// give notice of the change
|
// 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(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
|
else
|
||||||
@ -3777,13 +3781,17 @@ class Get
|
|||||||
// insert local hash
|
// insert local hash
|
||||||
$this->db->insertObject('#__componentbuilder_external_code', $object);
|
$this->db->insertObject('#__componentbuilder_external_code', $object);
|
||||||
// give notice the first time this is added
|
// 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(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
|
else
|
||||||
{
|
{
|
||||||
// set notice that we could not get a valid string from the target
|
// 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(JText::sprintf('The <b>%s</b> returned an invalid string!', $key), 'Warning');
|
||||||
|
$this->app->enqueueMessage('<hr />', 'Warning');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add to local bucket
|
// add to local bucket
|
||||||
|
@ -12355,70 +12355,81 @@ class Interpretation extends Fields
|
|||||||
$nameList = ComponentbuilderHelper::safeString($menu['name_code']);
|
$nameList = ComponentbuilderHelper::safeString($menu['name_code']);
|
||||||
$nameUpper = ComponentbuilderHelper::safeString($menu['name_code'], 'U');
|
$nameUpper = ComponentbuilderHelper::safeString($menu['name_code'], 'U');
|
||||||
if (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && $view['adminview'] == $menu['before'])
|
if (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && $view['adminview'] == $menu['before'])
|
||||||
{
|
|
||||||
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
|
|
||||||
{
|
|
||||||
// TODO must look at adding custom links to icons aswell
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
|
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
|
||||||
if ($type)
|
if ($type)
|
||||||
{
|
{
|
||||||
$type = $type . ".";
|
|
||||||
// icon builder loader
|
// icon builder loader
|
||||||
$this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon'];
|
$this->iconBuilder[$type .".". $nameList] = 'images/' . $menu['icon'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$type = 'png.';
|
$type = 'png';
|
||||||
}
|
}
|
||||||
// build lang
|
// build lang
|
||||||
$langName = $menu['name'] . '<br /><br />';
|
$langName = $menu['name'] . '<br /><br />';
|
||||||
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
|
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
|
||||||
// add to lang
|
// add to lang
|
||||||
$this->langContent[$this->lang][$langKey] = $langName;
|
$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
|
// set icon
|
||||||
if ($counter == 0)
|
if ($counter == 0)
|
||||||
{
|
{
|
||||||
$counter++;
|
$counter++;
|
||||||
$icon .= "'" . $type . $nameList . "'";
|
$icon .= "'".$type."||".$nameList."||".$menu['link']."'";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$counter++;
|
$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']))
|
elseif (isset($menu['dashboard_list']) && $menu['dashboard_list'] == 1 && empty($menu['before']))
|
||||||
{
|
|
||||||
if (isset($menu['link']) && ComponentbuilderHelper::checkString($menu['link']))
|
|
||||||
{
|
|
||||||
// TODO must look at adding custom links to icons aswell
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
|
$type = ComponentbuilderHelper::imageInfo('images/' . $menu['icon']);
|
||||||
if ($type)
|
if ($type)
|
||||||
{
|
{
|
||||||
$type = $type . ".";
|
|
||||||
// icon builder loader
|
// icon builder loader
|
||||||
$this->iconBuilder[$type . $nameList] = 'images/' . $menu['icon'];
|
$this->iconBuilder[$type .".". $nameList] = 'images/' . $menu['icon'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$type = 'png.';
|
$type = 'png';
|
||||||
}
|
}
|
||||||
// build lang
|
// build lang
|
||||||
$langName = $menu['name'] . '<br /><br />';
|
$langName = $menu['name'] . '<br /><br />';
|
||||||
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
|
$langKey = $this->langPrefix . '_DASHBOARD_' . $nameUpper;
|
||||||
// add to lang
|
// add to lang
|
||||||
$this->langContent[$this->lang][$langKey] = $langName;
|
$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
|
// set icon
|
||||||
$this->lastCustomDashboardIcon[$nr] = ", '" . $type . $nameList . "'";
|
$this->lastCustomDashboardIcon[$nr] = ", '".$type."||".$nameList."||".$menu['link']."'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set icon
|
||||||
|
$this->lastCustomDashboardIcon[$nr] = ", '" . $type .".". $nameList . "'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
|||||||
'library_files_folders_urls.create' => 'library_files_folders_urls.create',
|
'library_files_folders_urls.create' => 'library_files_folders_urls.create',
|
||||||
'libraries_files_folders_urls.access' => 'library_files_folders_urls.access',
|
'libraries_files_folders_urls.access' => 'library_files_folders_urls.access',
|
||||||
'library_files_folders_urls.access' => 'library_files_folders_urls.access');
|
'library_files_folders_urls.access' => 'library_files_folders_urls.access');
|
||||||
|
// loop over the $views
|
||||||
foreach($viewGroups as $group => $views)
|
foreach($viewGroups as $group => $views)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -184,7 +185,22 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
|||||||
foreach($views as $view)
|
foreach($views as $view)
|
||||||
{
|
{
|
||||||
$add = false;
|
$add = false;
|
||||||
if (strpos($view,'.') !== false)
|
// external views (links)
|
||||||
|
if (strpos($view,'||') !== false)
|
||||||
|
{
|
||||||
|
$dwd = explode('||', $view);
|
||||||
|
if (count($dwd) == 3)
|
||||||
|
{
|
||||||
|
list($type, $name, $url) = $dwd;
|
||||||
|
$viewName = $name;
|
||||||
|
$alt = $name;
|
||||||
|
$url = $url;
|
||||||
|
$image = $name.'.'.$type;
|
||||||
|
$name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// internal views
|
||||||
|
elseif (strpos($view,'.') !== false)
|
||||||
{
|
{
|
||||||
$dwd = explode('.', $view);
|
$dwd = explode('.', $view);
|
||||||
if (count($dwd) == 3)
|
if (count($dwd) == 3)
|
||||||
@ -202,7 +218,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
|
|||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case 'add':
|
case 'add':
|
||||||
$url ='index.php?option=com_componentbuilder&view='.$name.'&layout=edit';
|
$url = 'index.php?option=com_componentbuilder&view='.$name.'&layout=edit';
|
||||||
$image = $name.'_'.$action.'.'.$type;
|
$image = $name.'_'.$action.'.'.$type;
|
||||||
$alt = $name.' '.$action;
|
$alt = $name.' '.$action;
|
||||||
$name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD';
|
$name = 'COM_COMPONENTBUILDER_DASHBOARD_'.ComponentbuilderHelper::safeString($name,'U').'_ADD';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="3.2" method="upgrade">
|
<extension type="component" version="3.2" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>3rd March, 2018</creationDate>
|
<creationDate>5th March, 2018</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||||
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>
|
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>
|
||||||
|
Loading…
Reference in New Issue
Block a user