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

本博客系个人收集材料及学习记录之用,各类“大侠”勿扰!

留言簿(14)

随笔分类

收藏夹

My Favorite Web Sites

名Bloger

非著名Bloger

搜索

  •  

积分与排名

  • 积分 - 197496
  • 排名 - 289

最新评论

问题描述:
         在添加图片或者音频视频的时候,如果需要一个资源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 阅读(1586) 评论(1)  编辑  收藏 所属分类: JavaEE

FeedBack:
# re: FckEditor编辑器添加对话框的内容 2008-09-25 08:21 放水老倌
唐,最近在做这方面的项目?  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: