隨筆 - 251  文章 - 504  trackbacks - 0
          <2008年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          本博客系個人收集材料及學習記錄之用,各類“大俠”勿擾!

          留言簿(14)

          隨筆分類

          收藏夾

          My Favorite Web Sites

          名Bloger

          非著名Bloger

          搜索

          •  

          積分與排名

          • 積分 - 202332
          • 排名 - 285

          最新評論

          問題描述:
                   在添加圖片或者音頻視頻的時候,如果需要一個資源title字段來表示該資源的標題內容,并需要控制這個必填項,如果該項輸入為空就不能完成整個內容的添加。

          首先,需要在圖片或資源輸入對話框里添加一個字段resourceTitle輸入框,(我們以音頻視頻為例)在editor\dialog下的fck_flash.html添加以下內容:
          <TR>
                                          
          <TD nowrap>
                                              
          <span fckLang="DlgResourceTitle">resourcetitle</span><br>
                                              
          <input id="resourceTitle" type="text" size="33">
                                          
          </TD>
                                          
          <TD>&nbsp;</TD>
                                      
          </TR>
          其中,DlgResouceTitle在\editor\lang下的zh-cn.js文件中定義,如:DlgResourceTitle : "資源標題"。


          這樣對話框中就可以多出一條“資源標題”的輸入框,要對其進行判斷和控制需要修改editor\dialog\fck_flash下的fck_flash.js文件,如:1)在
          1function LoadSelection()
          2{
          3    if ( ! oEmbed ) return ;
          4
          5    GetE('txtUrl').value    = GetAttribute( oEmbed, 'src', '' ) ;
          6    GetE('txtWidth').value  = GetAttribute( oEmbed, 'width', '' ) ;
          7    GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ;
          8    GetE('resourceTitle').value = GetAttribute( oEmbed, 'resourcetitle', '' ) ;
          中添加8行那段代碼;2)然后在function Ok()方法中,添加:
          1if ( GetE('resourceTitle').value.length == 0 )
          2    {
          3        dialog.SetSelectedTab( 'Info' ) ;
          4        GetE('resourceTitle').focus() ;
          5
          6        alert( oEditor.FCKLang.DlgAlertFlashTitle ) ;
          7
          8        return false ;
          9    }
          這個方法中的DlgAlerFlashTitle同樣是在\editor\lang下的zh-cn.js文件中定義,文字內容就是彈出的警告信息的內容。
          DlgAlertFlashTitle    : "請輸入資源標題",

          3)為了在修改參數時能顯示“資源標題”的內容,需要在UpdateEmbed( e )方法中:
           1if(FlashPlayer(GetE('txtUrl').value)!=null){
           2
           3SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
           4
           5SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ;
           6
           7}
           8
           9
          10    SetAttribute( e, 'src', GetE('txtUrl').value ) ;
          11    SetAttribute( e, "resourcetitle" , GetE('resourceTitle').value ) ;
          12    SetAttribute( e, "width" , GetE('txtWidth').value ) ;
          13    SetAttribute( e, "height", GetE('txtHeight').value ) ;
          14
          15    // Advances Attributes

          添加11行代碼。

          圖片輸入對話框的方法大致一樣,就不做多解釋。
          posted on 2008-09-24 14:56 matthew 閱讀(1606) 評論(1)  編輯  收藏 所屬分類: JavaEE

          FeedBack:
          # re: FckEditor編輯器添加對話框的內容 2008-09-25 08:21 放水老倌
          唐,最近在做這方面的項目?  回復  更多評論
            
          主站蜘蛛池模板: 静宁县| 个旧市| 阿图什市| 碌曲县| 香格里拉县| 新郑市| 丹江口市| 无锡市| 阿荣旗| 济源市| 松溪县| 天台县| 绥滨县| 大宁县| 白银市| 临武县| 临沭县| 嘉黎县| 汕头市| 阿尔山市| 宿迁市| 甘泉县| 新沂市| 临洮县| 兴隆县| 垦利县| 江北区| 房产| 佳木斯市| 英德市| 溆浦县| 赤水市| 安康市| 泽普县| 怀来县| 华阴市| 内江市| 汕尾市| 桐庐县| 扎鲁特旗| 鄂托克前旗|