From c48a85fb775a83a807a35ea348e49a053e16fa70 Mon Sep 17 00:00:00 2001 From: CaMer0n Date: Sun, 29 Apr 2012 10:38:45 +0000 Subject: [PATCH] TinyMce iBrowser work --- e107_handlers/media_class.php | 52 ++++++++++------ .../tinymce/plugins/ibrowser/editor_plugin.js | 4 +- .../tinymce/plugins/ibrowser/ibrowser.php | 61 +++++++++++++------ e107_plugins/tinymce/wysiwyg.php | 2 + 4 files changed, 79 insertions(+), 40 deletions(-) diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 7c860e24c..04cf95760 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -334,42 +334,56 @@ class e_media public function mediaSelect($cat='',$tagid=null,$att=null) { + $onclick = null; $cat = ($cat) ? $cat."+" : ""; - $images = $this->getImages($cat); + parse_str($att); + + $images = $this->getImages($cat,0,30); $att = 'aw=120&ah=100'; - $name = $tagid; - $prevId = $name."_prev"; + - $onclick_clear = "onclick =\" - parent.document.getElementById('{$tagid}').value = ''; + $prevId = $tagid."_prev"; + + $onclick_clear = "parent.document.getElementById('{$tagid}').value = ''; parent.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/blank.gif'; parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); - return false; \""; + return false;"; - $text .= " -
+ $text .= " +
No Image
"; + $srch = array("{MEDIA_URL}","{MEDIA_PATH}"); foreach($images as $im) { + $media_path = e107::getParser()->replaceConstants($im['media_url'],'full'); $realPath = e107::getParser()->thumbUrl($im['media_url'], $att); $diz = e107::getParser()->toAttribute($im['media_title']); - - $onclick = "onclick =\" - parent.document.getElementById('{$tagid}').value = '{$im['media_url']}'; - parent.document.getElementById('".$prevId."').src = '{$realPath}'; - parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); - return false; \""; - - //FIXME Make Window Close automatically when selection is made. - $text .= "
"; - $text .= "\"".$im['media_title']."\""; - $text .= ""; + $repl = array($im['media_url'],$media_path); + + if($onclick == null) + { + $onclicki = "parent.document.getElementById('{$tagid}').value = '{$im['media_url']}'; + parent.document.getElementById('".$prevId."').src = '{$realPath}'; + parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); + return false;"; + } + else + { + $onclicki = str_replace($srch,$repl,$onclick); + } + + + $text .= "\n"; + $text .= "\"".$im['media_title']."\"\n"; + $text .= "\n\n"; } + + return $text; } diff --git a/e107_plugins/tinymce/plugins/ibrowser/editor_plugin.js b/e107_plugins/tinymce/plugins/ibrowser/editor_plugin.js index 7d1ab2df7..93964c010 100644 --- a/e107_plugins/tinymce/plugins/ibrowser/editor_plugin.js +++ b/e107_plugins/tinymce/plugins/ibrowser/editor_plugin.js @@ -2,7 +2,7 @@ * $Id$ * * @author Moxiecode - * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved. */ (function() { @@ -23,7 +23,7 @@ ed.addCommand('mceibrowser', function() { ed.windowManager.open({ file : url + '/ibrowser.php', - width : 520 + parseInt(ed.getLang('ibrowser.delta_width', 0)), + width : 800 + parseInt(ed.getLang('ibrowser.delta_width', 0)), height : 770 + parseInt(ed.getLang('ibrowser.delta_height', 0)), inline : 1 }, { diff --git a/e107_plugins/tinymce/plugins/ibrowser/ibrowser.php b/e107_plugins/tinymce/plugins/ibrowser/ibrowser.php index 400cb7f91..4236284dc 100644 --- a/e107_plugins/tinymce/plugins/ibrowser/ibrowser.php +++ b/e107_plugins/tinymce/plugins/ibrowser/ibrowser.php @@ -304,21 +304,37 @@ echo " ".$lang_ibrowser_img_sel." -
+ +
\n"; + +echo e107::getMedia()->mediaSelect('news',null, "onclick=document.getElementById('src').value = '{MEDIA_PATH}';return false"); + + /* + echo " - - - - - - + \n"; + + + + + + echo " + + + + + "; + + + + + echo " @@ -326,7 +342,8 @@ echo " + echo " "; + echo " - + "; + + */ + + echo " -
".$lang_ibrowser_library.":   ".$lang_ibrowser_preview.":
  - -
  + +
".$lang_ibrowser_images.":  
"; - $mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common"; + $mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common"; + $mediaCat = "news+"; $array = e107::getMedia()->getImages($mediaCat); @@ -349,13 +366,14 @@ echo " } } - - - - - echo "  
@@ -372,7 +390,12 @@ echo "
+ + + + +
diff --git a/e107_plugins/tinymce/wysiwyg.php b/e107_plugins/tinymce/wysiwyg.php index ace65d1ae..829f7350b 100644 --- a/e107_plugins/tinymce/wysiwyg.php +++ b/e107_plugins/tinymce/wysiwyg.php @@ -262,6 +262,8 @@ class wysiwyg 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_blockformats' => 'p,h2,blockquote,code', + 'dialog_type' => "modal", +