Fixed gh-529 so that the custom admin view does not hidemainmenu when it is selected as the default view (dashboard)

This commit is contained in:
Llewellyn van der Merwe 2020-04-23 23:15:07 +02:00
parent b078d7f01f
commit e83319635a
No known key found for this signature in database
GPG Key ID: 8A8F406BA7238C4E
10 changed files with 92 additions and 57 deletions

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 21st April, 2020 + *Last Build*: 23rd April, 2020
+ *Version*: 2.11.0 + *Version*: 2.11.0
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280799** + *Line count*: **280795**
+ *Field count*: **1514** + *Field count*: **1514**
+ *File count*: **1769** + *File count*: **1769**
+ *Folder count*: **286** + *Folder count*: **286**

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 21st April, 2020 + *Last Build*: 23rd April, 2020
+ *Version*: 2.11.0 + *Version*: 2.11.0
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280799** + *Line count*: **280795**
+ *Field count*: **1514** + *Field count*: **1514**
+ *File count*: **1769** + *File count*: **1769**
+ *Folder count*: **286** + *Folder count*: **286**

View File

@ -48,9 +48,7 @@ class ###Component###View###SView### extends JViewLegacy
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {###HIDEMAINMENU###
// hide the main menu
$this->app->input->set('hidemainmenu', true);
// set the title // set the title
if (isset($this->item->name) && $this->item->name) if (isset($this->item->name) && $this->item->name)
{ {
@ -62,11 +60,7 @@ class ###Component###View###SView### extends JViewLegacy
$title = JText::_('COM_###COMPONENT###_###SVIEW###'); $title = JText::_('COM_###COMPONENT###_###SVIEW###');
} }
// add title to the page // add title to the page
JToolbarHelper::title($title,'###ICOMOON###'); JToolbarHelper::title($title,'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS###
// add the back button
// JToolBarHelper::custom('###sview###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
// add cpanel button
JToolBarHelper::custom('###sview###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS###
// set help url for this view if found // set help url for this view if found
$help_url = ###Component###Helper::getHelpUrl('###sviews###'); $help_url = ###Component###Helper::getHelpUrl('###sviews###');

View File

@ -48,15 +48,9 @@ class ###Component###View###SViews### extends JViewLegacy
* Setting the toolbar * Setting the toolbar
*/ */
protected function addToolBar() protected function addToolBar()
{ {###HIDEMAINMENU###
// hide the main menu
$this->app->input->set('hidemainmenu', true);
// add title to the page // add title to the page
JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###'); JToolbarHelper::title(JText::_('COM_###COMPONENT###_###SVIEWS###'),'###ICOMOON###');###CUSTOM_ADMIN_CUSTOM_BUTTONS###
// add the back button
// JToolBarHelper::custom('###sviews###.back', 'undo-2', '', 'COM_###COMPONENT###_BACK', false);
// add cpanel button
JToolBarHelper::custom('###sviews###.dashboard', 'grid-2', '', 'COM_###COMPONENT###_DASH', false);###CUSTOM_ADMIN_CUSTOM_BUTTONS###
// set help url for this view if found // set help url for this view if found
$help_url = ###Component###Helper::getHelpUrl('###sviews###'); $help_url = ###Component###Helper::getHelpUrl('###sviews###');

View File

@ -349,6 +349,13 @@ class Structure extends Get
*/ */
public $dynamicDashboard = false; public $dynamicDashboard = false;
/**
* The default view type
*
* @var string
*/
public $dynamicDashboardType;
/** /**
* Constructor * Constructor
*/ */
@ -1696,6 +1703,8 @@ class Structure extends Get
= ComponentbuilderHelper::safeString( = ComponentbuilderHelper::safeString(
$dashboard['settings']->{$keys[$t]} $dashboard['settings']->{$keys[$t]}
); );
$this->dynamicDashboardType
= $targets[$t];
} }
else else
{ {

View File

@ -5359,6 +5359,8 @@ class Interpretation extends Fields
// validate selection // validate selection
$validateSelection = 'true'; $validateSelection = 'true';
} }
// reset buttons
$buttons = array();
// if site add buttons to view // if site add buttons to view
if ($this->target === 'site') if ($this->target === 'site')
{ {
@ -5405,11 +5407,28 @@ class Interpretation extends Fields
break; break;
} }
} }
// add some buttons if custom admin view
elseif (1 == $type)
{
// add this button only if this is not the default view
if ($this->dynamicDashboardType !== 'custom_admin_views'
|| ($this->dynamicDashboardType === 'custom_admin_views'
&& $this->dynamicDashboard !== $viewName))
{
$buttons[] = $tab . $this->_t(2)
. "//" . $this->setLine(__LINE__) . " add cpanel button";
$buttons[] = $tab . $this->_t(2)
. "JToolBarHelper::custom('" . $viewName . "."
. "dashboard', 'grid-2', '', 'COM_"
. $this->fileContentStatic[$this->hhh
. 'COMPONENT' . $this->hhh]
. "_DASH', false);";
}
}
// check if custom button should be added // check if custom button should be added
if (isset($view['settings']->add_custom_button) if (isset($view['settings']->add_custom_button)
&& $view['settings']->add_custom_button == 1) && $view['settings']->add_custom_button == 1)
{ {
$buttons = array();
$this->onlyFunctionButton = array(); $this->onlyFunctionButton = array();
$functionNames = array(); $functionNames = array();
if (isset($view['settings']->custom_buttons) if (isset($view['settings']->custom_buttons)
@ -5592,6 +5611,7 @@ class Interpretation extends Fields
); );
} }
} }
}
// return buttons if they were build // return buttons if they were build
if (ComponentbuilderHelper::checkArray($buttons)) if (ComponentbuilderHelper::checkArray($buttons))
{ {
@ -5599,7 +5619,7 @@ class Interpretation extends Fields
$this->fileContentDynamic[$view['settings']->code][$this->hhh $this->fileContentDynamic[$view['settings']->code][$this->hhh
. $TARGET . '_JAVASCRIPT_FOR_BUTTONS' . $this->hhh] . $TARGET . '_JAVASCRIPT_FOR_BUTTONS' . $this->hhh]
= $this->setJavaScriptForButtons(); = $this->setJavaScriptForButtons();
// insure the form is added (only if not form exist) // insure the form is added (only if no form exist)
if (isset($view['settings']->default) if (isset($view['settings']->default)
&& strpos( && strpos(
$view['settings']->default, '<form' $view['settings']->default, '<form'
@ -5611,8 +5631,6 @@ class Interpretation extends Fields
return PHP_EOL . implode(PHP_EOL, $buttons); return PHP_EOL . implode(PHP_EOL, $buttons);
} }
}
return ''; return '';
} }

View File

@ -1175,6 +1175,26 @@ class Infusion extends Interpretation
$view['settings']->code, $this->target $view['settings']->code, $this->target
); );
// check if this custom admin view is the default view
if ($this->dynamicDashboardType === 'custom_admin_views'
&& $this->dynamicDashboard === $view['settings']->code)
{
// HIDEMAINMENU <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'HIDEMAINMENU' . $this->hhh] = '';
}
else
{
// HIDEMAINMENU <<<DYNAMIC>>>
$this->fileContentDynamic[$view['settings']->code][$this->hhh
. 'HIDEMAINMENU' . $this->hhh]
= PHP_EOL . $this->_t(2) . '//' . $this->setLine(
__LINE__
) . " hide the main menu"
. PHP_EOL . $this->_t(2)
. "\$this->app->input->set('hidemainmenu', true);";
}
if ($view['settings']->main_get->gettype == 1) if ($view['settings']->main_get->gettype == 1)
{ {
// CUSTOM_ADMIN_BEFORE_GET_ITEM <<<DYNAMIC>>> // CUSTOM_ADMIN_BEFORE_GET_ITEM <<<DYNAMIC>>>
@ -1399,19 +1419,22 @@ class Infusion extends Interpretation
$this->fileContentDynamic['import'][$this->hhh $this->fileContentDynamic['import'][$this->hhh
. 'IMPORT_EXT_METHOD' . $this->hhh] . 'IMPORT_EXT_METHOD' . $this->hhh]
= PHP_EOL . PHP_EOL . $this->setPlaceholders( = PHP_EOL . PHP_EOL . $this->setPlaceholders(
ComponentbuilderHelper::getDynamicScripts('ext'), $this->placeholders ComponentbuilderHelper::getDynamicScripts('ext'),
$this->placeholders
); );
// IMPORT_SETDATA_METHOD <<<DYNAMIC>>> // IMPORT_SETDATA_METHOD <<<DYNAMIC>>>
$this->fileContentDynamic['import'][$this->hhh $this->fileContentDynamic['import'][$this->hhh
. 'IMPORT_SETDATA_METHOD' . $this->hhh] . 'IMPORT_SETDATA_METHOD' . $this->hhh]
= PHP_EOL . PHP_EOL . $this->setPlaceholders( = PHP_EOL . PHP_EOL . $this->setPlaceholders(
ComponentbuilderHelper::getDynamicScripts('setdata'), $this->placeholders ComponentbuilderHelper::getDynamicScripts('setdata'),
$this->placeholders
); );
// IMPORT_SAVE_METHOD <<<DYNAMIC>>> // IMPORT_SAVE_METHOD <<<DYNAMIC>>>
$this->fileContentDynamic['import'][$this->hhh $this->fileContentDynamic['import'][$this->hhh
. 'IMPORT_SAVE_METHOD' . $this->hhh] . 'IMPORT_SAVE_METHOD' . $this->hhh]
= PHP_EOL . PHP_EOL . $this->setPlaceholders( = PHP_EOL . PHP_EOL . $this->setPlaceholders(
ComponentbuilderHelper::getDynamicScripts('save'), $this->placeholders ComponentbuilderHelper::getDynamicScripts('save'),
$this->placeholders
); );
} }
@ -2237,7 +2260,8 @@ class Infusion extends Interpretation
// Trigger Event: jcb_ce_onBeforeBuildAllLangFiles // Trigger Event: jcb_ce_onBeforeBuildAllLangFiles
$this->triggerEvent( $this->triggerEvent(
'jcb_ce_onBeforeBuildAllLangFiles', 'jcb_ce_onBeforeBuildAllLangFiles',
array(&$this->componentContext, &$this->languages['components'], &$this->langTag) array(&$this->componentContext, &$this->languages['components'],
&$this->langTag)
); );
// now we insert the values into the files // now we insert the values into the files
if (ComponentbuilderHelper::checkArray($this->languages['components'])) if (ComponentbuilderHelper::checkArray($this->languages['components']))

