对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进
2007-08-21 10:27
429 查看
用过FckEditor的朋友都知道,它的选择图片对话框中“浏览服务器”按钮。点击该按钮可以浏览以前已经上传过的文件。不过这个按钮点击后弹出的对话框在MAXTHON浏览器下是以标签形式打开的,这样模态对话框就始终显示在了浏览文件窗口之前,要想选择文件得先关掉模态对话框。先前有朋友提出把弹出模态对话框的功能改为ShowModlessDialog,这个终究不是解决之道,现将我的解决方法写下来与大家分享:
思路就是基于IE内核的浏览器采用模态对话框弹出浏览服务器窗口,其他的仍然window.open不变1:修改\fckeditor\editor\dialog\common\fck_dialog_common.js
1 function OpenFileBrowser( url, width, height )
2 {
3 // oEditor must be defined.
4
5 var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ;
6 var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
7
8 var sOptions = "toolbar=no,status=no,resizable=no,dependent=yes,scrollbars=yes" ;
9 sOptions += ",width=" + width ;
10 sOptions += ",height=" + height ;
11 sOptions += ",left=" + iLeft ;
12 sOptions += ",top=" + iTop ;
13
14 // The "PreserveSessionOnFileBrowser" because the above code could be
15 // blocked by popup blockers.
16 if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE )
17 {
18 // The following change has been made otherwise IE will open the file
19 // browser on a different server session (on some cases):
20 // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
21 // by Simone Chiaretta.
22 var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
23
24 if ( oWindow )
25 {
26 // Detect Yahoo popup blocker.
27 try
28 {
29 var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user.
30 oWindow.opener = window ;
31 }
32 catch(e)
33 {
34 alert( oEditor.FCKLang.BrowseServerBlocked ) ;
35 }
36 }
37 else
38 alert( oEditor.FCKLang.BrowseServerBlocked ) ;
39 }
40 else
41 {
//这里是修改部分
42 if(oEditor.FCKBrowserInfo.IsIE)
43 {
44 window.showModalDialog(url+"&rdm="+new Date(),window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px\"");
45 }
46 else
47 {
48 window.open( url, 'FCKBrowseWindow', sOptions ) ;
49 }
50 }
51 }
2:修改\fckeditor\editor\filemanager\browser\default\frmresourceslist.html
function OpenFile( fileUrl )
{
if( window.dialogArguments)
{
window.dialogArguments.SetUrl( fileUrl ) ;
window.close() ;
window.dialogArguments.focus() ;
}
else
{
window.top.opener.SetUrl( fileUrl ) ;
window.top.close() ;
window.top.opener.focus() ;
}
}
这样就没有问题了。
文章来源:http://www.cnblogs.com/Wang-Seraph/archive/2007/04/09/705447.html
思路就是基于IE内核的浏览器采用模态对话框弹出浏览服务器窗口,其他的仍然window.open不变1:修改\fckeditor\editor\dialog\common\fck_dialog_common.js
1 function OpenFileBrowser( url, width, height )
2 {
3 // oEditor must be defined.
4
5 var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ;
6 var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
7
8 var sOptions = "toolbar=no,status=no,resizable=no,dependent=yes,scrollbars=yes" ;
9 sOptions += ",width=" + width ;
10 sOptions += ",height=" + height ;
11 sOptions += ",left=" + iLeft ;
12 sOptions += ",top=" + iTop ;
13
14 // The "PreserveSessionOnFileBrowser" because the above code could be
15 // blocked by popup blockers.
16 if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE )
17 {
18 // The following change has been made otherwise IE will open the file
19 // browser on a different server session (on some cases):
20 // http://support.microsoft.com/default.aspx?scid=kb;en-us;831678
21 // by Simone Chiaretta.
22 var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
23
24 if ( oWindow )
25 {
26 // Detect Yahoo popup blocker.
27 try
28 {
29 var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user.
30 oWindow.opener = window ;
31 }
32 catch(e)
33 {
34 alert( oEditor.FCKLang.BrowseServerBlocked ) ;
35 }
36 }
37 else
38 alert( oEditor.FCKLang.BrowseServerBlocked ) ;
39 }
40 else
41 {
//这里是修改部分
42 if(oEditor.FCKBrowserInfo.IsIE)
43 {
44 window.showModalDialog(url+"&rdm="+new Date(),window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px\"");
45 }
46 else
47 {
48 window.open( url, 'FCKBrowseWindow', sOptions ) ;
49 }
50 }
51 }
2:修改\fckeditor\editor\filemanager\browser\default\frmresourceslist.html
function OpenFile( fileUrl )
{
if( window.dialogArguments)
{
window.dialogArguments.SetUrl( fileUrl ) ;
window.close() ;
window.dialogArguments.focus() ;
}
else
{
window.top.opener.SetUrl( fileUrl ) ;
window.top.close() ;
window.top.opener.focus() ;
}
}
这样就没有问题了。
文章来源:http://www.cnblogs.com/Wang-Seraph/archive/2007/04/09/705447.html
相关文章推荐
- 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进
- 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进
- 对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进
- HTML and CSS(二)——编辑器和浏览器的选择,显示已知文件扩展名
- 在Android浏览器中通过WebView调用相机拍照/选择文件 上传到服务器
- [*Linux*] - 搭建vsftpd服务器访问无法正常显示目录(创建 删除文件)
- 在localhost测试的jsp页面显示正常的,放到服务器上去字体就变大了,同一款浏览器测试的.
- 如何打开文件对话框并将选择的文件显示在编辑框中?
- 在二级目录和顶级域名下使FCKeditor编辑器图片显示正常
- asp在本地正常,在服务器上报无法识别的属性“targetFramework”,我改了版本显示文件不存在404,从微软官网下载.net包就正常了
- C#按键打开文件选择对话框,并把选择好的路径保存/显示到textBox
- 在MFC中使用按下按钮出现选择文件对话框,选中一个指定文件,并将其地址显示到指定的编辑框中
- 有些MP4文件在浏览器无法正常显示
- cocos2d-x 解决win32下 从文件对话框选择文件,显示在游戏中乱码的问题
- 解决Tomcat服务器下载 xls、rar等文件时浏览器直接打开而没弹出另存为对话框
- 关于对微软MSDN扩展图片弹出对话框的改进(可以正常比例显示图片缩略图)
- VBS 显示“选择文件或文件夹”对话框的代码
- 将txt文档中内容导入到数据库,并且显示一个对话框,提示用户选择文件的位置
- 解决FCKEditor编辑器在浏览器返回时显示html源代码的问题
- 窗体显示/编码设置/开机启动/文件选择与复制/对话框等