Skip to content

Commit

Permalink
[j3.7] New Feature Contact editor-xtd plugin (#12252)
Browse files Browse the repository at this point in the history
* New editor-xtd contact plugin

* docs

* update sql

* add contact icon

* prevent loading in com_banners where it is useless

* Installation sql

* correct installation

* extra line feed

* __DEPLOY_VERSION__

* __DEPLOY_VERSION__

* com_admin script

* Update contact.php

* Update contact.php

* Update contact.php

* Update contact.xml

* Update en-GB.plg_editors-xtd_contact.sys.ini

* Update en-GB.plg_editors-xtd_contact.ini

* Update 3.7.0-2016-10-01.sql

* Update 3.7.0-2016-10-01.sql

* Update 3.7.0-2016-10-01.sql
  • Loading branch information
brianteeman authored and rdeutz committed Oct 4, 2016
1 parent f8812d5 commit 1f3db97
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 3 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 @@ -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__
*/
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;
$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>
</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>

0 comments on commit 1f3db97

Please sign in to comment.