Filemanager icon indicating copy to clipboard operation
Filemanager copied to clipboard

Update composer.json class autoloading.

Open SamMousa opened this issue 10 years ago • 3 comments
trafficstars

I'm trying to use this filemanager inside a PHP MVC environment. Ideally I'd like to load the FileManager class and provide it an argument so it knows where to look for config.json (if at all)

I think hardcoding paths is bad practice and it should be easily avoidable in this case.

SamMousa avatar Apr 14 '15 10:04 SamMousa

Would you like to propose a fix that works with all configuration cases ?

See also : https://github.com/simogeo/Filemanager/blob/master/utils/path-info.pdf

simogeo avatar Apr 14 '15 12:04 simogeo

The composer.json autoloading is configuration independent; all it needs to do is specify the classname to file mapping for the filemanager class.

The second issue is of configuration could be simply specified by not instantiating from filemanager.js..

Why not have a simpler HTML file to begin with:

    <html>
    <head>
    -- include required scripts.
    </head>
    <body>
    <script>
    filemanager.init('path/to/config.json') // or whatever syntax you want.
    </script>
    </body>
    </html>

This way all use cases that are not the basics can simply specify another path in the html part. Another syntax would be to add the config to the script tag.

    <html>
    <head>
    <script src="/path/to/filemanager.js" data-config="/path/to/config.json"/>
    </head>
    </html>

SamMousa avatar Apr 14 '15 12:04 SamMousa

This is not that easy. Please see also #197

simogeo avatar Apr 14 '15 13:04 simogeo