primo commit
This commit is contained in:
1
plugins/editors-xtd/insert_attachments_token/index.html
Normal file
1
plugins/editors-xtd/insert_attachments_token/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* Add Attachments Button plugin
|
||||
*
|
||||
* @package Attachments
|
||||
* @subpackage Insert_Attachments_Token_Button_Plugin
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2018 Jonathan M. Cameron, All Rights Reserved
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
* @link http://joomlacode.org/gf/project/attachments/frs/
|
||||
* @author Jonathan M. Cameron
|
||||
*/
|
||||
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die('Restricted access');
|
||||
|
||||
jimport('joomla.plugin.plugin');
|
||||
|
||||
/**
|
||||
* Button that allows you to insert an {attachments} token into the text from the editor
|
||||
*
|
||||
* @package Attachments
|
||||
*/
|
||||
class plgButtonInsert_attachments_token extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param &object &$subject The object to observe
|
||||
* @param array $config An array that holds the plugin configuration
|
||||
* @since 1.5
|
||||
*/
|
||||
public function __construct(&$subject, $config)
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
$this->loadLanguage();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert attachments token button
|
||||
*
|
||||
* @param string $name The name of the editor form
|
||||
* @param int $asset The asset ID for the entity being edited
|
||||
* @param int $authro The ID of the author of the entity
|
||||
*
|
||||
* @return a button
|
||||
*/
|
||||
public function onDisplay($name, $asset, $author)
|
||||
{
|
||||
// Get the component parameters
|
||||
jimport('joomla.application.component.helper');
|
||||
$params = JComponentHelper::getParams('com_attachments');
|
||||
|
||||
// This button should only be displayed in 'custom placement' mode.
|
||||
// Check to make sure that is the case
|
||||
$placement = $params->get('attachments_placement', 'end');
|
||||
if ( $placement != 'custom' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Avoid displaying the button for anything except for registered parents
|
||||
$parent_type = JRequest::getCmd('option');
|
||||
|
||||
// Handle sections and categories specially (since they are really com_content)
|
||||
if ($parent_type == 'com_categories') {
|
||||
$parent_type = 'com_content';
|
||||
}
|
||||
|
||||
// Get the article/parent handler
|
||||
JPluginHelper::importPlugin('attachments');
|
||||
$apm = getAttachmentsPluginManager();
|
||||
if ( !$apm->attachmentsPluginInstalled($parent_type) ) {
|
||||
// Exit if there is no Attachments plugin to handle this parent_type
|
||||
return new JObject();
|
||||
}
|
||||
|
||||
// Get ready for language things
|
||||
$lang = JFactory::getLanguage();
|
||||
if ( !$lang->load('plg_editors-xtd_insert_attachments_token', dirname(__FILE__)) ) {
|
||||
// If the desired translation is not available, at least load the English
|
||||
$lang->load('plg_editors-xtd_insert_attachments_token', JPATH_ADMINISTRATOR, 'en-GB');
|
||||
}
|
||||
|
||||
// Set up the Javascript to insert the tag
|
||||
$getContent = $this->_subject->getContent($name);
|
||||
$present = JText::_('ATTACH_ATTACHMENTS_TOKEN_ALREADY_PRESENT', true) ;
|
||||
$js = "
|
||||
function insertAttachmentsToken(editor) {
|
||||
var content = $getContent
|
||||
if (content.match(/\{\s*attachments/i)) {
|
||||
alert('$present');
|
||||
return false;
|
||||
} else {
|
||||
jInsertEditorText('<span class=\"hide_attachments_token\">{attachments}</span>', editor);
|
||||
}
|
||||
}
|
||||
";
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
$doc = JFactory::getDocument();
|
||||
$uri = JFactory::getURI();
|
||||
|
||||
$doc->addScriptDeclaration($js);
|
||||
|
||||
// Add the regular css file
|
||||
JHtml::stylesheet('com_attachments/attachments_list.css', Array(), true);
|
||||
JHtml::stylesheet('com_attachments/insert_attachments_token_button.css', Array(), true);
|
||||
|
||||
// Handle RTL styling (if necessary)
|
||||
if ( $lang->isRTL() ) {
|
||||
JHtml::stylesheet('com_attachments/attachments_list_rtl.css', Array(), true);
|
||||
JHtml::stylesheet('com_attachments/insert_attachments_token_button_rtl.css', Array(), true);
|
||||
}
|
||||
|
||||
$button = new JObject();
|
||||
$button->set('modal', false);
|
||||
$button->set('class', 'btn');
|
||||
$button->set('onclick', 'insertAttachmentsToken(\''.$name.'\');return false;');
|
||||
$button->set('text', JText::_('ATTACH_ATTACHMENTS_TOKEN'));
|
||||
$button->set('title', JText::_('ATTACH_ATTACHMENTS_TOKEN_DESCRIPTION'));
|
||||
|
||||
if ( $app->isAdmin() ) {
|
||||
$button_name = 'insert_attachments_token';
|
||||
if (version_compare(JVERSION, '3.3', 'ge')) {
|
||||
$button_name = 'paperclip';
|
||||
}
|
||||
$button->set('name', $button_name);
|
||||
}
|
||||
else {
|
||||
$button_name = 'insert_attachments_token_frontend';
|
||||
if (version_compare(JVERSION, '3.3', 'ge')) {
|
||||
$button_name = 'paperclip';
|
||||
}
|
||||
$button->set('name', $button_name);
|
||||
}
|
||||
|
||||
// TODO: The button writer needs to take into account the javascript directive
|
||||
// $button->set('link', 'javascript:void(0)');
|
||||
$button->set('link', '#');
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" group="editors-xtd" version="2.5" method="upgrade">
|
||||
<name>plg_editors-xtd_insert_attachments_token_btn</name>
|
||||
<version>3.2.6</version>
|
||||
<creationDate>March 26, 2018</creationDate>
|
||||
<author>Jonathan M. Cameron</author>
|
||||
<copyright>(C) 2007-2018 Jonathan M. Cameron. All rights reserved.</copyright>
|
||||
<license>http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL</license>
|
||||
<authorEmail>jmcameron@jmcameron.net</authorEmail>
|
||||
<authorUrl>http://joomlacode.org/gf/project/attachments/</authorUrl>
|
||||
<description>ATTACH_INSERT_ATTACHMENTS_TOKEN_BUTTON_PLUGIN_DESCRIPTION</description>
|
||||
|
||||
<files>
|
||||
<filename plugin="insert_attachments_token">insert_attachments_token.php</filename>
|
||||
<filename>index.html</filename>
|
||||
<folder>language</folder>
|
||||
</files>
|
||||
|
||||
</extension>
|
||||
@ -0,0 +1,18 @@
|
||||
; en-GB.plg_editors-xtd_add_attachment.ini
|
||||
; Attachments for Joomla! extension
|
||||
; Copyright (C) 2007-2018 Jonathan M. Cameron, All rights reserved.
|
||||
; License http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
; English translation
|
||||
|
||||
; NOTE TO TRANSLATORS:
|
||||
; Do not translate the '{attachments}' part of any of the right-hand
|
||||
; strings below! It must appear exactly as '{attachments}' in the
|
||||
; article/parent text in order for the substitutions to work correctly in
|
||||
; 'custom placement' mode.!
|
||||
|
||||
ATTACH_ATTACHMENTS_TOKEN="Insert {attachments} token"
|
||||
ATTACH_ATTACHMENTS_TOKEN_ALREADY_PRESENT="The {attachments} token is already present. It can only appear in one location in the text!"
|
||||
ATTACH_ATTACHMENTS_TOKEN_DESCRIPTION="Place the cursor in the location where you want the attachments list to display (in the front end) and then click on this button. This inserts the {attachments} token that the 'Custom Placement' option uses. Some HTML is also added to hide the token when attachments lists are not shown."
|
||||
ATTACH_INSERT_ATTACHMENTS_TOKEN_BUTTON_PLUGIN_DESCRIPTION="The insert attachments token plugin adds a button that allows you to insert an {attachments} custom placement token while editing articles or categories."
|
||||
@ -0,0 +1,16 @@
|
||||
; en-GB.plg_editors-xtd_add_attachment.sys.ini
|
||||
; Attachments for Joomla! extension
|
||||
; Copyright (C) 2007-2018 Jonathan M. Cameron, All rights reserved.
|
||||
; License http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
; English translation
|
||||
|
||||
; NOTE TO TRANSLATORS:
|
||||
; Do not translate the '{attachments}' part of any of the right-hand
|
||||
; strings below! It must appear exactly as '{attachments}' in the
|
||||
; article/parent text in order for the substitutions to work correctly in
|
||||
; 'custom placement' mode.!
|
||||
|
||||
ATTACH_INSERT_ATTACHMENTS_TOKEN_BUTTON_PLUGIN_DESCRIPTION="The insert attachments token plugin adds a button that allows you to insert an {attachments} custom placement token while editing articles or categories."
|
||||
PLG_EDITORS-XTD_INSERT_ATTACHMENTS_TOKEN_BTN="Editor Button - Insert Attachments Token"
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@ -0,0 +1,18 @@
|
||||
; it-IT.plg_editors-xtd_add_attachment.ini
|
||||
; Attachments for Joomla! extension
|
||||
; Copyright (C) 2007-2013 Jonathan M. Cameron, All rights reserved.
|
||||
; License GNU GPL 3: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
; Italian translation by: Piero Mattirolo (2.0, 3.0), Lemminkainen (version 1.3.4)
|
||||
|
||||
; NOTE TO TRANSLATORS:
|
||||
; Do not translate the '{attachments}' part of any of the right-hand
|
||||
; strings below! It must appear exactly as '{attachments}' in the
|
||||
; article/parent text in order for the substitutions to work correctly in
|
||||
; 'custom placement' mode.!
|
||||
|
||||
ATTACH_ATTACHMENTS_TOKEN="Inserisce segnaposto {attachments}"
|
||||
ATTACH_ATTACHMENTS_TOKEN_ALREADY_PRESENT="Il segnaposto {attachments} è già presente. Può soltanto apparire in una sola posizione nel testo!"
|
||||
ATTACH_ATTACHMENTS_TOKEN_DESCRIPTION="Inserire il cursore nella posizione dove si desidere mostrare la lista allegati (nel front end) e premere il bottone. Questo inserisce il segnaposto {attachments} utilizzato dall'opzione 'Posizione personalizzata'. Viene inserito del codice HTML che nasconde il segnaposto quando la lista degli allegati non viene mostrata."
|
||||
ATTACH_INSERT_ATTACHMENTS_TOKEN_BUTTON_PLUGIN_DESCRIPTION="Il plugin aggiunge un bottone che permette di inserire un segnaposto personalizzato {attachments} in fase di modifica di articoli o categorie."
|
||||
@ -0,0 +1,16 @@
|
||||
; it-IT.plg_editors-xtd_add_attachment.sys.ini
|
||||
; Attachments for Joomla! extension
|
||||
; Copyright (C) 2007-2013 Jonathan M. Cameron, All rights reserved.
|
||||
; License GNU GPL 3: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
; Note : All ini files need to be saved as UTF-8 - No BOM
|
||||
|
||||
; Italian translation by: Piero Mattirolo (2.0, 3.0), Lemminkainen (version 1.3.4)
|
||||
|
||||
; NOTE TO TRANSLATORS:
|
||||
; Do not translate the '{attachments}' part of any of the right-hand
|
||||
; strings below! It must appear exactly as '{attachments}' in the
|
||||
; article/parent text in order for the substitutions to work correctly in
|
||||
; 'custom placement' mode.!
|
||||
|
||||
ATTACH_INSERT_ATTACHMENTS_TOKEN_BUTTON_PLUGIN_DESCRIPTION="Questo plugin aggiunge un bottone che permette di inserire un segnaposto personalizzato per l'inserimento di {attachments} mentre si modificano articoli o categorie."
|
||||
PLG_EDITORS-XTD_INSERT_ATTACHMENTS_TOKEN_BTN="Bottone Editor - Inserisce segnaposto allegati"
|
||||
Reference in New Issue
Block a user