[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[转帖]如何在FCKeditor 2.6中添加插入视频和音频功能

上一篇:[备忘]fckeditor 2.6版的后台java的配置文档地址~~
下一篇:[备忘]word中的visio图,转pdf时,visio图中文字变方块的问题~~

添加日期:2014/3/7 17:44:10 快速返回   返回列表 阅读2362次
原文地址:
http://blog.lehu.shu.edu.cn/qiutian/A20112.html


FCKeditor 是现在用的最多的可视编辑器,乐乎也是使用了该编辑器,应大家的要求,添加了插入视频和音频的功能,因为2.6版的修改可能和其他版本不一样,所以我把修改的地方列举出来,格式我是看到网上有位同志的格式很好,照抄的,内容已经修改

修改前注意备份文件,以免造成不必要的麻烦。

一、分别打开:editor/js/fckeditorcode_ie.js和/editor/js/fckeditorcode_gecko.js

找到程序代码

||/\.swf($|#|\?)/i.test(A.src)


这段代码的主要用来判断后缀名,如果后缀名不是swf则返回,把它替换为:
 


||/\.swf($|#|\?)/i.test(A.src)||/\.mpg($|#|\?)/i.test(A.src)||/\.asf($|#|\?)/i.test(A.src)||/\.wma($|#|\?)/i.test(A.src)

||/\.wmv($|#|\?)/i.test(A.src)||/\.avi($|#|\?)/i.test(A.src)||/\.mov($|#|\?)/i.test(A.src)||/\.mp3($|#|\?)/i.test(A.src)

||/\.rmvb($|#|\?)/i.test(A.src)||/\.mid($|#|\?)/i.test(A.src)


实际上,用
||/\.(rmvb|mpg|asf|wmv|avi|mov|mid)($|#|\?)/i.test(A.src)
这种形式比较简单。
 
文件格式可以根据情况来修改,但是注意要和其他的几个地方吻合

二、打开/editor/dialog/fck_flash/fck_flash.js

1、增加程序代码,这段代码用来判断后缀名


function WinPlayer(url){
var r, re;
re = /.(avi|wmv|asf|wma|mid|mp3|mpg)$/i;
r = url.match(re);
return r;
}

function RealPlayer(url){
var r, re;
re = /.(.rm|.ra|.rmvb|ram)$/i;
r = url.match(re);
return r;
}

function QuickTime(url){
var r, re;
re = /.(mov|qt)$/i;
r = url.match(re);
return r;
}

function FlashPlayer(url){
var r, re;
re = /.swf$/i;
r = url.match(re);
return r;
}




2、替换程序代码,这段代码是在UpdatePreview中用来添加type属性
 

SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ;





if(WinPlayer(GetE('txtUrl').value)!=null){ 
SetAttribute( e, 'type', 'application/x-mplayer2' ) ; 

if(RealPlayer(GetE('txtUrl').value)!=null){ 
SetAttribute( e, 'type', 'audio/x-pn-realaudio-plugin' ) ; 

if(QuickTime(GetE('txtUrl').value)!=null){ 
SetAttribute( e, 'type', 'application/video/quicktime' ) ; 

if(FlashPlayer(GetE('txtUrl').value)!=null){ 
SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; 
SetAttribute( e, 'pluginspage', 'http://www.macromedia.com/go/getflashplayer' ) ; 
}



3、替换程序代码,这段代码是在UpdateEmbed中用来添加type属性
 


SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ;




if(WinPlayer(GetE('txtUrl').value)!=null){
SetAttribute( e, 'type' , 'application/x-mplayer2' ) ; 
SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
}
if(RealPlayer(GetE('txtUrl').value)!=null){
SetAttribute( e, 'type' , 'audio/x-pn-realaudio-plugin' ) ; 
SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
}
if(QuickTime(GetE('txtUrl').value)!=null){
SetAttribute( e, 'type' , 'video/quicktime' ) ; 
SetAttribute( e, 'autostart', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ;
}
if(FlashPlayer(GetE('txtUrl').value)!=null){
SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ;
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ;
}



三、打开/fckconfig.js,该文件为配置文件

替换程序代码,这个是在上传文件的时候检查后缀名

FCKConfig.FlashUploadAllowedExtensions = ".(swf)$" ; // empty for all





FCKConfig.FlashUploadAllowedExtensions = ".(swf|fla|mpg|asf|wma|wmv|avi|mov|mp3|rmvb|mid)$" ; // empty for all



三、打开/editor/lang/zh-cn.js 文件,该部分为语言文件,"Flash"替换掉就可以了

 
然后整体修改完成,现在已经支持上传视频和音频文件,不过注意的是,如果视频文件太大,还是可能出现不能播放的情况

参考地址:http://www.wilf.cn/post/550.html
---------------------------------------------
fck的参数设置说明:
http://java.fckeditor.net/properties.html

原文还差一步:

还需要在java后台端的fckeditor.properties文件里加上:

connector.resourceType.flash.extensions.allowed=swf|fla|mpg|asf|wma|wmv|avi|mov|mp3|rmvb|mid

否则后台会检查后缀,不让上传文件。
------------------------------------------------
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved