1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-24 07:03:06 +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,43 +334,57 @@ class e_media
public function mediaSelect($cat='',$tagid=null,$att=null) public function mediaSelect($cat='',$tagid=null,$att=null)
{ {
$onclick = null;
$cat = ($cat) ? $cat."+" : ""; $cat = ($cat) ? $cat."+" : "";
$images = $this->getImages($cat); parse_str($att);
$images = $this->getImages($cat,0,30);
$att = 'aw=120&ah=100'; $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.document.getElementById('".$prevId."').src = '".e_IMAGE_ABS."generic/blank.gif';
parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close(); parent.e107Widgets.DialogManagerDefault.getWindow('e-dialog').close();
return false; \""; return false;";
$text .= "<a class='media-select-clear' style='float:left' href='#' {$onclick_clear} > $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:60px'> <div style='display:block;border:1px solid silver;padding-top:40px;text-align:center;vertical-align:middle;width:120px;height:58px'>
No Image</div>"; No Image</div>";
$srch = array("{MEDIA_URL}","{MEDIA_PATH}");
foreach($images as $im) foreach($images as $im)
{ {
$media_path = e107::getParser()->replaceConstants($im['media_url'],'full');
$realPath = e107::getParser()->thumbUrl($im['media_url'], $att); $realPath = e107::getParser()->thumbUrl($im['media_url'], $att);
$diz = e107::getParser()->toAttribute($im['media_title']); $diz = e107::getParser()->toAttribute($im['media_title']);
$onclick = "onclick =\" $repl = array($im['media_url'],$media_path);
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. 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} >";
$text .= "<img src='".e107::getParser()->thumbUrl($im['media_url'], $att)."' alt=\"".$im['media_title']."\" />"; $text .= "<a class='media-select' title=\"".$diz."\" href='#' onclick=\"{$onclicki}\" >\n";
$text .= "</a>"; $text .= "<img src='".e107::getParser()->thumbUrl($im['media_url'], $att)."' alt=\"".$im['media_title']."\" />\n";
$text .= "</a>\n\n";
} }
return $text; return $text;
} }

View File

@@ -2,7 +2,7 @@
* $Id$ * $Id$
* *
* @author Moxiecode * @author Moxiecode
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved. * @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
*/ */
(function() { (function() {
@@ -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 : 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)), height : 770 + parseInt(ed.getLang('ibrowser.delta_height', 0)),
inline : 1 inline : 1
}, { }, {

View File

@@ -304,21 +304,37 @@ echo "</head>
<legend>".$lang_ibrowser_img_sel."</legend> <legend>".$lang_ibrowser_img_sel."</legend>
<table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\"> <table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
<tr> <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> <tr>
<td style='width:210px'><strong>".$lang_ibrowser_library.":</strong></td> <td style='width:210px'><strong>".$lang_ibrowser_library.":</strong></td>
<td style='width:5px'>&nbsp;</td> <td style='width:5px'>&nbsp;</td>
<td ><strong>".$lang_ibrowser_preview.":</strong></td> <td ><strong>".$lang_ibrowser_preview.":</strong></td>
</tr> </tr>\n";
<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\"> echo "
<iframe name=\"imgpreview\" id=\"imgpreview\" class=\"previewWindow\" src=\"".$preview."\" style=\"border:0px;width: 100%; height: 220px;overflow:auto\" ></iframe> <tr>
</td> <td><select name=\"lib\" size=\"1\" style=\"width: 100%;\" onchange=\"this.form.submit();\">
</tr> ".$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> <tr>
<td><strong>".$lang_ibrowser_images.":</strong></td> <td><strong>".$lang_ibrowser_images.":</strong></td>
<td>&nbsp;</td> <td>&nbsp;</td>
@@ -327,6 +343,7 @@ echo "</head>
<td>"; <td>";
$mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common"; $mediaCat = ($_POST['lib']) ? $_POST['lib'] : "_common";
$mediaCat = "news+";
$array = e107::getMedia()->getImages($mediaCat); $array = e107::getMedia()->getImages($mediaCat);
@@ -349,13 +366,14 @@ echo "</head>
} }
} }
echo " </select>";
echo "</td>
echo " </select></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>";
*/
echo "
<tr> <tr>
<td colspan=\"3\"><table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\"> <td colspan=\"3\"><table style='width:100%;border:0px' cellspacing=\"0\" cellpadding=\"0\">
<tr> <tr>
@@ -372,7 +390,12 @@ echo "</head>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
</table></td> </table>
</td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>

View File

@@ -262,6 +262,8 @@ class wysiwyg
'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_location' => 'top',
'theme_advanced_toolbar_align' => 'left', 'theme_advanced_toolbar_align' => 'left',
'theme_advanced_blockformats' => 'p,h2,blockquote,code', 'theme_advanced_blockformats' => 'p,h2,blockquote,code',
'dialog_type' => "modal",