TinyMce4 fixes. Video and Glyph plugins working again. Editor toggle button working. And embedded video thumbnail workaround added.
@@ -946,7 +946,7 @@ class media_admin_ui extends e_admin_ui
|
||||
|
||||
if($this->getQuery('iframe'))
|
||||
{
|
||||
e107::js('tinymce','tiny_mce_popup.js');
|
||||
e107::js('tinymce4','plugins/compat3x/tiny_mce_popup.js');
|
||||
$this->getResponse()->setIframeMod(); // disable header/footer menus etc.
|
||||
|
||||
if(!$this->getQuery('for'))
|
||||
@@ -1262,8 +1262,8 @@ class media_admin_ui extends e_admin_ui
|
||||
}
|
||||
|
||||
$type = (E107_DEBUG_LEVEL > 0) ? "text" : "hidden";
|
||||
$br = (E107_DEBUG_LEVEL > 0) ? "<br />" : "";
|
||||
|
||||
$br = (E107_DEBUG_LEVEL > 0) ? "<br />" : "";
|
||||
|
||||
$text .= "
|
||||
".$br."<input title='bbcode' type='{$type}' readonly='readonly' class='span11' id='bbcode_holder' name='bbcode_holder' value='' />
|
||||
".$br."<input title='html/wysiwyg' type='{$type}' class='span11' readonly='readonly' id='html_holder' name='html_holder' value='' />
|
||||
|
@@ -1102,13 +1102,15 @@ class e_media
|
||||
|
||||
|
||||
$close = (E107_DEBUG_LEVEL > 0) ? "" : " data-close='true' "; //
|
||||
|
||||
//
|
||||
$text .= "\n\n<!-- Start Item -->\n<div class='media-carousel ".$data['gridClass']."'>
|
||||
$select = (E107_DEBUG_LEVEL > 0) ? '' : " e-dialog-save e-dialog-close";
|
||||
|
||||
|
||||
|
||||
$text = "\n\n<!-- Start Item -->\n<div class='media-carousel ".$data['gridClass']."'>
|
||||
|
||||
<div class='well clearfix'>
|
||||
|
||||
<a data-toggle='context' class='e-media-select e-tip e-dialog-save e-dialog-close' ".$close." data-id='".$data['id']."' data-width='".$data['width']."' data-height='".$data['height']."' data-src='".$data['previewUrl']."' data-type='".$data['type']."' data-bbcode='".$data['bbcode']."' data-target='".$data['tagid']."' data-path='".$data['saveValue']."' data-preview='".$data['previewUrl']."' title=\"".$data['title']."\" style='float:left' href='#' >";
|
||||
<a data-toggle='context' class='e-media-select e-tip".$select."' ".$close." data-id='".$data['id']."' data-width='".$data['width']."' data-height='".$data['height']."' data-src='".$data['previewUrl']."' data-type='".$data['type']."' data-bbcode='".$data['bbcode']."' data-target='".$data['tagid']."' data-path='".$data['saveValue']."' data-preview='".$data['previewUrl']."' title=\"".$data['title']."\" style='float:left' href='#' >";
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
733
e107_plugins/tinymce4/admin_config.php
Normal file
@@ -0,0 +1,733 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*/
|
||||
require_once("../../class2.php");
|
||||
if( !e107::isInstalled('tinymce4'))
|
||||
{
|
||||
header("location:".e_BASE."index.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class tinymce4_admin extends e_admin_dispatcher
|
||||
{
|
||||
|
||||
protected $modes = array(
|
||||
'main' => 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 = "<form method='post' action='".e_SELF."?mode=create'>
|
||||
<fieldset id='core-release-list'>
|
||||
<legend class='e-hideme'>".$this->pluginTitle."</legend>
|
||||
<table class='adminlist'>".
|
||||
$frm->colGroup($this->fields,$this->fieldpref).
|
||||
$frm->thead($this->fields,$this->fieldpref).
|
||||
|
||||
"<tbody>";
|
||||
|
||||
|
||||
if(!$sql->db_Select_gen($this->listQry))
|
||||
{
|
||||
$text .= "\n<tr><td colspan='".count($this->fields)."' class='center middle'>".CUSLAN_42."</td></tr>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$row = $sql->db_getList('ALL', FALSE, FALSE);
|
||||
|
||||
foreach($row as $field)
|
||||
{
|
||||
$text .= "<tr>\n";
|
||||
foreach($this->fields as $key=>$att)
|
||||
{
|
||||
$class = vartrue($this->fields[$key]['thclass']) ? "class='".$this->fields[$key]['thclass']."'" : "";
|
||||
$text .= (in_array($key,$this->fieldpref) || $att['forced']==TRUE) ? "\t<td ".$class.">".$this->renderValue($key,$field)."</td>\n" : "";
|
||||
}
|
||||
$text .= "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
|
||||
$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 = "<input type='image' class='action edit' name='edit[{$row[$id]}]' src='".ADMIN_EDIT_ICON_PATH."' title='".LAN_EDIT."' />";
|
||||
$text .= "<input type='image' class='action delete' name='delete[{$row[$id]}]' src='".ADMIN_DELETE_ICON_PATH."' title='".LAN_DELETE." [ ID: {$row[$id]} ]' />";
|
||||
return $text;
|
||||
}
|
||||
|
||||
if($key == "tinymce_userclass")
|
||||
{
|
||||
return $frm->uc_label($row[$key]);
|
||||
}
|
||||
|
||||
if($key == "tinymce_plugins")
|
||||
{
|
||||
return str_replace(",","<br />",$row[$key]);
|
||||
}
|
||||
|
||||
switch($att['type'])
|
||||
{
|
||||
case 'url':
|
||||
return "<a href='".$row[$key]."'>".$row[$key]."</a>";
|
||||
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 = "
|
||||
<form method='post' action='".e_SELF."?mode=create' id='dataform' enctype='multipart/form-data'>
|
||||
<fieldset id='core-cpage-create-general'>
|
||||
<legend class='e-hideme'>".$this->pluginTitle."</legend>
|
||||
<table class='adminedit'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Preview<div style='padding:20px'>[<a href='javascript:start_tinyMce();'>Refresh Preview</a>]
|
||||
<br /><br />[<a href='#' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'content');\">Toggle WYSIWYG</a>]
|
||||
</div>
|
||||
</td>
|
||||
<td>".$this->tinymce_preview()."</td>
|
||||
</tr>";
|
||||
|
||||
|
||||
|
||||
foreach($this->fields as $key=>$att)
|
||||
{
|
||||
if($att['forced']!==TRUE)
|
||||
{
|
||||
$text .= "
|
||||
<tr>
|
||||
<td>".$att['title']."</td>
|
||||
<td>".$this->renderElement($key,$row)."</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>";
|
||||
|
||||
if($id)
|
||||
{
|
||||
$text .= $frm->admin_button('update', LAN_UPDATE, 'update');
|
||||
$text .= "<input type='hidden' name='record_id' value='".$id."' />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= $frm->admin_button('create', LAN_CREATE, 'create');
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>";
|
||||
|
||||
$ns->tablerender($this->pluginTitle." :: ".$this->createCaption,$mes->render(). $text);
|
||||
}
|
||||
|
||||
|
||||
function tinymce_buttons($curVal,$id)
|
||||
{
|
||||
return "<input class='tbox' style='width:97%' type='text' name='tinymce_buttons".$id."' value='".$curVal."' />\n";
|
||||
}
|
||||
|
||||
|
||||
function tinymce_preview()
|
||||
{
|
||||
return "<textarea id='content' class='e-wysiwyg tbox' rows='10' cols='10' name='preview' style='width:80%'> </textarea>";
|
||||
|
||||
}
|
||||
|
||||
function tinymce_plugins($curVal)
|
||||
{
|
||||
$fl = e107::getFile();
|
||||
|
||||
$curArray = explode(",",$curVal);
|
||||
|
||||
if($plug_array = $fl->get_dirs(e_PLUGIN."tinymce/plugins/"))
|
||||
{
|
||||
sort($plug_array);
|
||||
}
|
||||
|
||||
$text = "<div style='width:80%'>";
|
||||
|
||||
foreach($plug_array as $mce_plg)
|
||||
{
|
||||
$checked = (in_array($mce_plg,$curArray)) ? "checked='checked'" : "";
|
||||
$text .= "<div style='width:25%;float:left'><input type='checkbox' name='tinymce_plugins[]' value='".$mce_plg."' $checked /> $mce_plg </div>";
|
||||
}
|
||||
|
||||
$text .= "</div>";
|
||||
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('<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
|
||||
{
|
||||
$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 = "
|
||||
<form method='post' action='".e_SELF."?".e_QUERY."'>
|
||||
<fieldset id='core-cpage-options'>
|
||||
<legend class='e-hideme'>".LAN_OPTIONS."</legend>
|
||||
<table class='adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>".CUSLAN_29."</td>
|
||||
<td>
|
||||
".$frm->radio_switch('listPages', $pref['listPages'])."
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>".CUSLAN_30."</td>
|
||||
<td>
|
||||
".$frm->text('pageCookieExpire', $pref['pageCookieExpire'], 10)."
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class='buttons-bar center'>
|
||||
".$frm->admin_button('saveOptions', CUSLAN_40, 'submit')."
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
";
|
||||
|
||||
$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 = "<div style='text-align:center'>
|
||||
<form method='post' action='".e_SELF."'>
|
||||
<fieldset id='plugin-tinymce-config'>
|
||||
<table class='adminform'>
|
||||
<colgroup>
|
||||
<col class='col-label' />
|
||||
<col class='col-control' />
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td>Preview<div style='padding:20px'>[<a href='javascript:start_tinyMce();'>Refresh Preview</a>]
|
||||
<br /><br />[<a href='#' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'content');\">Toggle WYSIWYG</a>]
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id='content' class='e-wysiwyg tbox' rows='10' cols='10' name='name3' style='width:80%'> </textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Installed Plugins</td>
|
||||
<td><div style='width:80%'>
|
||||
";
|
||||
|
||||
foreach($plug_array as $mce_plg)
|
||||
{
|
||||
$checked = (in_array($mce_plg,$tpref['plugins'])) ? "checked='checked'" : "";
|
||||
$text .= "<div style='width:25%;float:left'><input type='checkbox' name='mce_plugins[]' value='".$mce_plg."' $checked /> $mce_plg </div>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$text .= "</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Button Layout</td>
|
||||
<td style='width:80%' class='forumheader3'>";
|
||||
for ($i=1; $i<=4; $i++)
|
||||
{
|
||||
$rowNm = "theme_advanced_buttons".$i;
|
||||
$text .= "\t<input class='tbox' style='width:97%' type='text' name='".$rowNm."' value='".$tpref[$rowNm]."' />\n";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Custom TinyMce Javascript</td>
|
||||
<td>
|
||||
<textarea rows='5' cols='10' name='customjs' class='tbox' style='width:80%'>".$tpref['customjs']."</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='buttons-bar center'>";
|
||||
$text .= "<input class='btn button' type='submit' name='save_settings' value='".LAN_SAVE."' />";
|
||||
$text .= "
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
$ns -> tablerender("TinyMCE Configuration", $text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
require_once(e_ADMIN."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('<div>";
|
||||
// $insert .= "<a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle btn btn-inverse btn-mini\">Switch to bbcode<\/a>";
|
||||
$insert .= "<a href=\"#\" id=\"' + id + '\" class=\"e-wysiwyg-toggle btn btn-inverse btn-mini\">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
|
||||
|
||||
// <div><a href='#' class='e-wysiwyg-switch' onclick=\"tinyMCE.execCommand('mceToggleEditor',false,'".$tinyMceID."');expandit('".$toggleID."');\">Toggle WYSIWYG</a></div>
|
||||
|
||||
|
||||
|
||||
e107::js('footer-inline',"
|
||||
|
||||
|
||||
<!---- TinyMCE Footer Inline Code -->
|
||||
|
||||
|
||||
$(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 = '<img src=\''+src +'\' alt=\'emote\' />';
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
BIN
e107_plugins/tinymce4/images/icon_16.png
Normal file
After Width: | Height: | Size: 859 B |
BIN
e107_plugins/tinymce4/images/icon_32.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
@@ -3,4 +3,7 @@
|
||||
<author name="e107 Inc." url="http://e107.org" />
|
||||
<description>TinyMce4 CDN version</description>
|
||||
<category>misc</category>
|
||||
<adminLinks>
|
||||
<link url='admin_config.php' description='Configure' icon='images/icon_32.png' iconSmall='images/icon_16.png' primary='true' >Configure</link>
|
||||
</adminLinks>
|
||||
</e107Plugin>
|
118
e107_plugins/tinymce4/plugins/compat3x/css/dialog.css
Normal file
@@ -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;}
|
BIN
e107_plugins/tinymce4/plugins/compat3x/img/buttons.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/icons.gif
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/items.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/menu_arrow.gif
Normal file
After Width: | Height: | Size: 68 B |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/menu_check.gif
Normal file
After Width: | Height: | Size: 70 B |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/progress.gif
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
e107_plugins/tinymce4/plugins/compat3x/img/tabs.gif
Normal file
After Width: | Height: | Size: 1.3 KiB |
297
e107_plugins/tinymce4/plugins/compat3x/plugin.js
Normal file
@@ -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('<target>.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);
|
1
e107_plugins/tinymce4/plugins/compat3x/plugin.min.js
vendored
Normal file
@@ -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<e.length;i++)h.push(c[e[i]]);("function"!=typeof e||(h=e(d,c,a)))&&(e||(h=[c]),h.unshift(f||a),b.apply(g||f||a,h)===!1&&c.stopImmediatePropagation())}return c("<target>.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);
|
542
e107_plugins/tinymce4/plugins/compat3x/tiny_mce_popup.js
vendored
Normal file
@@ -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 <plugin url>/langs/<code>_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('<script type="text/javascript" src="' + url + '"></script>');
|
||||
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;
|
||||
};
|
||||
};
|
@@ -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<nl.length; i++) {
|
||||
if (nl[i].className.indexOf('mceEditableSelect') != -1) {
|
||||
o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
|
||||
|
||||
o.className = 'mceAddSelectValue';
|
||||
|
||||
nl[i].options[nl[i].options.length] = o;
|
||||
nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onChangeEditableSelect : function(e) {
|
||||
var d = document, ne, se = window.event ? window.event.srcElement : e.target;
|
||||
|
||||
if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
|
||||
ne = d.createElement("input");
|
||||
ne.id = se.id + "_custom";
|
||||
ne.name = se.name + "_custom";
|
||||
ne.type = "text";
|
||||
|
||||
ne.style.width = se.offsetWidth + 'px';
|
||||
se.parentNode.insertBefore(ne, se);
|
||||
se.style.display = 'none';
|
||||
ne.focus();
|
||||
ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
|
||||
ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
|
||||
TinyMCE_EditableSelects.editSelectElm = se;
|
||||
}
|
||||
},
|
||||
|
||||
onBlurEditableSelectInput : function() {
|
||||
var se = TinyMCE_EditableSelects.editSelectElm;
|
||||
|
||||
if (se) {
|
||||
if (se.previousSibling.value != '') {
|
||||
addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
|
||||
selectByValue(document.forms[0], se.id, se.previousSibling.value);
|
||||
} else
|
||||
selectByValue(document.forms[0], se.id, '');
|
||||
|
||||
se.style.display = 'inline';
|
||||
se.parentNode.removeChild(se.previousSibling);
|
||||
TinyMCE_EditableSelects.editSelectElm = null;
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13)
|
||||
TinyMCE_EditableSelects.onBlurEditableSelectInput();
|
||||
}
|
||||
};
|
210
e107_plugins/tinymce4/plugins/compat3x/utils/form_utils.js
Normal file
@@ -0,0 +1,210 @@
|
||||
/**
|
||||
* form_utils.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
|
||||
|
||||
function getColorPickerHTML(id, target_form_element) {
|
||||
var h = "", dom = tinyMCEPopup.dom;
|
||||
|
||||
if (label = dom.select('label[for=' + target_form_element + ']')[0]) {
|
||||
label.id = label.id || dom.uniqueId();
|
||||
}
|
||||
|
||||
h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
|
||||
h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>';
|
||||
|
||||
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 += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
|
||||
html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>';
|
||||
|
||||
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<sel.options.length; i++) {
|
||||
var option = sel.options[i];
|
||||
|
||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||
option.selected = true;
|
||||
found = true;
|
||||
} else
|
||||
option.selected = false;
|
||||
}
|
||||
|
||||
if (!found && add_custom && value != '') {
|
||||
var option = new Option(value, value);
|
||||
option.selected = true;
|
||||
sel.options[sel.options.length] = option;
|
||||
sel.selectedIndex = sel.options.length - 1;
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
function getSelectValue(form_obj, field_name) {
|
||||
var elm = form_obj.elements[field_name];
|
||||
|
||||
if (elm == null || elm.options == null || elm.selectedIndex === -1)
|
||||
return "";
|
||||
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
}
|
||||
|
||||
function addSelectValue(form_obj, field_name, name, value) {
|
||||
var s = form_obj.elements[field_name];
|
||||
var o = new Option(name, value);
|
||||
s.options[s.options.length] = o;
|
||||
}
|
||||
|
||||
function addClassesToList(list_id, specific_option) {
|
||||
// Setup class droplist
|
||||
var styleSelectElm = document.getElementById(list_id);
|
||||
var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
|
||||
styles = tinyMCEPopup.getParam(specific_option, styles);
|
||||
|
||||
if (styles) {
|
||||
var stylesAr = styles.split(';');
|
||||
|
||||
for (var i=0; i<stylesAr.length; i++) {
|
||||
if (stylesAr != "") {
|
||||
var key, value;
|
||||
|
||||
key = stylesAr[i].split('=')[0];
|
||||
value = stylesAr[i].split('=')[1];
|
||||
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
|
||||
styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
|
||||
});*/
|
||||
}
|
||||
}
|
||||
|
||||
function isVisible(element_id) {
|
||||
var elm = document.getElementById(element_id);
|
||||
|
||||
return elm && elm.style.display != "none";
|
||||
}
|
||||
|
||||
function convertRGBToHex(col) {
|
||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||
|
||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||
if (rgb.length == 3) {
|
||||
r = parseInt(rgb[0]).toString(16);
|
||||
g = parseInt(rgb[1]).toString(16);
|
||||
b = parseInt(rgb[2]).toString(16);
|
||||
|
||||
r = r.length == 1 ? '0' + r : r;
|
||||
g = g.length == 1 ? '0' + g : g;
|
||||
b = b.length == 1 ? '0' + b : b;
|
||||
|
||||
return "#" + r + g + b;
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function convertHexToRGB(col) {
|
||||
if (col.indexOf('#') != -1) {
|
||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||
|
||||
r = parseInt(col.substring(0, 2), 16);
|
||||
g = parseInt(col.substring(2, 4), 16);
|
||||
b = parseInt(col.substring(4, 6), 16);
|
||||
|
||||
return "rgb(" + r + "," + g + "," + b + ")";
|
||||
}
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
function trimSize(size) {
|
||||
return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2');
|
||||
}
|
||||
|
||||
function getCSSSize(size) {
|
||||
size = trimSize(size);
|
||||
|
||||
if (size == "")
|
||||
return "";
|
||||
|
||||
// Add px
|
||||
if (/^[0-9]+$/.test(size))
|
||||
size += 'px';
|
||||
// Sanity check, IE doesn't like broken values
|
||||
else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size)))
|
||||
return "";
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
function getStyle(elm, attrib, style) {
|
||||
var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
|
||||
|
||||
if (val != '')
|
||||
return '' + val;
|
||||
|
||||
if (typeof(style) == 'undefined')
|
||||
style = attrib;
|
||||
|
||||
return tinyMCEPopup.dom.getStyle(elm, style);
|
||||
}
|
164
e107_plugins/tinymce4/plugins/compat3x/utils/mctabs.js
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* mctabs.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*jshint globals: tinyMCEPopup */
|
||||
|
||||
function MCTabs() {
|
||||
this.settings = [];
|
||||
this.onChange = tinyMCEPopup.editor.windowManager.createInstance('tinymce.util.Dispatcher');
|
||||
};
|
||||
|
||||
MCTabs.prototype.init = function(settings) {
|
||||
this.settings = settings;
|
||||
};
|
||||
|
||||
MCTabs.prototype.getParam = function(name, default_value) {
|
||||
var value = null;
|
||||
|
||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||
|
||||
// Fix bool values
|
||||
if (value == "true" || value == "false")
|
||||
return (value == "true");
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showTab =function(tab){
|
||||
tab.className = 'current';
|
||||
tab.setAttribute("aria-selected", true);
|
||||
tab.setAttribute("aria-expanded", true);
|
||||
tab.tabIndex = 0;
|
||||
};
|
||||
|
||||
MCTabs.prototype.hideTab =function(tab){
|
||||
var t=this;
|
||||
|
||||
tab.className = '';
|
||||
tab.setAttribute("aria-selected", false);
|
||||
tab.setAttribute("aria-expanded", false);
|
||||
tab.tabIndex = -1;
|
||||
};
|
||||
|
||||
MCTabs.prototype.showPanel = function(panel) {
|
||||
panel.className = 'current';
|
||||
panel.setAttribute("aria-hidden", false);
|
||||
};
|
||||
|
||||
MCTabs.prototype.hidePanel = function(panel) {
|
||||
panel.className = 'panel';
|
||||
panel.setAttribute("aria-hidden", true);
|
||||
};
|
||||
|
||||
MCTabs.prototype.getPanelForTab = function(tabElm) {
|
||||
return tinyMCEPopup.dom.getAttrib(tabElm, "aria-controls");
|
||||
};
|
||||
|
||||
MCTabs.prototype.displayTab = function(tab_id, panel_id, avoid_focus) {
|
||||
var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i, t = this;
|
||||
|
||||
tabElm = document.getElementById(tab_id);
|
||||
|
||||
if (panel_id === undefined) {
|
||||
panel_id = t.getPanelForTab(tabElm);
|
||||
}
|
||||
|
||||
panelElm= document.getElementById(panel_id);
|
||||
panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||
tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||
selectionClass = t.getParam('selection_class', 'current');
|
||||
|
||||
if (tabElm && tabContainerElm) {
|
||||
nodes = tabContainerElm.childNodes;
|
||||
|
||||
// Hide all other tabs
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "LI") {
|
||||
t.hideTab(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Show selected tab
|
||||
t.showTab(tabElm);
|
||||
}
|
||||
|
||||
if (panelElm && panelContainerElm) {
|
||||
nodes = panelContainerElm.childNodes;
|
||||
|
||||
// Hide all other panels
|
||||
for (i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].nodeName == "DIV")
|
||||
t.hidePanel(nodes[i]);
|
||||
}
|
||||
|
||||
if (!avoid_focus) {
|
||||
tabElm.focus();
|
||||
}
|
||||
|
||||
// Show selected panel
|
||||
t.showPanel(panelElm);
|
||||
}
|
||||
};
|
||||
|
||||
MCTabs.prototype.getAnchor = function() {
|
||||
var pos, url = document.location.href;
|
||||
|
||||
if ((pos = url.lastIndexOf('#')) != -1)
|
||||
return url.substring(pos + 1);
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
|
||||
//Global instance
|
||||
var mcTabs = new MCTabs();
|
||||
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
var tinymce = tinyMCEPopup.getWin().tinymce, dom = tinyMCEPopup.dom, each = tinymce.each;
|
||||
|
||||
each(dom.select('div.tabs'), function(tabContainerElm) {
|
||||
//var keyNav;
|
||||
|
||||
dom.setAttrib(tabContainerElm, "role", "tablist");
|
||||
|
||||
var items = tinyMCEPopup.dom.select('li', tabContainerElm);
|
||||
var action = function(id) {
|
||||
mcTabs.displayTab(id, mcTabs.getPanelForTab(id));
|
||||
mcTabs.onChange.dispatch(id);
|
||||
};
|
||||
|
||||
each(items, function(item) {
|
||||
dom.setAttrib(item, 'role', 'tab');
|
||||
dom.bind(item, 'click', function(evt) {
|
||||
action(item.id);
|
||||
});
|
||||
});
|
||||
|
||||
dom.bind(dom.getRoot(), 'keydown', function(evt) {
|
||||
if (evt.keyCode === 9 && evt.ctrlKey && !evt.altKey) { // Tab
|
||||
//keyNav.moveFocus(evt.shiftKey ? -1 : 1);
|
||||
tinymce.dom.Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
|
||||
each(dom.select('a', tabContainerElm), function(a) {
|
||||
dom.setAttrib(a, 'tabindex', '-1');
|
||||
});
|
||||
|
||||
/*keyNav = tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', {
|
||||
root: tabContainerElm,
|
||||
items: items,
|
||||
onAction: action,
|
||||
actOnFocus: true,
|
||||
enableLeftRight: true,
|
||||
enableUpDown: true
|
||||
}, tinyMCEPopup.dom);*/
|
||||
});
|
||||
});
|
252
e107_plugins/tinymce4/plugins/compat3x/utils/validate.js
Normal file
@@ -0,0 +1,252 @@
|
||||
/**
|
||||
* validate.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/**
|
||||
// String validation:
|
||||
|
||||
if (!Validator.isEmail('myemail'))
|
||||
alert('Invalid email.');
|
||||
|
||||
// Form validation:
|
||||
|
||||
var f = document.forms['myform'];
|
||||
|
||||
if (!Validator.isEmail(f.myemail))
|
||||
alert('Invalid email.');
|
||||
*/
|
||||
|
||||
var Validator = {
|
||||
isEmail : function(s) {
|
||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||
},
|
||||
|
||||
isAbsUrl : function(s) {
|
||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||
},
|
||||
|
||||
isSize : function(s) {
|
||||
return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
|
||||
},
|
||||
|
||||
isId : function(s) {
|
||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||
},
|
||||
|
||||
isEmpty : function(s) {
|
||||
var nl, i;
|
||||
|
||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||
return true;
|
||||
|
||||
if (s.type == 'checkbox' && !s.checked)
|
||||
return true;
|
||||
|
||||
if (s.type == 'radio') {
|
||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||
},
|
||||
|
||||
isNumber : function(s, d) {
|
||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||
},
|
||||
|
||||
test : function(s, p) {
|
||||
s = s.nodeType == 1 ? s.value : s;
|
||||
|
||||
return s == '' || new RegExp(p).test(s);
|
||||
}
|
||||
};
|
||||
|
||||
var AutoValidator = {
|
||||
settings : {
|
||||
id_cls : 'id',
|
||||
int_cls : 'int',
|
||||
url_cls : 'url',
|
||||
number_cls : 'number',
|
||||
email_cls : 'email',
|
||||
size_cls : 'size',
|
||||
required_cls : 'required',
|
||||
invalid_cls : 'invalid',
|
||||
min_cls : 'min',
|
||||
max_cls : 'max'
|
||||
},
|
||||
|
||||
init : function(s) {
|
||||
var n;
|
||||
|
||||
for (n in s)
|
||||
this.settings[n] = s[n];
|
||||
},
|
||||
|
||||
validate : function(f) {
|
||||
var i, nl, s = this.settings, c = 0;
|
||||
|
||||
nl = this.tags(f, 'label');
|
||||
for (i=0; i<nl.length; i++) {
|
||||
this.removeClass(nl[i], s.invalid_cls);
|
||||
nl[i].setAttribute('aria-invalid', false);
|
||||
}
|
||||
|
||||
c += this.validateElms(f, 'input');
|
||||
c += this.validateElms(f, 'select');
|
||||
c += this.validateElms(f, 'textarea');
|
||||
|
||||
return c == 3;
|
||||
},
|
||||
|
||||
invalidate : function(n) {
|
||||
this.mark(n.form, n);
|
||||
},
|
||||
|
||||
getErrorMessages : function(f) {
|
||||
var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;
|
||||
nl = this.tags(f, "label");
|
||||
for (i=0; i<nl.length; i++) {
|
||||
if (this.hasClass(nl[i], s.invalid_cls)) {
|
||||
field = document.getElementById(nl[i].getAttribute("for"));
|
||||
values = { field: nl[i].textContent };
|
||||
if (this.hasClass(field, s.min_cls, true)) {
|
||||
message = ed.getLang('invalid_data_min');
|
||||
values.min = this.getNum(field, s.min_cls);
|
||||
} else if (this.hasClass(field, s.number_cls)) {
|
||||
message = ed.getLang('invalid_data_number');
|
||||
} else if (this.hasClass(field, s.size_cls)) {
|
||||
message = ed.getLang('invalid_data_size');
|
||||
} else {
|
||||
message = ed.getLang('invalid_data');
|
||||
}
|
||||
|
||||
message = message.replace(/{\#([^}]+)\}/g, function(a, b) {
|
||||
return values[b] || '{#' + b + '}';
|
||||
});
|
||||
messages.push(message);
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
},
|
||||
|
||||
reset : function(e) {
|
||||
var t = ['label', 'input', 'select', 'textarea'];
|
||||
var i, j, nl, s = this.settings;
|
||||
|
||||
if (e == null)
|
||||
return;
|
||||
|
||||
for (i=0; i<t.length; i++) {
|
||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||
for (j=0; j<nl.length; j++) {
|
||||
this.removeClass(nl[j], s.invalid_cls);
|
||||
nl[j].setAttribute('aria-invalid', false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
validateElms : function(f, e) {
|
||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||
|
||||
nl = this.tags(f, e);
|
||||
for (i=0; i<nl.length; i++) {
|
||||
n = nl[i];
|
||||
|
||||
this.removeClass(n, s.invalid_cls);
|
||||
|
||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||
st = this.mark(f, n);
|
||||
|
||||
if (this.hasClass(n, s.min_cls, true)) {
|
||||
v = this.getNum(n, s.min_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||
st = this.mark(f, n);
|
||||
}
|
||||
|
||||
if (this.hasClass(n, s.max_cls, true)) {
|
||||
v = this.getNum(n, s.max_cls);
|
||||
|
||||
if (isNaN(v) || parseInt(n.value) > 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<nl.length; i++) {
|
||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||
this.addClass(nl[i], ic);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
@@ -26,7 +26,7 @@ e107::css('inline',"
|
||||
|
||||
");
|
||||
|
||||
e107::js('tinymce','tiny_mce_popup.js');
|
||||
e107::js('tinymce4','plugins/compat3x/tiny_mce_popup.js');
|
||||
|
||||
e107::js('inline',"
|
||||
|
||||
@@ -89,7 +89,7 @@ $(document).ready(function()
|
||||
}).responseText;
|
||||
|
||||
html = '<bbcode alt=\"'+encodeURIComponent(s)+'\">' + html + '</bbcode> ' ;
|
||||
|
||||
alert(html);
|
||||
tinyMCEPopup.editor.execCommand('mceInsertContent', false, html);
|
||||
tinyMCEPopup.close();
|
||||
});
|
||||
|
@@ -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 "<pre>".$content."</pre>";
|
||||
echo $content;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo $content;
|
||||
|
||||
}
|
||||
else // bbcode Mode.
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@
|
||||
insertdatetime media nonbreaking save table contextmenu directionality emoticons template paste textcolor</plugins>
|
||||
<menubar>edit view format insert table tools</menubar>
|
||||
<toolbar1>undo redo | styleselect | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image template | e107-image e107-video e107-glyph | preview</toolbar1>
|
||||
<external_plugins>e107 example</external_plugins>
|
||||
<external_plugins>e107 example compat3x</external_plugins>
|
||||
<image_advtab>true</image_advtab>
|
||||
<extended_valid_elements>i[*], object[*],embed[*],bbcode[*]</extended_valid_elements>
|
||||
<templates>[
|
||||
|
@@ -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';
|
||||
|
||||
|