Subversion Repositories Applications.papyrus

Rev

Rev 1688 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1688 Rev 1921
Line 1... Line 1...
1
/*
1
/*
2
 * FCKeditor - The text editor for internet
2
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
 * Copyright (C) 2003-2006 Frederico Caldeira Knabben
3
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
4
 * 
4
 *
5
 * Licensed under the terms of the GNU Lesser General Public License:
5
 * == BEGIN LICENSE ==
6
 * 		http://www.opensource.org/licenses/lgpl-license.php
-
 
7
 * 
6
 *
8
 * For further information visit:
7
 * Licensed under the terms of any of the following licenses at your
9
 * 		http://www.fckeditor.net/
8
 * choice:
10
 * 
9
 *
11
 * "Support Open Source software. What about a donation today?"
10
 *  - GNU General Public License Version 2 or later (the "GPL")
-
 
11
 *    http://www.gnu.org/licenses/gpl.html
12
 * 
12
 *
-
 
13
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
13
 * File Name: fck_flash.js
14
 *    http://www.gnu.org/licenses/lgpl.html
-
 
15
 *
14
 * 	Scripts related to the Flash dialog window (see fck_flash.html).
16
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
-
 
17
 *    http://www.mozilla.org/MPL/MPL-1.1.html
15
 * 
18
 *
16
 * File Authors:
19
 * == END LICENSE ==
-
 
20
 *
17
 * 		Frederico Caldeira Knabben (fredck@fckeditor.net)
21
 * Scripts related to the Flash dialog window (see fck_flash.html).
18
 */
22
 */
Line -... Line 23...
-
 
23
 
19
 
24
var dialog		= window.parent ;
20
var oEditor		= window.parent.InnerDialogLoaded() ;
25
var oEditor		= dialog.InnerDialogLoaded() ;
21
var FCK			= oEditor.FCK ;
26
var FCK			= oEditor.FCK ;
22
var FCKLang		= oEditor.FCKLang ;
27
var FCKLang		= oEditor.FCKLang ;
-
 
28
var FCKConfig	= oEditor.FCKConfig ;
Line 23... Line 29...
23
var FCKConfig	= oEditor.FCKConfig ;
29
var FCKTools	= oEditor.FCKTools ;
Line 24... Line 30...
24
 
30
 
25
//#### Dialog Tabs
31
//#### Dialog Tabs
Line 26... Line 32...
26
 
32
 
27
// Set the dialog tabs.
33
// Set the dialog tabs.
Line 28... Line 34...
28
window.parent.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ;
34
dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ;
29
 
35
 
Line 30... Line 36...
30
if ( FCKConfig.FlashUpload )
36
if ( FCKConfig.FlashUpload )
31
	window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
37
	dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
32
 
38
 
33
if ( !FCKConfig.FlashDlgHideAdvanced )
39
if ( !FCKConfig.FlashDlgHideAdvanced )
34
	window.parent.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ;
40
	dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ;
35
 
41
 
36
// Function called when a dialog tag is selected.
42
// Function called when a dialog tag is selected.
Line 37... Line 43...
37
function OnDialogTabChange( tabCode )
43
function OnDialogTabChange( tabCode )
38
{
44
{
39
	ShowE('divInfo'		, ( tabCode == 'Info' ) ) ;
45
	ShowE('divInfo'		, ( tabCode == 'Info' ) ) ;
Line 40... Line 46...
40
	ShowE('divUpload'	, ( tabCode == 'Upload' ) ) ;
46
	ShowE('divUpload'	, ( tabCode == 'Upload' ) ) ;
41
	ShowE('divAdvanced'	, ( tabCode == 'Advanced' ) ) ;
47
	ShowE('divAdvanced'	, ( tabCode == 'Advanced' ) ) ;
42
}
48
}
Line 66... Line 72...
66
 
72
 
67
	// Set the actual uploader URL.
73
	// Set the actual uploader URL.
68
	if ( FCKConfig.FlashUpload )
74
	if ( FCKConfig.FlashUpload )
Line 69... Line 75...
69
		GetE('frmUpload').action = FCKConfig.FlashUploadURL ;
75
		GetE('frmUpload').action = FCKConfig.FlashUploadURL ;
Line 70... Line 76...
70
 
76
 
71
	window.parent.SetAutoSize( true ) ;
77
	dialog.SetAutoSize( true ) ;
-
 
78
 
-
 
79
	// Activate the "OK" button.
72
 
80
	dialog.SetOkButton( true ) ;
Line 73... Line 81...
73
	// Activate the "OK" button.
81
 
74
	window.parent.SetOkButton( true ) ;
82
	SelectField( 'txtUrl' ) ;
75
}
83
}
Line 76... Line -...
76
 
-
 
77
function LoadSelection()
-
 
78
{
84
 
79
	if ( ! oEmbed ) return ;
85
function LoadSelection()
80
 
86
{
Line 81... Line 87...
81
	var sUrl = GetAttribute( oEmbed, 'src', '' ) ;
87
	if ( ! oEmbed ) return ;
Line 99... Line 105...
99
		GetE('txtAttStyle').value = oEmbed.style.cssText ;
105
		GetE('txtAttStyle').value = oEmbed.style.cssText ;
100
	}
106
	}
101
	else
107
	else
102
	{
108
	{
103
		GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ;
109
		GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ;
104
		GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) ;
110
		GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ;
105
	}
111
	}
Line 106... Line 112...
106
 
