Hi to all,
I'm having this problem trying to implement a user path builder as well a user action!
I followed the documentation... read some post about it, but it seems not to be working.....
I need to fetch some external resources from my repository to FCKeditor depending on a request parameter (let's say a folder name).
My servlet is runnig and is able to contruct some example files fetched from there but as I sayed, I need to pass some request parameters to it.
fckeditor.propertes file is being read because the configurations are working as defined (base path and toolbar), but the implementations are not!
My code:
jsp
<c:url value="/scripts/fckeditor/editor/filemanager/browser/default/browser.html" var="browserUrl" />
<c:url value="/scripts/fckeditor/editor/filemanager/connectors" var="connectorUrl" />
<fck:editor instanceName="text" value="">
<fck:config DefaultLanguage="pt" AutoDetectLanguage="false"
ImageBrowserURL="${browserUrl}?Type=Image&folder=something&Connector=${connectorUrl}"/>
</fck:editor>
fckeditor.properties
fckeditor.basePath=/scripts/fckeditor
fckeditor.toolbarSet=mytoolbar
connector.userActionImpl=com.example.presentation.util.FCKActionImpl
connector.userPathBuilderImpl=com.example.presentation.util.FCKPathBuilder
UserActionImpl
public class FCKActionImpl implements UserAction{
@Override
public boolean isEnabledForFileUpload(HttpServletRequest httpServletRequest) {
System.out.println("****************************** Is enabled for upload");
return false;
}
@Override
public boolean isEnabledForFileBrowsing(HttpServletRequest httpServletRequest) {
System.out.println("****************************** Is enabled for file browsing");
return true;
}
UserPathBuilderImpl
public class FCKPathBuilder implements UserPathBuilder {
@Override
public String getUserFilesPath(HttpServletRequest httpServletRequest) {
System.out.println("****************************** building path");
return httpServletRequest.getParameter("folder");
}
}
In my Servlet ,
String currentFolderStr = request.getParameter("CurrentFolder");
is not getting the path... allways gets / and log is not showed in the out print!
Any help here would be appreciated... seams I'm missing somethig!
Thanks in advance
Sat, 05/09/2009 - 14:08
#1
Re: UserPathBuilder and UserAction seems not working.....
provide first the versions you are using.
As far as I understood your problem, you want to provide some custom implementation.
Here are my questions first:
Especially without 2 and 3 it makes really hard to help remotely.
Mike
Re: UserPathBuilder and UserAction seems not working.....
Thanks for the kick response!
I'm using FCKeditor 2.6.4 with fckeditor-java-core-2.4.1.jar!
And, yes! I want to make a customized implementation! I want to be able to read files from a JCR repository, depending on the request parameter!
Anwsering your questions:
1) Yes, I want to pass another parameter! But thinking again, current folder could work just fine for me! just need to dinamically change it and to pass it to the servlet (the folder=currentFolder I want to look for). But don't know how I can change it!
2) Default config is sort of working... when checking it again and after deleting some properties, I'm seeing that the connector is not taking in care connector.userActionImpl (i delete it) property as he does not give an error message (as explained in documentation), but still, he enters my servlet and returns me the XML response!
3)I'm doing it a step by step but still the same problem! I'm gonna try to override the properties in the init method of the servlet!
Any others advices?
Many Thanks
Re: UserPathBuilder and UserAction seems not working.....
Your goal is probably not achievable with 2.4.1 since it can serve from the current context only! Please checkout 2.5-SNAPSHOT from trunk and build binaries and site. It provides all the features you need to implement your custom Connector. This version will ease your development tremendously.
Make sure, you see appropriate log outputs of interface initializations.
Mike
Re: UserPathBuilder and UserAction seems not working.....
For sure I will give it a try!
Reply you back soon!
Again, many thanks,
Rico
Re: UserPathBuilder and UserAction seems not working.....
Actually I have the connector, the user action, and the user path builder working!
But still cant pass a parameter from jsp to the user path builder or to the connector for the correct construction of the folder path where to look for!
As I read around in other posts...
<c:url value="/scripts/fckeditor/editor/filemanager/browser/default/browser.html" var="browserUrl" />
<c:url value="/scripts/fckeditor/editor/filemanager/connectors" var="connectorUrl" />
<fck:editor instanceName="text" >
<jsp:attribute name="value"></jsp:attribute>
<jsp:body>
<fck:config DefaultLanguage="pt" AutoDetectLanguage="false"
ImageBrowserURL="${browserUrl}?Type=Image&folderPath=/something&Connector=${connectorUrl}"/>
</jsp:body>
</fck:editor>
Where the FF URL tab shows:
..../scripts/fckeditor/editor/filemanager/browser/default/browser.html?Type=Image&folderPath=/something&Connector=/scripts/fckeditor/editor/filemanager/connectors
Again, request.getParameter("folderPath") at UserPathBuilder keeps giving-me null
The only parametes passed are Type, uuid, Command and CurrentFolder!
As I told you I could work just fine with CurrentFolder parameter! But dont know were to change it!
Thanks in advance
Rico
PS: Is this snapshot ready for production enviornments?
Re: UserPathBuilder and UserAction seems not working.....
I'm glad you got it almost working. I remember that I have posted a solution for passing additional parameter. Anyway, I will investigate that later this day and will repost. Keep tight!
As far as I am concerned, the code is feature-complete. I tested it on Tomcat, Jetty and GlassFish von Windows XP SP2+3 and Ubuntu 8.04 LTS: Worked without a flaw. The reason it takes me so long to push the first beta, is that I am still working on a reasonable documenation for beginners.
Re: UserPathBuilder and UserAction seems not working.....
Hi Mike,
Let me thank you again for the great support you are giving me on this!
I've read the "passing parameters post" and my solution is quite similar to the example you gave on that post.
Yesterday I got the 2.5 snapshot. At the beggingI was a little bit confused on the how to. But after checking the code flow, I realized what to do! By far this is more robust implementation them 2.4.1. Keep up the good work
I also instaled the demo war! And I was looking for some example jsp where you could exchange parameters with server! ....No luck! Think it is a good idea if you include it in a future example!...
If you are glad to hear, I'm working on jboss 4.2.3 and till now no problems were found with this snapshot!
Well, for now, I will investigate what is happening and wait for your reply
Thanks
Rico
Re: UserPathBuilder and UserAction seems not working.....
Mike,
I couldn't do it!
I don't know what to do more!
Almost read the entire forum with this parameter problem and the solution seams not working on me!
request.getParameter at my implementation of UserPathBuilder keeps giving me null!
Does I need to upgrade fckeditor?
Looking around... don't know if it is the connector.php that only passes the "super" parameters (type, uuid...) and chuncks the rest!
Even when I try to override the "CurrentFolder" in the fck:config tag:
...ImageBrowserURL="${browserUrl}?Type=Image&CurrentFolder=/something&Connector=${connectorUrl}"/>
Keep allways returning me root (/). He his not taking in care the parameters passed by URL. For sure I'm missing something here!
Without this 'dam' parameter on my connector I cant go forward... I need to know what folder to read in JCR repository and this is done by passing the param.
I really need your help on this.. could you give it shot?
Many thanks
Rico
Re: UserPathBuilder and UserAction seems not working.....
Beside the above mentioned, I just checked the JS sources, you cannot pass an arbitrary startup CurrentFolder, it will always default to "/". It would be necessary to patch the file browser code. (IIRC, someone else was asking for this too).
But you can piggyback other parameters to the connector, which is really wicked. Be aware that this parameter is always as-is as long as the file browser ist open.
Firebug shows MyParam as a GET param.
Mike
Re: UserPathBuilder and UserAction seems not working.....
Mike,
Finnally I did it!
Well it took me quiet long to understend the problem and if it wasn't you (almost had a string tokenizer to get me the param from the referer header) I still would be around here for some time!
It was not easy beacause it was a little confusing... But now it makes sense!...Let me state the problem and the solution:
From reading this thread http://www.fckeditor.net/forums/viewtopic.php?f=6&t=11290&hilit=+rewrite I copy out the example of passing the userid as a parameter, but it was not working (as you know).
From your last post with, fck:config tag example I realized my problem! Never had thougt that the parameter has to be passed in the connector url string. I thougt it could be passed in the middle of the string (has showed in the example).
So the solution was to put my param at the end of the connector url string and as to start with ? rather then & (starting the query string)!
Finnally got it working! It was about time
Again many thanks for your support.
And keep up the good work you've been doing!
Thanks
Rico
Re: UserPathBuilder and UserAction seems not working.....
Here is me again! Could not pass more then one parameter in the query string!
As you said, I would be able to pass more than one parameter, but i'm not achiving it! Again, if not asking to much, could you confirm?
If I had to the end of the URL connector my param... all works great! like
Then if I put one more parameter with the new one is not passed as a get parameter (firebug tested)!
Tired of debugging.... getting my parameters from parsing the string assigned with request.getHeader("referer")!
Thanks!
Re: UserPathBuilder and UserAction seems not working.....
Why the heck are you using the referer header? User request#getParameter!
Re: UserPathBuilder and UserAction seems not working.....
Thanks Mike!
I was tired of unsuccessfull retries of request.getParameter! So for moving on, I'm getting them from the referer header!
Well... manage to fetch my resources from JCR respository and show them properlly in the dialog and also in editor!
Thanks
Re: UserPathBuilder and UserAction seems not working.....
I have finally managed to run it. All params are now passed as expected!
Right now we have passed:
Which works if you want to pass only one param. If you want to pass more than one, you have to escape the url with URLEncoder#encode(String, String) to:
See the subtle difference.
It was a tricky one but took only 20 min to solve. You should really investigate longer. Firebug is your close friend. I did all with it.
Mike
Re: UserPathBuilder and UserAction seems not working.....
Hi Mike,
Great you it working! I moved to your solution! far better then mine!
Re: UserPathBuilder and UserAction seems not working.....
That's great. Enjoy and share it!
I will mark this down in the FAQ or in some other prominent place. I hope it will be easier to pass params in CKEditor 3.0. You might want to open a ticket on/about it.
Edit: documented: http://dev.fckeditor.net/changeset/3503
Re: UserPathBuilder and UserAction seems not working.....
Ticket #3521!