Index: lams_central/web/fckeditor/editor/plugins/movieplayer/LICENSE.TXT =================================================================== diff -u --- lams_central/web/fckeditor/editor/plugins/movieplayer/LICENSE.TXT (revision 0) +++ lams_central/web/fckeditor/editor/plugins/movieplayer/LICENSE.TXT (revision 7e5b11955f75a4d27da79691a214f87cf07a923c) @@ -0,0 +1,25 @@ +FLV Player +------------------------------- +HomePage: [http://flv-player.net/] +License in page: [http://flv-player.net/players/normal/license/] + The player is under the Creative Commons BY SA and MPL 1.1 license. + You can use the player without citing the author. +Files: player_flv_maxi.swf + + +MP3 Player +------------------------------ +HomePage: [http://flash-mp3-player.net/] +License in page: [http://flash-mp3-player.net/players/maxi/license/] + The player is under the Creative Commons BY SA and MPL 1.1 license. + You can use the player without citing the author. +Files: player_mp3_maxi.swf + +ICON +------------------------------- +HomePage: [http://commons.wikimedia.org/wiki/File:Filmreel.png] +License in page: [http://commons.wikimedia.org/wiki/File:Filmreel.png] + I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide. + In case this is not legally possible: + I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. +Files: filmreel.png, filmreel.gif \ No newline at end of file Index: lams_central/web/fckeditor/editor/plugins/movieplayer/fckplugin.js =================================================================== diff -u --- lams_central/web/fckeditor/editor/plugins/movieplayer/fckplugin.js (revision 0) +++ lams_central/web/fckeditor/editor/plugins/movieplayer/fckplugin.js (revision 7e5b11955f75a4d27da79691a214f87cf07a923c) @@ -0,0 +1,18 @@ +/* + * FCKPlugin.js for Movie Player + * ------------ + */ + +// Register the related commands. +FCKCommands.RegisterCommand( + 'MoviePlayer', new FCKDialogCommand('MoviePlayer', FCKLang.DlgMoviePlayerTitle, FCKConfig.PluginsPath + 'movieplayer/movieplayer.html', 450, 260) ); + +// Create the toolbar button. +var oMoviePlayerItem = new FCKToolbarButton( + 'MoviePlayer', + FCKLang['MoviePlayerBtn'], + FCKLang['MoviePlayerTooltip'], + null, + false, true); +oMoviePlayerItem.IconPath = FCKConfig.PluginsPath + 'movieplayer/filmreel.gif'; +FCKToolbarItems.RegisterItem('MoviePlayer', oMoviePlayerItem); Index: lams_central/web/fckeditor/editor/plugins/movieplayer/filmreel.gif =================================================================== diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/movieplayer/filmreel.png =================================================================== diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/movieplayer/lang/en.js =================================================================== diff -u --- lams_central/web/fckeditor/editor/plugins/movieplayer/lang/en.js (revision 0) +++ lams_central/web/fckeditor/editor/plugins/movieplayer/lang/en.js (revision 7e5b11955f75a4d27da79691a214f87cf07a923c) @@ -0,0 +1,14 @@ +// Toolbar button +FCKLang['MoviePlayerBtn'] = 'Media Player'; +FCKLang['MoviePlayerTooltip'] = 'Insert/Edit Movies or Audio'; + +// Dialog +FCKLang['DlgMoviePlayerTitle'] = 'Media Player Properties'; +FCKLang['MoviePlayerURL'] = 'URL:'; +FCKLang['MoviePlayerURLDesc'] = 'Select a .mp3, .flv, .wma, .avi, .mov, .mp4 or .mpv file'; +FCKLang['MoviePlayerWidth'] = 'Width:'; +FCKLang['MoviePlayerHeight'] = 'Height:'; +FCKLang['MoviePlayerAutoplay'] = 'Auto Play:'; + +// Dialog errors +FCKLang['MoviePlayerNoUrl'] = 'Please specify a movie URL.' Index: lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.html =================================================================== diff -u --- lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.html (revision 0) +++ lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.html (revision 7e5b11955f75a4d27da79691a214f87cf07a923c) @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
+ URL: +
+ +
+ Select a .mp3, .flv, .wma, .avi, .mov, .mp4 or .mpv file +
+ + +
+ + + + + + + + + + + + + +
Width:
Height:
Auto Play:
+ + + Index: lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.js =================================================================== diff -u --- lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.js (revision 0) +++ lams_central/web/fckeditor/editor/plugins/movieplayer/movieplayer.js (revision 7e5b11955f75a4d27da79691a214f87cf07a923c) @@ -0,0 +1,299 @@ +var oEditor = window.parent.InnerDialogLoaded(); +var FCK = oEditor.FCK; +var FCKLang = oEditor.FCKLang ; +var FCKConfig = oEditor.FCKConfig ; +var oMovie = null; +var isNew = true; +var flashPlayer = FCKConfig.PluginsPath + '/movieplayer/player_flv_maxi.swf'; +var mp3Player = FCKConfig.PluginsPath + '/movieplayer/player_mp3_maxi.swf'; + + + +/** Initial setup */ +window.onload = function() { + // Translate dialog box + oEditor.FCKLanguageManager.TranslatePage(document); + // Load selected movie + loadMovieSelection(); + // Show Ok button + window.parent.SetOkButton(true); +} + + +/** Movie object */ +var Movie = function (o){ + this.id = ''; + this.contentType = ''; + this.url = ''; + this.autoplay = '0'; + this.width = '320'; + this.height = '240'; + if(o) this.setObjectElement(o); +}; + + +/** Load FCKEditor selection */ +function loadMovieSelection() { + oMovie = new Movie(); + var oSel = FCK.Selection.GetSelectedElement(); + if(oSel != null) { + var oSelConv = FCK.GetRealElement(oSel); + if(oSelConv != null) { + oSel = oSelConv; + } + if (oSel.id != null && oSel.id.match(/^movie[0-9]*$/)) { + oMovie.setAttribute('id', oSel.id); + } + for ( var i = 0; i < oSel.childNodes.length; i++) { + if (oSel.childNodes[i].tagName == 'PARAM') { + var name = GetAttribute(oSel.childNodes[i], 'name'); + var value = GetAttribute(oSel.childNodes[i], 'value'); + if (name == 'FlashVars') { + // Flash video + var vars = value.split('&'); + for ( var fv = 0; fv < vars.length; fv++) { + var varsT = vars[fv].split('='); + name = varsT[0]; + value = varsT[1]; + if (name == 'flv') { + oMovie.setAttribute('url', value); + } else { + oMovie.setAttribute(name, value); + } + } + } else if (name == 'autostart' || name == 'autoplay') { + value = (value == 'true' || value == '1') ? 1 : 0; + oMovie.setAttribute('autoplay', value); + } else if (name == 'src' + || (name == 'movie' && !name.endsWith(flashPlayer))) { + oMovie.setAttribute('url', value); + } else { + // Other movie types + oMovie.setAttribute(name, value); + } + isNew = false; + } + } + } + + // Read current settings (existing movie) + GetE('txtUrl').value = oMovie.url; + if(!isNew) { + oMovie.contentType = getContentType(oMovie.url); + } + GetE('txtWidth').value = oMovie.width; + GetE('txtHeight').value = oMovie.height; + GetE('chkAutoplay').checked = oMovie.autoplay == '1'; + + // Show/Hide according to settings + ShowE('tdBrowse', FCKConfig.LinkBrowser); + return oMovie; +} + + +/** Browse/upload a file on server */ +function BrowseServer() { + if(!FCKConfig.MediaBrowserURL) { + FCKConfig.MediaBrowserURL = FCKConfig.ImageBrowserURL.replace(/(&|\?)Type=Image/i, "$1Type=Media"); + } + if(!FCKConfig.MediaBrowserWindowWidth) { + FCKConfig.MediaBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7; + } + if(!FCKConfig.MediaBrowserWindowWidth) { + FCKConfig.MediaBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7; + } + OpenFileBrowser( + FCKConfig.MediaBrowserURL, + FCKConfig.MediaBrowserWindowWidth, + FCKConfig.MediaBrowserWindowHeight); +} + + +/** Start processing */ +function Ok() { + if(GetE('txtUrl').value.length == 0) { + GetE('txtUrl').focus(); + window.parent.SetSelectedTab('Info'); + alert(FCKLang.MoviePlayerNoUrl) ; + return false ; + } + + oEditor.FCKUndo.SaveUndoStep(); + + var e = (oMovie || new Movie()) ; + updateMovieObject(e) ; + if(!isNew) { + if(!navigator.userAgent.contains('Safari')) { + FCK.Selection.Delete(); + } + FCK.InsertHtml(e.getInnerHTML()); + }else{ + FCK.InsertHtml(e.getInnerHTML()); + } + + return true; +} + + +/** Update Movie object from Form */ +function updateMovieObject(e){ + e.url = GetE('txtUrl').value; + e.contentType = getContentType(e.url); + e.width = (isNaN(GetE('txtWidth').value)) ? 0 : parseInt(GetE('txtWidth').value); + e.height = (isNaN(GetE('txtHeight').value)) ? 0 : parseInt(GetE('txtHeight').value); + e.autoplay = (GetE('chkAutoplay').checked) ? '1' : '0'; +} + + +/** Create Movie html */ +Movie.prototype.getInnerHTML = function (objectId){ + var rnd = Math.floor(Math.random()*1000001); + var s = ""; + + // html + if(this.contentType == "application/x-shockwave-flash") { + if(getExtension(this.url) == 'flv') { + // Flash video (FLV) + s += ''; + s += ' '; + s += ' '; + s += ' '; + s += ''; + + }else{ + // Fix youtube url + if(this.url.contains('youtube.com/')) { + this.url = this.url.replace(/youtube\.com\/watch\?v=/i, "youtube.com/v/"); + } + + // Flash object (SWF) + s += ''; + s += ' '; + s += ' '; + s += ''; + } + + }else if (this.contentType == "audio/mpeg") { + // We use the flash mp3 player + s += ''; + s += ' '; + s += ''; + + + }else { + // Other video types + var pluginspace, codebase, classid; + if(this.contentType == "video/quicktime" || this.contentType == "video/mp4" || this.contentType == "video/mpeg") { + // QUICKTIME + this.autoplay = (this.autoplay == 'true' || this.autoplay == '1') ? 'true' : 'false'; + s += ''; + s += ' '; + s += ' '; + s += ' '; + s += ' '; + s += ' '; + s += ' '; + s += ''; + + }else{ + // WINDOWS MEDIA & OTHERS + this.autoplay = (this.autoplay == 'true' || this.autoplay == '1') ? 'true' : 'false'; + s += ''; + s += ''; + s += ''; + s += ''; + s += ''; + s += ''; + s += ' '; + s += ''; + + } + + } + + return s; +} + + +/** Set movie attribute */ +Movie.prototype.setAttribute = function(attr, val) { + if (val=="true") { + this[attr]=true; + } else if (val=="false") { + this[attr]=false; + } else { + this[attr]=val; + } +}; + +/** Get the file extension */ +function getExtension(url) { + var ext = url.match(/\.(avi|asf|fla|flv|mov|mp3|mp4|m4v|mpg|mpeg|mpv|qt|swf|wma|wmv)$/i); + if(ext != null && ext.length && ext.length > 0) { + ext = ext[1]; + }else{ + if(url.contains('youtube.com/')) { + ext = 'swf'; + }else{ + ext = ''; + } + } + return ext; +} + +/** Configure content type basing on provided url */ +function getContentType(url) { + var ext = getExtension(url); + var contentType = + (ext=="mpg"||ext=="mpeg"||ext=="mpv") ? "video/mpeg": + (ext=="mp4") ? "video/mp4": + (ext=="m4v") ? "video/mp4": + (ext=="mp3") ? "audio/mpeg": + (ext=="flv"||ext=="fla"||ext=="swf") ? "application/x-shockwave-flash": + (ext=="wmv"||ext=="wm" ||ext=="avi") ? "video/x-ms-wmv": + (ext=="asf") ? "video/x-ms-asf": + (ext=="wma") ? "audio/x-ms-wma": + (ext=="mov"||ext=="qt") ? "video/quicktime" : "video/x-ms-wmv"; + return contentType; +} + +Movie.prototype.setObjectElement = function (e){ + if (!e) return ; + this.width = GetAttribute( e, 'width', this.width ); + this.height = GetAttribute( e, 'height', this.height ); +}; + +String.prototype.endsWith = function(str) +{return (this.match(str+"$")==str)} + +String.prototype.contains = function(str) +{return (this.match(str)==str)} + +/** Set selected URL from Browser */ +function SetUrl(url) { + GetE('txtUrl').value = url; +} + Index: lams_central/web/fckeditor/editor/plugins/movieplayer/player_flv_maxi.swf =================================================================== diff -u Binary files differ Index: lams_central/web/fckeditor/editor/plugins/movieplayer/player_mp3_maxi.swf =================================================================== diff -u Binary files differ