Filebrowser: filter files by extension

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Filebrowser: filter files by extension

Post by cmb » Thu Jan 30, 2014 6:56 pm

Hello Community,

in a German thread about KCFinder there was a discussion that might better be lead in this forum. It is about the file types (specified by the file extension) which are visible in the file browser. Currently that solely depends how the filebrowser is initially accessed:
  • Adminmenu -> Files: userfiles
  • Adminmenu -> Files -> Images resp. Editor -> Insert Image: images
  • Adminmenu -> Files -> Downloads resp. Editor -> Insert Link: downloads
  • Adminmenu -> Files -> Media resp. Editor -> Insert Media: media
This was absolutely reasonable in CMSimple_XH 1.5 where it was not possible to enter the other folders, but since XH 1.6 it is possible to call Adminmenu -> Files -> Images, for instance, and surf to the media folder; however, only the allowed image extensions will be visible in there. This might be a good feature or not. Consider you want to insert an image and an according image link for a lightbox (e.g. hi_fancybox). Inserting the image via the insert image dialog works as expected, but inserting the image link via the insert link dialog doesn't, because its browse button opens the filebrowser in "download" mode. That might not be regarded a problem, as one could add the required image file extensions to the allowed extensions for downloads.

However, we may consider to improve the situation. It should be possible to change the behavior completely, so that the allowed extensions don't depend on how the filebrowser was opened, but solely on the current folder. Another possibility would be to only make some exceptions, e.g. only when the filebrowser is opened in "download" mode (e.g. for inserting a link), the current folder is used to determine the allowed extensions; in other modes we could stick with the current solution.

Any suggestions?

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: filter files by extension

Post by cmb » Fri May 09, 2014 11:12 am

cmb wrote:However, we may consider to improve the situation. It should be possible to change the behavior completely, so that the allowed extensions don't depend on how the filebrowser was opened, but solely on the current folder.
I have implemented this (r1271). While doing so, I noticed that it is not possible to switch to the userfiles/ folder, when the filebrowser has been opened for images, downloads or media. I have not changed this behavior, as it may be sensible.

However, I noticed a problem: what to do, if the user configured the four folders to be (partially) the same? In this case the type of the current folder can not be determined unambiguously. A solution would be to catch this case, and fall back to the old behavior. Not sure, if that's the best option though.

Any thoughts?
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: filter files by extension

Post by cmb » Sun May 11, 2014 11:12 am

I have moved a more sophisticated suggestion to its own thread.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: filter files by extension

Post by cmb » Fri May 16, 2014 10:35 pm

cmb wrote:However, I noticed a problem: what to do, if the user configured the four folders to be (partially) the same? In this case the type of the current folder can not be determined unambiguously. A solution would be to catch this case, and fall back to the old behavior. Not sure, if that's the best option though.
We have to solve this issue some way or the other before we can release XH 1.6.2. Besides this issue the release could probably happen in the next few days (most items on the roadmap are already done).
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: filter files by extension

Post by cmb » Thu May 22, 2014 11:44 am

cmb wrote:However, I noticed a problem: what to do, if the user configured the four folders to be (partially) the same? In this case the type of the current folder can not be determined unambiguously. A solution would be to catch this case, and fall back to the old behavior.
I have implemented this (r1303).
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply