[svn r13219] add the flv support in fck editor (plugin video)

skala
Eric Marguin 19 years ago
parent dd83a780c1
commit ccbdd4c02c
  1. 13
      main/document/edit_document.php
  2. 10
      main/inc/lib/fckeditor/editor/css/fck_internal.css
  3. BIN
      main/inc/lib/fckeditor/editor/css/images/flv.gif
  4. 2
      main/inc/lib/fckeditor/editor/filemanager/upload/php/config.php
  5. 160
      main/inc/lib/fckeditor/editor/plugins/Video/fck_video.js
  6. BIN
      main/inc/lib/flv_player/player_flv_mini.swf
  7. BIN
      main/inc/lib/flv_player/src.zip

@ -1,4 +1,4 @@
<?php // $Id: edit_document.php 13091 2007-09-19 14:25:42Z elixir_julian $
<?php // $Id: edit_document.php 13219 2007-09-24 13:41:13Z elixir_inter $
/*
==============================================================================
Dokeos - elearning and course management software
@ -368,11 +368,22 @@ if($is_allowedToEdit)
$texte = text_filter($texte);
//echo('file path: '.$filepath.$filename.'.'.$extension);
//if flv player, change absolute paht temporarely to prevent from erasing it in the following lines
$texte = str_replace('flv=h','flv=h|',$texte);
$texte = str_replace('flv=/','flv=/|',$texte);
$path_to_remove=api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir;
$texte=str_replace($path_to_remove,'./',$texte);
$texte=str_replace('mp3player.swf?son='.urlencode($path_to_remove),'mp3player.swf?son=.%2F',$texte);
// for flv player : change back the url to absolute
$texte = str_replace('flv=h|','flv=h',$texte);
$texte = str_replace('flv=/|','flv=/',$texte);
//echo('texte: '.$texte);
//echo (fputs($fp,$texte))?'FPUTS OK':'FPUTS NIET OK';

@ -88,6 +88,16 @@ input[type="hidden"]:after
background-repeat: no-repeat;
width: 80px;
height: 80px;
}
.FCK__Video_flv
{
border: darkgray 1px solid;
background-position: center center;
background-image: url(images/flv.gif);
background-repeat: no-repeat;
width: 320px;
height: 240px;
}
.FCK__MP3

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

@ -38,7 +38,7 @@ $Config['DeniedExtensions']['Flash'] = array() ;
$Config['AllowedExtensions']['MP3'] = array('mp3') ;
$Config['DeniedExtensions']['MP3'] = array() ;
$Config['AllowedExtensions']['Video'] = array('avi','mpg','mpeg','mov','wmv','rm') ;
$Config['AllowedExtensions']['Video'] = array('avi','mpg','mpeg','mov','wmv','rm','flv') ;
$Config['DeniedExtensions']['Video'] = array() ;
?>

@ -2,11 +2,15 @@ var oEditor = window.parent.InnerDialogLoaded() ;
var FCK = oEditor.FCK ;
var FCKLang = oEditor.FCKLang ;
var FCKConfig = oEditor.FCKConfig ;
var flv_url = "";
// Set the dialog tabs.
window.parent.AddTab( 'Upload', FCKLang.DlgVideoUpload ) ;
window.parent.AddTab( 'Info', FCKLang.DlgVideoTab ) ;
var oMedia = null;
// Function called when a dialog tag is selected.
function OnDialogTabChange( tabCode )
{
@ -79,25 +83,56 @@ function Ok()
return false ;
}
if ( !oEmbed )
{
oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ;
oFakeImage = null ;
}
UpdateEmbed( oEmbed ) ;
if ( !oFakeImage )
// check if it's a flv file
tmp_url = GetE('txtUrl').value;
extension = tmp_url.substring(tmp_url.indexOf('.')+1);
if(extension == 'flv')
flvplayer = true;
else
flvplayer = false;
if(flvplayer == true)
{
oFakeImage = oEditor.FCKDocumentProcessors_CreateFakeImage( 'FCK__Video', oEmbed ) ;
oFakeImage.setAttribute( '_fckVideo', 'true', 0 ) ;
oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ;
var e = (oMedia || new Media()) ;
updateMovie(e);
FCK.InsertHtml(e.getOuterHTML()) ;
if ( !oFakeImage )
{
oFakeImage = oEditor.FCKDocumentProcessors_CreateFakeImage( 'FCK__Video_flv', oEmbed ) ;
oFakeImage.setAttribute( '_fckVideo', 'true', 0 ) ;
oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ;
}
else
oEditor.FCKUndo.SaveUndoStep() ;
}
else
oEditor.FCKUndo.SaveUndoStep() ;
{
if ( !oFakeImage )
{
oFakeImage = oEditor.FCKDocumentProcessors_CreateFakeImage( 'FCK__Video', oEmbed ) ;
oFakeImage.setAttribute( '_fckVideo', 'true', 0 ) ;
oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ;
}
else
oEditor.FCKUndo.SaveUndoStep() ;
UpdateEmbed( oEmbed ) ;
}
oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ;
oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ;
return true ;
}
@ -171,6 +206,7 @@ function SetUrl( url, width, height )
UpdatePreview() ;
//window.parent.SetSelectedTab( 'Info' ) ;
Ok();
window.parent.close();
@ -223,6 +259,8 @@ function CheckUpload()
return false ;
}
alert("ici "+oUploadAllowedExtRegex.test( sFile ));
if ( ( FCKConfig.VideoUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
( FCKConfig.VideoUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
{
@ -237,3 +275,109 @@ function OnSizeChanged( dimension, value )
{
UpdatePreview() ;
}
function updateMovie(e){
e.url = GetE('txtUrl').value;
}
function getObjData(txtUrl){ // to create data attribute for object
var url=txtUrl;
var configBasePath = FCKConfig.BasePath;
var cor_indx=configBasePath.indexOf("inc/")+4;
var objdata = configBasePath.substring(0, cor_indx)+"lib/flv_player/player_flv_mini.swf";
setVideoUrl(GetE('txtUrl').value);
return objdata;
}
function setVideoUrl(url){
flv_url=url;
}
function getVideoUrl(){
return flv_url;
}
var Media = function (o){
this.url = '';
this.width = '';
this.height = '';
if (o)
this.setObjectElement(o);
};
/**
* Toma los datos de un elemento.
*/
Media.prototype.setObjectElement = function (e){
if (!e) return ;
this.width = GetAttribute( e, 'width', this.width );
this.height = GetAttribute( e, 'height', this.height );
this.url = GetAttribute( e, 'data', this.url );
// params
for (var i=0;i<e.childNodes.length;i++){
if (e.childNodes[i].tagName == 'PARAM'){
var paramName = GetAttribute(e.childNodes[i], 'name', '').toLowerCase();
var paramValue = GetAttribute(e.childNodes[i], 'value', '');
switch (paramName){
case 'movie':
this.url = paramValue;
break;
case 'quality':
this.quality = paramValue;
break;
case 'scale':
this.scale = paramValue;
break;
case 'bgcolor':
this.bgcolor = paramValue;
break;
case 'loop':
this.loop = paramValue;
break;
case 'play':
this.play = paramValue;
break;
}
}
}
};
/**
* Devuelve el codigo HTML externo del elemento
*/
Media.prototype.getOuterHTML = function (objectId){
var s;
s= this.getInnerHTML(objectId);
return s;
};
/**
* Devuelve el codigo HTML interno del elemento
*/
Media.prototype.getInnerHTML = function (objectId){
var s = '<object type="application/x-shockwave-flash" data="'+getObjData(this.url)+'" height="240" width="320">\r\n<param name="movie" value="'+getObjData(this.url)+'">\r\n\t<param name="FlashVars" value="flv='+getVideoUrl()+'">\r\n</object>\r\n';
//var s = 'D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="test" ALIGN=""><PARAM NAME=movie VALUE="'+getObjData(this.url)+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF><PARAM NAME="FlashVars" value="flv='+getVideoUrl()+'" /> <EMBED src="'+getObjData(this.url)+'" quality=high bgcolor=#FFFFFF NAME="Streaming" ALIGN=""TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
return s;
};
Media.prototype.createAttribute = function(n,v){
return ' '+n+'="'+v+'" ';
}

Binary file not shown.
Loading…
Cancel
Save