diff --git a/deployed/regularlabs/components/com_advancedmodules/advancedmodules.php b/deployed/regularlabs/components/com_advancedmodules/advancedmodules.php
new file mode 100644
index 00000000..ff2a026c
--- /dev/null
+++ b/deployed/regularlabs/components/com_advancedmodules/advancedmodules.php
@@ -0,0 +1,68 @@
+
+ * @link http://www.regularlabs.com
+ * @copyright Copyright © 2018 Regular Labs All Rights Reserved
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
+ */
+
+defined('_JEXEC') or die;
+
+$app = JFactory::getApplication();
+
+if ( ! JFactory::getUser()->authorise('module.edit.frontend', 'com_modules.module.' . $app->input->get('id'))
+ && ! JFactory::getUser()->authorise('module.edit.frontend', 'com_modules')
+)
+{
+ throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
+}
+
+JFactory::getLanguage()->load('com_modules', JPATH_ADMINISTRATOR);
+JFactory::getLanguage()->load('com_advancedmodules', JPATH_ADMINISTRATOR . '/components/com_advancedmodules');
+
+jimport('joomla.filesystem.file');
+
+// return if Regular Labs Library plugin is not installed
+if (
+ ! is_file(JPATH_PLUGINS . '/system/regularlabs/regularlabs.xml')
+ || ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php')
+)
+{
+ $msg = JText::_('AMM_REGULAR_LABS_LIBRARY_NOT_INSTALLED')
+ . ' ' . JText::sprintf('AMM_EXTENSION_CAN_NOT_FUNCTION', JText::_('COM_ADVANCEDMODULES'));
+ JFactory::getApplication()->enqueueMessage($msg, 'error');
+
+ return;
+}
+
+// give notice if Regular Labs Library plugin is not enabled
+if ( ! JPluginHelper::isEnabled('system', 'regularlabs'))
+{
+ $msg = JText::_('AMM_REGULAR_LABS_LIBRARY_NOT_ENABLED')
+ . ' ' . JText::sprintf('AMM_EXTENSION_CAN_NOT_FUNCTION', JText::_('COM_ADVANCEDMODULES'));
+ JFactory::getApplication()->enqueueMessage($msg, 'notice');
+}
+
+require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
+
+use RegularLabs\Library\Language as RL_Language;
+
+RL_Language::load('plg_system_regularlabs');
+// Load admin main core language strings
+RL_Language::load('', JPATH_ADMINISTRATOR);
+
+// Tell the browser not to cache this page.
+$app->setHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true);
+
+$config = [];
+if ($app->input->get('task') === 'module.orderPosition')
+{
+ $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
+}
+
+$controller = JControllerLegacy::getInstance('AdvancedModules', $config);
+$controller->execute($app->input->get('task'));
+$controller->redirect();
diff --git a/deployed/regularlabs/components/com_advancedmodules/controller.php b/deployed/regularlabs/components/com_advancedmodules/controller.php
new file mode 100644
index 00000000..f7f7a449
--- /dev/null
+++ b/deployed/regularlabs/components/com_advancedmodules/controller.php
@@ -0,0 +1,36 @@
+
+ * @link http://www.regularlabs.com
+ * @copyright Copyright © 2018 Regular Labs All Rights Reserved
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
+ */
+
+defined('_JEXEC') or die;
+
+class AdvancedModulesController extends JControllerLegacy
+{
+ protected $default_view = 'edit';
+
+ public function display($cachable = false, $urlparams = false)
+ {
+ return parent::display();
+ }
+
+ public function __construct($config = [])
+ {
+ $this->input = JFactory::getApplication()->input;
+
+ // Modules frontpage Editor Module proxying:
+ if ($this->input->get('view') === 'modules' && $this->input->get('layout') === 'modal')
+ {
+ JHtml::_('stylesheet', 'system/adminlist.css', [], true);
+ $config['base_path'] = JPATH_COMPONENT_ADMINISTRATOR;
+ }
+
+ parent::__construct($config);
+ }
+}
diff --git a/deployed/regularlabs/components/com_advancedmodules/controllers/edit.php b/deployed/regularlabs/components/com_advancedmodules/controllers/edit.php
new file mode 100644
index 00000000..4f19daa9
--- /dev/null
+++ b/deployed/regularlabs/components/com_advancedmodules/controllers/edit.php
@@ -0,0 +1,18 @@
+
+ * @link http://www.regularlabs.com
+ * @copyright Copyright © 2018 Regular Labs All Rights Reserved
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
+ */
+
+defined('_JEXEC') or die;
+
+require_once JPATH_ADMINISTRATOR . '/components/com_advancedmodules/controllers/module.php';
+
+class AdvancedModulesControllerEdit extends AdvancedModulesControllerModule
+{
+}
diff --git a/deployed/regularlabs/components/com_advancedmodules/controllers/module.php b/deployed/regularlabs/components/com_advancedmodules/controllers/module.php
new file mode 100644
index 00000000..16aa36e0
--- /dev/null
+++ b/deployed/regularlabs/components/com_advancedmodules/controllers/module.php
@@ -0,0 +1,15 @@
+
+ * @link http://www.regularlabs.com
+ * @copyright Copyright © 2018 Regular Labs All Rights Reserved
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
+ */
+
+defined('_JEXEC') or die;
+
+require_once JPATH_ADMINISTRATOR . '/components/com_advancedmodules/controllers/module.php';
+
diff --git a/deployed/regularlabs/components/com_advancedmodules/empty.xml b/deployed/regularlabs/components/com_advancedmodules/empty.xml
new file mode 100644
index 00000000..0f384d61
--- /dev/null
+++ b/deployed/regularlabs/components/com_advancedmodules/empty.xml
@@ -0,0 +1,4 @@
+
+
' . $this->escape(JText::_($fieldSet->description)) . '
'; + } + + $displayData->fieldset = $name; + echo JLayoutHelper::render('joomla.edit.fieldset', $displayData); + + echo JHtml::_('bootstrap.endSlide'); + } +} +else +{ + $html = []; + $html[] = ''; + + echo implode('', $html); +} diff --git a/deployed/regularlabs/components/com_advancedmodules/models/edit.php b/deployed/regularlabs/components/com_advancedmodules/models/edit.php new file mode 100644 index 00000000..48c65488 --- /dev/null +++ b/deployed/regularlabs/components/com_advancedmodules/models/edit.php @@ -0,0 +1,22 @@ + + * @link http://www.regularlabs.com + * @copyright Copyright © 2018 Regular Labs All Rights Reserved + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +defined('_JEXEC') or die; + +require_once JPATH_ADMINISTRATOR . '/components/com_advancedmodules/models/module.php'; + +class AdvancedModulesModelEdit extends AdvancedModulesModelModule +{ + public function __construct($config = []) + { + parent::__construct($config); + } +} diff --git a/deployed/regularlabs/components/com_advancedmodules/models/forms/module.xml b/deployed/regularlabs/components/com_advancedmodules/models/forms/module.xml new file mode 100644 index 00000000..480eb5fb --- /dev/null +++ b/deployed/regularlabs/components/com_advancedmodules/models/forms/module.xml @@ -0,0 +1,133 @@ + + diff --git a/deployed/regularlabs/components/com_advancedmodules/models/module.php b/deployed/regularlabs/components/com_advancedmodules/models/module.php new file mode 100644 index 00000000..3aebd9a3 --- /dev/null +++ b/deployed/regularlabs/components/com_advancedmodules/models/module.php @@ -0,0 +1,14 @@ + + * @link http://www.regularlabs.com + * @copyright Copyright © 2018 Regular Labs All Rights Reserved + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +defined('_JEXEC') or die; + +require_once JPATH_ADMINISTRATOR . '/components/com_advancedmodules/models/module.php'; diff --git a/deployed/regularlabs/components/com_advancedmodules/tables/advancedmodules.php b/deployed/regularlabs/components/com_advancedmodules/tables/advancedmodules.php new file mode 100644 index 00000000..acb4f559 --- /dev/null +++ b/deployed/regularlabs/components/com_advancedmodules/tables/advancedmodules.php @@ -0,0 +1,74 @@ + + * @link http://www.regularlabs.com + * @copyright Copyright © 2018 Regular Labs All Rights Reserved + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +defined('_JEXEC') or die; + +class AdvancedModulesTable extends JTable +{ + public function __construct(&$db) + { + parent::__construct('#__advancedmodules', 'moduleid', $db); + } + + protected function _getAssetName() + { + $k = $this->_tbl_key; + + return 'com_modules.module.' . (int) $this->{$k}; + } + + protected function _getAssetTitle() + { + if (isset($this->_title)) + { + return $this->_title; + } + + return $this->_getAssetName(); + } + + protected function getAssetParentId(JTable $table = null, $id = null) + { + // Initialise variables. + $assetId = null; + $db = $this->getDbo(); + + $query = $db->getQuery(true) + ->select('id') + ->from('#__assets') + ->where('name = ' . $db->quote('com_modules')); + + // Get the asset id from the database. + $db->setQuery($query); + if ($result = $db->loadResult()) + { + $assetId = (int) $result; + } + + // Return the asset id. + if ($assetId) + { + return $assetId; + } + else + { + return parent::_getAssetParentId($table, $id); + } + } +} + +class AdvancedModulesTableAdvancedModules extends AdvancedModulesTable +{ + protected function _getAssetParentId(JTable $table = null, $id = null) + { + return parent::getAssetParentId($table, $id); + } +} diff --git a/deployed/regularlabs/components/com_advancedmodules/views/edit/tmpl/edit.php b/deployed/regularlabs/components/com_advancedmodules/views/edit/tmpl/edit.php new file mode 100644 index 00000000..e0616c8a --- /dev/null +++ b/deployed/regularlabs/components/com_advancedmodules/views/edit/tmpl/edit.php @@ -0,0 +1,222 @@ + + * @link http://www.regularlabs.com + * @copyright Copyright © 2018 Regular Labs All Rights Reserved + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +defined('_JEXEC') or die; + +use RegularLabs\Library\Document as RL_Document; + +JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); + +JHtml::_('jquery.framework'); +JHtml::_('bootstrap.framework'); +JHtml::_('behavior.formvalidator'); +JHtml::_('behavior.combobox'); +JHtml::_('formbehavior.chosen', 'select'); + +$hasContent = empty($this->item->module) || isset($this->item->xml->customContent); +$hasContentFieldName = 'content'; + +// For a later improvement +if ($hasContent) +{ + $hasContentFieldName = 'content'; +} + +// Get Params Fieldsets +$this->fieldsets = $this->form->getFieldsets('params'); +$this->hidden_fields = ''; + +$uri = JUri::getInstance(); + +$script = " +Joomla.submitbutton = function(task) +{ + if (task == 'module.cancel' || document.formvalidator.isValid(document.id('module-form'))) {"; +if ($hasContent) +{ + $script .= $this->form->getField($hasContentFieldName)->save(); +} +$script .= " Joomla.submitform(task, document.getElementById('module-form')); + if (self != top) + { + window.top.setTimeout('window.parent.SqueezeBox.close();', 1000); + } + } + };"; +if (JFactory::getUser()->authorise('core.admin')) +{ + $script .= " + jQuery(document).ready(function() + { + // add alert on remove assignment buttons + jQuery('button.rl_remove_assignment').click(function() + { + if(confirm('" . str_replace('