Search code examples
javascriptasp.net-mvc-4elfinder

Disabling "Open" in elFinder


Does anybody know a way to disable or in some way modify the "open" functionality in elFinder?

I'm using this in an ASP.NET MVC site and have added additional server-side filtering for file permissions and whatnot. So users don't have direct access to files, everything has to go through the server-side component that feeds elFinder. Thus, whenever someone tries to directly open a file, they get a 404 response.

There are a couple of UX pieces affected by this:

  • Double-clicking a file - I am able to override the dblclick elFilder event and simply return false. However, this carries the undesirable effect that one can't double-click folders to open them.
  • Clicking the "open" menu item - I tried removing the 'open' option from the commands configuration, but the option was still there. A lot of other items were removable (renaming, uploading, anything other than read-only access which I'm denying users in this case), but this one isn't for some reason.
  • Clicking the link in the "info" pop-up. Not sure how to address this one. Maybe customize the "info" pop-up with some template?

Has anybody run into this before and come up with any novel solutions? I'm not against modifying the actual JavaScript for elFinder as a last resort (that would make it operationally more of a pain if I ever want to upgrade elFinder).


Solution

  • Another way to add getfilecallback as follow:

    $('#finder').elfinder({

        url : 'php/connector.php',
        getFileCallback : function(files, fm) {
                return false;
        }
    

    });