-
";
+ ";
if($data['type'] == 'image')
{
@@ -1339,7 +1341,13 @@ class e_media
}
$ret = str_replace('{INDICATORS}', $this->browserIndicators($slides,$carouselID), $text);
-
+
+ if(E107_DEBUG_LEVEL > 0)
+ {
+ print_a($parm);
+ }
+
+
return $ret;
}
diff --git a/e107_plugins/tinymce4/admin_config.php b/e107_plugins/tinymce4/admin_config.php
new file mode 100644
index 000000000..5d5c946f9
--- /dev/null
+++ b/e107_plugins/tinymce4/admin_config.php
@@ -0,0 +1,733 @@
+ array(
+ 'controller' => 'tinymce4_ui',
+ 'path' => null,
+ 'ui' => 'tinymce4_ui_form',
+ 'uipath' => null
+ ),
+ );
+
+
+ protected $adminMenu = array(
+
+ 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P'),
+
+ // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
+ );
+
+ protected $adminMenuAliases = array(
+ 'main/edit' => 'main/list'
+ );
+
+ protected $menuTitle = 'TinyMce';
+ }
+
+
+
+ class tinymce4_ui extends e_admin_ui
+ {
+
+ protected $pluginTitle = 'TinyMce4';
+ protected $pluginName = 'tinymce4';
+
+
+
+ protected $prefs = array(
+ 'paste_as_text' => array('title'=> 'Paste as text by default', 'type'=>'boolean', 'data' => 'int','help'=> ''), );
+
+
+ public function init()
+ {
+
+
+ }
+ }
+
+
+ class tinymce4_ui_form extends e_admin_form_ui
+ {
+
+ }
+
+
+ new tinymce4_admin();
+
+ require_once(e_ADMIN."auth.php");
+ e107::getAdminUI()->runPage();
+
+ require_once(e_ADMIN."footer.php");
+ exit;
+
+
+
+
+
+
+
+
+
+
+require_once(e_HANDLER."form_handler.php");
+require_once (e_HANDLER.'message_handler.php');
+
+$frm = new e_form(true);
+
+$ef = new tinymce;
+//TODO save prefs to separate config row.
+// List all forms of access, and allow the user to choose between simple/advanced or 'custom' settings.
+
+
+if(varset($_POST['update']) || varset($_POST['create']))
+{
+ $id = intval($_POST['record_id']);
+ $ef->submitPage($id);
+}
+
+if(varset($_POST['delete']))
+{
+ $id = key($_POST['delete']);
+ $ef->deleteRecord($id);
+ $_GET['mode'] = "list";
+}
+
+if(isset($_POST['edit']) || $id) // define after db changes and before header loads.
+{
+ $id = (isset($_POST['edit'])) ? key($_POST['edit']) : $id;
+ define("TINYMCE_CONFIG",$id);
+}
+else
+{
+ define("TINYMCE_CONFIG",FALSE);
+}
+
+
+require_once(e_ADMIN."auth.php");
+
+if(varset($_GET['mode'])=='create')
+{
+ $id = varset($_POST['edit']) ? key($_POST['edit']) : "";
+ if($_POST['record_id'])
+ {
+ $id = $_POST['record_id'];
+ }
+ $ef->createRecord($id);
+}
+else
+{
+ $ef->listRecords();
+}
+
+if(isset($_POST['etrigger_ecolumns']))
+{
+ $user_pref['admin_release_columns'] = $_POST['e-columns'];
+ save_prefs('user');
+}
+
+
+require_once(e_ADMIN."footer.php");
+
+
+
+class tinymce
+{
+ var $fields;
+ var $fieldpref;
+ var $listQry;
+ var $table;
+ var $primary;
+
+
+ function __construct()
+ {
+
+ $this->fields = array(
+ 'tinymce_id' => array('title'=> ID, 'width'=>'5%', 'forced'=> TRUE, 'primary'=>TRUE),
+ 'tinymce_name' => array('title'=> 'name', 'width'=>'auto','type'=>'text'),
+ 'tinymce_userclass' => array('title'=> 'class', 'type' => 'array', 'method'=>'tinymce_class', 'width' => 'auto'),
+ 'tinymce_plugins' => array('title'=> 'plugins', 'type' => 'array', 'method'=>'tinymce_plugins', 'width' => 'auto'),
+ 'tinymce_buttons1' => array('title'=> 'buttons1', 'type' => 'text', 'method'=>'tinymce_buttons', 'methodparms'=>1, 'width' => 'auto'),
+ 'tinymce_buttons2' => array('title'=> 'buttons2', 'type' => 'text', 'method'=>'tinymce_buttons', 'methodparms'=>2, 'width' => 'auto'),
+ 'tinymce_buttons3' => array('title'=> 'buttons3', 'type' => 'text', 'method'=>'tinymce_buttons', 'methodparms'=>3, 'width' => 'auto', 'thclass' => 'left first'),
+ 'tinymce_buttons4' => array('title'=> 'buttons4', 'type' => 'text', 'method'=>'tinymce_buttons', 'methodparms'=>4, 'width' => 'auto', 'thclass' => 'left first'),
+ 'tinymce_custom' => array('title'=> 'custom', 'type' => 'text', 'width' => 'auto'),
+ 'tinymce_prefs' => array('title'=> 'prefs', 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ),
+ 'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last')
+ );
+
+ $this->fieldpref = (varset($user_pref['admin_tinymce_columns'])) ? $user_pref['admin_tinymce_columns'] : array_keys($this->fields);
+ $this->table = "tinymce";
+ $this->listQry = "SELECT * FROM #tinymce ORDER BY tinymce_id";
+ $this->editQry = "SELECT * FROM #tinymce WHERE tinymce_id = {ID}";
+ $this->primary = "tinymce_id";
+ $this->pluginTitle = "Tinymce";
+
+ $this->listCaption = "Tinymce Configs";
+ $this->createCaption = LAN_CREATE."/".LAN_EDIT;
+
+ }
+
+
+// --------------------------------------------------------------------------
+ /**
+ * Generic DB Record Listing Function.
+ *
+ * @param object $mode [optional] - reserved
+ * @return void
+ */
+ function listRecords($mode = FALSE)
+ {
+ $ns = e107::getRender();
+ $sql = e107::getDb();
+ $frm = e107::getForm();
+
+
+ global $pref;
+
+ $emessage = eMessage::getInstance();
+
+ $text = "
+ ";
+
+ $ns->tablerender($this->pluginTitle." :: ".$this->listCaption, $emessage->render().$text);
+ }
+
+ /**
+ * Render Field value (listing page)
+ *
+ * @param array $key
+ * @param array $row
+ * @return string
+ */
+ function renderValue($key, $row)
+ {
+ $att = $this->fields[$key];
+ $frm = e107::getForm();
+
+ if($key == "options")
+ {
+ $id = $this->primary;
+ $text = "";
+ $text .= "";
+ return $text;
+ }
+
+ if($key == "tinymce_userclass")
+ {
+ return $frm->uc_label($row[$key]);
+ }
+
+ if($key == "tinymce_plugins")
+ {
+ return str_replace(",","
",$row[$key]);
+ }
+
+ switch($att['type'])
+ {
+ case 'url':
+ return "".$row[$key]."";
+ break;
+
+ default:
+ return $row[$key];
+ break;
+ }
+ return $row[$key] .$att['type'];
+ }
+
+ /**
+ * Render Form Element (edit page)
+ *
+ * @param array $key
+ * @param array $row
+ * @return string method's value or HTML input
+ */
+ function renderElement($key, $row)
+ {
+ $frm = e107::getForm();
+ $att = $this->fields[$key];
+ $value = $row[$key];
+
+ if($att['method'])
+ {
+ $meth = $att['method'];
+ if(isset($att['methodparms']))
+ {
+ return $this->$meth($value, $att['methodparms']);
+ }
+ return $this->$meth($value);
+ }
+
+
+ return $frm->text($key, $row[$key], 50);
+
+ }
+
+
+
+ function createRecord($id=FALSE)
+ {
+ global $frm, $e_userclass, $e_event;
+
+ $tp = e107::getParser();
+ $ns = e107::getRender();
+ $sql = e107::getDb();
+ $mes = eMessage::getInstance();
+
+ if($id)
+ {
+ $query = str_replace("{ID}",$id,$this->editQry);
+ $sql->db_Select_gen($query);
+ $row = $sql->db_Fetch(MYSQL_ASSOC);
+ }
+ else
+ {
+ $row = array();
+ }
+
+ $text = "
+
";
+
+ $ns->tablerender($this->pluginTitle." :: ".$this->createCaption,$mes->render(). $text);
+ }
+
+
+ function tinymce_buttons($curVal,$id)
+ {
+ return "
\n";
+ }
+
+
+ function tinymce_preview()
+ {
+ return "
";
+
+ }
+
+ function tinymce_plugins($curVal)
+ {
+ $fl = e107::getFile();
+
+ $curArray = explode(",",$curVal);
+
+ if($plug_array = $fl->get_dirs(e_PLUGIN."tinymce/plugins/"))
+ {
+ sort($plug_array);
+ }
+
+ $text = "
";
+
+ foreach($plug_array as $mce_plg)
+ {
+ $checked = (in_array($mce_plg,$curArray)) ? "checked='checked'" : "";
+ $text .= "
$mce_plg
";
+ }
+
+ $text .= "
";
+ return $text;
+ }
+
+
+ function tinymce_class($curVal)
+ {
+ $frm = e107::getForm();
+ // $cur = explode(",",$curVal);
+ $uc_options = "guest,member,admin,main,classes";
+ return $frm->uc_checkbox('tinymce_userclass', $curVal, $uc_options);
+ }
+
+
+
+ /**
+ * Generic Save DB Record Function.
+ * Insert or Update a table row.
+ *
+ * @param mixed $id [optional] if set, $id correspond to the primary key of the table
+ * @return void
+ */
+ function submitPage($id = FALSE)
+ {
+ global $sql, $tp, $e107cache, $admin_log, $e_event;
+ $emessage = eMessage::getInstance();
+
+ $insert_array = array();
+
+ foreach($this->fields as $key=>$att)
+ {
+ if($att['forced']!=TRUE)
+ {
+ $insert_array[$key] = $_POST[$key];
+ }
+
+ if($att['type']=='array')
+ {
+ $insert_array[$key] = implode(",",$_POST[$key]);
+ }
+ }
+
+ $xml = new SimpleXMLElement('
');
+ $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
+ {
+ $status = $sql->db_Insert($this->table,$insert_array) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
+ $message = LAN_CREATED;
+ }
+
+
+ $emessage->add($message, $status);
+ }
+
+ function deleteRecord($id)
+ {
+ if(!$id || !$this->primary || !$this->table)
+ {
+ return;
+ }
+
+ $emessage = eMessage::getInstance();
+ $sql = e107::getDb();
+
+ $query = $this->primary." = ".$id;
+ $status = $sql->db_Delete($this->table,$query) ? E_MESSAGE_SUCCESS : E_MESSAGE_FAILED;
+ $message = LAN_DELETED;
+ $emessage->add($message, $status);
+ }
+
+ function optionsPage()
+ {
+ global $e107, $pref, $frm, $emessage;
+
+ if(!isset($pref['pageCookieExpire'])) $pref['pageCookieExpire'] = 84600;
+
+ //XXX Lan - Options
+ $text = "
+
+ ";
+
+ $e107->ns->tablerender(LAN_OPTIONS, $emessage->render().$text);
+ }
+
+
+ function saveSettings()
+ {
+ global $pref, $admin_log, $emessage;
+ $temp['listPages'] = $_POST['listPages'];
+ $temp['pageCookieExpire'] = $_POST['pageCookieExpire'];
+ if ($admin_log->logArrayDiffs($temp, $pref, 'CPAGE_04'))
+ {
+ save_prefs(); // Only save if changes
+ $emessage->add(CUSLAN_45, E_MESSAGE_SUCCESS);
+ }
+ else
+ {
+ $emessage->add(CUSLAN_46);
+ }
+ }
+
+
+ function show_options($action)
+ {
+ $action = varset($_GET['mode'],'list');
+
+ $var['list']['text'] = $this->listCaption;
+ $var['list']['link'] = e_SELF."?mode=list";
+ $var['list']['perm'] = "0";
+
+ $var['create']['text'] = $this->createCaption;
+ $var['create']['link'] = e_SELF."?mode=create";
+ $var['create']['perm'] = 0;
+
+/*
+ $var['options']['text'] = LAN_OPTIONS;
+ $var['options']['link'] = e_SELF."?options";
+ $var['options']['perm'] = "0";*/
+
+ e107::getNav()->admin($this->pluginTitle, $action, $var);
+ }
+}
+
+function admin_config_adminmenu()
+{
+ global $ef;
+ global $action;
+ $ef->show_options($action);
+}
+
+
+if($_POST['save_settings']) // Needs to be saved before e_meta.php is loaded by auth.php.
+{
+ $tpref['customjs'] = $_POST['customjs'];
+ $tpref['theme_advanced_buttons1'] = $_POST['theme_advanced_buttons1'];
+ $tpref['theme_advanced_buttons2'] = $_POST['theme_advanced_buttons2'];
+ $tpref['theme_advanced_buttons3'] = $_POST['theme_advanced_buttons3'];
+ $tpref['theme_advanced_buttons4'] = $_POST['theme_advanced_buttons4'];
+ $tpref['plugins'] = $_POST['mce_plugins'];
+
+ e107::getPlugConfig('tinymce')->setPref($tpref);
+ e107::getPlugConfig('tinymce')->save();
+}
+
+ $tpref = e107::getPlugConfig('tinymce')->getPref();
+
+
+
+if($_POST['save_settings']) // is there an if $emessage? $emessage->hasMessage doesn't return TRUE.
+{
+ $emessage->add(LAN_UPDATED, E_MESSAGE_SUCCESS);
+ e107::getRender()->tablerender(LAN_UPDATED, $emessage->render());
+}
+
+
+ if(!$tpref['theme_advanced_buttons1'])
+ {
+ $tpref['theme_advanced_buttons1'] = "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect";
+ }
+
+ if(!$tpref['theme_advanced_buttons2'])
+ {
+ $tpref['theme_advanced_buttons2'] = "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor";
+ }
+
+ if(!$tpref['theme_advanced_buttons3'])
+ {
+ $tpref['theme_advanced_buttons3'] = "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,emoticons,ibrowser";
+ }
+
+ if(!$tpref['theme_advanced_buttons4'])
+ {
+ $tpref['theme_advanced_buttons4'] = "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage";
+ }
+
+
+function edit_theme()
+{
+ $ns = e107::getRender();
+
+
+
+ $text = "
";
+
+ $ns -> tablerender("TinyMCE Configuration", $text);
+}
+
+
+
+
+
+require_once(e_ADMIN."footer.php");
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/tinymce4/e_footer.php b/e107_plugins/tinymce4/e_footer.php
index cde1401e6..8dfa327b7 100644
--- a/e107_plugins/tinymce4/e_footer.php
+++ b/e107_plugins/tinymce4/e_footer.php
@@ -19,7 +19,7 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
//e107::js('tinymce','tiny_mce.js','jquery');
//e107::js('tinymce','wysiwyg.php','jquery',5);
- e107::js('footer', "http://tinymce.cachefly.net/4.0/tinymce.min.js");
+ e107::js('footer', "http://tinymce.cachefly.net/4.1/tinymce.min.js");
e107::js('footer',e_PLUGIN.'tinymce4/wysiwyg.php','jquery',5);
// e107::js('inline', "
// tinymce.init({selector:'.e-wysiwyg'});
@@ -29,13 +29,14 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
}
else
{
+ e107::js('tinymce4','plugins/compat3x/tiny_mce_popup.js');
// e107::js('tinymce','tiny_mce_popup.js','jquery');
}
if(ADMIN)
{
$insert = "$('#'+id).after('
";
- // $insert .= "
Switch to bbcode<\/a>";
+ $insert .= "Switch to bbcode<\/a>";
if(e_PAGE == 'mailout.php')
{
@@ -59,86 +60,97 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
//
-
+
e107::js('footer-inline',"
-
+
-
+
$(function() {
-
-
+
+
$('.e-wysiwyg').each(function() {
-
+
var id = $(this).attr('id'); // 'e-wysiwyg';
console.log(id);
".SWITCH_TO_BB."
// alert(id);
$('#bbcode-panel-'+id+'--preview').hide();
-
+
});
-
+
$('.tinyInsert').click(function() {
-
- var val = $(this).attr('data-value');
+
+ var val = $(this).attr('data-value');
top.tinymce.activeEditor.execCommand('mceInsertContent',0,val);
- return false;
+ return false;
});
-
+
/*
$('img.tinyInsertEmote').live('click',function() {
-
- var src = $(this).attr('src');
- // alert(src);
+
+ var src = $(this).attr('src');
+ // alert(src);
// var html = '
';
tinyMCE.execCommand('mceInsertRawHTML',false, 'hi there');
;
$('.mceContentBody', window.top.document).tinymce().execCommand('mceInsertContent',false,src);
-
- // tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src);
-
+
+ // tinyMCE.selectedInstance.execCommand('mceInsertContent',0,src);
+
$('#uiModal').modal('hide');
- return true;
+ return true;
});*/
-
-
-
-
- // When new tab is added - convert textarea to TinyMce.
+
+
+
+
+ // 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 idt = $(this).attr('data-target'); // eg. news-body
var ct = parseInt($('#e-tab-count').val());
var id = idt + '-' + ct;
$('#bbcode-panel-'+id+'--preview').hide();
".SWITCH_TO_BB."
top.tinymce.activeEditor.execCommand('mceAddControl', false, id);
});
-
-
+
+
$('a.e-wysiwyg-toggle').toggle(function(){
- var id = $(this).attr('id'); // eg. news-body
+
+ var id = $(this).attr('id'); // eg. news-body
+
$('#bbcode-panel-'+id+'--preview').show();
$(this).text('Switch to wysiwyg');
- tinymce.activeEditor.execCommand('mceRemoveControl', false, id);
+
+ tinymce.EditorManager.execCommand('mceRemoveEditor',true, id); //v4.x
+
+ // tinymce.remove('#'+id);
+ // tinymce.activeEditor.execCommand('mceRemoveControl', false, id);
+ // $('#'+id).tinymce().remove();
+
}, function () {
var id = $(this).attr('id');
$('#bbcode-panel-'+id+'--preview').hide();
$(this).text('Switch to bbcode');
- tinymce.activeEditor.execCommand('mceAddControl', false, id);
- });
-
-
- $('.e-dialog-save').on('click', function(){
-
- // var html = $('#html_holder').val();
-
- var s = $('#bbcode_holder').val();
-
+ tinymce.EditorManager.execCommand('mceAddEditor',true, id); //v4.x
+ // tinymce.remove('#'+id);
+ // tinymce.activeEditor.execCommand('mceAddControl', false, id);
+ });
+
+
+ $(document).on('click','.e-dialog-save', function(){
+ // var html = $('#html_holder').val();
+
+ var s = $('#bbcode_holder').val();
+
+ // alert(s);
+
var p = $.ajax({
type: 'POST',
- url: '".e_PLUGIN_ABS. "tinymce4/plugins/e107/parser.php', // parse bbcode value
+ url: '".e_PLUGIN_ABS. "tinymce4/plugins/e107/parser.php', // parse bbcode value
data: { content: s, mode: 'tohtml' },
async : false,
@@ -146,40 +158,42 @@ if((e107::wysiwyg() === true && check_class($pref['post_html'])) || strpos(e_SEL
success: function(html) {
return html;
}
+
+
}).responseText;
html = p;
- // alert(html);
-
+ // alert(s);
+
if(html === undefined)
{
return;
}
-
+
// tinyMCE.execCommand('mceInsertContent',false,html);
top.tinymce.activeEditor.execCommand('mceInsertRawHTML',false,html);
top.tinymce.activeEditor.windowManager.close();
-
+
});
-
- // $('.e-dialog-close').click(function(){
-
- // top.tinymce.activeEditor.windowManager.close();
- // });
-
-
-
-
-
-
+
+ $('.e-dialog-close').click(function(){
+
+ // top.tinymce.activeEditor.windowManager.close();
+ });
+
+
+
+
+
+
});
-
-
-
-
+
+
+
+
","jquery", 1);
-
-
+
+
}
?>
\ No newline at end of file
diff --git a/e107_plugins/tinymce4/images/icon_16.png b/e107_plugins/tinymce4/images/icon_16.png
new file mode 100644
index 000000000..ea6fb21e9
Binary files /dev/null and b/e107_plugins/tinymce4/images/icon_16.png differ
diff --git a/e107_plugins/tinymce4/images/icon_32.png b/e107_plugins/tinymce4/images/icon_32.png
new file mode 100644
index 000000000..dc81e96ac
Binary files /dev/null and b/e107_plugins/tinymce4/images/icon_32.png differ
diff --git a/e107_plugins/tinymce4/plugin.xml b/e107_plugins/tinymce4/plugin.xml
index 8969f9502..8a11cae45 100644
--- a/e107_plugins/tinymce4/plugin.xml
+++ b/e107_plugins/tinymce4/plugin.xml
@@ -3,4 +3,7 @@
TinyMce4 CDN version
misc
+
+ Configure
+
\ No newline at end of file
diff --git a/e107_plugins/tinymce4/plugins/compat3x/css/dialog.css b/e107_plugins/tinymce4/plugins/compat3x/css/dialog.css
new file mode 100644
index 000000000..274743b2e
--- /dev/null
+++ b/e107_plugins/tinymce4/plugins/compat3x/css/dialog.css
@@ -0,0 +1,118 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(../img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+float:left;
+}
+
+#insert {background:url(../img/buttons.png) 0 -52px}
+#cancel {background:url(../img/buttons.png) 0 0; float:right}
+
+/* Browse */
+a.pickcolor, a.browse {text-decoration:none}
+a.browse span {display:block; width:20px; height:18px; background:url(../img/icons.gif) -20px 0 no-repeat; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #AAA; text-align:center; font-size:12px; vertical-align:middle; line-height: 18px;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(../img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(../img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(../img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(../img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(../img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {display:inline-block; padding-left:40px; height:14px; border:1px solid black; margin-left:5px; margin-right: 5px}
+#colorpicker #previewblock {position: relative; top: -3px; padding-left:5px; padding-top: 0px; display:inline}
+#colorpicker #preview_wrapper { text-align:center; padding-top:4px; white-space: nowrap}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/buttons.png b/e107_plugins/tinymce4/plugins/compat3x/img/buttons.png
new file mode 100644
index 000000000..1e53560e0
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/buttons.png differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/icons.gif b/e107_plugins/tinymce4/plugins/compat3x/img/icons.gif
new file mode 100644
index 000000000..ca2224901
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/icons.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/items.gif b/e107_plugins/tinymce4/plugins/compat3x/img/items.gif
new file mode 100644
index 000000000..d2f93671c
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/items.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/menu_arrow.gif b/e107_plugins/tinymce4/plugins/compat3x/img/menu_arrow.gif
new file mode 100644
index 000000000..85e31dfb2
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/menu_arrow.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/menu_check.gif b/e107_plugins/tinymce4/plugins/compat3x/img/menu_check.gif
new file mode 100644
index 000000000..adfdddccd
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/menu_check.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/progress.gif b/e107_plugins/tinymce4/plugins/compat3x/img/progress.gif
new file mode 100644
index 000000000..5bb90fd6a
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/progress.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/img/tabs.gif b/e107_plugins/tinymce4/plugins/compat3x/img/tabs.gif
new file mode 100644
index 000000000..06812cb41
Binary files /dev/null and b/e107_plugins/tinymce4/plugins/compat3x/img/tabs.gif differ
diff --git a/e107_plugins/tinymce4/plugins/compat3x/plugin.js b/e107_plugins/tinymce4/plugins/compat3x/plugin.js
new file mode 100644
index 000000000..85b2e0578
--- /dev/null
+++ b/e107_plugins/tinymce4/plugins/compat3x/plugin.js
@@ -0,0 +1,297 @@
+/**
+ * plugin.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+/*global tinymce:true, console:true */
+/*eslint no-console:0, new-cap:0 */
+
+/**
+ * This plugin adds missing events form the 4.x API back. Not every event is
+ * properly supported but most things should work.
+ *
+ * Unsupported things:
+ * - No editor.onEvent
+ * - Can't cancel execCommands with beforeExecCommand
+ */
+(function(tinymce) {
+ var reported;
+
+ function noop() {
+ }
+
+ function log(apiCall) {
+ if (!reported && window && window.console) {
+ reported = true;
+ console.log("Deprecated TinyMCE API call: " + apiCall);
+ }
+ }
+
+ function Dispatcher(target, newEventName, argsMap, defaultScope) {
+ target = target || this;
+
+ if (!newEventName) {
+ this.add = this.addToTop = this.remove = this.dispatch = noop;
+ return;
+ }
+
+ this.add = function(callback, scope, prepend) {
+ log('.on' + newEventName + ".add(..)");
+
+ // Convert callback({arg1:x, arg2:x}) -> callback(arg1, arg2)
+ function patchedEventCallback(e) {
+ var callbackArgs = [];
+
+ if (typeof argsMap == "string") {
+ argsMap = argsMap.split(" ");
+ }
+
+ if (argsMap && typeof argsMap != "function") {
+ for (var i = 0; i < argsMap.length; i++) {
+ callbackArgs.push(e[argsMap[i]]);
+ }
+ }
+
+ if (typeof argsMap == "function") {
+ callbackArgs = argsMap(newEventName, e, target);
+ if (!callbackArgs) {
+ return;
+ }
+ }
+
+ if (!argsMap) {
+ callbackArgs = [e];
+ }
+
+ callbackArgs.unshift(defaultScope || target);
+
+ if (callback.apply(scope || defaultScope || target, callbackArgs) === false) {
+ e.stopImmediatePropagation();
+ }
+ }
+
+ target.on(newEventName, patchedEventCallback, prepend);
+
+ return patchedEventCallback;
+ };
+
+ this.addToTop = function(callback, scope) {
+ this.add(callback, scope, true);
+ };
+
+ this.remove = function(callback) {
+ return target.off(newEventName, callback);
+ };
+
+ this.dispatch = function() {
+ target.fire(newEventName);
+
+ return true;
+ };
+ }
+
+ tinymce.util.Dispatcher = Dispatcher;
+ tinymce.onBeforeUnload = new Dispatcher(tinymce, "BeforeUnload");
+ tinymce.onAddEditor = new Dispatcher(tinymce, "AddEditor", "editor");
+ tinymce.onRemoveEditor = new Dispatcher(tinymce, "RemoveEditor", "editor");
+
+ tinymce.util.Cookie = {
+ get: noop, getHash: noop, remove: noop, set: noop, setHash: noop
+ };
+
+ function patchEditor(editor) {
+ function patchEditorEvents(oldEventNames, argsMap) {
+ tinymce.each(oldEventNames.split(" "), function(oldName) {
+ editor["on" + oldName] = new Dispatcher(editor, oldName, argsMap);
+ });
+ }
+
+ function convertUndoEventArgs(type, event, target) {
+ return [
+ event.level,
+ target
+ ];
+ }
+
+ function filterSelectionEvents(needsSelection) {
+ return function(type, e) {
+ if ((!e.selection && !needsSelection) || e.selection == needsSelection) {
+ return [e];
+ }
+ };
+ }
+
+ if (editor.controlManager) {
+ return;
+ }
+
+ function cmNoop() {
+ var obj = {}, methods = 'add addMenu addSeparator collapse createMenu destroy displayColor expand focus ' +
+ 'getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark ' +
+ 'postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex ' +
+ 'setActive setAriaProperty setColor setDisabled setSelected setState showMenu update';
+
+ log('editor.controlManager.*');
+
+ function _noop() {
+ return cmNoop();
+ }
+
+ tinymce.each(methods.split(' '), function(method) {
+ obj[method] = _noop;
+ });
+
+ return obj;
+ }
+
+ editor.controlManager = {
+ buttons: {},
+
+ setDisabled: function(name, state) {
+ log("controlManager.setDisabled(..)");
+
+ if (this.buttons[name]) {
+ this.buttons[name].disabled(state);
+ }
+ },
+
+ setActive: function(name, state) {
+ log("controlManager.setActive(..)");
+
+ if (this.buttons[name]) {
+ this.buttons[name].active(state);
+ }
+ },
+
+ onAdd: new Dispatcher(),
+ onPostRender: new Dispatcher(),
+
+ add: function(obj) {
+ return obj;
+ },
+ createButton: cmNoop,
+ createColorSplitButton: cmNoop,
+ createControl: cmNoop,
+ createDropMenu: cmNoop,
+ createListBox: cmNoop,
+ createMenuButton: cmNoop,
+ createSeparator: cmNoop,
+ createSplitButton: cmNoop,
+ createToolbar: cmNoop,
+ createToolbarGroup: cmNoop,
+ destroy: noop,
+ get: noop,
+ setControlType: cmNoop
+ };
+
+ patchEditorEvents("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate", "editor");
+ patchEditorEvents("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset");
+ patchEditorEvents("BeforeExecCommand ExecCommand", "command ui value args"); // args.terminate not supported
+ patchEditorEvents("PreProcess PostProcess LoadContent SaveContent Change");
+ patchEditorEvents("BeforeSetContent BeforeGetContent SetContent GetContent", filterSelectionEvents(false));
+ patchEditorEvents("SetProgressState", "state time");
+ patchEditorEvents("VisualAid", "element hasVisual");
+ patchEditorEvents("Undo Redo", convertUndoEventArgs);
+
+ patchEditorEvents("NodeChange", function(type, e) {
+ return [
+ editor.controlManager,
+ e.element,
+ editor.selection.isCollapsed(),
+ e
+ ];
+ });
+
+ var originalAddButton = editor.addButton;
+ editor.addButton = function(name, settings) {
+ var originalOnPostRender;
+
+ function patchedPostRender() {
+ editor.controlManager.buttons[name] = this;
+
+ if (originalOnPostRender) {
+ return originalOnPostRender.call(this);
+ }
+ }
+
+ for (var key in settings) {
+ if (key.toLowerCase() === "onpostrender") {
+ originalOnPostRender = settings[key];
+ settings.onPostRender = patchedPostRender;
+ }
+ }
+
+ if (!originalOnPostRender) {
+ settings.onPostRender = patchedPostRender;
+ }
+
+ if (settings.title) {
+ settings.title = tinymce.i18n.translate((editor.settings.language || "en") + "." + settings.title);
+ }
+
+ return originalAddButton.call(this, name, settings);
+ };
+
+ editor.on('init', function() {
+ var undoManager = editor.undoManager, selection = editor.selection;
+
+ undoManager.onUndo = new Dispatcher(editor, "Undo", convertUndoEventArgs, null, undoManager);
+ undoManager.onRedo = new Dispatcher(editor, "Redo", convertUndoEventArgs, null, undoManager);
+ undoManager.onBeforeAdd = new Dispatcher(editor, "BeforeAddUndo", null, undoManager);
+ undoManager.onAdd = new Dispatcher(editor, "AddUndo", null, undoManager);
+
+ selection.onBeforeGetContent = new Dispatcher(editor, "BeforeGetContent", filterSelectionEvents(true), selection);
+ selection.onGetContent = new Dispatcher(editor, "GetContent", filterSelectionEvents(true), selection);
+ selection.onBeforeSetContent = new Dispatcher(editor, "BeforeSetContent", filterSelectionEvents(true), selection);
+ selection.onSetContent = new Dispatcher(editor, "SetContent", filterSelectionEvents(true), selection);
+ });
+
+ editor.on('BeforeRenderUI', function() {
+ var windowManager = editor.windowManager;
+
+ windowManager.onOpen = new Dispatcher();
+ windowManager.onClose = new Dispatcher();
+ windowManager.createInstance = function(className, a, b, c, d, e) {
+ log("windowManager.createInstance(..)");
+
+ var constr = tinymce.resolve(className);
+ return new constr(a, b, c, d, e);
+ };
+ });
+ }
+
+ tinymce.on('SetupEditor', patchEditor);
+ tinymce.PluginManager.add("compat3x", patchEditor);
+
+ tinymce.addI18n = function(prefix, o) {
+ var I18n = tinymce.util.I18n, each = tinymce.each;
+
+ if (typeof prefix == "string" && prefix.indexOf('.') === -1) {
+ I18n.add(prefix, o);
+ return;
+ }
+
+ if (!tinymce.is(prefix, 'string')) {
+ each(prefix, function(o, lc) {
+ each(o, function(o, g) {
+ each(o, function(o, k) {
+ if (g === 'common') {
+ I18n.data[lc + '.' + k] = o;
+ } else {
+ I18n.data[lc + '.' + g + '.' + k] = o;
+ }
+ });
+ });
+ });
+ } else {
+ each(o, function(o, k) {
+ I18n.data[prefix + '.' + k] = o;
+ });
+ }
+ };
+})(tinymce);
diff --git a/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js b/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js
new file mode 100644
index 000000000..d9fee4629
--- /dev/null
+++ b/e107_plugins/tinymce4/plugins/compat3x/plugin.min.js
@@ -0,0 +1 @@
+!function(a){function b(){}function c(a){!f&&window&&window.console&&(f=!0,console.log("Deprecated TinyMCE API call: "+a))}function d(a,d,e,f){return a=a||this,d?(this.add=function(b,g,h){function i(c){var h=[];if("string"==typeof e&&(e=e.split(" ")),e&&"function"!=typeof e)for(var i=0;i.on"+d+".add(..)"),a.on(d,i,h),i},this.addToTop=function(a,b){this.add(a,b,!0)},this.remove=function(b){return a.off(d,b)},void(this.dispatch=function(){return a.fire(d),!0})):void(this.add=this.addToTop=this.remove=this.dispatch=b)}function e(e){function f(b,c){a.each(b.split(" "),function(a){e["on"+a]=new d(e,a,c)})}function g(a,b,c){return[b.level,c]}function h(a){return function(b,c){return!c.selection&&!a||c.selection==a?[c]:void 0}}function i(){function b(){return i()}var d={},e="add addMenu addSeparator collapse createMenu destroy displayColor expand focus getLength hasMenus hideMenu isActive isCollapsed isDisabled isRendered isSelected mark postRender remove removeAll renderHTML renderMenu renderNode renderTo select selectByIndex setActive setAriaProperty setColor setDisabled setSelected setState showMenu update";return c("editor.controlManager.*"),a.each(e.split(" "),function(a){d[a]=b}),d}if(!e.controlManager){e.controlManager={buttons:{},setDisabled:function(a,b){c("controlManager.setDisabled(..)"),this.buttons[a]&&this.buttons[a].disabled(b)},setActive:function(a,b){c("controlManager.setActive(..)"),this.buttons[a]&&this.buttons[a].active(b)},onAdd:new d,onPostRender:new d,add:function(a){return a},createButton:i,createColorSplitButton:i,createControl:i,createDropMenu:i,createListBox:i,createMenuButton:i,createSeparator:i,createSplitButton:i,createToolbar:i,createToolbarGroup:i,destroy:b,get:b,setControlType:i},f("PreInit BeforeRenderUI PostRender Load Init Remove Activate Deactivate","editor"),f("Click MouseUp MouseDown DblClick KeyDown KeyUp KeyPress ContextMenu Paste Submit Reset"),f("BeforeExecCommand ExecCommand","command ui value args"),f("PreProcess PostProcess LoadContent SaveContent Change"),f("BeforeSetContent BeforeGetContent SetContent GetContent",h(!1)),f("SetProgressState","state time"),f("VisualAid","element hasVisual"),f("Undo Redo",g),f("NodeChange",function(a,b){return[e.controlManager,b.element,e.selection.isCollapsed(),b]});var j=e.addButton;e.addButton=function(b,c){function d(){return e.controlManager.buttons[b]=this,f?f.call(this):void 0}var f;for(var g in c)"onpostrender"===g.toLowerCase()&&(f=c[g],c.onPostRender=d);return f||(c.onPostRender=d),c.title&&(c.title=a.i18n.translate((e.settings.language||"en")+"."+c.title)),j.call(this,b,c)},e.on("init",function(){var a=e.undoManager,b=e.selection;a.onUndo=new d(e,"Undo",g,null,a),a.onRedo=new d(e,"Redo",g,null,a),a.onBeforeAdd=new d(e,"BeforeAddUndo",null,a),a.onAdd=new d(e,"AddUndo",null,a),b.onBeforeGetContent=new d(e,"BeforeGetContent",h(!0),b),b.onGetContent=new d(e,"GetContent",h(!0),b),b.onBeforeSetContent=new d(e,"BeforeSetContent",h(!0),b),b.onSetContent=new d(e,"SetContent",h(!0),b)}),e.on("BeforeRenderUI",function(){var b=e.windowManager;b.onOpen=new d,b.onClose=new d,b.createInstance=function(b,d,e,f,g,h){c("windowManager.createInstance(..)");var i=a.resolve(b);return new i(d,e,f,g,h)}})}}var f;a.util.Dispatcher=d,a.onBeforeUnload=new d(a,"BeforeUnload"),a.onAddEditor=new d(a,"AddEditor","editor"),a.onRemoveEditor=new d(a,"RemoveEditor","editor"),a.util.Cookie={get:b,getHash:b,remove:b,set:b,setHash:b},a.on("SetupEditor",e),a.PluginManager.add("compat3x",e),a.addI18n=function(b,c){var d=a.util.I18n,e=a.each;return"string"==typeof b&&-1===b.indexOf(".")?void d.add(b,c):void(a.is(b,"string")?e(c,function(a,c){d.data[b+"."+c]=a}):e(b,function(a,b){e(a,function(a,c){e(a,function(a,e){"common"===c?d.data[b+"."+e]=a:d.data[b+"."+c+"."+e]=a})})}))}}(tinymce);
\ No newline at end of file
diff --git a/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js b/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js
new file mode 100644
index 000000000..733f4397e
--- /dev/null
+++ b/e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js
@@ -0,0 +1,542 @@
+/**
+ * Popup.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+var tinymce, tinyMCE;
+
+/**
+ * TinyMCE popup/dialog helper class. This gives you easy access to the
+ * parent editor instance and a bunch of other things. It's higly recommended
+ * that you load this script into your dialogs.
+ *
+ * @static
+ * @class tinyMCEPopup
+ */
+var tinyMCEPopup = {
+ /**
+ * Initializes the popup this will be called automatically.
+ *
+ * @method init
+ */
+ init: function() {
+ var self = this, parentWin, settings, uiWindow;
+
+ // Find window & API
+ parentWin = self.getWin();
+ tinymce = tinyMCE = parentWin.tinymce;
+ self.editor = tinymce.EditorManager.activeEditor;
+ self.params = self.editor.windowManager.getParams();
+
+ uiWindow = self.editor.windowManager.windows[self.editor.windowManager.windows.length - 1];
+ self.features = uiWindow.features;
+ self.uiWindow = uiWindow;
+
+ settings = self.editor.settings;
+
+ // Setup popup CSS path(s)
+ if (settings.popup_css !== false) {
+ if (settings.popup_css) {
+ settings.popup_css = self.editor.documentBaseURI.toAbsolute(settings.popup_css);
+ } else {
+ settings.popup_css = self.editor.baseURI.toAbsolute("plugins/compat3x/css/dialog.css");
+ }
+ }
+
+ if (settings.popup_css_add) {
+ settings.popup_css += ',' + self.editor.documentBaseURI.toAbsolute(settings.popup_css_add);
+ }
+
+ // Setup local DOM
+ self.dom = self.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document, {
+ ownEvents: true,
+ proxy: tinyMCEPopup._eventProxy
+ });
+
+ self.dom.bind(window, 'ready', self._onDOMLoaded, self);
+
+ // Enables you to skip loading the default css
+ if (self.features.popup_css !== false) {
+ self.dom.loadCSS(self.features.popup_css || self.editor.settings.popup_css);
+ }
+
+ // Setup on init listeners
+ self.listeners = [];
+
+ /**
+ * Fires when the popup is initialized.
+ *
+ * @event onInit
+ * @param {tinymce.Editor} editor Editor instance.
+ * @example
+ * // Alerts the selected contents when the dialog is loaded
+ * tinyMCEPopup.onInit.add(function(ed) {
+ * alert(ed.selection.getContent());
+ * });
+ *
+ * // Executes the init method on page load in some object using the SomeObject scope
+ * tinyMCEPopup.onInit.add(SomeObject.init, SomeObject);
+ */
+ self.onInit = {
+ add: function(func, scope) {
+ self.listeners.push({func : func, scope : scope});
+ }
+ };
+
+ self.isWindow = !self.getWindowArg('mce_inline');
+ self.id = self.getWindowArg('mce_window_id');
+ },
+
+ /**
+ * Returns the reference to the parent window that opened the dialog.
+ *
+ * @method getWin
+ * @return {Window} Reference to the parent window that opened the dialog.
+ */
+ getWin: function() {
+ // Added frameElement check to fix bug: #2817583
+ return (!window.frameElement && window.dialogArguments) || opener || parent || top;
+ },
+
+ /**
+ * Returns a window argument/parameter by name.
+ *
+ * @method getWindowArg
+ * @param {String} name Name of the window argument to retrive.
+ * @param {String} defaultValue Optional default value to return.
+ * @return {String} Argument value or default value if it wasn't found.
+ */
+ getWindowArg : function(name, defaultValue) {
+ var value = this.params[name];
+
+ return tinymce.is(value) ? value : defaultValue;
+ },
+
+ /**
+ * Returns a editor parameter/config option value.
+ *
+ * @method getParam
+ * @param {String} name Name of the editor config option to retrive.
+ * @param {String} defaultValue Optional default value to return.
+ * @return {String} Parameter value or default value if it wasn't found.
+ */
+ getParam : function(name, defaultValue) {
+ return this.editor.getParam(name, defaultValue);
+ },
+
+ /**
+ * Returns a language item by key.
+ *
+ * @method getLang
+ * @param {String} name Language item like mydialog.something.
+ * @param {String} defaultValue Optional default value to return.
+ * @return {String} Language value for the item like "my string" or the default value if it wasn't found.
+ */
+ getLang : function(name, defaultValue) {
+ return this.editor.getLang(name, defaultValue);
+ },
+
+ /**
+ * Executed a command on editor that opened the dialog/popup.
+ *
+ * @method execCommand
+ * @param {String} cmd Command to execute.
+ * @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
+ * @param {Object} val Optional value to pass with the comman like an URL.
+ * @param {Object} a Optional arguments object.
+ */
+ execCommand : function(cmd, ui, val, args) {
+ args = args || {};
+ args.skip_focus = 1;
+
+ this.restoreSelection();
+ return this.editor.execCommand(cmd, ui, val, args);
+ },
+
+ /**
+ * Resizes the dialog to the inner size of the window. This is needed since various browsers
+ * have different border sizes on windows.
+ *
+ * @method resizeToInnerSize
+ */
+ resizeToInnerSize : function() {
+ /*var self = this;
+
+ // Detach it to workaround a Chrome specific bug
+ // https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
+ setTimeout(function() {
+ var vp = self.dom.getViewPort(window);
+
+ self.editor.windowManager.resizeBy(
+ self.getWindowArg('mce_width') - vp.w,
+ self.getWindowArg('mce_height') - vp.h,
+ self.id || window
+ );
+ }, 10);*/
+ },
+
+ /**
+ * Will executed the specified string when the page has been loaded. This function
+ * was added for compatibility with the 2.x branch.
+ *
+ * @method executeOnLoad
+ * @param {String} evil String to evalutate on init.
+ */
+ executeOnLoad : function(evil) {
+ this.onInit.add(function() {
+ eval(evil);
+ });
+ },
+
+ /**
+ * Stores the current editor selection for later restoration. This can be useful since some browsers
+ * looses it's selection if a control element is selected/focused inside the dialogs.
+ *
+ * @method storeSelection
+ */
+ storeSelection : function() {
+ this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
+ },
+
+ /**
+ * Restores any stored selection. This can be useful since some browsers
+ * looses it's selection if a control element is selected/focused inside the dialogs.
+ *
+ * @method restoreSelection
+ */
+ restoreSelection : function() {
+ var self = tinyMCEPopup;
+
+ if (!self.isWindow && tinymce.isIE) {
+ self.editor.selection.moveToBookmark(self.editor.windowManager.bookmark);
+ }
+ },
+
+ /**
+ * Loads a specific dialog language pack. If you pass in plugin_url as a argument
+ * when you open the window it will load the /langs/_dlg.js lang pack file.
+ *
+ * @method requireLangPack
+ */
+ requireLangPack : function() {
+ var self = this, url = self.getWindowArg('plugin_url') || self.getWindowArg('theme_url'), settings = self.editor.settings, lang;
+
+ if (settings.language !== false) {
+ lang = settings.language || "en";
+ }
+
+ if (url && lang && self.features.translate_i18n !== false && settings.language_load !== false) {
+ url += '/langs/' + lang + '_dlg.js';
+
+ if (!tinymce.ScriptLoader.isDone(url)) {
+ document.write('');
+ tinymce.ScriptLoader.markDone(url);
+ }
+ }
+ },
+
+ /**
+ * Executes a color picker on the specified element id. When the user
+ * then selects a color it will be set as the value of the specified element.
+ *
+ * @method pickColor
+ * @param {DOMEvent} e DOM event object.
+ * @param {string} element_id Element id to be filled with the color value from the picker.
+ */
+ pickColor : function(e, element_id) {
+ var el = document.getElementById(element_id), colorPickerCallback = this.editor.settings.color_picker_callback;
+ if (colorPickerCallback) {
+ colorPickerCallback.call(
+ this.editor,
+ function (value) {
+ el.value = value;
+ try {
+ el.onchange();
+ } catch (ex) {
+ // Try fire event, ignore errors
+ }
+ },
+ el.value
+ );
+ }
+ },
+
+ /**
+ * Opens a filebrowser/imagebrowser this will set the output value from
+ * the browser as a value on the specified element.
+ *
+ * @method openBrowser
+ * @param {string} element_id Id of the element to set value in.
+ * @param {string} type Type of browser to open image/file/flash.
+ * @param {string} option Option name to get the file_broswer_callback function name from.
+ */
+ openBrowser : function(element_id, type) {
+ tinyMCEPopup.restoreSelection();
+ this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
+ },
+
+ /**
+ * Creates a confirm dialog. Please don't use the blocking behavior of this
+ * native version use the callback method instead then it can be extended.
+ *
+ * @method confirm
+ * @param {String} t Title for the new confirm dialog.
+ * @param {function} cb Callback function to be executed after the user has selected ok or cancel.
+ * @param {Object} s Optional scope to execute the callback in.
+ */
+ confirm : function(t, cb, s) {
+ this.editor.windowManager.confirm(t, cb, s, window);
+ },
+
+ /**
+ * Creates a alert dialog. Please don't use the blocking behavior of this
+ * native version use the callback method instead then it can be extended.
+ *
+ * @method alert
+ * @param {String} tx Title for the new alert dialog.
+ * @param {function} cb Callback function to be executed after the user has selected ok.
+ * @param {Object} s Optional scope to execute the callback in.
+ */
+ alert : function(tx, cb, s) {
+ this.editor.windowManager.alert(tx, cb, s, window);
+ },
+
+ /**
+ * Closes the current window.
+ *
+ * @method close
+ */
+ close : function() {
+ var t = this;
+
+ // To avoid domain relaxing issue in Opera
+ function close() {
+ t.editor.windowManager.close(window);
+ tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
+ }
+
+ if (tinymce.isOpera) {
+ t.getWin().setTimeout(close, 0);
+ } else {
+ close();
+ }
+ },
+
+ // Internal functions
+
+ _restoreSelection : function() {
+ var e = window.event.srcElement;
+
+ if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button')) {
+ tinyMCEPopup.restoreSelection();
+ }
+ },
+
+/* _restoreSelection : function() {
+ var e = window.event.srcElement;
+
+ // If user focus a non text input or textarea
+ if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
+ tinyMCEPopup.restoreSelection();
+ },*/
+
+ _onDOMLoaded : function() {
+ var t = tinyMCEPopup, ti = document.title, h, nv;
+
+ // Translate page
+ if (t.features.translate_i18n !== false) {
+ var map = {
+ "update": "Ok",
+ "insert": "Ok",
+ "cancel": "Cancel",
+ "not_set": "--",
+ "class_name": "Class name",
+ "browse": "Browse"
+ };
+
+ var langCode = tinymce.settings.language || 'en';
+ for (var key in map) {
+ tinymce.i18n.data[langCode + "." + key] = tinymce.i18n.translate(map[key]);
+ }
+
+ h = document.body.innerHTML;
+
+ // Replace a=x with a="x" in IE
+ if (tinymce.isIE) {
+ h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"');
+ }
+
+ document.dir = t.editor.getParam('directionality','');
+
+ if ((nv = t.editor.translate(h)) && nv != h) {
+ document.body.innerHTML = nv;
+ }
+
+ if ((nv = t.editor.translate(ti)) && nv != ti) {
+ document.title = ti = nv;
+ }
+ }
+
+ if (!t.editor.getParam('browser_preferred_colors', false) || !t.isWindow) {
+ t.dom.addClass(document.body, 'forceColors');
+ }
+
+ document.body.style.display = '';
+
+ // Restore selection in IE when focus is placed on a non textarea or input element of the type text
+ if (tinymce.Env.ie) {
+ if (tinymce.Env.ie < 11) {
+ document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
+
+ // Add base target element for it since it would fail with modal dialogs
+ t.dom.add(t.dom.select('head')[0], 'base', {target: '_self'});
+ } else {
+ document.addEventListener('mouseup', tinyMCEPopup._restoreSelection, false);
+ }
+ }
+
+ t.restoreSelection();
+ t.resizeToInnerSize();
+
+ // Set inline title
+ if (!t.isWindow) {
+ t.editor.windowManager.setTitle(window, ti);
+ } else {
+ window.focus();
+ }
+
+ if (!tinymce.isIE && !t.isWindow) {
+ t.dom.bind(document, 'focus', function() {
+ t.editor.windowManager.focus(t.id);
+ });
+ }
+
+ // Patch for accessibility
+ tinymce.each(t.dom.select('select'), function(e) {
+ e.onkeydown = tinyMCEPopup._accessHandler;
+ });
+
+ // Call onInit
+ // Init must be called before focus so the selection won't get lost by the focus call
+ tinymce.each(t.listeners, function(o) {
+ o.func.call(o.scope, t.editor);
+ });
+
+ // Move focus to window
+ if (t.getWindowArg('mce_auto_focus', true)) {
+ window.focus();
+
+ // Focus element with mceFocus class
+ tinymce.each(document.forms, function(f) {
+ tinymce.each(f.elements, function(e) {
+ if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
+ e.focus();
+ return false; // Break loop
+ }
+ });
+ });
+ }
+
+ document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
+
+ if ('textContent' in document) {
+ t.uiWindow.getEl('head').firstChild.textContent = document.title;
+ } else {
+ t.uiWindow.getEl('head').firstChild.innerText = document.title;
+ }
+ },
+
+ _accessHandler : function(e) {
+ e = e || window.event;
+
+ if (e.keyCode == 13 || e.keyCode == 32) {
+ var elm = e.target || e.srcElement;
+
+ if (elm.onchange) {
+ elm.onchange();
+ }
+
+ return tinymce.dom.Event.cancel(e);
+ }
+ },
+
+ _closeWinKeyHandler : function(e) {
+ e = e || window.event;
+
+ if (e.keyCode == 27) {
+ tinyMCEPopup.close();
+ }
+ },
+
+ _eventProxy: function(id) {
+ return function(evt) {
+ tinyMCEPopup.dom.events.callNativeHandler(id, evt);
+ };
+ }
+};
+
+tinyMCEPopup.init();
+
+tinymce.util.Dispatcher = function(scope) {
+ this.scope = scope || this;
+ this.listeners = [];
+
+ this.add = function(callback, scope) {
+ this.listeners.push({cb : callback, scope : scope || this.scope});
+
+ return callback;
+ };
+
+ this.addToTop = function(callback, scope) {
+ var self = this, listener = {cb : callback, scope : scope || self.scope};
+
+ // Create new listeners if addToTop is executed in a dispatch loop
+ if (self.inDispatch) {
+ self.listeners = [listener].concat(self.listeners);
+ } else {
+ self.listeners.unshift(listener);
+ }
+
+ return callback;
+ };
+
+ this.remove = function(callback) {
+ var listeners = this.listeners, output = null;
+
+ tinymce.each(listeners, function(listener, i) {
+ if (callback == listener.cb) {
+ output = listener;
+ listeners.splice(i, 1);
+ return false;
+ }
+ });
+
+ return output;
+ };
+
+ this.dispatch = function() {
+ var self = this, returnValue, args = arguments, i, listeners = self.listeners, listener;
+
+ self.inDispatch = true;
+
+ // Needs to be a real loop since the listener count might change while looping
+ // And this is also more efficient
+ for (i = 0; i < listeners.length; i++) {
+ listener = listeners[i];
+ returnValue = listener.cb.apply(listener.scope, args.length > 0 ? args : [listener.scope]);
+
+ if (returnValue === false) {
+ break;
+ }
+ }
+
+ self.inDispatch = false;
+
+ return returnValue;
+ };
+};
diff --git a/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js b/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js
new file mode 100644
index 000000000..8d30787d5
--- /dev/null
+++ b/e107_plugins/tinymce4/plugins/compat3x/utils/editable_selects.js
@@ -0,0 +1,70 @@
+/**
+ * editable_selects.js
+ *
+ * Copyright, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://www.tinymce.com/license
+ * Contributing: http://www.tinymce.com/contributing
+ */
+
+var TinyMCE_EditableSelects = {
+ editSelectElm : null,
+
+ init : function() {
+ var nl = document.getElementsByTagName("select"), i, d = document, o;
+
+ for (i=0; i';
+ h += ' ' + tinyMCEPopup.getLang('browse') + '
';
+
+ return h;
+}
+
+function updateColor(img_id, form_element_id) {
+ document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
+}
+
+function setBrowserDisabled(id, state) {
+ var img = document.getElementById(id);
+ var lnk = document.getElementById(id + "_link");
+
+ if (lnk) {
+ if (state) {
+ lnk.setAttribute("realhref", lnk.getAttribute("href"));
+ lnk.removeAttribute("href");
+ tinyMCEPopup.dom.addClass(img, 'disabled');
+ } else {
+ if (lnk.getAttribute("realhref"))
+ lnk.setAttribute("href", lnk.getAttribute("realhref"));
+
+ tinyMCEPopup.dom.removeClass(img, 'disabled');
+ }
+ }
+}
+
+function getBrowserHTML(id, target_form_element, type, prefix) {
+ var option = prefix + "_" + type + "_browser_callback", cb, html;
+
+ cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
+
+ if (!cb)
+ return "";
+
+ html = "";
+ html += '
';
+ html += ' ';
+
+ return html;
+}
+
+function openBrowser(img_id, target_form_element, type, option) {
+ var img = document.getElementById(img_id);
+
+ if (img.className != "mceButtonDisabled")
+ tinyMCEPopup.openBrowser(target_form_element, type, option);
+}
+
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
+ if (!form_obj || !form_obj.elements[field_name])
+ return;
+
+ if (!value)
+ value = "";
+
+ var sel = form_obj.elements[field_name];
+
+ var found = false;
+ for (var i=0; i
parseInt(v))
+ st = this.mark(f, n);
+ }
+ }
+
+ return st;
+ },
+
+ hasClass : function(n, c, d) {
+ return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
+ },
+
+ getNum : function(n, c) {
+ c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
+ c = c.replace(/[^0-9]/g, '');
+
+ return c;
+ },
+
+ addClass : function(n, c, b) {
+ var o = this.removeClass(n, c);
+ n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
+ },
+
+ removeClass : function(n, c) {
+ c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
+ return n.className = c != ' ' ? c : '';
+ },
+
+ tags : function(f, s) {
+ return f.getElementsByTagName(s);
+ },
+
+ mark : function(f, n) {
+ var s = this.settings;
+
+ this.addClass(n, s.invalid_cls);
+ n.setAttribute('aria-invalid', 'true');
+ this.markLabels(f, n, s.invalid_cls);
+
+ return false;
+ },
+
+ markLabels : function(f, n, ic) {
+ var nl, i;
+
+ nl = this.tags(f, "label");
+ for (i=0; i' + html + ' ' ;
-
+alert(html);
tinyMCEPopup.editor.execCommand('mceInsertContent', false, html);
tinyMCEPopup.close();
});
diff --git a/e107_plugins/tinymce4/plugins/e107/parser.php b/e107_plugins/tinymce4/plugins/e107/parser.php
index e8dc0204c..f46dde5d3 100644
--- a/e107_plugins/tinymce4/plugins/e107/parser.php
+++ b/e107_plugins/tinymce4/plugins/e107/parser.php
@@ -24,8 +24,8 @@ require_once("../../../../class2.php");
if($_POST['mode'] == 'tohtml')
{
-
-
+
+
// XXX @Cam possible fix - convert to BB first, see news admin AJAX request/response values for reference why
$content = stripslashes($_POST['content']);
@@ -59,12 +59,16 @@ if($_POST['mode'] == 'tohtml')
if(!empty($content) && E107_DEBUG_LEVEL > 0)
{
- $content = "-- DEBUG MODE ACTIVE -- \n".$content;
- echo htmlentities($content)."\n";
- exit;
+ $content = "-- DEBUG MODE ACTIVE -- \n".$content;
+ // echo htmlentities($content)."\n";
+ // echo "".$content."
";
+ echo $content;
+ exit;
}
-
+
+
echo $content;
+
}
else // bbcode Mode.
{
diff --git a/e107_plugins/tinymce4/templates/mainadmin.xml b/e107_plugins/tinymce4/templates/mainadmin.xml
index fa41f8c6c..9db5c26f0 100644
--- a/e107_plugins/tinymce4/templates/mainadmin.xml
+++ b/e107_plugins/tinymce4/templates/mainadmin.xml
@@ -4,7 +4,7 @@
insertdatetime media nonbreaking save table contextmenu directionality emoticons template paste textcolor
edit view format insert table tools
undo redo | styleselect | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image template | e107-image e107-video e107-glyph | preview
- e107 example
+ e107 example compat3x
true
i[*], object[*],embed[*],bbcode[*]
[
diff --git a/e107_plugins/tinymce4/wysiwyg.php b/e107_plugins/tinymce4/wysiwyg.php
index 3bc1299a4..a2efde29e 100644
--- a/e107_plugins/tinymce4/wysiwyg.php
+++ b/e107_plugins/tinymce4/wysiwyg.php
@@ -306,6 +306,13 @@ class wysiwyg
$ret[$k] = $xml;
}
+ $tPref = e107::pref('tinymce4');
+
+ if(!empty($tPref['paste_as_text']))
+ {
+ $ret['paste_as_text'] = true;
+ }
+
$ret['convert_fonts_to_spans'] = false;
$ret['content_css'] = e_PLUGIN_ABS.'tinymce4/editor.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css,http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css';