1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264 |
- // Reworks and improvements by Ivan Tcholakov, JUL-2009, FEB-2011.
- var dialog = window.parent ;
- var oEditor = dialog.InnerDialogLoaded() ;
- var FCK = oEditor.FCK ;
- var FCKLang = oEditor.FCKLang ;
- var FCKConfig = oEditor.FCKConfig ;
- var FCKTools = oEditor.FCKTools ;
- // Reading the Flash embedding method.
- if ( typeof FCKConfig[ 'FlashEmbeddingMethod' ] != 'string' )
- {
- FCKConfig[ 'FlashEmbeddingMethod' ] = 'embed' ;
- }
- if ( FCKConfig[ 'FlashEmbeddingMethod' ] != 'embed' &&
- FCKConfig[ 'FlashEmbeddingMethod' ] != 'object' &&
- FCKConfig[ 'FlashEmbeddingMethod' ] != 'adobe' &&
- FCKConfig[ 'FlashEmbeddingMethod' ] != 'swfobject' ) {
- FCKConfig[ 'FlashEmbeddingMethod' ] = 'embed' ;
- }
- // Set the language direction.
- window.document.dir = FCKLang.Dir ;
- // We have to avoid javascript errors if some language variables have not been defined.
- FCKLang['UploadSelectFileFirst'] = FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
- FCKLang['FileSuccessfullyUploaded'] = FCKLang['FileSuccessfullyUploaded'] ? FCKLang['FileSuccessfullyUploaded'] : 'Your file has been successfully uploaded.' ;
- FCKLang['FileRenamed'] = FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
- FCKLang['InvalidFileType'] = FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
- FCKLang['SecurityError'] = FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
- FCKLang['ConnectorDisabled'] = FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
- FCKLang['UploadError'] = FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
- // Dialog Tabs
- // Set the dialog tabs.
- dialog.AddTab( 'Info', FCKLang.DlgInfoTab ) ;
- dialog.AddTab( 'Preview', FCKLang.DlgImgPreview ) ;
- if ( FCKConfig.MediaUpload )
- {
- dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
- }
- // This function is called when a dialog tab has been selected.
- function OnDialogTabChange( tabCode )
- {
- ShowE( 'divInfo', ( tabCode == 'Info' ) ) ;
- ShowE( 'divPreview', ( tabCode == 'Preview' ) ) ;
- ShowE( 'divUpload', ( tabCode == 'Upload' ) ) ;
- if ( tabCode == 'Preview' )
- {
- UpdatePreview() ;
- }
- else
- {
- ClearPreview() ;
- }
- }
- function OnDialogModeChange( mode )
- {
- if ( mode == 'single')
- {
- btnBrowse.disabled = false ;
- btnImgBrowse.disabled = false ;
- btnLnkBrowse.disabled = true ;
- txtURL.disabled = false ;
- txtImgURL.disabled = false ;
- txtPlaylist.disabled = true ;
- txtPlaylist.value = '' ;
- txtURL.style.background = '#ffffff' ;
- txtImgURL.style.background = '#ffffff' ;
- txtPlaylist.style.background = 'transparent' ;
- selDispPlaylist.disabled = true ;
- }
- else
- {
- btnBrowse.disabled = true ;
- btnImgBrowse.disabled = true ;
- btnLnkBrowse.disabled = false ;
- txtURL.disabled = true ;
- txtImgURL.disabled = true ;
- txtPlaylist.disabled = false ;
- txtURL.value = '' ;
- txtImgURL.value = '' ;
- txtURL.style.background = 'transparent' ;
- txtImgURL.style.background = 'transparent' ;
- txtPlaylist.style.background = '#ffffff' ;
- selDispPlaylist.disabled = false ;
- }
- }
- var oMedia = null ;
- var is_new_flvplayer = true ;
- window.onload = function()
- {
- // Translate the dialog box texts.
- oEditor.FCKLanguageManager.TranslatePage(document) ;
- // Load the selected element information (if any).
- LoadSelection() ;
- // Show/Hide the "Browse Server" button.
- GetE('tdBrowse').style.display = FCKConfig.MediaBrowser ? '' : 'none' ;
- // Set the actual uploader URL.
- if ( FCKConfig.MediaUpload )
- GetE('frmUpload').action = FCKConfig.MediaUploadURL ;
- dialog.SetAutoSize( true ) ;
- // Activate the "OK" button.
- dialog.SetOkButton( true ) ;
- }
- function getSelectedMovie()
- {
- var oFakeImage = FCK.Selection.GetSelectedElement() ;
- var oSel = null ;
- oMedia = new Media() ;
- if ( oFakeImage )
- {
- if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute( '_fckvideo' ) )
- {
- oSel = FCK.GetRealElement( oFakeImage ) ;
- if ( oSel && oSel.id && oSel.id.match( /^player[0-9]*-parent$/ ) )
- {
- for ( var i = 0 ; i < oSel.childNodes.length ; i++ )
- {
- if ( oSel.childNodes.item(i).nodeName == "DIV" )
- {
- for ( var k = 0 ; k < oSel.childNodes.item(i).childNodes.length ; k++ )
- {
- if ( oSel.childNodes.item(i).childNodes.item(k).nodeName == "DIV" &&
- oSel.childNodes.item(i).childNodes.item(k).id &&
- oSel.childNodes.item(i).childNodes.item(k).id.match( /^player[0-9]*-config$/ ) )
- {
- var oC = oSel.childNodes.item(i).childNodes.item(k).innerHTML.split(' ') ;
- for ( var o = 0 ; o < oC.length ; o++ )
- {
- var tmp = oC[o].split( '=' ) ;
- oMedia.setAttribute( tmp[0], tmp[1] ) ;
- }
- is_new_flvplayer = false ;
- break ;
- }
- }
- }
- }
- }
- }
- }
- return oMedia ;
- }
- function updatePlaylistOption()
- {
- if ( GetE( 'selDispPlaylist' ).value == "right" || GetE( 'selDispPlaylist' ).value == "below" )
- {
- GetE( 'chkPLThumbs' ).disabled = false ;
- GetE( 'chkPLThumbs' ).checked = true ;
- GetE( 'txtPLDim' ).disabled = false ;
- GetE( 'txtPLDim' ).style.background = '#ffffff' ;
- GetE( 'spanDimText' ).style.display = 'none' ;
- if ( GetE( 'selDispPlaylist' ).value == "right" )
- {
- GetE( 'spanDimWText' ).style.display = '' ;
- GetE( 'spanDimHText' ).style.display = 'none' ;
- }
- else if ( GetE( 'selDispPlaylist' ).value == "below" )
- {
- GetE( 'spanDimWText' ).style.display = 'none' ;
- GetE( 'spanDimHText' ).style.display = '' ;
- }
- }
- else
- {
- GetE( 'chkPLThumbs' ).disabled = true ;
- GetE( 'chkPLThumbs' ).checked = false ;
- GetE( 'txtPLDim' ).value = "" ;
- GetE( 'txtPLDim' ).disabled = true ;
- GetE( 'txtPLDim' ).style.background = 'transparent' ;
- GetE( 'spanDimText' ).style.display = '' ;
- GetE( 'spanDimWText' ).style.display = 'none' ;
- GetE( 'spanDimHText' ).style.display = 'none' ;
- }
- }
- function LoadSelection()
- {
- oMedia = new Media() ;
- oMedia = getSelectedMovie() ;
- GetE( 'rbFileType' ).value = oMedia.fileType ;
- GetE( 'txtURL' ).value = oMedia.url ;
- GetE( 'txtPlaylist' ).value = oMedia.purl ;
- GetE( 'txtImgURL' ).value = oMedia.iurl ;
- GetE( 'txtWMURL' ).value = oMedia.wmurl ;
- GetE( 'txtWidth' ).value = oMedia.width.toString().length > 0 ? oMedia.width : 320 ;
- GetE( 'txtHeight' ).value = oMedia.height.toString().length > 0 ? oMedia.height : 240 ;
- GetE( 'chkLoop' ).checked = oMedia.loop ;
- GetE( 'chkAutoplay' ).checked = oMedia.play ;
- GetE( 'chkDownload' ).checked = oMedia.downloadable ;
- GetE( 'chkFullscreen' ).checked = oMedia.fullscreen ;
- GetE( 'txtBgColor' ).value = oMedia.bgcolor ;
- GetE( 'txtToolbarColor' ).value = oMedia.toolcolor ;
- GetE( 'txtToolbarTxtColor' ).value = oMedia.tooltcolor ;
- GetE( 'txtToolbarTxtRColor' ).value = oMedia.tooltrcolor ;
- GetE( 'chkShowNavigation' ).checked = oMedia.displayNavigation ;
- GetE( 'chkShowDigits' ).checked = oMedia.displayDigits ;
- GetE( 'selAlign' ).value = oMedia.align ;
- GetE( 'selDispPlaylist' ).value = oMedia.dispPlaylist ;
- GetE('txtRURL' ).value = oMedia.rurl ;
- GetE( 'txtPLDim' ).value = oMedia.playlistDim ;
- GetE( 'chkPLThumbs' ).checked = oMedia.playlistThumbs ;
- UpdatePreview() ;
- }
- // The OK button was hit.
- function Ok()
- {
- var rbFileTypeVal = "single" ;
- if ( !GetE( 'rbFileType' ).checked )
- {
- rbFileTypeVal = "list" ;
- }
- if ( rbFileTypeVal == "single" )
- {
- if ( GetE( 'txtURL' ).value.length == 0 )
- {
- GetE( 'txtURL' ).focus() ;
- alert( oEditor.FCKLang.DlgFLVPlayerAlertUrl ) ;
- return false ;
- }
- }
- if ( rbFileTypeVal == "list" )
- {
- if ( GetE( 'txtPlaylist' ).value.length == 0 )
- {
- GetE( 'txtPlaylist' ).focus() ;
- alert( oEditor.FCKLang.DlgFLVPlayerAlertPlaylist ) ;
- return false ;
- }
- }
- if ( GetE( 'txtWidth' ).value.length == 0 )
- {
- GetE( 'txtWidth' ).focus() ;
- alert( oEditor.FCKLang.DlgFLVPlayerAlertWidth ) ;
- return false ;
- }
- if ( GetE( 'txtHeight' ).value.length == 0 )
- {
- GetE( 'txtHeight' ).focus() ;
- alert( oEditor.FCKLang.DlgFLVPlayerAlertHeight ) ;
- return false ;
- }
- var e = ( oMedia || new Media() ) ;
- UpdateMovie( e ) ;
- // Replace or insert?
- if ( !is_new_flvplayer )
- {
- var oFakeImage = FCK.Selection.GetSelectedElement() ;
- var oSel = null ;
- oMedia = new Media() ;
- if ( oFakeImage )
- {
- if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute( '_fckvideo' ) )
- {
- oSel = FCK.GetRealElement( oFakeImage ) ;
- if ( oSel )
- {
- oSel = null ;
- FCK.InsertHtml( e.getInnerHTML() ) ;
- }
- }
- }
- }
- else
- {
- FCK.InsertHtml( e.getInnerHTML() ) ;
- }
- return true ;
- }
- function UpdateMovie( e )
- {
- e.fileType = GetE( 'rbFileType' ).value ;
- e.url = GetE( 'txtURL' ).value ;
- e.purl = GetE( 'txtPlaylist' ).value ;
- e.iurl = GetE( 'txtImgURL' ).value ;
- e.wmurl = GetE( 'txtWMURL' ).value ;
- e.bgcolor = GetE( 'txtBgColor' ).value ;
- e.toolcolor = GetE( 'txtToolbarColor' ).value ;
- e.tooltcolor = GetE( 'txtToolbarTxtColor' ).value ;
- e.tooltrcolor = GetE( 'txtToolbarTxtRColor' ).value ;
- e.width = ( isNaN( GetE( 'txtWidth' ).value ) ) ? 0 : parseInt( GetE( 'txtWidth' ).value ) ;
- e.height = ( isNaN( GetE( 'txtHeight' ).value ) ) ? 0 : parseInt( GetE( 'txtHeight' ).value ) ;
- e.loop = ( GetE( 'chkLoop' ).checked ) ? 'true' : 'false' ;
- e.play = ( GetE( 'chkAutoplay' ).checked ) ? 'true' : 'false' ;
- e.downloadable = ( GetE( 'chkDownload' ).checked ) ? 'true' : 'false' ;
- e.fullscreen = ( GetE( 'chkFullscreen' ).checked ) ? 'true' : 'false' ;
- e.displayNavigation = ( GetE( 'chkShowNavigation' ).checked ) ? 'true' : 'false' ;
- e.displayDigits = ( GetE( 'chkShowDigits' ).checked) ? 'true' : 'false' ;
- e.align = GetE( 'selAlign' ).value ;
- e.dispPlaylist = GetE( 'selDispPlaylist' ).value ;
- e.rurl = GetE( 'txtRURL' ).value ;
- e.playlistDim = GetE( 'txtPLDim' ).value ;
- e.playlistThumbs = ( GetE( 'chkPLThumbs' ).checked ) ? 'true' : 'false' ;
- }
- function BrowseServer()
- {
- OpenServerBrowser( 'flv', FCKConfig.MediaBrowserURL, FCKConfig.MediaBrowserWindowWidth, FCKConfig.MediaBrowserWindowHeight ) ;
- }
- function LnkBrowseServer()
- {
- OpenServerBrowser( 'link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
- }
- function Lnk2BrowseServer()
- {
- OpenServerBrowser( 'link2', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ;
- }
- function img1BrowseServer()
- {
- OpenServerBrowser( 'img1', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ;
- }
- function img2BrowseServer()
- {
- OpenServerBrowser( 'img2', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ;
- }
- function OpenServerBrowser( type, url, width, height )
- {
- sActualBrowser = type ;
- OpenFileBrowser( url, width, height ) ;
- }
- var sActualBrowser ;
- function SetUrl( url ) {
- url = FCK.GetSelectedUrl( url ) ;
-
- if ( sActualBrowser == 'flv' ) {
- GetE('txtURL').value = url ;
- GetE('txtWidth').value = 320 ;
- GetE('txtHeight').value = 240 ;
- }
- else if ( sActualBrowser == 'link' )
- {
- GetE('txtPlaylist').value = url ;
- }
- else if ( sActualBrowser == 'link2' )
- {
- GetE('txtRURL').value = url ;
- }
- else if ( sActualBrowser == 'img1' )
- {
- GetE('txtImgURL').value = url ;
- }
- else if ( sActualBrowser == 'img2' )
- {
- GetE('txtWMURL').value = url ;
- }
- UpdatePreview() ;
- dialog.SetSelectedTab( 'Info' ) ;
- }
- var Media = function ( o )
- {
- this.fileType = '' ;
- this.url = '' ;
- this.purl = '' ;
- this.iurl = '' ;
- this.wmurl = '' ;
- this.width = '' ;
- this.height = '' ;
- this.loop = '' ;
- this.play = '' ;
- this.downloadable = '' ;
- this.fullscreen = true ;
- this.bgcolor = '' ;
- this.toolcolor = '' ;
- this.tooltcolor = '' ;
- this.tooltrcolor = '' ;
- this.displayNavigation = true ;
- this.displayDigits = true ;
- this.align = '' ;
- this.dispPlaylist = '' ;
- this.rurl = '' ;
- this.playlistDim = '' ;
- this.playlistThumbs = '' ;
- if ( o )
- {
- this.setObjectElement( o ) ;
- }
- } ;
- Media.prototype.setObjectElement = function ( e )
- {
- if ( !e ) return ;
- this.width = GetAttribute( e, 'width', this.width ) ;
- this.height = GetAttribute( e, 'height', this.height ) ;
- } ;
- Media.prototype.setAttribute = function( attr, val )
- {
- if ( val == 'true' )
- {
- this[attr] = true ;
- }
- else if (val == 'false' )
- {
- this[attr] = false ;
- }
- else
- {
- this[attr] = val ;
- }
- } ;
- Media.prototype.getInnerHTML = function ( objectId )
- {
- var embeddingMethod = FCKConfig[ 'FlashEmbeddingMethod' ];
- var randomnumber = Math.floor( Math.random() * 1000001 ) ;
- var thisWidth = this.width ;
- var thisHeight = this.height ;
- var thisMediaType = 'single' ;
- if ( !GetE( 'rbFileType' ).checked )
- {
- thisMediaType = 'mpl' ;
- }
- // Alignment
- var cssalign = '' ;
- var cssfloat = '' ;
- if ( this.align == 'center' )
- {
- cssalign = 'margin-left: auto;margin-right: auto;' ;
- }
- else if ( this.align == 'right' )
- {
- cssfloat = 'float: right;' ;
- }
- else if ( this.align == 'left' )
- {
- cssfloat = 'float: left;' ;
- }
- var s = '' ;
- s += '\n' ;
- s += '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
- s += '<div style="border-style: none; height: ' + thisHeight + 'px; width: ' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); ' + cssalign + '">' ;
- if (embeddingMethod == 'swfobject')
- {
- s += '<script src="' + FCKConfig.ScriptSWFObject + '" type="text/javascript"></script>\n' ;
- }
- // NOTE: FOR LIST OF POSSIBLE SETTINGS GOTO http://www.jeroenwijering.com/extras/readme.html\n' ;
- // A hidden div containing setting, added width, height, overflow for MSIE7
- s += '<div id="player' + randomnumber + '-config" style="display: none; visibility: hidden; width: 0px; height: 0px; overflow: hidden;">' ;
- // Save settings.
- for ( var i in this )
- {
- if ( !i || !this[i] ) continue ;
- if ( !i.match( /(set|get)/ ) )
- {
- s += i + '=' + this[i] + ' ' ;
- }
- }
- s += '</div>' ;
- // The player's area.
- s += '<div id="player' + randomnumber + '">' ;
- if ( embeddingMethod == 'swfobject' )
- {
- s += '<a href="http://www.macromedia.com/go/getflashplayer" target="_blank">Get the Flash Player</a> to see this video.' ;
- }
- if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
- {
- var p = '' ; // Parameters.
- var v = '' ; // Variables.
- s += '<object id="' + thisMediaType + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" style="" width="' + thisWidth + '" height="' + thisHeight + '">' ;
- p += '<param name="movie" value="' + FCKConfig.FlashPlayerVideo + '" />' ;
- p += '<param name="quality" value="high" />' ;
- p += '<param name="allowfullscreen" value="' + this.fullscreen + '" />' ;
- v += 'width=' + thisWidth + '&' ;
- v += 'height=' + thisHeight + '&' ;
- v += 'autostart=' + this.play + '&' ;
- if ( thisMediaType == 'mpl' )
- {
- v += 'file=' + this.purl + '&' ;
- v += 'autoscroll=true&' ;
- p += 'allowscriptaccess="always" ' ;
- p += '<param name="allowscriptaccess" value="always" />' ;
- var dispWidth = thisWidth ;
- var dispHeight = thisHeight ;
- var dispThumbs = false ;
- if ( this.dispPlaylist != 'none' )
- {
- if ( this.dispPlaylist == 'right' )
- {
- if ( this.playlistDim.length > 0 )
- {
- dispWidth = thisWidth - this.playlistDim ;
- if ( this.playlistDim < 100 )
- {
- dispThumbs = false ;
- }
- else
- {
- dispThumbs = true ;
- }
- }
- else
- {
- if ( thisWidth >= 550 )
- {
- dispWidth = thisWidth - 200 ;
- dispThumbs = true ;
- }
- else if ( thisWidth >= 450 )
- {
- dispWidth = thisWidth - 100 ;
- dispThumbs = false ;
- }
- else if ( thisWidth >= 350 )
- {
- dispWidth = thisWidth - 50 ;
- dispThumbs = false ;
- }
- }
- v += 'displaywidth=' + dispWidth + '&' ;
- }
- else if ( this.dispPlaylist == 'below' )
- {
- dispThumbs = true ;
- if ( this.playlistDim.length > 0 )
- {
- dispHeight = thisWidth - this.playlistDim ;
- }
- else
- {
- if ( thisHeight >= 550 )
- {
- dispHeight = thisWidth - 200 ;
- }
- else if ( thisHeight >= 450 )
- {
- dispHeight = thisHeight - 150 ;
- }
- else if ( thisHeight >= 350 )
- {
- dispHeight = thisHeight - 100 ;
- }
- }
- v += 'displayheight=' + dispHeight + '&' ;
- }
- if ( this.playlistThumbs == 'false' )
- {
- dispThumbs = false ;
- }
- v += 'thumbsinplaylist=' + dispThumbs + '&' ;
- }
- v += 'shuffle=false&' ;
- if (this.loop)
- {
- v += 'repeat=list&' ;
- }
- else
- {
- v += 'repeat=' + this.loop + '&' ;
- }
- //v += 'transition=bgfade&' ;
- }
- else
- {
- v += 'file=' + this.url + '&' ;
- v += 'repeat=' + this.loop + '&' ;
- v += 'image=' + this.iurl + '&' ;
- }
- v += 'showdownload=' + this.downloadable + '&' ;
- v += 'link=' + this.url + '&' ;
- v += 'showdigits=' + this.displayDigits + '&' ;
- v += 'shownavigation=' + this.displayNavigation + '&' ;
- // SET THE COLOR OF THE TOOLBAR
- var colorChoice1 = this.toolcolor ;
- if ( colorChoice1.length > 0 )
- {
- colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
- v += 'backcolor=' + colorChoice1 + '&' ;
- }
- // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
- var colorChoice2 = this.tooltcolor ;
- if ( colorChoice2.length > 0 )
- {
- colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
- v += 'frontcolor=' + colorChoice2 + '&' ;
- }
- // SET COLOR OF ROLLOVER TEXT AND BUTTONS
- var colorChoice3 = this.tooltrcolor ;
- if ( colorChoice3.length > 0 )
- {
- colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
- v += 'lightcolor=' + colorChoice3 + '&' ;
- }
- // SET COLOR OF BACKGROUND
- var colorChoice4 = this.bgcolor ;
- if ( colorChoice4.length > 0 )
- {
- colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
- v += 'screencolor=' + colorChoice4 + '&' ;
- }
- v += 'logo=' + this.wmurl + '&' ;
- if ( this.rurl.length > 0 )
- {
- v += 'recommendations=' + this.rurl + '&' ;
- }
- s += p + '<param name="flashvars" value="' + v + '" />' ;
- }
- if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
- {
- var p = '' ; // Parameters (attributes).
- var v = '' ; // Variables.
- p += 'type="application/x-shockwave-flash" ' ;
- p += 'src="' + FCKConfig.FlashPlayerVideo + '" ' ;
- p += 'style="" ' ;
- p += 'id="' + thisMediaType + '" ' ;
- p += 'name="' + thisMediaType + '" ' ;
- p += 'quality="high" ' ;
- p += 'width="' + thisWidth + '" ' ;
- p += 'height="' + thisHeight + '" ' ;
- p += 'allowfullscreen="' + this.fullscreen + '" ' ;
- v += 'width=' + thisWidth + '&' ;
- v += 'height=' + thisHeight + '&' ;
- v += 'autostart=' + this.play + '&' ;
- if ( thisMediaType == 'mpl' )
- {
- v += 'file=' + this.purl + '&' ;
- v += 'autoscroll=true&' ;
- p += 'allowscriptaccess="always" ' ;
- var dispWidth = thisWidth ;
- var dispHeight = thisHeight ;
- var dispThumbs = false ;
- if ( this.dispPlaylist != 'none' )
- {
- if ( this.dispPlaylist == 'right' )
- {
- if ( this.playlistDim.length > 0 )
- {
- dispWidth = thisWidth - this.playlistDim ;
- if ( this.playlistDim < 100 )
- {
- dispThumbs = false ;
- }
- else
- {
- dispThumbs = true ;
- }
- }
- else
- {
- if ( thisWidth >= 550 )
- {
- dispWidth = thisWidth - 200 ;
- dispThumbs = true ;
- }
- else if ( thisWidth >= 450 )
- {
- dispWidth = thisWidth - 100 ;
- dispThumbs = false ;
- }
- else if ( thisWidth >= 350 )
- {
- dispWidth = thisWidth - 50 ;
- dispThumbs = false ;
- }
- }
- v += 'displaywidth=' + dispWidth + '&' ;
- }
- else if ( this.dispPlaylist == 'below' )
- {
- dispThumbs = true ;
- if ( this.playlistDim.length > 0 )
- {
- dispHeight = thisWidth - this.playlistDim ;
- }
- else
- {
- if ( thisHeight >= 550 )
- {
- dispHeight = thisWidth - 200 ;
- }
- else if ( thisHeight >= 450 )
- {
- dispHeight = thisHeight - 150 ;
- }
- else if ( thisHeight >= 350 )
- {
- dispHeight = thisHeight - 100 ;
- }
- }
- v += 'displayheight=' + dispHeight + '&' ;
- }
- if ( this.playlistThumbs == 'false' )
- {
- dispThumbs = false ;
- }
- v += 'thumbsinplaylist=' + dispThumbs + '&' ;
- }
- v += 'shuffle=false&' ;
- if (this.loop)
- {
- v += 'repeat=list&' ;
- }
- else
- {
- v += 'repeat=' + this.loop + '&' ;
- }
- //v += 'transition=bgfade&' ;
- }
- else
- {
- v += 'file=' + this.url + '&' ;
- v += 'repeat=' + this.loop + '&' ;
- v += 'image=' + this.iurl + '&' ;
- }
- v += 'showdownload=' + this.downloadable + '&' ;
- v += 'link=' + this.url + '&' ;
- v += 'showdigits=' + this.displayDigits + '&' ;
- v += 'shownavigation=' + this.displayNavigation + '&' ;
- // SET THE COLOR OF THE TOOLBAR
- var colorChoice1 = this.toolcolor ;
- if ( colorChoice1.length > 0 )
- {
- colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
- v += 'backcolor=' + colorChoice1 + '&' ;
- }
- // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
- var colorChoice2 = this.tooltcolor ;
- if ( colorChoice2.length > 0 )
- {
- colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
- v += 'frontcolor=' + colorChoice2 + '&' ;
- }
- // SET COLOR OF ROLLOVER TEXT AND BUTTONS
- var colorChoice3 = this.tooltrcolor ;
- if ( colorChoice3.length > 0 )
- {
- colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
- v += 'lightcolor=' + colorChoice3 + '&' ;
- }
- // SET COLOR OF BACKGROUND
- var colorChoice4 = this.bgcolor ;
- if ( colorChoice4.length > 0 )
- {
- colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
- v += 'screencolor=' + colorChoice4 + '&' ;
- }
- v += 'logo=' + this.wmurl + '&' ;
- if ( this.rurl.length > 0 )
- {
- v += 'recommendations=' + this.rurl + '&' ;
- }
- s += '<embed ' + p + 'flashvars="' + v + '" ></embed>' ;
- }
- if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
- {
- s += '</object>' ;
- }
- s += '</div>' ;
- // Generation of a javascript that implements the swfobject embedding method.
- if (embeddingMethod == 'swfobject')
- {
- s += '<script type="text/javascript">\n' ;
- s += ' var s1 = new SWFObject("' + FCKConfig.FlashPlayerVideo + '","' + thisMediaType + '","' + thisWidth + '","' + thisHeight + '","7");\n' ;
- s += ' s1.addVariable("width","' + thisWidth + '");\n' ;
- s += ' s1.addVariable("height","' + thisHeight + '");\n' ;
- s += ' s1.addVariable("autostart","' + this.play + '");\n' ;
- if ( thisMediaType == 'mpl' )
- {
- s += ' s1.addVariable("file","' + this.purl + '");\n' ;
- s += ' s1.addVariable("autoscroll","true");\n' ;
- s += ' s1.addParam("allowscriptaccess","always");\n' ;
- var dispWidth = thisWidth ;
- var dispHeight = thisHeight ;
- var dispThumbs = false ;
- if ( this.dispPlaylist != 'none' )
- {
- if ( this.dispPlaylist == 'right' )
- {
- if ( this.playlistDim.length > 0 )
- {
- dispWidth = thisWidth - this.playlistDim ;
- if ( this.playlistDim < 100 )
- {
- dispThumbs = false ;
- }
- else
- {
- dispThumbs = true ;
- }
- }
- else
- {
- if ( thisWidth >= 550 )
- {
- dispWidth = thisWidth - 200 ;
- dispThumbs = true ;
- }
- else if ( thisWidth >= 450 )
- {
- dispWidth = thisWidth - 100 ;
- dispThumbs = false ;
- }
- else if ( thisWidth >= 350 )
- {
- dispWidth = thisWidth - 50 ;
- dispThumbs = false ;
- }
- }
- s += ' s1.addVariable("displaywidth","' + dispWidth + '");\n' ;
- }
- else if ( this.dispPlaylist == 'below' )
- {
- dispThumbs = true ;
- if ( this.playlistDim.length > 0 )
- {
- dispHeight = thisWidth - this.playlistDim ;
- }
- else
- {
- if ( thisHeight >= 550 )
- {
- dispHeight = thisWidth - 200 ;
- }
- else if ( thisHeight >= 450 )
- {
- dispHeight = thisHeight - 150 ;
- }
- else if ( thisHeight >= 350 )
- {
- dispHeight = thisHeight - 100 ;
- }
- }
- s += ' s1.addVariable("displayheight","' + dispHeight + '");\n' ;
- }
- if ( this.playlistThumbs == 'false' )
- {
- dispThumbs = false ;
- }
- s += ' s1.addVariable("thumbsinplaylist","' + dispThumbs + '");\n' ;
- }
- s += ' s1.addVariable("shuffle","false");\n' ;
- if (this.loop)
- {
- s += ' s1.addVariable("repeat","list");\n' ;
- }
- else
- {
- s += ' s1.addVariable("repeat","' + this.loop + '");\n' ;
- }
- s += ' //s1.addVariable("transition","bgfade");\n' ;
- }
- else
- {
- s += ' s1.addVariable("file","' + this.url + '");\n' ;
- s += ' s1.addVariable("repeat","' + this.loop + '");\n' ;
- s += ' s1.addVariable("image","' + this.iurl + '");\n' ;
- }
- s += ' s1.addVariable("showdownload","' + this.downloadable + '");\n' ;
- s += ' s1.addVariable("link","' + this.url + '");\n' ;
- s += ' s1.addParam("allowfullscreen","' + this.fullscreen + '");\n' ;
- s += ' s1.addVariable("showdigits","' + this.displayDigits + '");\n' ;
- s += ' s1.addVariable("shownavigation","' + this.displayNavigation + '");\n' ;
- // SET THE COLOR OF THE TOOLBAR
- var colorChoice1 = this.toolcolor ;
- if ( colorChoice1.length > 0 )
- {
- colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
- s += ' s1.addVariable("backcolor","' + colorChoice1 + '");\n' ;
- }
- // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
- var colorChoice2 = this.tooltcolor ;
- if ( colorChoice2.length > 0 )
- {
- colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
- s += ' s1.addVariable("frontcolor","' + colorChoice2 + '");\n' ;
- }
- // SET COLOR OF ROLLOVER TEXT AND BUTTONS
- var colorChoice3 = this.tooltrcolor ;
- if ( colorChoice3.length > 0 )
- {
- colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
- s += ' s1.addVariable("lightcolor","' + colorChoice3 + '");\n' ;
- }
- // SET COLOR OF BACKGROUND
- var colorChoice4 = this.bgcolor ;
- if ( colorChoice4.length > 0 )
- {
- colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
- s += ' s1.addVariable("screencolor","' + colorChoice4 + '");\n' ;
- }
- s += ' s1.addVariable("logo","' + this.wmurl + '");\n' ;
- if ( this.rurl.length > 0 )
- {
- s += ' s1.addVariable("recommendations","' + this.rurl + '");\n' ;
- }
- s += ' s1.write("player' + randomnumber + '");\n' ;
- s += '</script>\n' ;
- }
- s += '</div>\n' ;
- s += '</div>\n' ;
- s += '\n' ;
- return s ;
- } ;
- function SelectColor1()
- {
- oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectBackColor ) ;
- }
- function SelectColor2()
- {
- oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolColor ) ;
- }
- function SelectColor3()
- {
- oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolTextColor ) ;
- }
- function SelectColor4()
- {
- oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, SelectToolTextRColor ) ;
- }
- function SelectBackColor( color )
- {
- if ( color && color.length > 0 )
- {
- GetE( 'txtBgColor' ).value = color ;
- }
- }
- function SelectToolColor( color )
- {
- if ( color && color.length > 0 )
- {
- GetE( 'txtToolbarColor' ).value = color ;
- }
- }
- function SelectToolTextColor( color )
- {
- if ( color && color.length > 0 )
- {
- GetE( 'txtToolbarTxtColor' ).value = color ;
- }
- }
- function SelectToolTextRColor( color )
- {
- if ( color && color.length > 0 )
- {
- GetE( 'txtToolbarTxtRColor' ).value = color ;
- }
- }
- var ePreview ;
- function IsValidMedia( oMedia )
- {
- if ( !oMedia )
- {
- return false ;
- }
- var url = oMedia.url ;
- var purl = oMedia.purl ;
- var width = oMedia.width ;
- var height = oMedia.height ;
- if ( url.length == 0 && purl.length == 0 )
- {
- return false ;
- }
- if ( isNaN( width ) )
- {
- return false ;
- }
- if ( parseInt( width, 10 ) <= 0 )
- {
- return false ;
- }
- if ( isNaN( height ) )
- {
- return false ;
- }
- if ( parseInt( height, 10 ) <= 0 )
- {
- return false ;
- }
- return true ;
- }
- function SetPreviewElement( previewEl )
- {
- ePreview = previewEl ;
- if ( IsValidMedia( oMedia ) )
- {
- UpdatePreview() ;
- }
- }
- function UpdatePreview()
- {
- if ( !ePreview )
- {
- return ;
- }
- while ( ePreview.firstChild )
- {
- ePreview.removeChild( ePreview.firstChild ) ;
- }
- if ( !oMedia )
- {
- var oMedia = new Media() ;
- UpdateMovie( oMedia ) ;
- }
- if ( !IsValidMedia( oMedia ) )
- {
- ePreview.innerHTML = ' ' ;
- }
- else
- {
- var max_width = 710 ;
- var max_height = 400 ;
- var new_size = FCK.ResizeToFit( oMedia.width, oMedia.height, max_width, max_height ) ;
- oMedia.width = new_size[0] ;
- oMedia.height = new_size[1] ;
- oMedia.play = false ;
- if ( FCKConfig[ 'FlashEmbeddingMethod' ] == 'swfobject' )
- {
- code = oMedia.getInnerHTML() ;
- var start = code.indexOf( 'var s1 = new SWFObject' ) ;
- if ( start == -1 )
- {
- return ;
- }
- var end = code.indexOf( 's1.write' ) ;
- if ( end == -1 )
- {
- return ;
- }
- code = code.substring( start, end ) + 'html = s1.getSWFHTML();' ;
- var html = '';
- eval (code) ;
- ePreview.innerHTML = html ;
- }
- else
- {
- ePreview.innerHTML = oMedia.getInnerHTML() ;
- }
- var margin_left = parseInt( ( max_width - oMedia.width ) / 2, 10 ) ;
- var margin_top = parseInt( ( max_height - oMedia.height ) / 2, 10 ) ;
- if ( ePreview.currentStyle )
- {
- // IE
- ePreview.style.marginLeft = margin_left ;
- ePreview.style.marginTop = margin_top ;
- }
- else
- {
- // Other browsers
- SetAttribute( ePreview, 'style', 'margin-left: ' + margin_left + 'px; margin-top: ' + margin_top + 'px;' ) ;
- }
- }
- }
- function ClearPreview()
- {
- if ( !ePreview )
- {
- return ;
- }
- while ( ePreview.firstChild )
- {
- ePreview.removeChild( ePreview.firstChild ) ;
- }
- ePreview.innerHTML = ' ' ;
- }
- function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
- {
- // Remove animation
- window.parent.Throbber.Hide() ;
- GetE( 'divUpload' ).style.display = '' ;
- switch ( errorNumber )
- {
- case 0 : // No errors
- //alert( FCKLang['FileSuccessfullyUploaded'] ) ;
- break ;
- case 1 : // Custom error
- alert( customMsg ) ;
- return ;
- case 101 : // Custom warning
- alert( customMsg ) ;
- break ;
- case 201 :
- alert( FCKLang['FileRenamed'] + ' "' + fileName + '".' ) ;
- break ;
- case 202 :
- alert( FCKLang['InvalidFileType'] ) ;
- return ;
- case 203 :
- alert( FCKLang['SecurityError'] ) ;
- return ;
- case 500 :
- alert( FCKLang['ConnectorDisabled'] ) ;
- break ;
- default :
- alert( FCKLang['UploadError'] + errorNumber ) ;
- return ;
- }
- OnDialogModeChange( 'single' ) ;
- sActualBrowser = 'flv' ;
- SetUrl( fileUrl ) ;
- GetE('frmUpload').reset() ;
- }
- var oUploadAllowedExtRegex = new RegExp( FCKConfig.MediaUploadAllowedExtensions, 'i' ) ;
- var oUploadDeniedExtRegex = new RegExp( FCKConfig.MediaUploadDeniedExtensions, 'i' ) ;
- function CheckUpload()
- {
- var sFile = GetE( 'txtUploadFile' ).value ;
- if ( sFile.length == 0 )
- {
- alert( FCKLang['UploadSelectFileFirst'] ) ;
- return false ;
- }
- if ( ( FCKConfig.MediaUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) ||
- ( FCKConfig.MediaUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) )
- {
- OnUploadCompleted( 202 ) ;
- return false ;
- }
- // Show animation.
- window.parent.Throbber.Show( 100 ) ;
- GetE( 'divUpload' ).style.display = 'none' ;
- return true ;
- }
|