Skip to content

Commit

Permalink
3.7.0: New Feature=>editor-xtd to insert menu items links in content
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Aug 22, 2016
1 parent 1f48268 commit d95c1f9
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 2 deletions.
1 change: 1 addition & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ protected function updateManifestCaches()
array('plugin', 'folderinstaller', 'installer', 0),
array('plugin', 'urlinstaller', 'installer', 0),
array('plugin', 'phpversioncheck', 'quickicon', 0),
array('plugin', 'menu', 'editors-xtd', 0),

// Templates
array('template', 'beez3', '', 0),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES
(459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES
(459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0);
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SET IDENTITY_INSERT #__extensions ON;

INSERT INTO #__extensions ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state])
SELECT 459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;

SET IDENTITY_INSERT #__extensions OFF;
8 changes: 8 additions & 0 deletions administrator/language/en-GB/en-GB.plg_editors-xtd_menu.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; Joomla! Project
; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8

PLG_EDITORS-XTD_MENU="Button - Menu"
PLG_MENU_BUTTON_MENU="Menu"
PLG_MENU_XML_DESCRIPTION="Displays a button to make it possible to insert menu items links into an Article. Displays a popup allowing you to choose the menu item."
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; Joomla! Project
; Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.
; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php
; Note : All ini files need to be saved as UTF-8

PLG_EDITORS-XTD_MENU="Button - Menu"
PLG_MENU_XML_DESCRIPTION="Displays a button to make it possible to insert menu items links into an Article. Displays a popup allowing you to choose the menu item."
2 changes: 2 additions & 0 deletions administrator/language/en-GB/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
<filename>en-GB.plg_editors-xtd_article.sys.ini</filename>
<filename>en-GB.plg_editors-xtd_image.ini</filename>
<filename>en-GB.plg_editors-xtd_image.sys.ini</filename>
<filename>en-GB.plg_editors-xtd_menu.ini</filename>
<filename>en-GB.plg_editors-xtd_menu.sys.ini</filename>
<filename>en-GB.plg_editors-xtd_module.ini</filename>
<filename>en-GB.plg_editors-xtd_module.sys.ini</filename>
<filename>en-GB.plg_editors-xtd_pagebreak.ini</filename>
Expand Down
1 change: 1 addition & 0 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`
(456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 2, 0),
(457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 3, 0),
(458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
(506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0),
Expand Down
3 changes: 2 additions & 1 deletion installation/sql/postgresql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,8 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder"
(455, 'plg_installer_packageinstaller', 'plugin', 'packageinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 1, 0),
(456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 2, 0),
(457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 3, 0),
(458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0);
(458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0),
(459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0);

-- Templates
INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES
Expand Down
4 changes: 3 additions & 1 deletion installation/sql/sqlazure/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@ SELECT 456, 'plg_installer_folderinstaller', 'plugin', 'folderinstaller', 'insta
UNION ALL
SELECT 457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 3, 0
UNION ALL
SELECT 458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;
SELECT 458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0
UNION ALL
SELECT 453, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;

INSERT [#__extensions] ([extension_id], [name], [type], [element], [folder], [client_id], [enabled], [access], [protected], [manifest_cache], [params], [custom_data], [system_data], [checked_out], [checked_out_time], [ordering], [state])
SELECT 503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1900-01-01 00:00:00', 0, 0
Expand Down
75 changes: 75 additions & 0 deletions plugins/editors-xtd/menu/menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.menu
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

/**
* Editor menu buton
*
* @since 3.7
*/
class PlgButtonMenu extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.7
*/
protected $autoloadLanguage = true;

/**
* Display the button
*
* @param string $name The name of the button to add
*
* @since 3.7
* @return array
*/
public function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectMenuItem when a menu item is clicked
* jSelectMenuItem creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "
function jSelectMenuItem(id, title, tree, object, uri, language)
{
var thislang = '';
if (language !== '')
{
var thislang = '&lang=';
}
var tag = '<a href=\"' + uri + thislang + language + '\">' + title + '</a>';
jInsertEditorText(tag, '" . $name . "');
jModalClose();
}";

$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);

/*
* Use the built-in element view to select the menu item.
* Currently uses blank class.
*/
$link = 'index.php?option=com_menus&amp;view=items&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';

$button = new JObject;
$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = JText::_('PLG_MENU_BUTTON_MENU');
$button->name = 'file-add';
$button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";

return $button;
}
}
19 changes: 19 additions & 0 deletions plugins/editors-xtd/menu/menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.7" type="plugin" group="editors-xtd" method="upgrade">
<name>plg_editors-xtd_menu</name>
<author>Joomla! Project</author>
<creationDate>August 2016</creationDate>
<copyright>Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.7.0</version>
<description>PLG_MENU_XML_DESCRIPTION</description>
<files>
<filename plugin="menu">menu.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_editors-xtd_menu.ini</language>
<language tag="en-GB">en-GB.plg_editors-xtd_menu.sys.ini</language>
</languages>
</extension>

0 comments on commit d95c1f9

Please sign in to comment.