1
0
mirror of https://github.com/e107inc/e107.git synced 2025-05-03 10:49:12 +02:00

TinyMce iBrowser work

This commit is contained in:
CaMer0n 2012-04-29 10:38:45 +00:00
parent 611e3ae7e2
commit c48a85fb77
4 changed files with 79 additions and 40 deletions

View File

@ -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 .= "<a class='media-select-clear' style='float:left' href='#' {$onclick_clear} >
<div style='display:block;border:1px solid silver;padding-top:40px;text-align:center;vertical-align:middle;width:120px;height:60px'>
$text .= "<a class='media-select-clear' style='float:left' href='#' onclick=\"{$onclick_clear}\" >
<div style='display:block;border:1px solid silver;padding-top:40px;text-align:center;vertical-align:middle;width:120px;height:58px'>
No Image</div>";
$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 .= "<a class='media-select' title=\"".$diz."\" href='#' {$onclick} >";
$text .= "<img src='".e107::getParser()->thumbUrl($im['media_url'], $att)."' alt=\"".$im['media_title']."\" />";
$text .= "</a>";
$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 .= "<a class='media-select' title=\"".$diz."\" href='#' onclick=\"{$onclicki}\" >\n";
$text .= "<img src='".e107::getParser()->thumbUrl($im['media_url'], $att)."' alt=\"".$im['media_title']."\" />\n";
$text .= "</a>\n\n";
}
return $text;
}

View File

@ -2,7 +2,7 @@
* $Id$
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright <EFBFBD> 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
}, {

View File

@ -304,21 +304,37 @@ echo "</head>
<legend>".$lang_ibrowser_img_sel."</legend>
<table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><table style='width:100%;border:0px' cellpadding=\"2\" cellspacing=\"0\">
<td><table style='width:100%;border:0px' cellpadding=\"2\" cellspacing=\"0\">\n";
echo e107::getMedia()->mediaSelect('news',null, "onclick=document.getElementById('src').value = '{MEDIA_PATH}';return false");
/*
echo "
<tr>
<td style='width:210px'><strong>".$lang_ibrowser_library.":</strong></td>
<td style='width:5px'>&nbsp;</td>
<td ><strong>".$lang_ibrowser_preview.":</strong></td>
</tr>
<tr>
<td><select name=\"lib\" size=\"1\" style=\"width: 100%;\" onchange=\"this.form.submit();\">
".$lib_options."
</select></td>
<td>&nbsp;</td>
<td style='border:0px;text-align:left;vertical-align:top' rowspan=\"3\">
<iframe name=\"imgpreview\" id=\"imgpreview\" class=\"previewWindow\" src=\"".$preview."\" style=\"border:0px;width: 100%; height: 220px;overflow:auto\" ></iframe>
</td>
</tr>
</tr>\n";
echo "
<tr>
<td><select name=\"lib\" size=\"1\" style=\"width: 100%;\" onchange=\"this.form.submit();\">
".$lib_options."
</select></td>
<td>&nbsp;</td>
<td style='border:0px;text-align:left;vertical-align:top' rowspan=\"3\">
<iframe name=\"imgpreview\" id=\"imgpreview\" class=\"previewWindow\" src=\"".$preview."\" style=\"border:0px;width: 100%; height: 220px;overflow:auto\" ></iframe>
</td>
</tr>";
echo "
<tr>
<td><strong>".$lang_ibrowser_images.":</strong></td>
<td>&nbsp;</td>
@ -326,7 +342,8 @@ echo "</head>
<tr>
<td>";
$mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common";
$mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common";
$mediaCat = "news+";
$array = e107::getMedia()->getImages($mediaCat);
@ -349,13 +366,14 @@ echo "</head>
}
}
echo " </select></td>
echo " </select>";
echo "</td>
<td>&nbsp;</td>
</tr>
</tr>";
*/
echo "
<tr>
<td colspan=\"3\"><table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
<tr>
@ -372,7 +390,12 @@ echo "</head>
</tr>
</table></td>
</tr>
</table></td>
</table>
</td>
</tr>
</table>
</fieldset>

View File

@ -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",