fixed function button bug that loaded it to all views, instead of only the owner view

This commit is contained in:
Llewellyn van der Merwe 2017-08-22 23:44:53 +01:00
parent cfc1af2b69
commit e6b3c2391d
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
14 changed files with 25 additions and 71 deletions

View File

@ -112,7 +112,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.5.0
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **111712**
+ *Line count*: **111662**
+ *File count*: **663**
+ *Folder count*: **117**

View File

@ -112,7 +112,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.5.0
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **111712**
+ *Line count*: **111662**
+ *File count*: **663**
+ *Folder count*: **117**

View File

@ -3113,11 +3113,15 @@ class Interpretation extends Fields
// add cpanel button TODO does not work well on site with permissions
if (isset($custom_button['type']) && $custom_button['type'] == 2)
{
$this->onlyFunctionButton[] = "\t".$tab."if (\$this->user->authorise('".$viewName.".".$keyCode."'))";
$this->onlyFunctionButton[] = "\t".$tab."{";
$this->onlyFunctionButton[] = "\t".$tab."\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$this->onlyFunctionButton[] = "\t".$tab."\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
$this->onlyFunctionButton[] = "\t".$tab."}";
if (!isset($this->onlyFunctionButton[$viewsName]))
{
$this->onlyFunctionButton[$viewsName] = array();
}
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."if (\$this->user->authorise('".$viewName.".".$keyCode."'))";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."{";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."\t//".$this->setLine(__LINE__)." add ".$custom_button['name']." button.";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."\tJToolBarHelper::custom('".$viewsName.".".$custom_button['method']."', '".$custom_button['icomoon']."', '', '".$keyLang."', false);";
$this->onlyFunctionButton[$viewsName][] = "\t".$tab."}";
}
else
{
@ -3182,12 +3186,12 @@ class Interpretation extends Fields
return '';
}
public function setFunctionOnlyButtons()
public function setFunctionOnlyButtons($viewName_list)
{
// return buttons if they were build
if (isset($this->onlyFunctionButton) && ComponentbuilderHelper::checkArray($this->onlyFunctionButton))
if (isset($this->onlyFunctionButton[$viewName_list]) && ComponentbuilderHelper::checkArray($this->onlyFunctionButton[$viewName_list]))
{
return PHP_EOL.implode(PHP_EOL,$this->onlyFunctionButton);
return PHP_EOL.implode(PHP_EOL,$this->onlyFunctionButton[$viewName_list]);
}
return '';
}

View File

@ -443,7 +443,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_list]['###ADMIN_CUSTOM_BUTTONS_LIST###']
= $this->setCustomButtons($view, 3, "\t");
$this->fileContentDynamic[$viewName_list]['###ADMIN_CUSTOM_FUNCTION_ONLY_BUTTONS_LIST###']
= $this->setFunctionOnlyButtons();
= $this->setFunctionOnlyButtons($viewName_list);
// ###GET_ITEMS_METHOD_STRING_FIX### <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list]['###GET_ITEMS_METHOD_STRING_FIX###']

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy
{
JToolBarHelper::custom('admin_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('admin_view.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewCustom_admin_views extends JViewLegacy
{
JToolBarHelper::custom('custom_admin_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('custom_admin_view.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy
{
JToolBarHelper::custom('custom_codes.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('custom_code.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy
{
JToolBarHelper::custom('dynamic_gets.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('dynamic_get.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewFields extends JViewLegacy
{
JToolBarHelper::custom('fields.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('field.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewFieldtypes extends JViewLegacy
{
JToolBarHelper::custom('fieldtypes.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('fieldtype.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewLayouts extends JViewLegacy
{
JToolBarHelper::custom('layouts.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('layout.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewSite_views extends JViewLegacy
{
JToolBarHelper::custom('site_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('site_view.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewSnippets extends JViewLegacy
{
JToolBarHelper::custom('snippets.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('snippet.import'))
{

View File

@ -149,12 +149,7 @@ class ComponentbuilderViewTemplates extends JViewLegacy
{
JToolBarHelper::custom('templates.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('template.import'))
{