public/ckeditor/4.4dev/plugins/filebrowser/plugin.js
function attachFileBrowser( editor, dialogName, definition, elements ) {
		if ( !elements || !elements.length )
			return;

		var element, fileInput;

		for ( var i = elements.length; i--; ) {
			element = elements[ i ];

			if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' )
				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 ) {
						// "element" here means the definition object, so we need to find the correct
						// button to scope the event call
						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 ) {
		if ( !elements || !elements.length )
			return;

		var element, fileInput;

		for ( var i = elements.length; i--; ) {
			element = elements[ i ];

			if ( element.type == 'hbox' || element.type == 'vbox' || element.type == 'fieldset' )
				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 ) {
						// "element" here means the definition object, so we need to find the correct
						// button to scope the event call
						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 ) { if ( ! elements || ! elements . length ) return ; var element , fileInput ; for ( var i = elements . length ; i -- ; ) { element = elements [ i ] ; if ( element . type == 'hbox' || element . type == 'vbox' || element . type == 'fieldset' ) 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 ) { // "element" here means the definition object, so we need to find the correct
 // button to scope the event call
 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.  @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 .