Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
316c7d72b9 | |||
3e60cd9eb4 | |||
3d0d54228d | |||
646ded102c | |||
305a64160d | |||
c239dc0d9a | |||
0970999cd4 | |||
e45d6e0488 | |||
0b4df83ab9 | |||
d1467dedc9 | |||
c3d8f790fb | |||
bd0c7a127a | |||
2bb15d1cab | |||
e8e2e4d465 | |||
57e7a019d6 | |||
76ed5cc6e6 | |||
ed286643ab | |||
c2be0d2dc7 | |||
9c44eabfd1 | |||
6191a364ef | |||
da71036a4b | |||
27dd030545 | |||
8d68185435 |
|
@ -14,15 +14,20 @@ defined('_JEXEC') or die('Restricted access');
|
|||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory;
|
||||
|
||||
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php');
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
|
||||
|
||||
/**
|
||||
* Extension - Componentbuilder Export Compiler plugin.
|
||||
*
|
||||
* @package ComponentbuilderExportCompiler
|
||||
* @since 2.0.0
|
||||
* @since 1.2.0
|
||||
*/
|
||||
class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
||||
{
|
||||
|
@ -75,10 +80,10 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
|||
if ($this->exportTextOnly && $this->componentActive())
|
||||
{
|
||||
// activate export text only
|
||||
Factory::_('Config')->set('export_text_only', (int) $this->exportTextOnly);
|
||||
CFactory::_('Config')->set('export_text_only', (int) $this->exportTextOnly);
|
||||
|
||||
// activate strict_permission_per_field if set in plugin (default true)
|
||||
Factory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions);
|
||||
CFactory::_('Config')->set('permission_strict_per_field', (bool) $this->strictFieldExportPermissions);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +127,7 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
|||
{
|
||||
foreach($this->languageArray as $key => $string)
|
||||
{
|
||||
Factory::_('Language')->set('adminsys', $key, $string);
|
||||
CFactory::_('Language')->set('adminsys', $key, $string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,19 +145,19 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
|||
if ($this->exportTextOnly && $this->componentActive() && $timer == 2)
|
||||
{
|
||||
// main lang prefix
|
||||
$lang = Factory::_('Config')->lang_prefix . '_CONFIG';
|
||||
$lang = CFactory::_('Config')->lang_prefix . '_CONFIG';
|
||||
// start building field set for config
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . "<fieldset");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'name="export_text_only_config"');
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"');
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">');
|
||||
$configFieldSets[] = Indent::_(1) . "<fieldset";
|
||||
$configFieldSets[] = Indent::_(2) . 'name="export_text_only_config"';
|
||||
$configFieldSets[] = Indent::_(2) . 'label="' . $lang . '_EXPORT_TEXT_ONLY_TAB_LABEL"';
|
||||
$configFieldSets[] = Indent::_(2) . 'description="' . $lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">';
|
||||
// setup lang
|
||||
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_LABEL'] = "Export Options";
|
||||
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behaviour of admin views.";
|
||||
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra option to adjust the export behavior of admin views.";
|
||||
// add custom Export Options
|
||||
if (isset($configFieldSetsCustomField['Export Options']) && ArrayHelper::check($configFieldSetsCustomField['Export Options']))
|
||||
{
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', implode("", $configFieldSetsCustomField['Export Options']));
|
||||
$configFieldSets[] = implode("", $configFieldSetsCustomField['Export Options']);
|
||||
unset($configFieldSetsCustomField['Export Options']);
|
||||
}
|
||||
else
|
||||
|
@ -163,20 +168,20 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
|||
$this->languageArray[$lang . '_ACTIVATE'] = "Activate";
|
||||
$this->languageArray[$lang . '_DEACTIVATE'] = "Deactivate";
|
||||
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Export Text Only Field. Type: Radio. (joomla) -->");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "<field");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "type=\"radio\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"export_text_only\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"0\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"1\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_ACTIVATE</option>");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"0\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_DEACTIVATE</option>");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "</field>");
|
||||
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Export Text Only Field. Type: Radio. (joomla) -->";
|
||||
$configFieldSets[] = Indent::_(2) . "<field";
|
||||
$configFieldSets[] = Indent::_(3) . "type=\"radio\"";
|
||||
$configFieldSets[] = Indent::_(3) . "name=\"export_text_only\"";
|
||||
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang . "_EXPORT_TEXT_ONLY_LABEL\"";
|
||||
$configFieldSets[] = Indent::_(3) . "description=\"" . $lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\"";
|
||||
$configFieldSets[] = Indent::_(3) . "class=\"btn-group btn-group-yesno\"";
|
||||
$configFieldSets[] = Indent::_(3) . "default=\"0\">";
|
||||
$configFieldSets[] = Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->";
|
||||
$configFieldSets[] = Indent::_(3) . "<option value=\"1\">";
|
||||
$configFieldSets[] = Indent::_(4) . $lang . "_ACTIVATE</option>";
|
||||
$configFieldSets[] = Indent::_(3) . "<option value=\"0\">";
|
||||
$configFieldSets[] = Indent::_(4) . $lang . "_DEACTIVATE</option>";
|
||||
$configFieldSets[] = Indent::_(2) . "</field>";
|
||||
|
||||
// add strict Field Export Permissions field
|
||||
if ($this->strictFieldExportPermissions)
|
||||
|
@ -184,24 +189,24 @@ class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
|
|||
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_LABEL'] = "Use Strict Permission per/field";
|
||||
$this->languageArray[$lang . '_STRICT_PERMISSION_PER_FIELD_DESCRIPTION'] = "Use strict permissions per/field in the export methods where there are fields permissions in a view.";
|
||||
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Strict_permission_per_field Field. Type: Radio. (joomla) -->");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "<field");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "type=\"radio\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "name=\"strict_permission_per_field\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "class=\"btn-group btn-group-yesno\"");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "default=\"1\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"1\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_ACTIVATE</option>");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(3) . "<option value=\"0\">");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(4) . $lang . "_DEACTIVATE</option>");
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(2) . "</field>");
|
||||
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" . Line::_(__Line__, __Class__) . " Strict_permission_per_field Field. Type: Radio. (joomla) -->";
|
||||
$configFieldSets[] = Indent::_(2) . "<field";
|
||||
$configFieldSets[] = Indent::_(3) . "type=\"radio\"";
|
||||
$configFieldSets[] = Indent::_(3) . "name=\"strict_permission_per_field\"";
|
||||
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_LABEL\"";
|
||||
$configFieldSets[] = Indent::_(3) . "description=\"" . $lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\"";
|
||||
$configFieldSets[] = Indent::_(3) . "class=\"btn-group btn-group-yesno\"";
|
||||
$configFieldSets[] = Indent::_(3) . "default=\"1\">";
|
||||
$configFieldSets[] = Indent::_(3) . "<!--" . Line::_(__Line__, __Class__) . " Option Set. -->";
|
||||
$configFieldSets[] = Indent::_(3) . "<option value=\"1\">";
|
||||
$configFieldSets[] = Indent::_(4) . $lang . "_ACTIVATE</option>";
|
||||
$configFieldSets[] = Indent::_(3) . "<option value=\"0\">";
|
||||
$configFieldSets[] = Indent::_(4) . $lang . "_DEACTIVATE</option>";
|
||||
$configFieldSets[] = Indent::_(2) . "</field>";
|
||||
}
|
||||
}
|
||||
// close that fieldset
|
||||
Factory::_('Compiler.Builder.Config.Fieldsets')->add('component', Indent::_(1) . "</fieldset>");
|
||||
$configFieldSets[] = Indent::_(1) . "</fieldset>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="5.0" group="extension" method="upgrade">
|
||||
<extension type="plugin" version="3.10" group="extension" method="upgrade">
|
||||
<name>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER</name>
|
||||
<creationDate>7th June, 2024</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
|
@ -7,7 +7,7 @@
|
|||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<version>2.0.0</version>
|
||||
<version>1.2.0</version>
|
||||
<description>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION</description>
|
||||
|
||||
<!-- Scripts to run on installation -->
|
||||
|
@ -28,8 +28,8 @@
|
|||
|
||||
<!-- Config parameter -->
|
||||
<config
|
||||
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
|
||||
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field">
|
||||
addrulepath="/administrator/components/com_componentbuilder/models/rules"
|
||||
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
|
||||
>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab."
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 21st August, 2019</small></p>"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. <b>All</b> will target all components, and <b>Selected</b> will let you select only those you want to be active."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension - Componentbuilder Export Compiler"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab."
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.2.0.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 10th March, 2024</small></p>"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Export Compiler (v.1.2.0)</h1> <div style='clear: both;'></div><p>This plugin is used to tweak the export options for your components during compilation. To activate it you must first enable it here. Then open your JCB component global options, and under the Global tab, select this plugin in the Activate Compiler Plugins field.Also be sure to activate the component/s that should be targeted with this added export feature under the Component Activation tab.</p><p>Created by <a href='https://dev.vdm.io' target='_blank'>Llewellyn van der Merwe</a><br /><small>Development started 21st August, 2019</small></p>"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate Options"
|
||||
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You can select the kind of activation control you would like to use. <b>All</b> will target all components, and <b>Selected</b> will let you select only those you want to be active."
|
||||
|
|
35
script.php
35
script.php
|
@ -24,4 +24,39 @@ use Joomla\CMS\Filesystem\Folder;
|
|||
*/
|
||||
class plgExtensionComponentbuilderExportCompilerInstallerScript
|
||||
{
|
||||
|
||||
/**
|
||||
* Called before any type of action
|
||||
*
|
||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function preflight($route, $adapter)
|
||||
{
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// the default for both install and update
|
||||
$jversion = new JVersion();
|
||||
if (!$jversion->isCompatible('3.8.0'))
|
||||
{
|
||||
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('install' === $route)
|
||||
{
|
||||
// check that componentbuilder is installed
|
||||
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
|
||||
if (!JFile::exists($pathToCore))
|
||||
{
|
||||
$app->enqueueMessage('Joomla Component Builder must first be installed from <a href="https://www.joomlacomponentbuilder.com/ " target="_blank">Joomla Component Builder</a>.', 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user