Skip to content

Allow to fetch json configuration from custom path #329

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

Closed
3 of 17 tasks
helios-ag opened this issue Jun 7, 2018 · 2 comments
Closed
3 of 17 tasks

Allow to fetch json configuration from custom path #329

helios-ag opened this issue Jun 7, 2018 · 2 comments

Comments

@helios-ag
Copy link
Contributor

helios-ag commented Jun 7, 2018

In raising this issue, I confirm the following (please check boxes):

  • I have read and understood the Wiki. Especially deploy and configuration articles.
  • I have checked that the bug I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.
  • I realise that server-side connectors are provided by various contributors. The implementations are vary due to programming language features/limitations or other factors. Thus a particular connector may not implement, or partially implement, the API features.
  • I realise that any changes in configuration options and/or plugin parameters affect the plugin behavior. I specified all the differences from defaults in details.

I use the following server-side connector (check one):

  • PHP connector by servocoder
  • Java connector by fabriceci
  • Python3 Flask connector by jsooter
  • Python3 Flask connector by stevelittlefish
  • NodeJs connector by jlaustill and forestlake
  • ASP.NET Core connector by sinanbozkus
  • ASHX connector by richeflits
  • Other (specified below)

My familiarity with the project is as follows (check one):

  • I have never used the project.
  • I have used the project briefly.
  • I have used the project extensively, but have not contributed previously.
  • I am an active contributor to the project.

Hi!
I want to implement dynamically changeable behavior for client side configuration, (i.e. dynamically build filemanager.config.json). This will for example provide custom UI based on user role.
As far as i can see, paths for configuration files are hardcoded. I propose to add something like configUrl to available options,

var defaults = {
    baseUrl: '.',	// relative path to the FM plugin folder
    configUrl: null, // Config url

and extend loadConfigFile with something like this

var loadConfigFile = function (type) {
	var url = null;
	type = (typeof type === 'undefined') ? 'user' : type;

	if(type === 'user') {
		if(_url_.param('config')) {
			url = fm.settings.baseUrl + '/config/' + _url_.param('config');
		} else {
			url =  fm.settings.configUrl ?  fm.settings.configUrl : fm.settings.baseUrl + '/config/filemanager.config.json'; // if configUrl is defined
		}
	} else {
		url = fm.settings.baseUrl + '/config/filemanager.config.default.json';
	}

	return $.ajax({
		type: 'GET',
		url: url,
		dataType: 'json',
		cache: false,
		error: function(response) {
			fm.error('Given config file (' + url + ') does not exist!');
		}
	});
};
@submediax
Copy link

Al Ganiev hello,
Please consider implementation of this issue as well.
Thanks

@psolom
Copy link
Owner

psolom commented Jun 23, 2018

Your PR have been merged.

@psolom psolom closed this as completed Jun 23, 2018
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

3 participants