Opened 10 years ago

Closed 7 years ago

#5384 closed New Feature (wontfix)

java: create userfilepath according to chosen directory

Reported by: Boudewijn van Weert Owned by:
Priority: Normal Milestone:
Component: Server : Java Version: FCKeditor.Java 2.6
Keywords: Cc:

Description

In the file browser, I've created a virtual file directory that points to another file system directory. What I'd want is in case of choosing that virual directory, the userfilepath also changes. I've managed this by overriding the GetResponse class, and add the following line in the constructor:

		if ("/screens/".equals(currentFolder))
			constructedUrl = <my new userfilepath>

This works fine, it would be nice if this could somehow be plugable/ configurable. It would also be nice if this could be configured for several subdirectories.

I tried to do this by overriding ServerRootPathBuilder.getUserFilesPath, but then the returned path is "<userfilepath>/file/screens/<myFile>", while what I need is "<userfilepath>/<myFile>"

Change History (12)

comment:1 Changed 10 years ago by Michael Osipov

Are you using FCKeditor.Java 2.6??

You are going the wrong way. All you have to do is to implement the PathBuilder interface. Subclassing the ServerRootPathBuilder does probably not was you want. Choose the RootPathConnector and plugin your PathBuilder and your are done. You can construct paths the way you want.

comment:2 in reply to:  1 Changed 10 years ago by Boudewijn van Weert

Replying to mosipov:

Are you using FCKeditor.Java 2.6??

I'm using 2.5 (sorry, that version is not available in the ticket system). The apis seem to coincide with the javadocs on the web (http://java.fckeditor.net/java-core/apidocs)

You are going the wrong way. All you have to do is to implement the PathBuilder interface. Subclassing the ServerRootPathBuilder does probably not was you want. Choose the RootPathConnector and plugin your PathBuilder and your are done. You can construct paths the way you want.

Do you mean LocalConnector and UserPathBuilder? I've created a subclass of LocalConnector to satisfy my needs (that is, show files from another directory if I'm in the virtual directory "screens"). However, if I'm not in this virtual directory, the behaviour should be the default one as you defined it for ServerRootPathBuilder. What I was trying to explain is that if I use my UserPathBuilder (which I tried), the system prepends the result of the getUserFilesPath call, and then adds "/file/screens/<myFile>". But I don't want the "file/screens/" part at all. One way to do this is alter the GetResponse class, as stated before, but it's not too elegant..

comment:3 Changed 10 years ago by Michael Osipov

Sorry for the missing version tag. I seriously didn't notice it.

Is there a need to subclass the LocalConnector at all? It processes the paths as-is passed by a pathbuilder implementation. The path is not tampered anywhere else.

Try with 2.6 please, the entire system has been decoupled from the local filesystem. 2.5 is legacy.

Where did you enter the "/file/screens" prefix? In the fkceditor.properties? You can leave it out.

comment:4 Changed 10 years ago by Boudewijn van Weert

Version: FCKeditor.Java 2.4.1FCKeditor.Java 2.6

I have it working now for version 2.6 I subclass LocalConnector because I add the virtual directory "screens" when the method getFolders is called, and I return my own set of files when the user asks for the files in the "screens" directory. I don't enter the prefix /file/screens, FCKEditor.java does (when I select one of my virtual files in the directory /file/screens) So basically, whan I'd need plugable is a transformation of the final path where the chosen file is into; I want to be able to return a file path without /file/screens, even though the chosen file is chosen in that directory...Right now, the result of pathBuilder is prepended to the chosen file, so when that file is into /file/screens, I get <pathBuilderResult>/file/screens as a result.

comment:5 Changed 10 years ago by Michael Osipov

Ah, finally I see what you want. You want a listener/url interceptor to analyze and modify the result based on with. Right?

comment:6 Changed 10 years ago by Michael Osipov

If so, it is the correct way to subclass LocalConnector and override the getFolders method.

comment:7 Changed 10 years ago by Boudewijn van Weert

That's what I did, but it's not enough. I also needed to change the URL that was passed into the GetResponse constructor. For this purpose, I replaced the original GetResponse class, but this is not very elegant. It would be much more elegant to have a plugable interceptor that could change the result just before it's written as a result.

comment:8 Changed 10 years ago by Michael Osipov

OK, I will take a look into it and will open and describe a new ticket based on the facts. I will let you know in the next couple of days.

The basic idea would be: <baseUrl>/<chosenUrl> right now, you are able to manipulate the baseUrl with the UserPathBuilder interface, you want an interface for the chosenUrl. Is that correct?

comment:9 Changed 10 years ago by Michael Osipov

Please provide some example urls which are given, processed, altered and returned. I'd like to be able to visualize it.

comment:10 Changed 10 years ago by Boudewijn van Weert

This could be a solution. <chosenUrl> should be able to be empty.

examples:

chosen file: file1.txt -> <baseUrl>=/userfiles/file/, <chosenUrl> = file1.txt (normal case)

chosen file: subdir1/file2.txt -> <baseUrl>=/userfiles/file/, <chosenUrl> = subdir1/file2.txt (normal case)

Chosen file: screens/file3.vm -> <baseUrl>=/content/template/ <chosenUrl> = file3.vm (special case: virtual directory)
Chosen file: privatescreens/file4.vm -> <baseUrl>=/privateContent/template/ <chosenUrl> = file4.vm (special case: other virtual directory)

comment:11 Changed 10 years ago by Boudewijn van Weert

Sorry, not necessary that <chosenUrl> should be able to be empty.

comment:12 Changed 7 years ago by Jakub Ś

Resolution: wontfix
Status: newclosed

FCKeditor was retired and is no longer supported. All active development was moved to its successor, CKEditor 3.x, that is a fully mature and far superior product. We recommend you upgrade as soon as possible.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy