public/js/ckeditor/_source/plugins/filebrowser/plugin.js
/*
	 * Traverse through the content definition and attach filebrowser to
	 * elements with 'filebrowser' attribute.
	 *
	 * @param String
	 *            dialogName Dialog name.
	 * @param {CKEDITOR.dialog.definitionObject}
	 *            definition Dialog definition.
	 * @param {Array}
	 *            elements Array of {@link CKEDITOR.dialog.definition.content}
	 *            objects.
	 */
Traverse through the content definition and attach filebrowser to
elements with 'filebrowser' attribute.

@param String
dialogName Dialog name.
@param {CKEDITOR.dialog.definitionObject}
definition Dialog definition.
@param {Array}
elements Array of  CKEDITOR.dialog.definition.content
objects.
Traverse through the content definition and attach filebrowser to elements with ' filebrowser ' attribute . @param String dialogName Dialog name . @param { CKEDITOR . dialog . definitionObject } definition Dialog definition . @param { Array } elements Array of CKEDITOR . dialog . definition . content objects .
function attachFileBrowser( editor, dialogName, definition, elements )
	{
		var element, fileInput;
		for ( var i in elements )
		{
			element = elements[ i ];
			if ( element.type == 'hbox' || element.type == 'vbox' )
				attachFileBrowser( editor, dialogName, definition, element.children );
			if ( !element.filebrowser )
				continue;
			if ( typeof element.filebrowser == 'string' )
			{
				var fb =
				{
					action : ( element.type == 'fileButton' ) ? 'QuickUpload' : 'Browse',
					target : element.filebrowser
				};
				element.filebrowser = fb;
			}
			if ( element.filebrowser.action == 'Browse' )
			{
				var url = element.filebrowser.url;
				if ( url === undefined )
				{
					url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'BrowseUrl' ];
					if ( url === undefined )
						url = editor.config.filebrowserBrowseUrl;
				}
				if ( url )
				{
					element.onClick = browseServer;
					element.filebrowser.url = url;
					element.hidden = false;
				}
			}
			else if ( element.filebrowser.action == 'QuickUpload' && element[ 'for' ] )
			{
				url = element.filebrowser.url;
				if ( url === undefined )
				{
					url = editor.config[ 'filebrowser' + ucFirst( dialogName ) + 'UploadUrl' ];
					if ( url === undefined )
						url = editor.config.filebrowserUploadUrl;
				}
				if ( url )
				{
					var onClick = element.onClick;
					element.onClick = function( evt )
					{
						var sender = evt.sender;
						if ( onClick && onClick.call( sender, evt ) === false )
							return false;
						return uploadFile.call( sender, evt );
					};
					element.filebrowser.url = url;
					element.hidden = false;
					setupFileElement( editor, definition.getContents( element[ 'for' ][ 0 ] ).get( element[ 'for' ][ 1 ] ), element.filebrowser );
				}
			}
		}
	}
function attachFileBrowser ( editor , dialogName , definition , elements ) { var element , fileInput ; for ( var i in elements ) { element = elements [ i ] ; if ( element . type == 'hbox' || element . type == 'vbox' ) attachFileBrowser ( editor , dialogName , definition , element . children ) ; if ( ! element . filebrowser ) continue ; if ( typeof element . filebrowser == 'string' ) { var fb = { action : ( element . type == 'fileButton' ) ? 'QuickUpload' : 'Browse' , target : element . filebrowser } ; element . filebrowser = fb ; } if ( element . filebrowser . action == 'Browse' ) { var url = element . filebrowser . url ; if ( url === undefined ) { url = editor . config [ 'filebrowser' + ucFirst ( dialogName ) + 'BrowseUrl' ] ; if ( url === undefined ) url = editor . config . filebrowserBrowseUrl ; } if ( url ) { element . onClick = browseServer ; element . filebrowser . url = url ; element . hidden = false ; } } else if ( element . filebrowser . action == 'QuickUpload' && element [ 'for' ] ) { url = element . filebrowser . url ; if ( url === undefined ) { url = editor . config [ 'filebrowser' + ucFirst ( dialogName ) + 'UploadUrl' ] ; if ( url === undefined ) url = editor . config . filebrowserUploadUrl ; } if ( url ) { var onClick = element . onClick ; element . onClick = function ( evt ) { var sender = evt . sender ; if ( onClick && onClick . call ( sender , evt ) === false ) return false ; return uploadFile . call ( sender , evt ) ; } ; element . filebrowser . url = url ; element . hidden = false ; setupFileElement ( editor , definition . getContents ( element [ 'for' ] [ 0 ] ) . get ( element [ 'for' ] [ 1 ] ) , element . filebrowser ) ; } } } }
Traverse through the content definition and attach filebrowser to
 elements with 'filebrowser' attribute.
Traverse through the content definition and attach filebrowser to elements with ' filebrowser ' attribute .
// "element" here means the definition object, so we need to find the correct // button to scope the event call