Chinaunix首页 | 论坛 | 博客
  • 博客访问: 619456
  • 博文数量: 98
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 1528
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-28 16:20
文章分类

全部博文(98)

文章存档

2011年(1)

2010年(11)

2009年(44)

2008年(42)

我的朋友

分类: Java

2008-04-02 13:22:18

对FckEditor编辑器在MAXTHON浏览器下选择服务器文件对话框显示不正常的改进 
 
 
 
 用过FckEditor的朋友都知道,它的选择图片对话框中“浏览服务器”按钮。点击该按钮可以浏览以前已经上传过的文件。不过这个按钮点击后弹出的对话框在MAXTHON浏览器下是以标签形式打开的,这样模态对话框就始终显示在了浏览文件窗口之前,要想选择文件得先关掉模态对话框。先前有朋友提出把弹出模态对话框的功能改为ShowModlessDialog,这个终究不是解决之道,现将我的解决方法写下来与大家分享:
思路就是基于IE内核的浏览器采用模态对话框弹出浏览服务器窗口,其他的仍然window.open不变1:修改\fckeditor\editor\dialog\common\fck_dialog_common.js

  function OpenFileBrowser( url, width, height )
 {
      // oEditor must be defined.
  
      var iLeft = ( oEditor.FCKConfig.ScreenWidth  - width ) / 2 ;
      var iTop  = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
  
      var sOptions = "toolbar=no,status=no,resizable=no,dependent=yes,scrollbars=yes" ;
      sOptions += ",width=" + width ;
     sOptions += ",height=" + height ;
     sOptions += ",left=" + iLeft ;
     sOptions += ",top=" + iTop ;
      // The "PreserveSessionOnFileBrowser" because the above code could be
     // blocked by popup blockers.
     if ( oEditor.FCKConfig.PreserveSessionOnFileBrowser && oEditor.FCKBrowserInfo.IsIE )
     {
         // The following change has been made otherwise IE will open the file
         // browser on a different server session (on some cases):
        // 
         // by Simone Chiaretta.
         var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
 
         if ( oWindow )
         {
             // Detect Yahoo popup blocker.

             try
             {
                 var sTest = oWindow.name ; // Yahoo returns "something", but we can't access it, so detect that and avoid strange errors for the user.
                 oWindow.opener = window ;
             }
             catch(e)
             {
                 alert( oEditor.FCKLang.BrowseServerBlocked ) ;
             }
         }
         else
             alert( oEditor.FCKLang.BrowseServerBlocked ) ;
     }
     else
     {    
            //这里是修改部分
         if(oEditor.FCKBrowserInfo.IsIE)
         {
             window.showModalDialog(url+"&rdm="+new Date(),window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px\"");
         }
         else
         {
             window.open( url, 'FCKBrowseWindow', sOptions ) ;
         }
     }
 }


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() ;    
    }
}
阅读(1120) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:hibernate 应用配置连接池

给主人留下些什么吧!~~