﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
210	More Flexible Upload Directory Control	anonymous		"I am using FCK2.4 under cold fusion. I appreciate that one can control the image upload directory on a ""per-session"" basis and indeed have previously done just this.

However there are occasions when it is absolutely necessary to have each browser instance have its own unique image directory. Say, for example that a CMS manager operator opens one window (with image directory ""a/"") and then opens another with image directory ""b/"" to cut and paste some text from that window to the first one. On a session basis the window ""b"" will hijack the upload directory of window ""a"" and so any subsequent file activity on window will go to the wrong place. The user might not even notice.

I regard this as bizarre and unnecessary behaviour. I have modified FCK so that it behave the way I want and I am hoping my modifications will be integrated by someone who knows what they are doing in a more clinical and correct manner!!

This is what I did: 


After creating the CF object with:
	
{{{
fckEditor = createObject(""component"", basepath & ""FCKeditor"");
}}}
I added:

{{{
fckEditor.Config[""UserFilesPath""] = FCKUserFiles;
}}}
where FCKUserFiles is my control directory variable 

'''In fckeditor.cfc'''
line 205
"",UserFilesPath"" added to end of lconfig. This is where it picks up the variable passed above. The result of this is that the html line (where my instance is called ""pageText"" is added to the form instance calling FCK. You can see my custom path.


<input type=""hidden"" id=""pageText___Config"" value=""CustomConfigurationsPath=/fishing2006/FCKeditor/myconfig.js&amp;
ToolbarStartExpanded=true&amp;UserFilesPath=fishing2006/userfiles/charters/69&amp;
EditorAreaCSS=/fishing2006/include/site.css"" style=""display:none"" />


Now it gets difficult because IE calls up the file browser with showModaldialog whereas gecko spawn another browser. I had to get the UserFiles data over to this window somehow. It then has to be passed to he actual file browser connector.

'''In editor/js/fckeditorcod_ie.js'''

 On about line 92 (since this code is obfuscated) Look for the showModalDialog on about line 92 and then insert this line before it assuming that the letter A refers to the second argument showModalDialog. For the gecko version it is easier and handled later.
								
{{{
A.UserFilesPath =FCKConfig.UserFilesPath;
}}}

'''In editor/editor/fckdialog.html'''
Line 37 add	

{{{
var UserFilesPath (create variable)
}}}
and then line 45-47

{{{
UserFilesPath =  window.dialogArguments.UserFilesPath;
if (window.opener) UserFilesPath = window.opener.FCKConfig.UserFilesPath;
//(this is for gecko because on IE it uses a showModalDialog box and there is no window.opener)
}}}

'''In editor/_source/internals/fckdialog.js''' 
Line 90-91

{{{
if ( sKey == 'UserFilesPath' )	// My new userfiles path.
	FCKConfig[ sKey ] = sVal ;
}}}


'''In editor/filemanager/browser/default/browser.html'''
Line 50

{{{
var sConnUserFilesPath =  window.opener.top.UserFilesPath;
}}}

Line 70,74

{{{
var sUrl = this.ConnectorUrl + 'Command=' + command ;
sUrl += '&Type=' + this.ResourceType ;
sUrl += '&UserFilesPath=' + encodeURIComponent(sConnUserFilesPath) ;
sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ;
}}}


'''In editor/filemanager/browser/default/frmupload.html'''
Line 38-39

{{{
sUrl += '&Type=' + resourceType ;
sUrl += '&UserFilesPath=' + encodeURIComponent(window.top.sConnUserFilesPath);
sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ;
}}}
		
'''In connectors/cfm/connector.cfm	'''
Line 46 

{{{
<cfparam name=""url.UserFilesPath"" default=""thisdirectoryhere"">
}}}

Line 52-53

{{{
userFilesPath = URLDecode(url.UserFilesPath);
//	userFilesPath = config.userFilesPath; (commented out the original)
}}}

I hope you are all as confused as I was. Well you get the general idea. Pass the userfiles directory right from the form instance calling FCK up to the file browser connector. Believe it or not this works	and I believe should be incorporated as an official change it is so useful!!					"	New Feature	closed	Normal		File Browser	FCKeditor 2.4	invalid	HasPatch	
