From e71ba204cae49c4ef162090723d412455b7dcd67 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 20 Sep 2018 21:17:07 +0200 Subject: [PATCH] Added the [Run Expansion] button option for faster compile and install option of selected components. --- README.md | 2 +- admin/README.txt | 2 +- admin/access.xml | 7 ++ admin/config.xml | 4 +- admin/controllers/admin_views.php | 41 +++++++ admin/controllers/compiler.php | 107 +++++++++++++----- admin/controllers/custom_codes.php | 41 +++++++ admin/controllers/dynamic_gets.php | 41 +++++++ admin/controllers/fields.php | 41 +++++++ admin/controllers/joomla_components.php | 77 ++++++++++++- admin/helpers/componentbuilder.php | 2 +- .../en-GB/en-GB.com_componentbuilder.ini | 33 +++++- .../en-GB/en-GB.com_componentbuilder.sys.ini | 14 +++ admin/views/admin_views/tmpl/default.php | 24 +++- admin/views/admin_views/view.html.php | 5 + admin/views/compiler/view.html.php | 5 + admin/views/custom_codes/tmpl/default.php | 24 +++- admin/views/custom_codes/view.html.php | 5 + admin/views/dynamic_gets/tmpl/default.php | 24 +++- admin/views/dynamic_gets/view.html.php | 5 + admin/views/fields/tmpl/default.php | 24 +++- admin/views/fields/view.html.php | 5 + .../views/joomla_components/tmpl/default.php | 8 +- admin/views/joomla_components/view.html.php | 10 ++ site/controllers/api.php | 24 +++- site/helpers/componentbuilder.php | 2 +- 26 files changed, 530 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 9f727fdb8..1ec0d6efb 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Version*: 2.9.1 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **193303** ++ *Line count*: **193777** + *Field count*: **1081** + *File count*: **1273** + *Folder count*: **201** diff --git a/admin/README.txt b/admin/README.txt index 9f727fdb8..1ec0d6efb 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -129,7 +129,7 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo + *Version*: 2.9.1 + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **193303** ++ *Line count*: **193777** + *Field count*: **1081** + *File count*: **1273** + *Folder count*: **201** diff --git a/admin/access.xml b/admin/access.xml index bf8e8090a..46c536535 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -15,6 +15,7 @@ + @@ -73,6 +74,7 @@ + @@ -173,6 +175,7 @@ + @@ -187,6 +190,7 @@ + @@ -200,6 +204,7 @@ + @@ -252,9 +257,11 @@ + + diff --git a/admin/config.xml b/admin/config.xml index f062d1ed7..33bb953c6 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -688,9 +688,9 @@ COM_COMPONENTBUILDER_CONFIG_EXPANSION - + - + setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error'); return; + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=admin_views', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; } + } diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index 1e2d040e2..07bed82d4 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -35,11 +35,84 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin return; } + /** - * Import an spreadsheet. + * Run the Expansion * * @return void */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + + /** + * Clear tmp folder + * + * @return true on success + */ + public function clearTmp() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); + if($user->authorise('core.admin', 'com_componentbuilder')) + { + // get the model + $model = $this->getModel('compiler'); + // get tmp folder + $comConfig = JFactory::getConfig(); + $tmp = $comConfig->get('tmp_path'); + if ($model->emptyFolder($tmp)) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + /** + * Run the Compiler + * + * @return true on success + */ public function compiler() { // Check for request forgeries @@ -125,33 +198,11 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin return false; } - public function clearTmp() - { - // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - // check if user has the right - $user = JFactory::getUser(); - // set page redirect - $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false); - $message = 'Could not clear the tmp folder'; - if($user->authorise('core.admin', 'com_componentbuilder')) - { - // get the model - $model = $this->getModel('compiler'); - // get tmp folder - $comConfig = JFactory::getConfig(); - $tmp = $comConfig->get('tmp_path'); - if ($model->emptyFolder($tmp)) - { - $message = 'The tmp folder has been clear successfully!'; - $this->setRedirect($redirect_url,$message,'message'); - return true; - } - } - $this->setRedirect($redirect_url,$message,'error'); - return false; - } - + /** + * Install Compiled Extension + * + * @return true on success + */ public function installExtention() { // Check for request forgeries diff --git a/admin/controllers/custom_codes.php b/admin/controllers/custom_codes.php index ce4d96191..e63be82d6 100644 --- a/admin/controllers/custom_codes.php +++ b/admin/controllers/custom_codes.php @@ -102,5 +102,46 @@ class ComponentbuilderControllerCustom_codes extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error'); return; + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=custom_codes', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; } + } diff --git a/admin/controllers/dynamic_gets.php b/admin/controllers/dynamic_gets.php index 1d27f7554..24c0a2b8e 100644 --- a/admin/controllers/dynamic_gets.php +++ b/admin/controllers/dynamic_gets.php @@ -102,5 +102,46 @@ class ComponentbuilderControllerDynamic_gets extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error'); return; + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=dynamic_gets', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; } + } diff --git a/admin/controllers/fields.php b/admin/controllers/fields.php index b896d12c3..241a9cf35 100644 --- a/admin/controllers/fields.php +++ b/admin/controllers/fields.php @@ -102,5 +102,46 @@ class ComponentbuilderControllerFields extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error'); return; + } + + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=fields', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; } + } diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index 84cc751ed..e99f120ea 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -104,6 +104,79 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin return; } + + /** + * Run the Expansion + * + * @return void + */ + public function runExpansion() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false); + // set massage + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE'); + // check if this user has the right to run expansion + if($user->authorise('compiler.run_expansion', 'com_componentbuilder')) + { + // set massage + $message = JText::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB'); + // run expansion via API + $result = ComponentbuilderHelper::getFileContents(JURI::root() . 'index.php?option=com_componentbuilder&task=api.expand'); + // is there a message returned + if (!is_numeric($result) && ComponentbuilderHelper::checkString($result)) + { + $this->setRedirect($redirect_url, $result); + return true; + } + elseif (is_numeric($result) && 1 == $result) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + + + /** + * Clear tmp folder + * + * @return true on success + */ + public function clearTmp() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + // check if user has the right + $user = JFactory::getUser(); + // set page redirect + $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false); + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER'); + if($user->authorise('core.admin', 'com_componentbuilder')) + { + // get the model + $model = $this->getModel('compiler'); + // get tmp folder + $comConfig = JFactory::getConfig(); + $tmp = $comConfig->get('tmp_path'); + if ($model->emptyFolder($tmp)) + { + $message = JText::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB'); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + public function smartImport() { // check if import is allowed for this user. @@ -122,7 +195,7 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=joomla_components', false), $message, 'error'); return; - } + } public function smartExport() { @@ -353,7 +426,7 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin // quite only if auto backup (adding this script from custom code :) if ('backup' === 'manualBackup') { - echo "# Error\n".JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); + echo "# Error\n" . JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); // clear session JFactory::getApplication()->getSession()->destroy(); jexit(); diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index c2865ee98..6f8c3f218 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -3656,7 +3656,7 @@ abstract class ComponentbuilderHelper * @param string $component The component these views belong to * @param string $headsup The message to show on click of button * - * @return string On success the full html edit button + * @return string On success the full html link * */ public static function getEditButton(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE') diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index e6cef43f3..00ed24548 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -946,6 +946,8 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_READONLY="readonly" COM_COMPONENTBUILDER_ADMIN_VIEW_READWRITE="read/write" COM_COMPONENTBUILDER_ADMIN_VIEW_REMOVE="Remove" COM_COMPONENTBUILDER_ADMIN_VIEW_REPLY="Reply" +COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS="Admin View Run Expansion Button Access" +COM_COMPONENTBUILDER_ADMIN_VIEW_RUN_EXPANSION_BUTTON_ACCESS_DESC=" Allows the users in this group to access the run expansion button." COM_COMPONENTBUILDER_ADMIN_VIEW_SAVE_COPY="Save Copy" COM_COMPONENTBUILDER_ADMIN_VIEW_SAVE_NEW="Save New" COM_COMPONENTBUILDER_ADMIN_VIEW_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Admin View to customise the alias." @@ -1113,6 +1115,8 @@ COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="%s could not be imported COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED="%s has been imported!" COM_COMPONENTBUILDER_BSB_HAS_BEEN_UPDATED="%s has been updated!" COM_COMPONENTBUILDER_BSB_WAS_FOUND="%s was found!" +COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB="The expansion was successfully! to see more information change the Return Options for Build to Display Message in the global options of JCB under the Development Method tab." +COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEAR_SUCCESSFULLYB="The tmp folder has been clear successfully!" COM_COMPONENTBUILDER_BUILD="Build" COM_COMPONENTBUILDER_BUILDIN="Build-in" COM_COMPONENTBUILDER_BULK="Bulk" @@ -1143,6 +1147,8 @@ COM_COMPONENTBUILDER_COMPILER_CLEAR_TMP_BUTTON_ACCESS_DESC=" Allows the users in COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST="Compiler Dashboard List" COM_COMPONENTBUILDER_COMPILER_DASHBOARD_LIST_DESC="Allows the users in this group to dashboard list of Compiler" COM_COMPONENTBUILDER_COMPILER_DESC="The compiler" +COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS="Compiler Run Expansion Button Access" +COM_COMPONENTBUILDER_COMPILER_RUN_EXPANSION_BUTTON_ACCESS_DESC=" Allows the users in this group to access the run expansion button." COM_COMPONENTBUILDER_COMPILER_SUBMENU="Compiler Submenu" COM_COMPONENTBUILDER_COMPILER_SUBMENU_DESC="Allows the users in this group to submenu of Compiler" COM_COMPONENTBUILDER_COMPILE_COMPONENT="Compile Component" @@ -2653,9 +2659,18 @@ COM_COMPONENTBUILDER_CONFIG_NOTE_COMPILER_FOLDER_PATH_DESCRIPTION="The compiler COM_COMPONENTBUILDER_CONFIG_NOTE_COMPILER_FOLDER_PATH_LABEL="Moving The Compiler Folder" COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_FOLDER_PATH_DESCRIPTION="The custom folder is where all files and folders that you would like to include in your components are stored, the default location is [administrator/components/com_componentbuilder/custom]. You can move this folder by adding your own path here. Remember to move the content of the default custom folder to this new location." COM_COMPONENTBUILDER_CONFIG_NOTE_CUSTOM_FOLDER_PATH_LABEL="Moving The Custom Folder" -COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION="

This method is basically the way JCB has always worked by default.

You have a compiler area, once you have made changes you go to the compiler view and compile your component. Then you have the option to install and/or distribute the Joomla install package.

This can also be called the manual development method.

" +COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_DESCRIPTION="

This method is basically the way JCB has always worked by default.

+

So once you have made changes, you go to the compiler view and compile your component. Then you have the option to install and/or distribute the Joomla installation package.

This option will always be active to those with permission to access the compiler. You can change this permission in the Permissions tab with the option called Compiler Access.

" COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_DEFAULT_LABEL="Default Development Method" -COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION="

This method adds auto expansion to the current Joomla automatically.

Below you setup the behaviour of a selected set of components that will be auto build and installed. So you do not need to manually compile and install those components any more, the system does all that automatically for you.

So your experience is that you change the field, view or something else in JCB and then the component in Joomla moments later reflect those changed automatically. The latency of the workflow is based on your cronjob frequency and the size of your component. You can pause the build in a few ways, one by actually checking out/opening the Joomla Component view of the component in JCB, or changing the state to unpublish, archive or trashed, or simply remove if from the list below.

This can also be called the automatic development method.

" +COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_DESCRIPTION="

This method adds easy compile and install of multiple components to the current Joomla system. This automated action is called expansion.

+

Expansion can be achieved in two ways.

+

Button Expansion Option

+

The first and most common way is to click on any of the Run Expansion buttons found at the top of some of the JCB admin views.

+

Cronjob Expansion Option

+

The second is by running a cronjob as explained bellow the area of selection in this tab. So you do not need to manually compile and install the selected components any more, the system does all that automatically for you. The latency of the workflow is based on your cronjob frequency and the size of your component.

+

Expansion is pause for a component in a few ways, one by actually checking out/opening the Joomla Component view of the component in JCB, or changing the state to unpublish, archive or trashed, or simply remove if from the list below.

+

The Expansion method is there to speedup development testing.

+

Below you should set the behaviour of a selected set of components that will be auto build and installed when the expansion module is run.

" COM_COMPONENTBUILDER_CONFIG_NOTE_DEVELOPMENT_METHOD_EXPANSION_LABEL="Expansion Development Method" COM_COMPONENTBUILDER_CONFIG_NOTE_DKIM_USE_DESCRIPTION="

Using the below details, you need to configure your DNS by adding a TXT record on your domain:

\ No newline at end of file diff --git a/admin/views/admin_views/view.html.php b/admin/views/admin_views/view.html.php index 6af305d65..a042ee2a8 100644 --- a/admin/views/admin_views/view.html.php +++ b/admin/views/admin_views/view.html.php @@ -132,6 +132,11 @@ class ComponentbuilderViewAdmin_views extends JViewLegacy JToolBarHelper::custom('admin_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } + if ($this->user->authorise('admin_view.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('admin_views.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('admin_view.import')) { diff --git a/admin/views/compiler/view.html.php b/admin/views/compiler/view.html.php index 936c58a19..d2455b0ae 100644 --- a/admin/views/compiler/view.html.php +++ b/admin/views/compiler/view.html.php @@ -304,6 +304,11 @@ class ComponentbuilderViewCompiler extends JViewLegacy // JToolBarHelper::custom('compiler.back', 'undo-2', '', 'COM_COMPONENTBUILDER_BACK', false); // add cpanel button JToolBarHelper::custom('compiler.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false); + if ($this->canDo->get('compiler.run_expansion')) + { + // add Run Expansion button. + JToolBarHelper::custom('compiler.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('compiler.clear_tmp')) { // add Clear tmp button. diff --git a/admin/views/custom_codes/tmpl/default.php b/admin/views/custom_codes/tmpl/default.php index 59c19aec2..45c232990 100644 --- a/admin/views/custom_codes/tmpl/default.php +++ b/admin/views/custom_codes/tmpl/default.php @@ -82,4 +82,26 @@ if ($this->saveOrder) - \ No newline at end of file + + \ No newline at end of file diff --git a/admin/views/custom_codes/view.html.php b/admin/views/custom_codes/view.html.php index 0370cfe3b..39fe1b158 100644 --- a/admin/views/custom_codes/view.html.php +++ b/admin/views/custom_codes/view.html.php @@ -132,6 +132,11 @@ class ComponentbuilderViewCustom_codes extends JViewLegacy JToolBarHelper::custom('custom_codes.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } + if ($this->user->authorise('custom_code.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('custom_codes.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('custom_code.import')) { diff --git a/admin/views/dynamic_gets/tmpl/default.php b/admin/views/dynamic_gets/tmpl/default.php index f26c40e0a..22dc61b45 100644 --- a/admin/views/dynamic_gets/tmpl/default.php +++ b/admin/views/dynamic_gets/tmpl/default.php @@ -82,4 +82,26 @@ if ($this->saveOrder) - \ No newline at end of file + + \ No newline at end of file diff --git a/admin/views/dynamic_gets/view.html.php b/admin/views/dynamic_gets/view.html.php index ee5fb6135..77161c9b8 100644 --- a/admin/views/dynamic_gets/view.html.php +++ b/admin/views/dynamic_gets/view.html.php @@ -132,6 +132,11 @@ class ComponentbuilderViewDynamic_gets extends JViewLegacy JToolBarHelper::custom('dynamic_gets.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } + if ($this->user->authorise('dynamic_get.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('dynamic_gets.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('dynamic_get.import')) { diff --git a/admin/views/fields/tmpl/default.php b/admin/views/fields/tmpl/default.php index b6168e7c3..252e48f1d 100644 --- a/admin/views/fields/tmpl/default.php +++ b/admin/views/fields/tmpl/default.php @@ -82,4 +82,26 @@ if ($this->saveOrder) - \ No newline at end of file + + \ No newline at end of file diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index 6e532c68a..2e002ac95 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -132,6 +132,11 @@ class ComponentbuilderViewFields extends JViewLegacy JToolBarHelper::custom('fields.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } } + if ($this->user->authorise('field.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('fields.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('field.import')) { diff --git a/admin/views/joomla_components/tmpl/default.php b/admin/views/joomla_components/tmpl/default.php index 7d38a725b..0b52963c8 100644 --- a/admin/views/joomla_components/tmpl/default.php +++ b/admin/views/joomla_components/tmpl/default.php @@ -85,6 +85,7 @@ if ($this->saveOrder) \ No newline at end of file diff --git a/admin/views/joomla_components/view.html.php b/admin/views/joomla_components/view.html.php index 3a475eee5..984a49fc5 100644 --- a/admin/views/joomla_components/view.html.php +++ b/admin/views/joomla_components/view.html.php @@ -147,11 +147,21 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy // add Import JCB Packages button. JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_JCB_PACKAGES', false); } + if ($this->user->authorise('joomla_component.run_expansion', 'com_componentbuilder')) + { + // add Run Expansion button. + JToolBarHelper::custom('joomla_components.runExpansion', 'expand-2', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false); + } if ($this->user->authorise('joomla_component.backup', 'com_componentbuilder')) { // add Backup button. JToolBarHelper::custom('joomla_components.backup', 'archive', '', 'COM_COMPONENTBUILDER_BACKUP', false); } + if ($this->user->authorise('joomla_component.clear_tmp', 'com_componentbuilder')) + { + // add Clear tmp button. + JToolBarHelper::custom('joomla_components.clearTmp', 'purge', '', 'COM_COMPONENTBUILDER_CLEAR_TMP', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('joomla_component.import')) { diff --git a/site/controllers/api.php b/site/controllers/api.php index f65cbfdc0..5cc6d2d1f 100644 --- a/site/controllers/api.php +++ b/site/controllers/api.php @@ -184,7 +184,7 @@ class ComponentbuilderControllerApi extends JControllerForm // quite only if auto backup (adding this script from custom code :) if ('backup' === 'backup') { - echo "# Error\n".JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); + echo "# Error\n" . JText::_('COM_COMPONENTBUILDER_ACCESS_DENIED'); // clear session JFactory::getApplication()->getSession()->destroy(); jexit(); @@ -193,6 +193,11 @@ class ComponentbuilderControllerApi extends JControllerForm return; } + /** + * Run the Expansion + * + * @return mix + */ public function expand() { // get params first @@ -287,19 +292,29 @@ class ComponentbuilderControllerApi extends JControllerForm // check if message is to be returned if (1== $returnOptionsBuild) { - jexit('Expansion Disabled!'); + jexit('Expansion Disabled! Expansion can be enabled by your system administrator in the global Options of JCB under the Development Method tab.'); } // return bool echo 0; jexit(); } + /** + * Get API User + * + * @return object + */ protected function getApiUser() { // return user object return JFactory::getUser($this->params->get('api', 0, 'INT')); } + /** + * Run worker request + * + * @return mix + */ public function worker() { // get input values @@ -351,6 +366,11 @@ class ComponentbuilderControllerApi extends JControllerForm jexit(); } + /** + * Load the needed script + * + * @return void + */ protected function _autoloader() { // include component compiler diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index dba965497..4b7fd195d 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -3656,7 +3656,7 @@ abstract class ComponentbuilderHelper * @param string $component The component these views belong to * @param string $headsup The message to show on click of button * - * @return string On success the full html edit button + * @return string On success the full html link * */ public static function getEditButton(&$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')