1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-16 12:36:26 +02:00

Media-Manager and TinyMce connectivity

This commit is contained in:
CaMer0n
2012-04-30 20:35:59 +00:00
parent 2a50dc6177
commit 972b7fa401
5 changed files with 29 additions and 14 deletions

View File

@ -349,12 +349,16 @@ class media_admin_ui extends e_admin_ui
/* Send the generated IMG bbcode back to the textarea/window */ /* Send the generated IMG bbcode back to the textarea/window */
function saveBB() function saveBB()
{ {
var add = document.getElementById('bbcode_holder').value;
addtext(add);
// tinyMCE.execCommand('mceInsertContent',false,'hi there');
var add = document.getElementById('bbcode_holder').value;
var html = document.getElementById('html_holder').value;
// tinyMCE.execCommand('mceInsertContent',false,add);
tinyMCE.execCommand('mceInsertRawHTML',false,html);
tinyMCEPopup.close(); tinyMCEPopup.close();
//addtext(add);
//parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); //parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();
return false; return false;
} }
@ -503,6 +507,11 @@ class media_admin_ui extends e_admin_ui
</tr> </tr>
</tbody></table> </tbody></table>
<table><tr><td>Preview<br /></td></tr>
<tr><td style='text-align:center'>
<img id='preview' src='".e_IMAGE_ABS."generic/blank.gif' style='border:1px solid silver; min-width:220px; min-height:180px;' />
</td></tr></table>
</fieldset>"; </fieldset>";
} }
$text .= "</div>"; $text .= "</div>";
@ -587,7 +596,7 @@ class media_admin_ui extends e_admin_ui
document.getElementById('bbcode_holder').value = bb; document.getElementById('bbcode_holder').value = bb;
var html = '<img src=\''+ src +'\' style=\'' + style + '\' />'; var html = '<img style=\"' + style + '\" src=\"'+ src +'\" />';
document.getElementById('html_holder').value = html; document.getElementById('html_holder').value = html;
} }

View File

@ -368,6 +368,7 @@ class e_media
} }
$srch = array("{MEDIA_URL}","{MEDIA_PATH}"); $srch = array("{MEDIA_URL}","{MEDIA_PATH}");
foreach($images as $im) foreach($images as $im)
@ -386,10 +387,10 @@ class e_media
} }
else // TinyMce and other applications. else // TinyMce and other applications.
{ {
//TODO Add a preview window
$onclicki = "document.getElementById('src').value = '{$im['media_url']}'; $onclicki = "document.getElementById('src').value = '{$im['media_url']}';
document.getElementById('preview').src = '{$realPath}';
updateBB(); updateBB();
;
return false;"; return false;";
} }

View File

@ -14,7 +14,7 @@
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php")) if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php") )
{ {
require_once(e_PLUGIN."tinymce/wysiwyg.php"); require_once(e_PLUGIN."tinymce/wysiwyg.php");
if(deftrue('TINYMCE_CONFIG')) if(deftrue('TINYMCE_CONFIG'))
@ -26,7 +26,11 @@ if(e_WYSIWYG || strpos(e_SELF,"tinymce/admin_config.php"))
$wy = new wysiwyg(); $wy = new wysiwyg();
} }
if(!strpos(e_SELF,e_ADMIN_ABS."image.php"))
{
$wy -> render(); $wy -> render();
}
} }

View File

@ -83,9 +83,10 @@
// New Image Handler // verified // New Image Handler // verified
rep(/<img(?:\s*)?(?:style="(.*)")?\s?(?:src="(\S*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/gi,"[img style=$1;width:$4px;height:$5px]$2[/img]" ) // rep(/<img(?:\s*)?(?:style="(.*)")?\s?(?:src="([\S ]*)")(?:\s*)?(?:alt="(\S*)")?(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?\/>/gi,"[img style=$1;width:$4px;height:$5px]$2[/img]" )
rep(/<img(?:\s*)?(?:style="(.*)")?\s?(?:src="([^;"]*)")(?:\s*)?(?:width="([\d]*)")?\s*(?:height="([\d]*)")?(?:\s*)?(?:alt="(\S*)")? (?:\s*)?\/>/gi,"[img style=$1;width:$4px;height:$5px]$2[/img]" );
rep(/;width:px;height:px/gi, ""); // Img cleanup. rep(/;width:px;height:px/gi, ""); // Img cleanup.
rep(/<img\s*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]"); // rep(/<img\s*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
rep(/<blockquote[^>]*>/gi,"[blockquote]"); rep(/<blockquote[^>]*>/gi,"[blockquote]");
rep(/<\/blockquote>/gi,"[/blockquote]"); rep(/<\/blockquote>/gi,"[/blockquote]");

View File

@ -23,7 +23,7 @@
ed.addCommand('mceibrowser', function() { ed.addCommand('mceibrowser', function() {
ed.windowManager.open({ ed.windowManager.open({
file : url + '/ibrowser.php', file : url + '/ibrowser.php',
width : 800 + parseInt(ed.getLang('ibrowser.delta_width', 0)), width : 830 + parseInt(ed.getLang('ibrowser.delta_width', 0)),
height : 770 + parseInt(ed.getLang('ibrowser.delta_height', 0)), height : 770 + parseInt(ed.getLang('ibrowser.delta_height', 0)),
inline : 1 inline : 1
}, { }, {