-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Changes from all commits
2137d48
1618fe7
26cfbb4
2db1aa8
22c2733
71f4a41
0cfed0f
136c374
31ca00b
9eb0445
83d320f
419116f
0622cb7
71872e7
a958f85
4c990c0
a207e5e
ff636a7
00043fc
8191430
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
@@ -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." |
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&view=contacts&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1'; | ||
|
||
$button = new JObject; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm as There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
} |
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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> |
There was a problem hiding this comment.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done