1,37 → 1,43 |
/* |
* FCKeditor - The text editor for internet |
* Copyright (C) 2003-2006 Frederico Caldeira Knabben |
* |
* Licensed under the terms of the GNU Lesser General Public License: |
* http://www.opensource.org/licenses/lgpl-license.php |
* |
* For further information visit: |
* http://www.fckeditor.net/ |
* |
* "Support Open Source software. What about a donation today?" |
* |
* File Name: fck_flash.js |
* Scripts related to the Flash dialog window (see fck_flash.html). |
* |
* File Authors: |
* Frederico Caldeira Knabben (fredck@fckeditor.net) |
* FCKeditor - The text editor for Internet - http://www.fckeditor.net |
* Copyright (C) 2003-2008 Frederico Caldeira Knabben |
* |
* == BEGIN LICENSE == |
* |
* Licensed under the terms of any of the following licenses at your |
* choice: |
* |
* - GNU General Public License Version 2 or later (the "GPL") |
* http://www.gnu.org/licenses/gpl.html |
* |
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL") |
* http://www.gnu.org/licenses/lgpl.html |
* |
* - Mozilla Public License Version 1.1 or later (the "MPL") |
* http://www.mozilla.org/MPL/MPL-1.1.html |
* |
* == END LICENSE == |
* |
* Scripts related to the Flash dialog window (see fck_flash.html). |
*/ |
|
var oEditor = window.parent.InnerDialogLoaded() ; |
var dialog = window.parent ; |
var oEditor = dialog.InnerDialogLoaded() ; |
var FCK = oEditor.FCK ; |
var FCKLang = oEditor.FCKLang ; |
var FCKConfig = oEditor.FCKConfig ; |
var FCKTools = oEditor.FCKTools ; |
|
//#### Dialog Tabs |
|
// Set the dialog tabs. |
window.parent.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; |
dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; |
|
if ( FCKConfig.FlashUpload ) |
window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; |
dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; |
|
if ( !FCKConfig.FlashDlgHideAdvanced ) |
window.parent.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; |
dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; |
|
// Function called when a dialog tag is selected. |
function OnDialogTabChange( tabCode ) |
42,7 → 48,7 |
} |
|
// Get the selected flash embed (if available). |
var oFakeImage = FCK.Selection.GetSelectedElement() ; |
var oFakeImage = dialog.Selection.GetSelectedElement() ; |
var oEmbed ; |
|
if ( oFakeImage ) |
68,10 → 74,12 |
if ( FCKConfig.FlashUpload ) |
GetE('frmUpload').action = FCKConfig.FlashUploadURL ; |
|
window.parent.SetAutoSize( true ) ; |
dialog.SetAutoSize( true ) ; |
|
// Activate the "OK" button. |
window.parent.SetOkButton( true ) ; |
dialog.SetOkButton( true ) ; |
|
SelectField( 'txtUrl' ) ; |
} |
|
function LoadSelection() |
78,8 → 86,6 |
{ |
if ( ! oEmbed ) return ; |
|
var sUrl = GetAttribute( oEmbed, 'src', '' ) ; |
|
GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; |
GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; |
GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; |
90,7 → 96,7 |
GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; |
GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; |
GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; |
|
|
GetE('txtAttTitle').value = oEmbed.title ; |
|
if ( oEditor.FCKBrowserInfo.IsIE ) |
101,7 → 107,7 |
else |
{ |
GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; |
GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) ; |
GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ; |
} |
|
UpdatePreview() ; |
112,7 → 118,7 |
{ |
if ( GetE('txtUrl').value.length == 0 ) |
{ |
window.parent.SetSelectedTab( 'Info' ) ; |
dialog.SetSelectedTab( 'Info' ) ; |
GetE('txtUrl').focus() ; |
|
alert( oEditor.FCKLang.DlgAlertUrl ) ; |
120,6 → 126,7 |
return false ; |
} |
|
oEditor.FCKUndo.SaveUndoStep() ; |
if ( !oEmbed ) |
{ |
oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; |
126,18 → 133,16 |
oFakeImage = null ; |
} |
UpdateEmbed( oEmbed ) ; |
|
|
if ( !oFakeImage ) |
{ |
oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; |
oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; |
oFakeImage = FCK.InsertElementAndGetIt( oFakeImage ) ; |
oFakeImage = FCK.InsertElement( oFakeImage ) ; |
} |
else |
oEditor.FCKUndo.SaveUndoStep() ; |
|
oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ; |
|
oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ; |
|
return true ; |
} |
|
146,15 → 151,15 |
SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; |
SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; |
|
e.src = GetE('txtUrl').value ; |
SetAttribute( e, 'src', GetE('txtUrl').value ) ; |
SetAttribute( e, "width" , GetE('txtWidth').value ) ; |
SetAttribute( e, "height", GetE('txtHeight').value ) ; |
|
|
// Advances Attributes |
|
SetAttribute( e, 'id' , GetE('txtAttId').value ) ; |
SetAttribute( e, 'scale', GetE('cmbScale').value ) ; |
|
|
SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; |
SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; |
SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; |
178,7 → 183,7 |
function SetPreviewElement( previewEl ) |
{ |
ePreview = previewEl ; |
|
|
if ( GetE('txtUrl').value.length > 0 ) |
UpdatePreview() ; |
} |
187,7 → 192,7 |
{ |
if ( !ePreview ) |
return ; |
|
|
while ( ePreview.firstChild ) |
ePreview.removeChild( ePreview.firstChild ) ; |
|
197,12 → 202,12 |
{ |
var oDoc = ePreview.ownerDocument || ePreview.document ; |
var e = oDoc.createElement( 'EMBED' ) ; |
|
e.src = GetE('txtUrl').value ; |
e.type = 'application/x-shockwave-flash' ; |
e.width = '100%' ; |
e.height = '100%' ; |
|
|
SetAttribute( e, 'src', GetE('txtUrl').value ) ; |
SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; |
SetAttribute( e, 'width', '100%' ) ; |
SetAttribute( e, 'height', '100%' ) ; |
|
ePreview.appendChild( e ) ; |
} |
} |
217,20 → 222,24 |
function SetUrl( url, width, height ) |
{ |
GetE('txtUrl').value = url ; |
|
|
if ( width ) |
GetE('txtWidth').value = width ; |
|
if ( height ) |
|
if ( height ) |
GetE('txtHeight').value = height ; |
|
UpdatePreview() ; |
|
window.parent.SetSelectedTab( 'Info' ) ; |
dialog.SetSelectedTab( 'Info' ) ; |
} |
|
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) |
{ |
// Remove animation |
window.parent.Throbber.Hide() ; |
GetE( 'divUpload' ).style.display = '' ; |
|
switch ( errorNumber ) |
{ |
case 0 : // No errors |
251,6 → 260,9 |
case 203 : |
alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; |
return ; |
case 500 : |
alert( 'The connector is disabled' ) ; |
break ; |
default : |
alert( 'Error on file upload. Error number: ' + errorNumber ) ; |
return ; |
266,13 → 278,13 |
function CheckUpload() |
{ |
var sFile = GetE('txtUploadFile').value ; |
|
|
if ( sFile.length == 0 ) |
{ |
alert( 'Please select a file to upload' ) ; |
return false ; |
} |
|
|
if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || |
( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) |
{ |
279,6 → 291,10 |
OnUploadCompleted( 202 ) ; |
return false ; |
} |
|
|
// Show animation |
window.parent.Throbber.Show( 100 ) ; |
GetE( 'divUpload' ).style.display = 'none' ; |
|
return true ; |
} |
} |