View File

@ -308,8 +308,6 @@ class ComponentbuilderViewCompiler extends JViewLegacy
$this->app->input->set('hidemainmenu', true); $this->app->input->set('hidemainmenu', true);
// add title to the page // add title to the page
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_COMPILER'),'cogs'); JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_COMPILER'),'cogs');
// add the back button
// JToolBarHelper::custom('compiler.back', 'undo-2', '', 'COM_COMPONENTBUILDER_BACK', false);
// add cpanel button // add cpanel button
JToolBarHelper::custom('compiler.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false); JToolBarHelper::custom('compiler.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
if ($this->canDo->get('compiler.run_expansion')) if ($this->canDo->get('compiler.run_expansion'))

View File

@ -252,8 +252,6 @@ class ComponentbuilderViewGet_snippets extends JViewLegacy
$this->app->input->set('hidemainmenu', true); $this->app->input->set('hidemainmenu', true);
// add title to the page // add title to the page
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search'); JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search');
// add the back button
// JToolBarHelper::custom('get_snippets.back', 'undo-2', '', 'COM_COMPONENTBUILDER_BACK', false);
// add cpanel button // add cpanel button
JToolBarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false); JToolBarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
if ($this->canDo->get('get_snippets.custom_admin_views')) if ($this->canDo->get('get_snippets.custom_admin_views'))

View File

@ -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>21st April, 2020</creationDate> <creationDate>23rd April, 2020</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://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>