問題描述:
在添加圖片或者音頻視頻的時(shí)候,如果需要一個(gè)資源title字段來表示該資源的標(biāo)題內(nèi)容,并需要控制這個(gè)必填項(xiàng),如果該項(xiàng)輸入為空就不能完成整個(gè)內(nèi)容的添加。
首先,需要在圖片或資源輸入對(duì)話框里添加一個(gè)字段resourceTitle輸入框,(我們以音頻視頻為例)在editor\dialog下的fck_flash.html添加以下內(nèi)容:
<TR>
<TD nowrap>
<span fckLang="DlgResourceTitle">resourcetitle</span><br>
<input id="resourceTitle" type="text" size="33">
</TD>
<TD> </TD>
</TR>
其中,DlgResouceTitle在\editor\lang下的zh-cn.js文件中定義,如:DlgResourceTitle : "資源標(biāo)題"。
這樣對(duì)話框中就可以多出一條“資源標(biāo)題”的輸入框,要對(duì)其進(jìn)行判斷和控制需要修改editor\dialog\fck_flash下的fck_flash.js文件,如:1)在
1
function 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()方法中,添加:
1
if ( 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
}
這個(gè)方法中的DlgAlerFlashTitle同樣是在\editor\lang下的zh-cn.js文件中定義,文字內(nèi)容就是彈出的警告信息的內(nèi)容。
DlgAlertFlashTitle : "請(qǐng)輸入資源標(biāo)題",
3)為了在修改參數(shù)時(shí)能顯示“資源標(biāo)題”的內(nèi)容,需要在UpdateEmbed( e )方法中:
1
if(FlashPlayer(GetE('txtUrl').value)!=null){
2
3
SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
4
5
SetAttribute( 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行代碼。
圖片輸入對(duì)話框的方法大致一樣,就不做多解釋。
posted on 2008-09-24 14:56
matthew 閱讀(1606)
評(píng)論(1) 編輯 收藏 所屬分類:
JavaEE