112
 
107
	UpdatePreview() ;
113
	UpdatePreview() ;
Line 108... Line 114...
108
}
114
}
109
 
115
 
110
//#### The OK button was hit.
116
//#### The OK button was hit.
111
function Ok()
117
function Ok()
112
{
118
{
113
	if ( GetE('txtUrl').value.length == 0 )
119
	if ( GetE('txtUrl').value.length == 0 )
114
	{
120
	{
Line 115... Line 121...
115
		window.parent.SetSelectedTab( 'Info' ) ;
121
		dialog.SetSelectedTab( 'Info' ) ;
Line 116... Line 122...
116
		GetE('txtUrl').focus() ;
122
		GetE('txtUrl').focus() ;
117
 
123
 
Line -... Line 124...
-
 
124
		alert( oEditor.FCKLang.DlgAlertUrl ) ;
118
		alert( oEditor.FCKLang.DlgAlertUrl ) ;
125
 
119
 
126
		return false ;
120
		return false ;
127
	}
121
	}
128
 
122
 
129
	oEditor.FCKUndo.SaveUndoStep() ;
Line 129... Line 136...
129
	
136
 
130
	if ( !oFakeImage )
137
	if ( !oFakeImage )
131
	{
138
	{
132
		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ;
139
		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ;
133
		oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ;
140
		oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ;
134
		oFakeImage	= FCK.InsertElementAndGetIt( oFakeImage ) ;
141
		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
135
	}
-
 
136
	else
-
 
Line 137... Line 142...
137
		oEditor.FCKUndo.SaveUndoStep() ;
142
	}
Line 138... Line 143...
138
	
143
 
139
	oEditor.FCKFlashProcessor.RefreshView( oFakeImage, oEmbed ) ;
144
	oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ;
Line 140... Line 145...
140
 
145
 
141
	return true ;
146
	return true ;
142
}
147
}
143
 
148
 
Line 144... Line 149...
144
function UpdateEmbed( e )
149
function UpdateEmbed( e )
145
{
150
{
146
	SetAttribute( e, 'type'			, 'application/x-shockwave-flash' ) ;
151
	SetAttribute( e, 'type'			, 'application/x-shockwave-flash' ) ;
Line 147... Line 152...
147
	SetAttribute( e, 'pluginspage'	, 'http://www.macromedia.com/go/getflashplayer' ) ;
152
	SetAttribute( e, 'pluginspage'	, 'http://www.macromedia.com/go/getflashplayer' ) ;
Line 196... Line 201...
196
	else
201
	else
197
	{
202
	{
198
		var oDoc	= ePreview.ownerDocument || ePreview.document ;
203
		var oDoc	= ePreview.ownerDocument || ePreview.document ;
199
		var e		= oDoc.createElement( 'EMBED' ) ;
204
		var e		= oDoc.createElement( 'EMBED' ) ;
Line 200... Line 205...
200
		
205
 
201
		e.src		= GetE('txtUrl').value ;
206
		SetAttribute( e, 'src', GetE('txtUrl').value ) ;
202
		e.type		= 'application/x-shockwave-flash' ;
207
		SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ;
203
		e.width		= '100%' ;
208
		SetAttribute( e, 'width', '100%' ) ;
Line 204... Line 209...
204
		e.height	= '100%' ;
209
		SetAttribute( e, 'height', '100%' ) ;
205
		
210
 
206
		ePreview.appendChild( e ) ;
211
		ePreview.appendChild( e ) ;
Line 224... Line 229...
224
	if ( height ) 
229
	if ( height )
225
		GetE('txtHeight').value = height ;
230
		GetE('txtHeight').value = height ;
Line 226... Line 231...
226
 
231
 
Line 227... Line 232...
227
	UpdatePreview() ;
232
	UpdatePreview() ;
228
 
233
 
Line 229... Line 234...
229
	window.parent.SetSelectedTab( 'Info' ) ;
234
	dialog.SetSelectedTab( 'Info' ) ;
230
}
235
}
-
 
236
 
-
 
237
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
-
 
238
{
-
 
239
	// Remove animation
231
 
240
	window.parent.Throbber.Hide() ;
232
function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg )
241
	GetE( 'divUpload' ).style.display  = '' ;
233
{
242
 
234
	switch ( errorNumber )
243
	switch ( errorNumber )
235
	{
244
	{
Line 249... Line 258...
249
			alert( 'Invalid file type' ) ;
258
			alert( 'Invalid file type' ) ;
250
			return ;
259
			return ;
251
		case 203 :
260
		case 203 :
252
			alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
261
			alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ;
253
			return ;
262
			return ;
-
 
263
		case 500 :
-
 
264
			alert( 'The connector is disabled' ) ;
-
 
265
			break ;
254
		default :
266
		default :
255
			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
267
			alert( 'Error on file upload. Error number: ' + errorNumber ) ;
256
			return ;
268
			return ;
257
	}
269
	}
Line 278... Line 290...
278
	{
290
	{
279
		OnUploadCompleted( 202 ) ;
291
		OnUploadCompleted( 202 ) ;
280
		return false ;
292
		return false ;
281
	}
293
	}
Line -... Line 294...
-
 
294
 
-
 
295
	// Show animation
-
 
296
	window.parent.Throbber.Show( 100 ) ;
-
 
297
	GetE( 'divUpload' ).style.display  = 'none' ;
282
	
298
 
283
	return true ;
299
	return true ;
284
}
300
}