Filemanager
Filemanager copied to clipboard
Update composer.json class autoloading.
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.
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
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>
This is not that easy. Please see also #197