Hi
Extending UserPathBuilder is the aim. The java implementation is not the problem but adding
parameters to HttpServletRequest via the editor of config tag.
The problem is that the only parameters in HttpServletRequest is (specific here, Image Browser)
Type=Image
CurrentFolder=/
Command=GetFoldersAndFiles
uuid=1221434287593
I need a way to add parameters dynamical and more specific I need the "instanceName" to be in the HttpServletRequest.
Any help in this regard is much appreciated
nico
Mon, 09/15/2008 - 02:08
#1
Re: Extending UserPathBuilder and Browser parameters
<FCK:editor instanceName="${instanceName}" />
It would be more helpful if you could elaborate when and where you want to append the parameters.
Re: Extending UserPathBuilder and Browser parameters
Thanks for the reply "mosipov" and to be more specific...
1. FCK Version: 2.6.3 and fck_java 2.4
2. I load fck for each user that login, thus each user has his own repository (place of file storage)
So creating the unique instance of fck is not the problem, my code:
<FCK:editor
instanceName="Editor_${pageDoc.userID}"
basePath="/fck263"
toolbarSet="${pageDoc.prefToolbar}"
width="100%"
height="500px">
<jsp:attribute name="value">
<html></html>
</jsp:attribute>
<jsp:body>
<FCK:config
SkinPath="skins/${pageDoc.skin}/"
DefaultLanguage="${pageDoc.lang}"
AutoDetectLanguage="false"/>
</jsp:body>
</FCK:editor>
3. The web-app is config for URL rewriting to allow multi sessions on same browser (IE or FF)... : not cookies
4. FCK java code is isolated from web-app code. (web-app reference fck, fck do not know about web-app)
5. If the userID (or any other par) can be passed via fck browser (browse, upload, file creation), then I can
look up the user in database, thus knowing what repository to allocate for him via UserPathBuilder
6. If the facility is there to extend the UserPathBuilder in the first place, on what basis would you extend it
when the only info given is HttpServletRequest, witch have parameters, but don't have any in them.
7. I try to avoid:
a) Modifying the actual fck js files (need to redo it every time I upgrade and not good coding practice)
b) Change fckConfig.js, caching is just one thing I like avoid (if changes is dynamic it is also more flexible.
8. If this is unavoidable, I still require some know-how in the minimal change required and then also some
explanation on point 6.
thanks nico
Re: Extending UserPathBuilder and Browser parameters
now the situation is much more clearer!
What's the scope of this ${pageDoc.userID} variable?
Re: Extending UserPathBuilder and Browser parameters
Hi
The web-app is session driven, this ${pageDoc} is in the HttpSession.
Just keep in mind that the web-app get its session ID from [<c:url value='/webController?c=v' />] witch
end up as [.../webController;jsessionid=80AE2B1EA45G65B501A157343051FEB?c=v] in the URL. This must
be in the url for all actions that require access to the session. Session awareness is the more correct
approach but if just adding a new parameter is complex, I can't imagine getting the session ID in the URL.
Note:
URL rewriting is the only solution (regarding session awareness). It provide multi-independent-sessions
in same browser. Meaning, same login, 2 browser tabs, different sequence of event.
Cookies get confused with the two sessions same profile (also cookies get blocked).
The end result is just to add parameters to the URL that access UserPathBuilderImpl.getUserFilesPath(HttpServletRequest req)
so that I can do the following:
String editorName = req.getParameter("instanceName");
int userID = Integer.parseInt(editorName);
UserBean user = DatabaseLocater.getData().getUser(userID);
String path = user.getRepository();
Do this make it more clear...
thanks nico
Re: Extending UserPathBuilder and Browser parameters
Re: Extending UserPathBuilder and Browser parameters
the solution is quite easy and straight forward:
what you can do:
You have to change every *BrowserURL and *UploadURL
here are two possible solutions which seem to work here perfectly (adapt paths to your config):
1. Solution
<c:url value="/fckeditor/editor/filemanager/browser/default/browser.html" var="browserUrl" />
<c:url value="/fckeditor/editor/filemanager/connectors" var="connectorUrl" />
<FCK:editor instanceName="some" value="some value">
<FCK:config ImageBrowserURL="${browserUrl}?Type=Image&Connector=${connectorUrl}" />
</FCK:editor>
You have have your jsessionid on any request for this user.
2. solution:
almost the same!
<c:url value="/fckeditor/editor/filemanager/browser/default/browser.html" var="browserUrl" />
<c:url value="/fckeditor/editor/filemanager/connectors" var="connectorUrl" />
<FCK:editor instanceName="some" value="some value">
<FCK:config ImageBrowserURL="${browserUrl}?Type=Image&userId=${userId}&Connector=${connectorUrl}" />
</FCK:editor>
You have to do this for every url.
works here perfectly.
Re: Extending UserPathBuilder and Browser parameters
Re: Extending UserPathBuilder and Browser parameters
Thanks for the help, the session came though just fine.
This solution (1) have worked for Image browser and Image Upload and file creation.
I would imagine that it will work for all the others as well....
Last time (FCK 2.3) I spend a week, debug/edit 10 files to get (then id) through to the
backend. With the new fck_java_2.4, I just knew there was some solution to the problem.
This section is the hardest for me (no javascript debugger or good IDE) and skills sort fall
in this area.
I still almost rewrite the backend for my specific needs:
- underscore spaces in file names (FireFox problem)
- remove that name(1).jpg section, so files can be replaces, need a delete function at some point
- rewrite file urls too point to a different container with command parameters where part is encrypted
(ie: Upload and View is from different machines and no direct reference to files)
....but that is no problem the moment it is in java.
Thanks again for the help
nico
Re: Extending UserPathBuilder and Browser parameters
Took me less than 30 min for the solution.
Try Firebug. Works great!
Well, this is default behavior.
This is going to emerge from version 2.5!
Have fun with our code.