mirror of
https://github.com/e107inc/e107.git
synced 2025-07-10 09:36:23 +02:00
TinyMce/MediaManager fixes.
This commit is contained in:
@ -491,13 +491,13 @@ class media_admin_ui extends e_admin_ui
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if($this->getQuery('bbcode'))
|
if($this->getQuery('bbcode'))
|
||||||
{
|
{
|
||||||
//TODO this is not really used when jquery is running.
|
//TODO this is not really used when jquery is running.
|
||||||
e107::getJS()->headerInline("
|
e107::getJS()->headerInline("
|
||||||
|
|
||||||
/* Send the generated IMG bbcode back to the textarea/window */
|
// Send the generated IMG bbcode back to the textarea/window
|
||||||
function saveBB()
|
function saveBB()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -517,6 +517,7 @@ class media_admin_ui extends e_admin_ui
|
|||||||
");
|
");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
$this->getResponse()->setIframeMod(); // disable header/footer menus etc.
|
$this->getResponse()->setIframeMod(); // disable header/footer menus etc.
|
||||||
if(!$this->getQuery('for'))
|
if(!$this->getQuery('for'))
|
||||||
@ -619,6 +620,8 @@ class media_admin_ui extends e_admin_ui
|
|||||||
<table class='adminedit'>
|
<table class='adminedit'>
|
||||||
<tbody><tr><td>
|
<tbody><tr><td>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
$tag = ($bbcodeMode) ? "" : $this->getQuery('tagid');
|
||||||
|
|
||||||
$text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'),$bbcodeMode); // eg. news, news-thumbnail
|
$text .= e107::getMedia()->mediaSelect($this->getQuery('for'),$this->getQuery('tagid'),$bbcodeMode); // eg. news, news-thumbnail
|
||||||
|
|
||||||
@ -715,10 +718,10 @@ class media_admin_ui extends e_admin_ui
|
|||||||
</div>";
|
</div>";
|
||||||
|
|
||||||
// TODO to eventually be hidden.
|
// TODO to eventually be hidden.
|
||||||
$text .= "bbcode: <input type='text' style='width:800px' id='bbcode_holder' name='bbcode_holder' value='' />
|
$text .= "bbcode: <input type='text' readonly='readonly' style='border:0px; width:700px' id='bbcode_holder' name='bbcode_holder' value='' />
|
||||||
<br />html: <input type='text' style='width:800px' id='html_holder' name='html_holder' value='' />
|
<input title='html' type='hidden' style='width:800px' id='html_holder' name='html_holder' value='' />
|
||||||
<br />src: <input type='text' style='width:600px' id='src' name='src' value='' />
|
<input title='src' type='hidden' style='width:600px' id='src' name='src' value='' />
|
||||||
<br />path: <input type='text' style='width:600px' id='path' name='path' value='' />
|
<input title='path' type='hidden' style='width:600px' id='path' name='path' value='' />
|
||||||
";
|
";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1995,12 +1995,12 @@ class admin_newspost
|
|||||||
|
|
||||||
$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
|
$val = (strstr($tp->post_toForm($_POST['news_body']), "[img]http") ? $tp->post_toForm($_POST['news_body']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_body'])));
|
||||||
$text .= "<div id='news-body-container'>";
|
$text .= "<div id='news-body-container'>";
|
||||||
$text .= $frm->bbarea('news_body', $val, 'news', 'helpb');
|
$text .= $frm->bbarea('news_body', $val, 'news', 'news');
|
||||||
$text .= "</div><div id='news-extended-container'>";
|
$text .= "</div><div id='news-extended-container'>";
|
||||||
|
|
||||||
|
|
||||||
$val = (strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended'])));
|
$val = (strstr($tp->post_toForm($_POST['news_extended']), "[img]http") ? $tp->post_toForm($_POST['news_extended']) : str_replace("[img]../", "[img]", $tp->post_toForm($_POST['news_extended'])));
|
||||||
$text .= $frm->bbarea('news_extended', $val, 'extended', 'helpc','large');
|
$text .= $frm->bbarea('news_extended', $val, 'extended', 'news','large');
|
||||||
|
|
||||||
$text .= "</div>
|
$text .= "</div>
|
||||||
</div></td></tr>";
|
</div></td></tr>";
|
||||||
|
@ -45,12 +45,9 @@ class bb_h extends e_bb_base
|
|||||||
}
|
}
|
||||||
if($safe)
|
if($safe)
|
||||||
{
|
{
|
||||||
return '[h'.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h'.$h.']';
|
return '[h='.$h.'|'.eHelper::buildAttr($safe).']'.$code_text.'[/h]';
|
||||||
}
|
}
|
||||||
return '[h'.$h.']'.$code_text.'[/h'.$h.']';
|
return '[h='.$h.']'.$code_text.'[/h]';
|
||||||
|
|
||||||
// IMPORTANT: Using '[h=2]' with a non-matching closing tag etc will cause major issues with TinyMce.
|
|
||||||
// It is cleaner to use [h2], [h3] etc. TODO - Batch BBcodes. ;-)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ $(document).ready(function()
|
|||||||
var newval = $('#bbcode_holder').val();
|
var newval = $('#bbcode_holder').val();
|
||||||
// alert(newval);
|
// alert(newval);
|
||||||
var target = $(this).attr('data-target');
|
var target = $(this).attr('data-target');
|
||||||
|
|
||||||
|
if(!target){return true; }
|
||||||
//('#' + target, window.top.document).insertAtCaret(newVal);
|
//('#' + target, window.top.document).insertAtCaret(newVal);
|
||||||
|
|
||||||
// $('#' + target, window.parent.document).append(newval); //FIXME caret!!
|
// $('#' + target, window.parent.document).append(newval); //FIXME caret!!
|
||||||
@ -102,7 +104,7 @@ $(document).ready(function()
|
|||||||
$(".e-media-select").live("click", function(){
|
$(".e-media-select").live("click", function(){
|
||||||
|
|
||||||
|
|
||||||
console.log(this);
|
// console.log(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -113,28 +115,27 @@ $(document).ready(function()
|
|||||||
var bbcode = $(this).attr('data-bbcode');
|
var bbcode = $(this).attr('data-bbcode');
|
||||||
|
|
||||||
$(this).addClass("media-select-active");
|
$(this).addClass("media-select-active");
|
||||||
$(this).closest("img").addClass("active");
|
$(this).closest("img").addClass("active");
|
||||||
|
|
||||||
// TinyMce?
|
if(bbcode) // not needed for Tinymce
|
||||||
$('input#' + target, window.top.document).attr('value',path); // set new value
|
|
||||||
|
|
||||||
if(bbcode)
|
|
||||||
{
|
{
|
||||||
bbpath = '['+bbcode+']'+ path + '[/' + bbcode + ']';
|
// $('input#' + target, window.top.document).attr('value',path); // set new value
|
||||||
$('textarea#' + target, window.top.document).attr('value',bbpath);
|
// bbpath = '['+bbcode+']'+ path + '[/' + bbcode + ']';
|
||||||
|
// $('textarea#' + target, window.top.document).attr('value',bbpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value
|
|
||||||
$('div#' + target + "_prev", window.top.document).html(preview); // set new value
|
|
||||||
$('span#' + target + "_prev", window.top.document).html(preview); // set new value
|
|
||||||
|
|
||||||
$('#src').attr('value',src); // working old
|
$('#src').attr('value',src); // working old
|
||||||
$('#preview').attr('src',preview); // working old
|
$('#preview').attr('src',preview); // working old
|
||||||
|
|
||||||
$('#path').attr('value',path); // working old
|
$('#path').attr('value',path); // working old
|
||||||
$('#src').attr('src',src); // working old
|
$('#src').attr('src',src); // working old
|
||||||
|
|
||||||
|
$('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value
|
||||||
|
$('div#' + target + "_prev", window.top.document).html(preview); // set new value
|
||||||
|
$('span#' + target + "_prev", window.top.document).html(preview); // set new value
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
eMediaAttribute(this);
|
eMediaAttribute(this);
|
||||||
// $(this).parent('#src').attr('value',preview); // set new value
|
// $(this).parent('#src').attr('value',preview); // set new value
|
||||||
|
@ -517,9 +517,12 @@ class e_bbcode
|
|||||||
array( "\n[/list]", '</ul>'),
|
array( "\n[/list]", '</ul>'),
|
||||||
array( "\n[*]", '<li>'),
|
array( "\n[*]", '<li>'),
|
||||||
array( "\n[*]", '<li class="bbcode bbcode-list">'),
|
array( "\n[*]", '<li class="bbcode bbcode-list">'),
|
||||||
array( "[h2]", '<h2 class="bbcode-center" style="text-align: center;">'), // e107 bbcode markup
|
array( "[h=2]", '<h2 class="bbcode-center" style="text-align: center;">'), // e107 bbcode markup
|
||||||
array( "[h2]", '<h2>'),
|
array( "[h=2]", '<h2>'),
|
||||||
array( "[/h2]", '</h2>'),
|
array( "[/h]", '</h2>'),
|
||||||
|
array( "[h=3]", '<h3 class="bbcode-center" style="text-align: center;">'), // e107 bbcode markup
|
||||||
|
array( "[h=3]", '<h3>'),
|
||||||
|
array( "[/h]", '</h3>'),
|
||||||
array( "[b]", '<strong>'), // Tinymce markup
|
array( "[b]", '<strong>'), // Tinymce markup
|
||||||
array( "[b]", '<strong class="bbcode bold bbcode-b">'), // e107 bbcode markup
|
array( "[b]", '<strong class="bbcode bold bbcode-b">'), // e107 bbcode markup
|
||||||
array( "[/b]", '</strong>'),
|
array( "[/b]", '</strong>'),
|
||||||
@ -529,7 +532,7 @@ class e_bbcode
|
|||||||
array( "[block]", '<div>'),
|
array( "[block]", '<div>'),
|
||||||
array( "[/block]", '</div>'),
|
array( "[/block]", '</div>'),
|
||||||
array( "[table]\n", '<table>'),
|
array( "[table]\n", '<table>'),
|
||||||
array( "[/table]\n", '</table>'),
|
array( "[/table]\n", '</table>'),
|
||||||
array( "[table]\n", '<table class="bbcode-table">'),
|
array( "[table]\n", '<table class="bbcode-table">'),
|
||||||
array( "[tbody]\n", '<tbody class="bbcode-tbody">'),
|
array( "[tbody]\n", '<tbody class="bbcode-tbody">'),
|
||||||
array( "[tr]", '<tr class="bbcode-tr">'),
|
array( "[tr]", '<tr class="bbcode-tr">'),
|
||||||
@ -545,7 +548,8 @@ class e_bbcode
|
|||||||
array( "[/td]", '</td>'),
|
array( "[/td]", '</td>'),
|
||||||
array( "[blockquote]", '<blockquote>'),
|
array( "[blockquote]", '<blockquote>'),
|
||||||
array( "[blockquote]", '<blockquote class="indent bbcode-blockquote">'),
|
array( "[blockquote]", '<blockquote class="indent bbcode-blockquote">'),
|
||||||
array( "[/blockquote]",'</blockquote>'),
|
array( "[/blockquote]",'</blockquote>')
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach($convert as $arr)
|
foreach($convert as $arr)
|
||||||
@ -563,12 +567,13 @@ class e_bbcode
|
|||||||
$text = preg_replace('/<span (?:class="bbcode underline bbcode-u" )?style="text-decoration: underline;">(.*?)<\/span>/i',"[u]$1[/u]",$text);
|
$text = preg_replace('/<span (?:class="bbcode underline bbcode-u" )?style="text-decoration: underline;">(.*?)<\/span>/i',"[u]$1[/u]",$text);
|
||||||
// $text = preg_replace('/<table([^"]*)>/i', "[table $1]",$text);
|
// $text = preg_replace('/<table([^"]*)>/i', "[table $1]",$text);
|
||||||
$text = preg_replace('/<table style="([^"]*)"([\w ="]*)?>/i', "[table style=$1]\n",$text);
|
$text = preg_replace('/<table style="([^"]*)"([\w ="]*)?>/i', "[table style=$1]\n",$text);
|
||||||
|
$text = preg_replace('/<table([\w :\-_;="]*)?>/i', "[table]\n",$text);
|
||||||
$text = preg_replace('/<tbody([\w ="]*)?>/i', "[tbody]\n",$text);
|
$text = preg_replace('/<tbody([\w ="]*)?>/i', "[tbody]\n",$text);
|
||||||
$text = preg_replace('/<code([\w :\-_;="]*)?>/i', "[code]\n",$text);
|
$text = preg_replace('/<code([\w :\-_;="]*)?>/i', "[code]\n",$text);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$blank = array('</li>','width:px;height:px;');
|
$blank = array('</li>','width:px;height:px;',"</p>","<p>");
|
||||||
$text = str_replace($blank,"",$text); // Cleanup
|
$text = str_replace($blank,"",$text); // Cleanup
|
||||||
|
|
||||||
return str_replace($srch,$repl,$text);
|
return str_replace($srch,$repl,$text);
|
||||||
|
@ -697,9 +697,10 @@ class e_form
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bbcode Area. Name, value, template, form-id, size, options array eg. counter
|
* Bbcode Area. Name, value, template, form-id, size, options array eg. counter
|
||||||
|
* IMPORTANT: $$mediaCat is also used is the media-manager category identifier
|
||||||
*/
|
*/
|
||||||
function bbarea($name, $value, $template = '', $help_tagid='', $size = 'large', $options = array())
|
function bbarea($name, $value, $template = '', $mediaCat='_common', $size = 'large', $options = array())
|
||||||
{
|
{
|
||||||
//size - large|medium|small
|
//size - large|medium|small
|
||||||
//width should be explicit set by current admin theme
|
//width should be explicit set by current admin theme
|
||||||
switch($size)
|
switch($size)
|
||||||
@ -720,17 +721,14 @@ class e_form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// auto-height support
|
// auto-height support
|
||||||
$options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight';
|
$options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight';
|
||||||
$bbbar = '';
|
$bbbar = '';
|
||||||
|
|
||||||
// FIXME - see ren_help.php
|
|
||||||
|
$help_tagid = $this->name2id($name)."--preview";
|
||||||
// require_once(e_HANDLER."ren_help.php"); // Ren-help no longer required.
|
$options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
|
||||||
// $bbbar = display_help($help_tagid, $template, 'addtext', 'help', $size);
|
|
||||||
$help_tagid = $this->name2id($name)."--preview"; // not really needed, but a unique name is always welcome
|
|
||||||
$options['other'] = "onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
|
|
||||||
|
|
||||||
$counter = vartrue($options['counter'],false);
|
$counter = vartrue($options['counter'],false);
|
||||||
|
|
||||||
$ret = "
|
$ret = "
|
||||||
<div class='bbarea {$size}'>
|
<div class='bbarea {$size}'>
|
||||||
@ -742,6 +740,8 @@ class e_form
|
|||||||
|
|
||||||
$ret .= "</div>\n";
|
$ret .= "</div>\n";
|
||||||
|
|
||||||
|
$_SESSION['media_category'] = $mediaCat; // used by TinyMce.
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
// Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler
|
// Quick fix - hide TinyMCE links if not installed, dups are handled by JS handler
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
// unset $tinyMCE_imglib_include
|
// unset $tinyMCE_imglib_include
|
||||||
require_once("../../../../class2.php");
|
require_once("../../../../class2.php");
|
||||||
header("Location: ".e_ADMIN_ABS.'image.php?mode=main&action=dialog&for=news&tagid=news-thumbnail&iframe=1&bbcode=1');
|
|
||||||
|
header("Location: ".e_ADMIN_ABS.'image.php?mode=main&action=dialog&for='.$_SESSION['media_category'].'&tagid=&iframe=1&bbcode=1');
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user