/plugins/editors-xtd/article/article.php
PHP | 69 lines | 31 code | 7 blank | 31 comment | 0 complexity | cbec377ecb41bdcda7f45590ff4372ff MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1
- <?php
- /**
- * @version $Id: image.php 13031 2009-10-02 21:54:22Z louis $
- * @package Joomla
- * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
- // no direct access
- defined('_JEXEC') or die;
- jimport('joomla.plugin.plugin');
- /**
- * Editor Article buton
- *
- * @package Editors-xtd
- * @since 1.5
- */
- class plgButtonArticle extends JPlugin
- {
- /**
- * Display the button
- *
- * @return array A four element array of (article_id, article_title, category_id, object)
- */
- function onDisplay($name)
- {
- /*
- * Javascript to insert the link
- * View element calls jSelectArticle when an article is clicked
- * jSelectArticle creates the link tag, sends it to the editor,
- * and closes the select frame.
- */
- $js = "
- function jSelectArticle(id, title, catid, object) {
- var tag = '<a href='+'\"index.php?option=com_content&view=article&catid='+catid+'&id='+id+'\">'+title+'</a>';
- jInsertEditorText(tag, '".$name."');
- SqueezeBox.close();
- }";
- /*
- * CSS for article button
- */
- $css = "
- .button2-left .article {
- background: url(../../../plugins/editors-xtd/article.png) 100% 0 no-repeat;
- }";
- $doc =& JFactory::getDocument();
- $doc->addScriptDeclaration($js);
- $doc->addStyleDeclaration($css);
- JHTML::_('behavior.modal');
- /*
- * Use the built-in element view to select the article.
- * Currently uses blank class.
- */
- $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component';
- $button = new JObject();
- $button->set('modal', true);
- $button->set('link', $link);
- $button->set('text', JText::_('PLG_ARTICLE_BUTTON_ARTICLE'));
- $button->set('name', 'article');
- $button->set('options', "{handler: 'iframe', size: {x: 770, y: 400}}");
- return $button;
- }
- }