Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[j3.7] New Feature Contact editor-xtd plugin #12252

Merged
merged 20 commits into from
Oct 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions administrator/components/com_admin/script.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ protected function updateManifestCaches()
array('plugin', 'urlinstaller', 'installer', 0),
array('plugin', 'phpversioncheck', 'quickicon', 0),
array('plugin', 'menu', 'editors-xtd', 0),
array('plugin', 'contact', '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
(460, 'plg_editors-xtd_contact', 'plugin', 'contact', '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
(460, 'plg_editors-xtd_contact', 'plugin', 'contact', '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 460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;

SET IDENTITY_INSERT [#__extensions] OFF;
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
description="COM_BANNERS_FIELD_DESCRIPTION_DESC"
filter="JComponentHelper::filterText"
buttons="true"
hide="readmore,pagebreak,module,article"
hide="readmore,pagebreak,module,article,contact"
/>

<field
Expand Down
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_CONTACT="Button - Contact"
PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT="Contact"
PLG_EDITORS-XTD_CONTACT_XML_DESCRIPTION="Displays a button to make it possible to insert links to Contacts in an article. Displays a popup allowing you to choose the contact."
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_CONTACT="Button - Contact"
PLG_EDITORS-XTD_CONTACT_XML_DESCRIPTION="Displays a button to make it possible to insert links to Contacts in an article. Displays a popup allowing you to choose the contact."
1 change: 1 addition & 0 deletions installation/sql/mysql/joomla.sql
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`
(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),
(460, 'plg_editors-xtd_contact', 'plugin', 'contact', '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 @@ -615,7 +615,8 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder"
(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),
(459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 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),
(460, 'plg_editors-xtd_contact', 'plugin', 'contact', '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 @@ -1014,7 +1014,9 @@ SELECT 457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer',
UNION ALL
SELECT 458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0
UNION ALL
SELECT 459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0;
SELECT 459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0
UNION ALL
SELECT 460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-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])
Expand Down
75 changes: 75 additions & 0 deletions plugins/editors-xtd/contact/contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Editors-xtd.contact
*
* @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 Contact buton
*
* @since __DEPLOY_VERSION__
*/
class PlgButtonContact extends JPlugin
{
/**
* Load the language file on instantiation.
*
* @var boolean
* @since __DEPLOY_VERSION__
*/
protected $autoloadLanguage = true;

/**
* Display the button
*
* @param string $name The name of the button to add
*
* @return JObject The button options as JObject
*
* @since __DEPLOY_VERSION__
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SInCE __DEPLOY_VERSION__ is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

public function onDisplay($name)
{
/*
* Javascript to insert the link
* View element calls jSelectContact when a contact is clicked
* jSelectContact creates the link tag, sends it to the editor,
* and closes the select frame.
*/
$js = "
function jSelectContact(id, title, catid, object, link, lang)
{
var hreflang = '';
if (lang !== '')
{
var hreflang = ' hreflang = \"' + lang + '\"';
}
var tag = '<a' + hreflang + ' href=\"' + link + '\">' + title + '</a>';
jInsertEditorText(tag, '" . $name . "');
jModalClose();
}";

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

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

$button = new JObject;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm as JObject is deprecated i guess we can use here $button = new stdClass();?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea - direct copy from the article plugin

$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = JText::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT');
$button->name = 'address';
$button->options = "{handler: 'iframe', size: {x: 800, y: 500}}";

return $button;
}
}
19 changes: 19 additions & 0 deletions plugins/editors-xtd/contact/contact.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_contact</name>
<author>Joomla! Project</author>
<creationDate>October 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>__DEPLOY_VERSION__</version>
<description>PLG_EDITORS-XTD_CONTACT_XML_DESCRIPTION</description>
<files>
<filename plugin="contact">contact.php</filename>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure here. As we have allready a plugin with the same deklaration: https://github.com/joomla/joomla-cms/blob/staging/plugins/content/contact/contact.xml#L13

The reason I'm not sure is that i don't know where this information is used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure its not an issue as the plugin-type/folder is different. For example We have two content and two contacts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops yes you are correct.

</files>
<languages>
<language tag="en-GB">en-GB.plg_editors-xtd_contact.ini</language>
<language tag="en-GB">en-GB.plg_editors-xtd_contact.sys.ini</language>
</languages>
</extension>