mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
TinyMce fixes. Switched to .xml templates.
This commit is contained in:
parent
cbd44f0ddd
commit
7e0ccc3c7a
@ -406,11 +406,24 @@ class tinymce
|
||||
}
|
||||
}
|
||||
|
||||
$xml = new SimpleXMLElement('<tinymce/>');
|
||||
$insertXml = array_flip($insert_array);
|
||||
array_walk_recursive($insertXml, array ($xml, 'addChild'));
|
||||
$save = $xml->asXML();
|
||||
|
||||
file_put_contents(e_SYSTEM."admin.xml",$save);
|
||||
|
||||
// echo htmlentities($save);
|
||||
|
||||
|
||||
if($id)
|
||||
{
|
||||
$insert_array['WHERE'] = $this->primary." = ".$id;
|
||||
$status = $sql->db_Update($this->table,$insert_array) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
|
||||
$message = LAN_UPDATED;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -40,8 +40,20 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
|
||||
|
||||
});
|
||||
|
||||
$('.e-wysiwyg').live('click',function(){
|
||||
var id = $(this).attr('id'); // eg. news-body
|
||||
// jQuery.e-tab-add = function()
|
||||
// {
|
||||
// alert('added tab');
|
||||
// }
|
||||
|
||||
|
||||
// When new tab is added - convert textarea to TinyMce.
|
||||
$('.e-tabs-add').on('click',function(){
|
||||
|
||||
alert('New Page Added'); // added for delay - quick and dirty work-around. XXX fixme
|
||||
|
||||
var idt = $(this).attr('data-target'); // eg. news-body
|
||||
var ct = parseInt($('#e-tab-count').val());
|
||||
var id = idt + '-' + ct;
|
||||
$('#bbcode-panel-'+id+'--preview').hide();
|
||||
$('#'+id).after('<div><a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle\">Switch to BBCODE</a></div>');
|
||||
tinyMCE.execCommand('mceAddControl', false, id);
|
||||
|
@ -1,12 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Id: plugin.xml,v 1.3 2009-10-20 03:49:22 e107coders Exp $ -->
|
||||
<e107Plugin name="TinyMce" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="true">
|
||||
<e107Plugin name="TinyMce" version="1.0" date="2012-08-01" compatibility="2.0" installRequired="false">
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>Wysiwyg Text-Area Replacement</description>
|
||||
<category>misc</category>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure TinyMce' icon='images/icon_32.png' iconSmall='images/icon_16.png' primary='true' >Configure TinyMce</link>
|
||||
</adminLinks>
|
||||
<pluginPrefs>
|
||||
</pluginPrefs>
|
||||
</e107Plugin>
|
1
e107_plugins/tinymce/templates/admin.xml
Normal file
1
e107_plugins/tinymce/templates/admin.xml
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0"?>
<tinymce>
<tinymce_name>Administrators</tinymce_name>
<tinymce_plugins>contextmenu,e107bbcode,emoticons,ibrowser,iespell,jqueryinlinepopups,paste,table,xhtmlxtras</tinymce_plugins>
<tinymce_buttons1>bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons</tinymce_buttons1>
<extended_valid_elements>object[*],embed[*]</extended_valid_elements>
</tinymce>
|
7
e107_plugins/tinymce/templates/mainadmin.xml
Normal file
7
e107_plugins/tinymce/templates/mainadmin.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<tinymce>
|
||||
<tinymce_name>Main Admin</tinymce_name>
|
||||
<tinymce_plugins>advhr,advlink,autosave,contextmenu,directionality,e107bbcode,emoticons,ibrowser,paste,table,visualchars,wordcount,xhtmlxtras,youtube</tinymce_plugins>
|
||||
<tinymce_buttons1>link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons, youtube</tinymce_buttons1>
|
||||
<extended_valid_elements>object[*],embed[*]</extended_valid_elements>
|
||||
</tinymce>
|
8
e107_plugins/tinymce/templates/member.xml
Normal file
8
e107_plugins/tinymce/templates/member.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<tinymce>
|
||||
<tinymce_name>Members</tinymce_name>
|
||||
<tinymce_userclass></tinymce_userclass>
|
||||
<tinymce_plugins>e107bbcode,emoticons,jqueryinlinepopups,table</tinymce_plugins>
|
||||
<tinymce_buttons1>bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons</tinymce_buttons1>
|
||||
<tinymce_prefs></tinymce_prefs>
|
||||
</tinymce>
|
7
e107_plugins/tinymce/templates/public.xml
Normal file
7
e107_plugins/tinymce/templates/public.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<tinymce>
|
||||
<tinymce_name>Simple Users</tinymce_name>
|
||||
<tinymce_userclass>252</tinymce_userclass>
|
||||
<tinymce_plugins>e107bbcode,emoticons,jqueryinlinepopups</tinymce_plugins>
|
||||
<tinymce_buttons1>bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons</tinymce_buttons1>
|
||||
</tinymce>
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* Custom TinyMce install/uninstall/update routines
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/tinymce/tinymce_setup.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*
|
||||
*/
|
||||
|
||||
class tinymce_setup
|
||||
{
|
||||
/*
|
||||
function install_pre($var)
|
||||
{
|
||||
// print_a($var);
|
||||
// echo "custom install 'pre' function<br /><br />";
|
||||
}
|
||||
*/
|
||||
function install_post($var)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$mes = e107::getMessage();
|
||||
|
||||
$query = "INSERT INTO #tinymce (
|
||||
`tinymce_id`, `tinymce_name`, `tinymce_userclass`, `tinymce_plugins`, `tinymce_buttons1`, `tinymce_buttons2`, `tinymce_buttons3`, `tinymce_buttons4`, `tinymce_custom`, `tinymce_prefs`) VALUES
|
||||
(1, 'Simple Users', '252', 'e107bbcode,emoticons,jqueryinlinepopups,', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(2, 'Members', '253', 'e107bbcode,emoticons,table,jqueryinlinepopups', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, emoticons', '', '', '', '', ''),
|
||||
(3, 'Administrators', '254', 'contextmenu,e107bbcode,jqueryinlinepopups,emoticons,ibrowser,iespell,paste,table,xhtmlxtras', 'bold, italic, underline, undo, redo, link, unlink, image, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, code, emoticons, youtube', '', '', '', '', ''),
|
||||
(4, 'Main Admin', '250', 'advhr,advlink,autoresize,contextmenu,directionality,e107bbcode,emoticons,ibrowser,jqueryinlinepopups,media,paste,table,visualchars,wordcount,xhtmlxtras,youtube,zoom', 'link, unlink, bold, italic, underline, undo, redo,formatselect,justifyleft,justifycenter,justifyright,justifyfull, |, ibrowser, forecolor, removeformat, table, bullist, numlist, outdent, indent, cleanup, emoticons,media,youtube', '', '', '', '', '');
|
||||
";
|
||||
|
||||
if($sql->db_Select_gen($query))
|
||||
{
|
||||
$mes->add("Default data added to table.", E_MESSAGE_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
$mes->add("Failed to add default table data.", E_MESSAGE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
function uninstall_options()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function uninstall_post($var)
|
||||
{
|
||||
// print_a($var);
|
||||
}
|
||||
|
||||
function upgrade_post($var)
|
||||
{
|
||||
// $sql = e107::getDb();
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
@ -1,15 +0,0 @@
|
||||
CREATE TABLE tinymce (
|
||||
`tinymce_id` int(5) NOT NULL AUTO_INCREMENT,
|
||||
`tinymce_name` varchar(255) NOT NULL,
|
||||
`tinymce_userclass` varchar(255) NOT NULL,
|
||||
`tinymce_plugins` text NOT NULL,
|
||||
`tinymce_buttons1` varchar(255) NOT NULL,
|
||||
`tinymce_buttons2` varchar(255) NOT NULL,
|
||||
`tinymce_buttons3` varchar(255) NOT NULL,
|
||||
`tinymce_buttons4` varchar(255) NOT NULL,
|
||||
`tinymce_custom` text NOT NULL,
|
||||
`tinymce_prefs` text NOT NULL,
|
||||
PRIMARY KEY (`tinymce_id`)
|
||||
) ENGINE=MyISAM;
|
||||
|
||||
|
@ -67,7 +67,9 @@ class wysiwyg
|
||||
$text .= "\n /* TinyMce Config: ".$this->configName." */";
|
||||
$text .= $this->tinyMce_config();
|
||||
|
||||
$text .= "\t\t start_tinyMce(); \n
|
||||
$text .= "\t\t start_tinyMce(); \n";
|
||||
|
||||
$text .= "
|
||||
|
||||
function tinymce_e107Paths(type, source) {
|
||||
";
|
||||
@ -235,20 +237,26 @@ class wysiwyg
|
||||
|
||||
|
||||
function getConfig($config=FALSE)
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
|
||||
if($config)
|
||||
{
|
||||
if(getperms('0'))
|
||||
{
|
||||
$query = "SELECT * FROM #tinymce WHERE tinymce_id = ".$config." LIMIT 1";
|
||||
$template = "mainadmin.xml";
|
||||
}
|
||||
elseif(ADMIN)
|
||||
{
|
||||
$template = "admin.xml";
|
||||
}
|
||||
elseif(USER)
|
||||
{
|
||||
$template = "member.xml";
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = "SELECT * FROM #tinymce WHERE tinymce_userclass REGEXP '".e_CLASS_REGEXP."' AND NOT (tinymce_userclass REGEXP '(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)') ORDER BY Field(tinymce_userclass,250,254,253) LIMIT 1";
|
||||
$template = "public.xml";
|
||||
}
|
||||
|
||||
$config = e107::getXml()->loadXMLfile(e_PLUGIN."tinymce/templates/".$template,true); //TODO System and theme folder checks for overrides.
|
||||
|
||||
$sql -> db_Select_gen($query);
|
||||
$config = $sql->db_Fetch();
|
||||
|
||||
//TODO Cache!
|
||||
|
||||
@ -267,20 +275,20 @@ class wysiwyg
|
||||
$this->config += array(
|
||||
|
||||
'theme_advanced_buttons1' => $config['tinymce_buttons1'],
|
||||
'theme_advanced_buttons2' => $config['tinymce_buttons2'],
|
||||
'theme_advanced_buttons3' => $config['tinymce_buttons3'],
|
||||
'theme_advanced_buttons4' => $config['tinymce_buttons4'],
|
||||
'theme_advanced_toolbar_location' => 'top',
|
||||
'theme_advanced_buttons2' => vartrue($config['tinymce_buttons2']),
|
||||
'theme_advanced_buttons3' => vartrue($config['tinymce_buttons3']),
|
||||
'theme_advanced_buttons4' => vartrue($config['tinymce_buttons4']),
|
||||
'theme_advanced_toolbar_location' => vartrue($config['theme_advanced_toolbar_location'],'top'),
|
||||
'theme_advanced_toolbar_align' => 'left',
|
||||
'theme_advanced_blockformats' => 'p,h2,h3,blockquote,code',
|
||||
'theme_advanced_resize_vertical' => 'true',
|
||||
// 'theme_advanced_resize_vertical' => 'true',
|
||||
'dialog_type' => "modal",
|
||||
'theme_advanced_source_editor_height' => '400',
|
||||
// 'theme_advanced_source_editor_height' => '400',
|
||||
|
||||
// 'theme_advanced_statusbar_location' => 'bottom',
|
||||
'theme_advanced_resizing' => 'false',
|
||||
'remove_linebreaks' => 'true',
|
||||
'extended_valid_elements' => (ADMIN ? 'object[*],embed[*]' : ''),
|
||||
'extended_valid_elements' => vartrue($config['extended_valid_elements']),
|
||||
'apply_source_formatting' => 'false',
|
||||
'invalid_elements' => 'p,font,align,script,applet',
|
||||
'auto_cleanup_word' => 'true',
|
||||
@ -292,6 +300,8 @@ class wysiwyg
|
||||
'debug' => 'false',
|
||||
'force_br_newlines' => 'true',
|
||||
'media_strict' => 'false',
|
||||
'width' => '85%',
|
||||
// 'height' => '90%', // higher causes padding at the top?
|
||||
// 'forced_root_block' => '',
|
||||
'convert_newlines_to_brs' => 'true', // will break [list] if set to true
|
||||
// 'force_p_newlines' => 'false',
|
||||
|
Loading…
x
Reference in New Issue
Block a user