CKEDITOR.plugins.add( 'flashs',{
init: function( editor )
{
editor.addCommand( 'flashsDialog', new CKEDITOR.dialogCommand( 'flashsDialog' ) );
editor.ui.addButton( 'flashs',
{
label: 'إدراج فلاش',
command: 'flashsDialog',
icon: this.path + 'flashs.png'
} );
CKEDITOR.dialog.add( 'flashsDialog', function( editor )
{
return {
title : 'إدراج فـلاش',
minWidth : 400,
minHeight : 250,
contents :
[
{
id : 'general',
label : 'Settings',
elements :
[
{
type : 'text',
id : 'contents',
label : 'الرابط',
validate : CKEDITOR.dialog.validate.notEmpty( 'رابط الفلاش مطلوب' ),
required : true,
commit : function( data )
{
data.contents = this.getValue();
}
},
{
type : 'html',
html : '<center><div style="text-align:center; background-color:#F3F3F3; font:normal 11px Tahoma; border:1px silver solid; height:15px; width:150px; line-height:15px; color:gray"> الامتدادت المسموحة : <font style="color:red; font:normal 11px Tahoma;">SWF</font> </div></center>'
},
{
type : 'hbox',
widths : [ '50%', '50%' ],
children :
[
{
type : 'text',
id : 'hei',
label : 'الارتفاع',
validate : CKEDITOR.dialog.validate.notEmpty( 'فضلا ضع ارتفاع للفلاش' ),
required : true,
style: 'width : 100px;',
labelLayout: 'vertical',
commit : function( data )
{
data.hei = this.getValue();
}
},
{
type : 'text',
id : 'wid',
label : 'العرض',
validate : CKEDITOR.dialog.validate.notEmpty( 'فضلا ضع عرض الفلاش' ),
required : true,
style: 'width : 100px;',
labelLayout: 'horzinal',
commit : function( data )
{
data.wid = this.getValue();
}
}
]
}
]
}
],
onOk : function()
{
var dialog = this,
data = {},
link = editor.document.createElement( 'span' );
this.commitContent( data );
editor.insertHtml('[swf="height=' + link.setHtml( data.hei ) + ' width=' + link.setHtml( data.wid ) + '"]' + link.setHtml( data.contents ) + '[/ swf]');
}
};
});
}
});