Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set param browseOnly #29

Closed
rhyudek1 opened this issue Aug 10, 2016 · 3 comments
Closed

set param browseOnly #29

rhyudek1 opened this issue Aug 10, 2016 · 3 comments

Comments

@rhyudek1
Copy link

is there any chance to edit parameters in filemanager.config.json in php through the object $fm

regards

@psolom
Copy link
Owner

psolom commented Aug 10, 2016

It should be possible, but due to implementation of plugins support I have removed this capability accidentally. I am going to take a look and bring it back soon.

Anyway you still could, but not through $fm object. Before $fm instance is initialised you are able to read config data from default config file, modify and write it to a new config file on the fly. Something like that:

$scriptsPath = "/your/path/to/folder/scripts/";
$configFile = $scriptsPath . 'filemanager.config.json';
/* creates config file if not exists */
if(!file_exists($configFile)) {
    $configDefaultFile = $scriptsPath . 'filemanager.config.default.json';
    $configDefault = json_decode(file_get_contents($configDefaultFile), true);
    /* modify $configDefault here */
    file_put_contents($configFile, json_encode($configDefault));
}

I don't force you to use this way, you can wait for a fix. I gave this example for a reference mostly.

@psolom
Copy link
Owner

psolom commented Aug 12, 2016

Ok, I have a bit more time for your problem now. Looking thoroughly at the subject of the current issue I found that you want override browseOnly option which relates to the client-side solely. Passing extra config to the constructor of $fm will take effect only for server-side related options like fileRoot etc. It is because the client-side have been already initiated with options from the config file at this point.

Thus the only way for you to override browseOnly option is to do as I suggested in the answer above. You have to execute this code before the 'filemanager(.min).js' file is attached to the page. Put it at the BEGINNING of the page where you are going to include FM html an js files - index.html by default.

On the other hand it's more easy if you have to override some server-side options (NOT the case for browseOnly option). Just make a replacement in the filemanager.php:

$fm = BaseHelper::getInstance();

to

require_once('LocalFilemanager.php');
$fm = new LocalFilemanager([
    'options' => [
        'fileRoot' => '/your/file/root/'
    ],
]);

Either way I'm going to modify filemanager.php file to make thing easier.

@psolom
Copy link
Owner

psolom commented Aug 16, 2016

Done.
You now able to override default configuration in filemanager.php.
But again, it affects only options which are related to server side, browseOnly is not the case. There is a plan discussed in #32 to divide the config file into 2 files to separate server-side options from client-side options to avoid the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants