diff --git a/administrator/components/com_plugins/views/plugin/tmpl/edit.php b/administrator/components/com_plugins/views/plugin/tmpl/edit.php index bd1a040931a1e..9303541c98ae3 100644 --- a/administrator/components/com_plugins/views/plugin/tmpl/edit.php +++ b/administrator/components/com_plugins/views/plugin/tmpl/edit.php @@ -23,6 +23,11 @@ if (task == 'plugin.cancel' || document.formvalidator.isValid(document.getElementById('style-form'))) { Joomla.submitform(task, document.getElementById('style-form')); } + + if (self !== top) { + window.top.setTimeout('window.parent.location = window.top.location.href', 1000); + window.parent.jQuery('#plugin" . $this->item->extension_id . "Modal').modal('hide'); + } }; "); ?> diff --git a/administrator/components/com_plugins/views/plugin/tmpl/modal.php b/administrator/components/com_plugins/views/plugin/tmpl/modal.php new file mode 100644 index 0000000000000..69d18a30cd77f --- /dev/null +++ b/administrator/components/com_plugins/views/plugin/tmpl/modal.php @@ -0,0 +1,26 @@ +addScriptDeclaration(' + window.parent.jQuery(".modal").on("hidden", function () { + if (typeof window.parent.jQuery("#plugin' . $this->item->extension_id . 'Modal iframe").contents().find("#closeBtn") !== "undefined") { + window.parent.jQuery("#plugin' . $this->item->extension_id . 'Modal iframe").contents().find("#closeBtn").click(); + } + }); +'); +?> + + + +setLayout('edit'); +echo $this->loadTemplate(); diff --git a/administrator/components/com_redirect/helpers/redirect.php b/administrator/components/com_redirect/helpers/redirect.php index 93779082edeb6..9951d3300280c 100644 --- a/administrator/components/com_redirect/helpers/redirect.php +++ b/administrator/components/com_redirect/helpers/redirect.php @@ -81,35 +81,6 @@ public static function publishedOptions() return $options; } - /** - * Determines if the plugin for Redirect to work is enabled. - * - * @return boolean - * - * @since 1.6 - */ - public static function isEnabled() - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('enabled')) - ->from($db->quoteName('#__extensions')) - ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) - ->where($db->quoteName('element') . ' = ' . $db->quote('redirect')); - $db->setQuery($query); - - try - { - $result = (boolean) $db->loadResult(); - } - catch (RuntimeException $e) - { - JError::raiseWarning(500, $e->getMessage()); - } - - return $result; - } - /** * Gets the redirect system plugin extension id. * diff --git a/administrator/components/com_redirect/views/links/tmpl/default.php b/administrator/components/com_redirect/views/links/tmpl/default.php index 9e05ec4a69c21..00d0cd09cc137 100644 --- a/administrator/components/com_redirect/views/links/tmpl/default.php +++ b/administrator/components/com_redirect/views/links/tmpl/default.php @@ -23,6 +23,24 @@
$this)); ?> + redirectPluginId) : ?> + redirectPluginId . '&tmpl=component&layout=modal'); ?> + redirectPluginId . 'Modal', + array( + 'url' => $link, + 'title' => JText::_('COM_REDIRECT_EDIT_PLUGIN_SETTINGS'), + 'height' => '400px', + 'modalWidth' => '60', + 'footer' => '' + . '' + ) + ); ?> + + items)) : ?>
diff --git a/administrator/components/com_redirect/views/links/view.html.php b/administrator/components/com_redirect/views/links/view.html.php index c2c7683f99e85..e0e224611b699 100644 --- a/administrator/components/com_redirect/views/links/view.html.php +++ b/administrator/components/com_redirect/views/links/view.html.php @@ -20,12 +20,18 @@ class RedirectViewLinks extends JViewLegacy protected $collect_urls_enabled; + protected $redirectPluginId = 0; + protected $items; protected $pagination; protected $state; + public $filterForm; + + public $activeFilters; + /** * Display the view. * @@ -34,12 +40,14 @@ class RedirectViewLinks extends JViewLegacy * @return mixed False if unsuccessful, otherwise void. * * @since 1.6 + * + * @throws Exception */ public function display($tpl = null) { // Set variables $app = JFactory::getApplication(); - $this->enabled = RedirectHelper::isEnabled(); + $this->enabled = JPluginHelper::isEnabled('system', 'redirect'); $this->collect_urls_enabled = RedirectHelper::collectUrlsEnabled(); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); @@ -56,22 +64,42 @@ public function display($tpl = null) // Show messages about the enabled plugin and if the plugin should collect URLs if ($this->enabled && $this->collect_urls_enabled) { - $app->enqueueMessage(JText::_('COM_REDIRECT_PLUGIN_ENABLED') . ' ' . JText::_('COM_REDIRECT_COLLECT_URLS_ENABLED'), 'notice'); - } - elseif ($this->enabled && !$this->collect_urls_enabled) - { - $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()); - $app->enqueueMessage(JText::_('COM_REDIRECT_PLUGIN_ENABLED') . JText::sprintf('COM_REDIRECT_COLLECT_URLS_DISABLED', $link), 'notice'); + $app->enqueueMessage(JText::sprintf('COM_REDIRECT_COLLECT_URLS_ENABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED')), 'notice'); } else { - $link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()); - $app->enqueueMessage(JText::sprintf('COM_REDIRECT_PLUGIN_DISABLED', $link), 'error'); + $this->redirectPluginId = RedirectHelper::getRedirectPluginId(); + + $link = JHtml::_( + 'link', + '#plugin' . $this->redirectPluginId . 'Modal', + JText::_('COM_REDIRECT_SYSTEM_PLUGIN'), + 'class="alert-link" data-toggle="modal" id="title-' . $this->redirectPluginId . '"' + ); + + // To be removed in Joomla 4 + if (JFactory::getApplication()->getTemplate() === 'hathor') + { + $link = JHtml::_( + 'link', + JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . RedirectHelper::getRedirectPluginId()), + JText::_('COM_REDIRECT_SYSTEM_PLUGIN') + ); + } + + if ($this->enabled && !$this->collect_urls_enabled) + { + $app->enqueueMessage(JText::sprintf('COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED', JText::_('COM_REDIRECT_PLUGIN_ENABLED'), $link), 'notice'); + } + else + { + $app->enqueueMessage(JText::sprintf('COM_REDIRECT_PLUGIN_MODAL_DISABLED', $link), 'error'); + } } $this->addToolbar(); - parent::display($tpl); + return parent::display($tpl); } /** @@ -129,6 +157,8 @@ protected function addToolbar() $title = JText::_('JTOOLBAR_BULK_IMPORT'); + JHtml::_('bootstrap.modal', 'collapseModal'); + // Instantiate a new JLayoutFile instance and render the batch button $layout = new JLayoutFile('toolbar.batch'); @@ -155,6 +185,5 @@ protected function addToolbar() } JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER'); - } } diff --git a/administrator/language/en-GB/en-GB.com_redirect.ini b/administrator/language/en-GB/en-GB.com_redirect.ini index 12c65d407132e..822ada2b49a83 100644 --- a/administrator/language/en-GB/en-GB.com_redirect.ini +++ b/administrator/language/en-GB/en-GB.com_redirect.ini @@ -10,11 +10,14 @@ COM_REDIRECT_BATCH_TIP="Enter expired URL (mandatory) with a new URL (optional) COM_REDIRECT_BUTTON_UPDATE_LINKS="Update Links" COM_REDIRECT_CLEAR_FAIL="Failed to delete unpublished links." COM_REDIRECT_CLEAR_SUCCESS="All unpublished links have been deleted." -COM_REDIRECT_COLLECT_URLS_ENABLED="The option 'Collect URLs' is enabled." +COM_REDIRECT_COLLECT_MODAL_URLS_DISABLED="%1$s The 'Collect URLs' option in the %2$s is disabled. Error page URLs will not be collected by this component." +COM_REDIRECT_COLLECT_URLS_ENABLED="%1$s The option 'Collect URLs' is enabled." +; The following string is deprecated and will be removed with 4.0. COM_REDIRECT_COLLECT_URLS_DISABLED="The 'Collect URLs' option in the Redirect System Plugin is disabled. Error page URLs will not be collected by this component." COM_REDIRECT_CONFIGURATION="Redirect: Options" COM_REDIRECT_DISABLE_LINK="Disable Link" COM_REDIRECT_EDIT_LINK="Edit Link #%d" +COM_REDIRECT_EDIT_PLUGIN_SETTINGS="Edit Plugin Settings" COM_REDIRECT_ENABLE_LINK="Enable Link" COM_REDIRECT_ERROR_DESTINATION_URL_REQUIRED="The redirect must have a destination URL" COM_REDIRECT_ERROR_DUPLICATE_OLD_URL="The source URL must be unique." @@ -79,11 +82,14 @@ COM_REDIRECT_N_LINKS_UPDATED_1="1 link has been updated." COM_REDIRECT_NEW_LINK="New Link" COM_REDIRECT_NO_ITEM_ADDED="No links added." COM_REDIRECT_NO_ITEM_SELECTED="No links selected." +; The following string is deprecated and will be removed with 4.0. COM_REDIRECT_PLUGIN_DISABLED="The Redirect System Plugin is disabled. It needs to be enabled for this component to work." COM_REDIRECT_PLUGIN_ENABLED="The Redirect Plugin is enabled." +COM_REDIRECT_PLUGIN_MODAL_DISABLED="The %s is disabled. It needs to be enabled for this component to work." COM_REDIRECT_REDIRECTED_ON="Redirected on: %s." COM_REDIRECT_SAVE_SUCCESS="Link saved." COM_REDIRECT_SEARCH_LINKS="Search in link fields." +COM_REDIRECT_SYSTEM_PLUGIN="Redirect System Plugin" COM_REDIRECT_TOOLBAR_PURGE="Purge Unpublished" COM_REDIRECT_XML_DESCRIPTION="This component implements link redirection." JLIB_RULES_SETTING_NOTES="Changes apply to this component only.
Inherited - a Global Configuration setting or higher level setting is applied.
Denied always wins - whatever is set at the Global or higher level and applies to all child elements.
Allowed will enable the action for this component unless it is overruled by a Global Configuration setting." diff --git a/administrator/templates/hathor/html/com_redirect/links/default.php b/administrator/templates/hathor/html/com_redirect/links/default.php index 2ed99612f07f3..adb9d82720a01 100644 --- a/administrator/templates/hathor/html/com_redirect/links/default.php +++ b/administrator/templates/hathor/html/com_redirect/links/default.php @@ -140,15 +140,18 @@ pagination->getListFooter(); ?>
diff --git a/libraries/src/Joomla/CMS/Plugin/PluginHelper.php b/libraries/src/Joomla/CMS/Plugin/PluginHelper.php index 0f5227187e71b..10f348dc3b30c 100644 --- a/libraries/src/Joomla/CMS/Plugin/PluginHelper.php +++ b/libraries/src/Joomla/CMS/Plugin/PluginHelper.php @@ -316,7 +316,22 @@ protected static function load() { $db = \JFactory::getDbo(); $query = $db->getQuery(true) - ->select(array($db->quoteName('folder', 'type'), $db->quoteName('element', 'name'), $db->quoteName('params'))) + ->select( + $db->quoteName( + array( + 'folder', + 'element', + 'params', + 'extension_id' + ), + array( + 'type', + 'name', + 'params', + 'id' + ) + ) + ) ->from('#__extensions') ->where('enabled = 1') ->where('type = ' . $db->quote('plugin'))