Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
          用過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() ;    
              }
          }
          posted on 2008-04-10 22:53 seal 閱讀(388) 評論(0)  編輯  收藏 所屬分類: webJavascript
          主站蜘蛛池模板: 外汇| 文成县| 唐山市| 南安市| 新昌县| 沧州市| 张家港市| 旬阳县| 东山县| 浦城县| 光泽县| 金川县| 澳门| 和硕县| 蕲春县| 德江县| 衡阳市| 泰安市| 睢宁县| 两当县| 庄河市| 阳城县| 麻阳| 石景山区| 安龙县| 鄂托克前旗| 邵武市| 和政县| 文安县| 炉霍县| 阳曲县| 惠来县| 西城区| 平邑县| 盐亭县| 乐至县| 大厂| 朝阳区| 尚志市| 奉化市| 敖汉旗|