mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-08-26 04:59:48 +00:00
Reworked editor-xtd handling, added ability to specifiy which editor-xtd plugins you don't want to display.
git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@7800 6f6e1ebd-4c2b-0410-823f-f34bde69bce9
This commit is contained in:
parent
ccdb0fbaea
commit
eab44e0601
@ -37,6 +37,9 @@ Legend:
|
||||
- -> Removed
|
||||
! -> Note
|
||||
|
||||
27-Jun-2007 Johan Janssens
|
||||
^ Reworked editor-xtd handling, added ability to specifiy which editor-xtd plugins you don't want to display.
|
||||
|
||||
27-Jun-2007 Rob Schley
|
||||
^ Reworked the password reset work-flow to be more secure
|
||||
^ Adjusted some of the links in mod_login to point to the new username reminder and password reset features
|
||||
@ -49,11 +52,11 @@ Legend:
|
||||
|
||||
26-Jun-2007 Johan Janssens
|
||||
^ Fixed [#5748] & appears as *amp; in breadcrumbs
|
||||
^ Fixed remember me functionality for the openid plugin. Changes also have effect on any of the
|
||||
other authentication and user plugins.
|
||||
^ Fixed remember me functionality for the openid plugin. Changes also have effect on any of the
|
||||
other authentication and user plugins.
|
||||
|
||||
26-Jun-2007 Toby Patterson
|
||||
^ JDocument will default to RAW document if the request format is not supported, but document's
|
||||
^ JDocument will default to RAW document if the request format is not supported, but document's
|
||||
type will be that of the requested format (see JDocument::getInstance) - Louis's suggestion
|
||||
# Fixed [#5743] Dateformat in category blog layout
|
||||
|
||||
@ -61,7 +64,7 @@ Legend:
|
||||
+ New method JUtility dump
|
||||
|
||||
25-Jun-2007 Mateusz Krzeszowiec
|
||||
# Fixed [#5757] com_content view=category does not show registered article link to nonregistered
|
||||
# Fixed [#5757] com_content view=category does not show registered article link to nonregistered
|
||||
user when Show UnAuthorized Links set to Yes
|
||||
|
||||
25-Jun-2007 Chris Davenport
|
||||
|
@ -472,7 +472,7 @@ class HTML_modules
|
||||
|
||||
<?php
|
||||
// parameters : areaname, content, width, height, cols, rows
|
||||
echo $editor->display( 'content', $row->content, '100%', '400', '60', '20' ) ;
|
||||
echo $editor->display( 'content', $row->content, '100%', '400', '60', '20', array('pagebreak', 'readmore') ) ;
|
||||
?>
|
||||
|
||||
</fieldset>
|
||||
|
@ -21,6 +21,7 @@ jimport('joomla.event.dispatcher');
|
||||
* JEditor class to handle WYSIWYG editors
|
||||
*
|
||||
* @author Louis Landry <louis.landry@joomla.org>
|
||||
* @author Johan Janssens <johan.janssens@joomla.org>
|
||||
* @package Joomla.Framework
|
||||
* @subpackage HTML
|
||||
* @since 1.5
|
||||
@ -224,6 +225,46 @@ class JEditor extends JObservable
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the editor buttons
|
||||
*
|
||||
* @param mixed $buttons Can be boolean or array, if boolean defines if the buttons
|
||||
* are displayed, if array defines a list of buttons not to show.
|
||||
* @access public
|
||||
* @since 1.5
|
||||
*/
|
||||
function getButtons($editor, $buttons = true)
|
||||
{
|
||||
$result = array();
|
||||
|
||||
if(is_bool($buttons) && !$buttons) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
//Make sure the plugin information is loaded
|
||||
$isLoaded = JPluginHelper::importPlugin('editors-xtd');
|
||||
|
||||
// Get plugins
|
||||
$plugins = JPluginHelper::getPlugin('editors-xtd');
|
||||
|
||||
foreach($plugins as $plugin)
|
||||
{
|
||||
if(is_array($buttons) && in_array($plugin->element, $buttons)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$className = 'plgButton'.$plugin->element;
|
||||
if(class_exists($className)) {
|
||||
$plugin = new $className($this);
|
||||
}
|
||||
|
||||
// Try to authenticate
|
||||
$result[] = $plugin->onDisplay($editor);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the editor
|
||||
*
|
||||
|
@ -14,41 +14,54 @@
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onCustomEditorButton', 'plgImageButton' );
|
||||
jimport('joomla.event.plugin');
|
||||
|
||||
/**
|
||||
* Editor Image button
|
||||
*
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function plgImageButton()
|
||||
* Editor Image buton
|
||||
*
|
||||
* @author Johan Janssens <johan.janssens@joomla.org>
|
||||
* @package Editors-xtd
|
||||
* @since 1.5
|
||||
*/
|
||||
class plgButtonImage extends JPlugin
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$doc =& JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
|
||||
// button is not active in specific content components
|
||||
switch ( $option )
|
||||
{
|
||||
case 'com_sections' :
|
||||
case 'com_categories' :
|
||||
$button = array( false );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$link = 'index.php?option=com_media&task=imgManager&tmpl=component';
|
||||
$css = "\t.button1-left .image { background: url($url/plugins/editors-xtd/image.gif) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScript($url.'includes/js/joomla/modal.js');
|
||||
$doc->addStyleSheet($url.'includes/js/joomla/modal.css');
|
||||
$button = array( "document.popup.show('$link', 570, 400, null)", JText::_('Image'), 'image' );
|
||||
break;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* For php4 compatability we must not use the __constructor as a constructor for plugins
|
||||
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
|
||||
* This causes problems with cross-referencing necessary for the observer design pattern.
|
||||
*
|
||||
* @param object $subject The object to observe
|
||||
* @since 1.5
|
||||
*/
|
||||
function plgButtonImage(& $subject) {
|
||||
parent::__construct($subject);
|
||||
}
|
||||
|
||||
return $button;
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function onDisplay($name)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
$doc =& JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
|
||||
$link = 'index.php?option=com_media&task=imgManager&tmpl=component';
|
||||
$css = "\t.button1-left .image { background: url($url/plugins/editors-xtd/image.gif) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScript($url.'includes/js/joomla/modal.js');
|
||||
$doc->addStyleSheet($url.'includes/js/joomla/modal.css');
|
||||
$button = array( "document.popup.show('$link', 570, 400, null)", JText::_('Image'), 'image' );
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
?>
|
@ -14,39 +14,53 @@
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onCustomEditorButton', 'plgPagebreakButton' );
|
||||
jimport('joomla.event.plugin');
|
||||
|
||||
/**
|
||||
* mospage button
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function plgPagebreakButton()
|
||||
* Editor Pagebreak buton
|
||||
*
|
||||
* @author Johan Janssens <johan.janssens@joomla.org>
|
||||
* @package Editors-xtd
|
||||
* @since 1.5
|
||||
*/
|
||||
class plgButtonPagebreak extends JPlugin
|
||||
{
|
||||
global $mainframe, $option;
|
||||
|
||||
$doc = & JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
// button is not active in specific content components
|
||||
switch ( $option )
|
||||
{
|
||||
case 'com_sections' :
|
||||
case 'com_categories':
|
||||
case 'com_modules' :
|
||||
$button = array( false );
|
||||
break;
|
||||
|
||||
default:
|
||||
$link = 'index.php?option=com_content&task=ins_pagebreak&tmpl=component';
|
||||
|
||||
$css = "\t.button1-left .pagebreak { background: url($url/plugins/editors-xtd/pagebreak.gif) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScript($url.'includes/js/joomla/modal.js');
|
||||
$doc->addStyleSheet($url.'includes/js/joomla/modal.css');
|
||||
$button = array( "document.popup.show('$link', 400, 150, null)", JText::_('Pagebreak'), 'pagebreak' );
|
||||
break;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* For php4 compatability we must not use the __constructor as a constructor for plugins
|
||||
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
|
||||
* This causes problems with cross-referencing necessary for the observer design pattern.
|
||||
*
|
||||
* @param object $subject The object to observe
|
||||
* @since 1.5
|
||||
*/
|
||||
function plgButtonPagebreak(& $subject) {
|
||||
parent::__construct($subject);
|
||||
}
|
||||
|
||||
return $button;
|
||||
/**
|
||||
* Display the button
|
||||
*
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function onDisplay($name)
|
||||
{
|
||||
global $mainframe;
|
||||
|
||||
$doc = & JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
|
||||
$link = 'index.php?option=com_content&task=ins_pagebreak&tmpl=component';
|
||||
|
||||
$css = "\t.button1-left .pagebreak { background: url($url/plugins/editors-xtd/pagebreak.gif) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScript($url.'includes/js/joomla/modal.js');
|
||||
$doc->addStyleSheet($url.'includes/js/joomla/modal.css');
|
||||
$button = array( "document.popup.show('$link', 400, 150, null)", JText::_('Pagebreak'), 'pagebreak' );
|
||||
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
?>
|
@ -14,34 +14,48 @@
|
||||
// no direct access
|
||||
defined( '_JEXEC' ) or die( 'Restricted access' );
|
||||
|
||||
$mainframe->registerEvent( 'onCustomEditorButton', 'plgReadmoreButton' );
|
||||
jimport('joomla.event.plugin');
|
||||
|
||||
/**
|
||||
* readmore button
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function plgReadmoreButton($name)
|
||||
* Editor Readmore buton
|
||||
*
|
||||
* @author Johan Janssens <johan.janssens@joomla.org>
|
||||
* @package Editors-xtd
|
||||
* @since 1.5
|
||||
*/
|
||||
class plgButtonReadmore extends JPlugin
|
||||
{
|
||||
global $mainframe, $option;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* For php4 compatability we must not use the __constructor as a constructor for plugins
|
||||
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
|
||||
* This causes problems with cross-referencing necessary for the observer design pattern.
|
||||
*
|
||||
* @param object $subject The object to observe
|
||||
* @since 1.5
|
||||
*/
|
||||
function plgButtonReadmore(& $subject) {
|
||||
parent::__construct($subject);
|
||||
}
|
||||
|
||||
$doc =& JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
// button is not active in specific content components
|
||||
switch ( $option )
|
||||
/**
|
||||
* readmore button
|
||||
* @return array A two element array of ( imageName, textToInsert )
|
||||
*/
|
||||
function onDisplay($name)
|
||||
{
|
||||
case 'com_sections':
|
||||
case 'com_categories':
|
||||
case 'com_modules':
|
||||
$button = array( false );
|
||||
break;
|
||||
global $mainframe;
|
||||
|
||||
default:
|
||||
$editor =& JFactory::getEditor();
|
||||
$getContent = $editor->getContent($name);
|
||||
$present = "Already Exists";
|
||||
$js = "
|
||||
$doc =& JFactory::getDocument();
|
||||
$template = $mainframe->getTemplate();
|
||||
|
||||
$url = $mainframe->isAdmin() ? $mainframe->getSiteURL() : JURI::base();
|
||||
// button is not active in specific content components
|
||||
|
||||
$getContent = $this->_subject->getContent($name);
|
||||
$present = "Already Exists";
|
||||
$js = "
|
||||
function insertReadmore() {
|
||||
var content = $getContent
|
||||
if (content.match(/<hr id=\"system-readmore\" \/>/)) {
|
||||
@ -53,13 +67,12 @@ function plgReadmoreButton($name)
|
||||
}
|
||||
";
|
||||
|
||||
$css = "\t.button1-left .readmore { background: url($url/plugins/editors-xtd/readmore.png) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScriptDeclaration($js);
|
||||
$button = array( "insertReadmore()", JText::_('Readmore'), 'readmore' );
|
||||
break;
|
||||
}
|
||||
$css = "\t.button1-left .readmore { background: url($url/plugins/editors-xtd/readmore.png) 100% 0 no-repeat; }";
|
||||
$doc->addStyleDeclaration($css);
|
||||
$doc->addScriptDeclaration($js);
|
||||
$button = array( "insertReadmore()", JText::_('Readmore'), 'readmore' );
|
||||
|
||||
return $button;
|
||||
return $button;
|
||||
}
|
||||
}
|
||||
?>
|
@ -131,9 +131,9 @@ class plgEditorNone extends JPlugin
|
||||
}
|
||||
}
|
||||
|
||||
if($buttons) {
|
||||
$dispatcher =& JEventDispatcher::getInstance();
|
||||
$results = $dispatcher->trigger( 'onCustomEditorButton', array('name' => $name) );
|
||||
if(!empty($buttons))
|
||||
{
|
||||
$results = $this->_subject->getButtons($name, $buttons);
|
||||
|
||||
/*
|
||||
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
|
||||
|
@ -363,8 +363,9 @@ class plgEditorTinymce extends JPlugin
|
||||
* @param string The height of the editor area
|
||||
* @param int The number of columns for the editor area
|
||||
* @param int The number of rows for the editor area
|
||||
* @param mixed Can be boolean or array.
|
||||
*/
|
||||
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true )
|
||||
function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = true)
|
||||
{
|
||||
// Only add "px" to width and height if they are not given as a percentage
|
||||
if (is_numeric( $width )) {
|
||||
@ -385,9 +386,9 @@ class plgEditorTinymce extends JPlugin
|
||||
}
|
||||
}
|
||||
|
||||
if($buttons) {
|
||||
$dispatcher =& JEventDispatcher::getInstance();
|
||||
$results = $dispatcher->trigger( 'onCustomEditorButton', array('name' => $name) );
|
||||
if(!empty($buttons))
|
||||
{
|
||||
$results = $this->_subject->getButtons($name, $buttons);
|
||||
|
||||
/*
|
||||
* This will allow plugins to attach buttons or change the behavior on the fly using AJAX
|
||||
|
Loading…
Reference in New Issue
Block a user