Commit 9814c366 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

default plugins in frontend are loaded automatically on map start

parent 68a036e6
......@@ -584,24 +584,38 @@ function create(params) {
return customMap.openSubmap(submapId);
}
}).then(function () {
var promises = [];
for (var i = 0; i < params.getPlugins().length; i++) {
promises.push(leftPanel.getPluginManager().addPlugin(params.getPlugins()[i]))
}
if (GuiConnector.getParams['plugins'] !== undefined) {
var hashes = GuiConnector.getParams['plugins'].split(",");
for (i = 0; i < hashes.length; i++) {
promises.push(ServerConnector.getPluginData(hashes[i]).then(function (plugin) {
if (plugin !== null) {
return leftPanel.getPluginManager().addPlugin({url: plugin.getUrls()[0]});
} else {
GuiConnector.warn("Plugin list contains invalid object.");
return ServerConnector.getPluginsData();
}).then(function (allPlugins) {
var promises = [], i;
for (i = 0; i < params.getPlugins().length; i++) {
promises.push(leftPanel.getPluginManager().addPlugin(params.getPlugins()[i]))
}
var hashes = [];
if (GuiConnector.getParams['plugins'] !== undefined) {
hashes = GuiConnector.getParams['plugins'].split(",");
}
for (i = 0; i < allPlugins.length; i++) {
if (hashes.indexOf(allPlugins[i].getHash()) < 0) {
if (allPlugins[i].isDefault()) {
hashes.push(allPlugins[i].getHash());
}
}))
}
}
for (i = 0; i < hashes.length; i++) {
if (hashes[i] !== '') {
promises.push(ServerConnector.getPluginData(hashes[i]).then(function (plugin) {
if (plugin !== null) {
return leftPanel.getPluginManager().addPlugin({url: plugin.getUrls()[0]});
} else {
GuiConnector.warn("Plugin list contains invalid object.");
}
}));
}
}
return Promise.all(promises);
}
return Promise.all(promises);
}).then(function () {
).then(function () {
return ServerConnector.getLoggedUser();
}).then(function (user) {
if (leftPanel.isGoogleLicenseConsentRequired()) {
......
......@@ -189,11 +189,13 @@ Plugin.prototype.load = function () {
Plugin.prototype.getMinWidth = function () {
var value;
var data = this.getLoadedPluginData();
if (data.minWidth !== undefined) {
if (typeof data.minWidth === "function") {
value = parseInt(data.minWidth());
} else {
value = parseInt(data.minWidth);
if (data !== undefined) {
if (data.minWidth !== undefined) {
if (typeof data.minWidth === "function") {
value = parseInt(data.minWidth());
} else {
value = parseInt(data.minWidth);
}
}
}
return value;
......
......@@ -187,6 +187,7 @@ PluginManager.prototype.adjustMinWidth = function () {
var i;
for (i = 0; i < self._plugins.length; i++) {
var plugin = self._plugins[i];
var value = plugin.getMinWidth();
if (value > minWidth) {
minWidth = value;
......
......@@ -141,6 +141,7 @@ public class PluginRestImpl extends BaseRestImpl {
Plugin plugin = pluginDao.getByHash(hash);
if (plugin != null) {
plugin.setPublic(false);
plugin.setDefault(false);
pluginDao.update(plugin);
} else {
throw new ObjectNotFoundException("Plugin doesn't exist");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment