Renamed L.Storage in L.U

This commit is contained in:
Yohan Boniface 2018-06-02 12:36:28 +02:00
parent 8049bc74b8
commit 887a9fc7e0
18 changed files with 229 additions and 230 deletions

View file

@ -1,4 +1,4 @@
L.S.AutoComplete = L.Class.extend({ L.U.AutoComplete = L.Class.extend({
options: { options: {
placeholder: 'Start typing...', placeholder: 'Start typing...',
@ -62,22 +62,22 @@ L.S.AutoComplete = L.Class.extend({
onKeyDown: function (e) { onKeyDown: function (e) {
switch (e.keyCode) { switch (e.keyCode) {
case L.S.Keys.TAB: case L.U.Keys.TAB:
if(this.CURRENT !== null) if(this.CURRENT !== null)
{ {
this.setChoice(); this.setChoice();
} }
L.DomEvent.stop(e); L.DomEvent.stop(e);
break; break;
case L.S.Keys.ENTER: case L.U.Keys.ENTER:
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.setChoice(); this.setChoice();
break; break;
case L.S.Keys.ESC: case L.U.Keys.ESC:
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.hide(); this.hide();
break; break;
case L.S.Keys.DOWN: case L.U.Keys.DOWN:
if(this.RESULTS.length > 0) { if(this.RESULTS.length > 0) {
if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl? if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl?
this.CURRENT++; this.CURRENT++;
@ -89,7 +89,7 @@ L.S.AutoComplete = L.Class.extend({
} }
} }
break; break;
case L.S.Keys.UP: case L.U.Keys.UP:
if(this.CURRENT !== null) { if(this.CURRENT !== null) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
} }
@ -109,16 +109,16 @@ L.S.AutoComplete = L.Class.extend({
onKeyUp: function (e) { onKeyUp: function (e) {
var special = [ var special = [
L.S.Keys.TAB, L.U.Keys.TAB,
L.S.Keys.ENTER, L.U.Keys.ENTER,
L.S.Keys.LEFT, L.U.Keys.LEFT,
L.S.Keys.RIGHT, L.U.Keys.RIGHT,
L.S.Keys.DOWN, L.U.Keys.DOWN,
L.S.Keys.UP, L.U.Keys.UP,
L.S.Keys.APPLE, L.U.Keys.APPLE,
L.S.Keys.SHIFT, L.U.Keys.SHIFT,
L.S.Keys.ALT, L.U.Keys.ALT,
L.S.Keys.CTRL L.U.Keys.CTRL
]; ];
if (special.indexOf(e.keyCode) === -1) if (special.indexOf(e.keyCode) === -1)
{ {
@ -260,10 +260,10 @@ L.S.AutoComplete = L.Class.extend({
}); });
L.S.AutoComplete.BaseSelect = L.S.AutoComplete.extend({ L.U.AutoComplete.BaseSelect = L.U.AutoComplete.extend({
initialize: function (el, options) { initialize: function (el, options) {
L.S.AutoComplete.prototype.initialize.call(this, el, options); L.U.AutoComplete.prototype.initialize.call(this, el, options);
if (!this.el) return this; if (!this.el) return this;
this.el.style.display = 'none'; this.el.style.display = 'none';
this.createInput(); this.createInput();
@ -311,7 +311,7 @@ L.S.AutoComplete.BaseSelect = L.S.AutoComplete.extend({
}); });
L.S.AutoComplete.MultiSelect = L.S.AutoComplete.BaseSelect.extend({ L.U.AutoComplete.MultiSelect = L.U.AutoComplete.BaseSelect.extend({
initSelectedContainer: function () { initSelectedContainer: function () {
this.selected_container = L.DomUtil.after(this.input, L.DomUtil.element('ul', {className: 'umap-multiresult'})); this.selected_container = L.DomUtil.after(this.input, L.DomUtil.element('ul', {className: 'umap-multiresult'}));
@ -337,12 +337,12 @@ L.S.AutoComplete.MultiSelect = L.S.AutoComplete.BaseSelect.extend({
}); });
L.S.AutoComplete.multiSelect = function (el, options) { L.U.AutoComplete.multiSelect = function (el, options) {
return new L.S.AutoComplete.MultiSelect(el, options); return new L.U.AutoComplete.MultiSelect(el, options);
}; };
L.S.AutoComplete.Select = L.S.AutoComplete.BaseSelect.extend({ L.U.AutoComplete.Select = L.U.AutoComplete.BaseSelect.extend({
initSelectedContainer: function () { initSelectedContainer: function () {
this.selected_container = L.DomUtil.after(this.input, L.DomUtil.element('div', {className: 'umap-singleresult'})); this.selected_container = L.DomUtil.after(this.input, L.DomUtil.element('div', {className: 'umap-singleresult'}));
@ -368,6 +368,6 @@ L.S.AutoComplete.Select = L.S.AutoComplete.BaseSelect.extend({
}); });
L.S.AutoComplete.select = function (el, options) { L.U.AutoComplete.select = function (el, options) {
return new L.S.AutoComplete.Select(el, options); return new L.U.AutoComplete.Select(el, options);
}; };

View file

@ -1,4 +1,4 @@
L.Storage.BaseAction = L.ToolbarAction.extend({ L.U.BaseAction = L.ToolbarAction.extend({
initialize: function (map) { initialize: function (map) {
this.map = map; this.map = map;
@ -12,7 +12,7 @@ L.Storage.BaseAction = L.ToolbarAction.extend({
}); });
L.Storage.ImportAction = L.Storage.BaseAction.extend({ L.U.ImportAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -26,7 +26,7 @@ L.Storage.ImportAction = L.Storage.BaseAction.extend({
}); });
L.Storage.EditPropertiesAction = L.Storage.BaseAction.extend({ L.U.EditPropertiesAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -40,7 +40,7 @@ L.Storage.EditPropertiesAction = L.Storage.BaseAction.extend({
}); });
L.Storage.ChangeTileLayerAction = L.Storage.BaseAction.extend({ L.U.ChangeTileLayerAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -54,7 +54,7 @@ L.Storage.ChangeTileLayerAction = L.Storage.BaseAction.extend({
}); });
L.Storage.ManageDatalayersAction = L.Storage.BaseAction.extend({ L.U.ManageDatalayersAction = L.U.BaseAction.extend({
options: { options: {
className: 'dark manage-datalayers', className: 'dark manage-datalayers',
@ -67,7 +67,7 @@ L.Storage.ManageDatalayersAction = L.Storage.BaseAction.extend({
}); });
L.Storage.UpdateExtentAction = L.Storage.BaseAction.extend({ L.U.UpdateExtentAction = L.U.BaseAction.extend({
options: { options: {
className: 'update-map-extent dark', className: 'update-map-extent dark',
@ -80,7 +80,7 @@ L.Storage.UpdateExtentAction = L.Storage.BaseAction.extend({
}); });
L.Storage.UpdatePermsAction = L.Storage.BaseAction.extend({ L.U.UpdatePermsAction = L.U.BaseAction.extend({
options: { options: {
className: 'update-map-permissions dark', className: 'update-map-permissions dark',
@ -93,7 +93,7 @@ L.Storage.UpdatePermsAction = L.Storage.BaseAction.extend({
}); });
L.Storage.DrawMarkerAction = L.Storage.BaseAction.extend({ L.U.DrawMarkerAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -107,7 +107,7 @@ L.Storage.DrawMarkerAction = L.Storage.BaseAction.extend({
}); });
L.Storage.DrawPolylineAction = L.Storage.BaseAction.extend({ L.U.DrawPolylineAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -121,7 +121,7 @@ L.Storage.DrawPolylineAction = L.Storage.BaseAction.extend({
}); });
L.Storage.DrawPolygonAction = L.Storage.BaseAction.extend({ L.U.DrawPolygonAction = L.U.BaseAction.extend({
options: { options: {
helpMenu: true, helpMenu: true,
@ -135,7 +135,7 @@ L.Storage.DrawPolygonAction = L.Storage.BaseAction.extend({
}); });
L.Storage.AddPolylineShapeAction = L.Storage.BaseAction.extend({ L.U.AddPolylineShapeAction = L.U.BaseAction.extend({
options: { options: {
className: 'storage-draw-polyline-multi dark', className: 'storage-draw-polyline-multi dark',
@ -148,7 +148,7 @@ L.Storage.AddPolylineShapeAction = L.Storage.BaseAction.extend({
}); });
L.Storage.AddPolygonShapeAction = L.S.AddPolylineShapeAction.extend({ L.U.AddPolygonShapeAction = L.U.AddPolylineShapeAction.extend({
options: { options: {
className: 'storage-draw-polygon-multi dark', className: 'storage-draw-polygon-multi dark',
@ -157,7 +157,7 @@ L.Storage.AddPolygonShapeAction = L.S.AddPolylineShapeAction.extend({
}); });
L.Storage.BaseFeatureAction = L.ToolbarAction.extend({ L.U.BaseFeatureAction = L.ToolbarAction.extend({
initialize: function (map, feature, latlng) { initialize: function (map, feature, latlng) {
this.map = map; this.map = map;
@ -180,7 +180,7 @@ L.Storage.BaseFeatureAction = L.ToolbarAction.extend({
}); });
L.Storage.CreateHoleAction = L.S.BaseFeatureAction.extend({ L.U.CreateHoleAction = L.U.BaseFeatureAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -195,7 +195,7 @@ L.Storage.CreateHoleAction = L.S.BaseFeatureAction.extend({
}); });
L.Storage.ToggleEditAction = L.S.BaseFeatureAction.extend({ L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -211,7 +211,7 @@ L.Storage.ToggleEditAction = L.S.BaseFeatureAction.extend({
}); });
L.Storage.DeleteFeatureAction = L.S.BaseFeatureAction.extend({ L.U.DeleteFeatureAction = L.U.BaseFeatureAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -230,7 +230,7 @@ L.Storage.DeleteFeatureAction = L.S.BaseFeatureAction.extend({
}); });
L.Storage.DeleteShapeAction = L.S.BaseFeatureAction.extend({ L.U.DeleteShapeAction = L.U.BaseFeatureAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -245,7 +245,7 @@ L.Storage.DeleteShapeAction = L.S.BaseFeatureAction.extend({
}); });
L.Storage.ExtractShapeFromMultiAction = L.S.BaseFeatureAction.extend({ L.U.ExtractShapeFromMultiAction = L.U.BaseFeatureAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -260,16 +260,16 @@ L.Storage.ExtractShapeFromMultiAction = L.S.BaseFeatureAction.extend({
}); });
L.Storage.BaseVertexAction = L.S.BaseFeatureAction.extend({ L.U.BaseVertexAction = L.U.BaseFeatureAction.extend({
initialize: function (map, feature, latlng, vertex) { initialize: function (map, feature, latlng, vertex) {
this.vertex = vertex; this.vertex = vertex;
L.S.BaseFeatureAction.prototype.initialize.call(this, map, feature, latlng); L.U.BaseFeatureAction.prototype.initialize.call(this, map, feature, latlng);
} }
}); });
L.Storage.DeleteVertexAction = L.S.BaseVertexAction.extend({ L.U.DeleteVertexAction = L.U.BaseVertexAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -284,7 +284,7 @@ L.Storage.DeleteVertexAction = L.S.BaseVertexAction.extend({
}); });
L.Storage.SplitLineAction = L.S.BaseVertexAction.extend({ L.U.SplitLineAction = L.U.BaseVertexAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -299,7 +299,7 @@ L.Storage.SplitLineAction = L.S.BaseVertexAction.extend({
}); });
L.Storage.ContinueLineAction = L.S.BaseVertexAction.extend({ L.U.ContinueLineAction = L.U.BaseVertexAction.extend({
options: { options: {
toolbarIcon: { toolbarIcon: {
@ -315,8 +315,8 @@ L.Storage.ContinueLineAction = L.S.BaseVertexAction.extend({
}); });
// Leaflet.Toolbar doesn't allow twice same toolbar class… // Leaflet.Toolbar doesn't allow twice same toolbar class…
L.Storage.SettingsToolbar = L.Toolbar.Control.extend({}); L.U.SettingsToolbar = L.Toolbar.Control.extend({});
L.Storage.DrawToolbar = L.Toolbar.Control.extend({ L.U.DrawToolbar = L.Toolbar.Control.extend({
initialize: function (options) { initialize: function (options) {
L.Toolbar.Control.prototype.initialize.call(this, options); L.Toolbar.Control.prototype.initialize.call(this, options);
@ -327,18 +327,18 @@ L.Storage.DrawToolbar = L.Toolbar.Control.extend({
appendToContainer: function (container) { appendToContainer: function (container) {
this.options.actions = []; this.options.actions = [];
if (this.map.options.enableMarkerDraw) { if (this.map.options.enableMarkerDraw) {
this.options.actions.push(L.S.DrawMarkerAction); this.options.actions.push(L.U.DrawMarkerAction);
} }
if (this.map.options.enablePolylineDraw) { if (this.map.options.enablePolylineDraw) {
this.options.actions.push(L.S.DrawPolylineAction); this.options.actions.push(L.U.DrawPolylineAction);
if (this.map.editedFeature && this.map.editedFeature instanceof L.S.Polyline) { if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polyline) {
this.options.actions.push(L.S.AddPolylineShapeAction); this.options.actions.push(L.U.AddPolylineShapeAction);
} }
} }
if (this.map.options.enablePolygonDraw) { if (this.map.options.enablePolygonDraw) {
this.options.actions.push(L.S.DrawPolygonAction); this.options.actions.push(L.U.DrawPolygonAction);
if (this.map.editedFeature && this.map.editedFeature instanceof L.S.Polygon) { if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polygon) {
this.options.actions.push(L.S.AddPolygonShapeAction); this.options.actions.push(L.U.AddPolygonShapeAction);
} }
} }
L.Toolbar.Control.prototype.appendToContainer.call(this, container); L.Toolbar.Control.prototype.appendToContainer.call(this, container);
@ -353,7 +353,7 @@ L.Storage.DrawToolbar = L.Toolbar.Control.extend({
}); });
L.Storage.EditControl = L.Control.extend({ L.U.EditControl = L.Control.extend({
options: { options: {
position: 'topright' position: 'topright'
@ -396,7 +396,7 @@ L.Control.Embed = L.Control.extend({
} }
}); });
L.Storage.MoreControls = L.Control.extend({ L.U.MoreControls = L.Control.extend({
options: { options: {
position: 'topleft' position: 'topleft'
@ -434,7 +434,7 @@ L.Storage.MoreControls = L.Control.extend({
}); });
L.Storage.DataLayersControl = L.Control.extend({ L.U.DataLayersControl = L.Control.extend({
options: { options: {
position: 'topleft' position: 'topleft'
@ -543,7 +543,7 @@ L.Storage.DataLayersControl = L.Control.extend({
this.map.eachDataLayerReverse(function (datalayer) { this.map.eachDataLayerReverse(function (datalayer) {
this.addDataLayer(container, datalayer, true); this.addDataLayer(container, datalayer, true);
}, this); }, this);
var orderable = new L.S.Orderable(container); var orderable = new L.U.Orderable(container);
orderable.on('drop', function (e) { orderable.on('drop', function (e) {
var layer = this.map.datalayers[e.src.dataset.id], var layer = this.map.datalayers[e.src.dataset.id],
other = this.map.datalayers[e.dst.dataset.id], other = this.map.datalayers[e.dst.dataset.id],
@ -571,7 +571,7 @@ L.Storage.DataLayersControl = L.Control.extend({
}); });
L.Storage.DataLayer.include({ L.U.DataLayer.include({
renderToolbox: function (container) { renderToolbox: function (container) {
var toggle = L.DomUtil.create('i', 'layer-toggle', container), var toggle = L.DomUtil.create('i', 'layer-toggle', container),
@ -632,14 +632,14 @@ L.Storage.DataLayer.include({
}); });
L.Storage.DataLayer.addInitHook(function () { L.U.DataLayer.addInitHook(function () {
this.on('hide', this.propagateHide); this.on('hide', this.propagateHide);
this.on('show', this.propagateShow); this.on('show', this.propagateShow);
this.propagateShow(); this.propagateShow();
}); });
L.Storage.Map.include({ L.U.Map.include({
_openBrowser: function () { _openBrowser: function () {
var browserContainer = L.DomUtil.create('div', 'storage-browse-data'), var browserContainer = L.DomUtil.create('div', 'storage-browse-data'),
@ -657,7 +657,7 @@ L.Storage.Map.include({
edit = L.DomUtil.create('i', 'show-on-edit feature-edit', feature_li), edit = L.DomUtil.create('i', 'show-on-edit feature-edit', feature_li),
color = L.DomUtil.create('i', 'feature-color', feature_li), color = L.DomUtil.create('i', 'feature-color', feature_li),
title = L.DomUtil.create('span', 'feature-title', feature_li), title = L.DomUtil.create('span', 'feature-title', feature_li),
symbol = feature._getIconUrl ? L.S.Icon.prototype.formatUrl(feature._getIconUrl(), feature): null; symbol = feature._getIconUrl ? L.U.Icon.prototype.formatUrl(feature._getIconUrl(), feature): null;
zoom_to.title = L._('Bring feature to center'); zoom_to.title = L._('Bring feature to center');
edit.title = L._('Edit this feature'); edit.title = L._('Edit this feature');
title.innerHTML = feature.getDisplayName() || '—'; title.innerHTML = feature.getDisplayName() || '—';
@ -728,7 +728,7 @@ L.Storage.Map.include({
L.Storage.TileLayerControl = L.Control.extend({ L.U.TileLayerControl = L.Control.extend({
options: { options: {
position: 'topleft' position: 'topleft'
}, },
@ -777,7 +777,7 @@ L.Storage.TileLayerControl = L.Control.extend({
}); });
L.S.AttributionControl = L.Control.Attribution.extend({ L.U.AttributionControl = L.Control.Attribution.extend({
options: { options: {
prefix: '' prefix: ''
@ -803,7 +803,7 @@ L.S.AttributionControl = L.Control.Attribution.extend({
}); });
L.Storage.LocateControl = L.Control.extend({ L.U.LocateControl = L.Control.extend({
options: { options: {
position: 'topleft' position: 'topleft'
@ -831,7 +831,7 @@ L.Storage.LocateControl = L.Control.extend({
}); });
L.Storage.Search = L.PhotonSearch.extend({ L.U.Search = L.PhotonSearch.extend({
onBlur: function (e) { onBlur: function (e) {
// Overrided because we don't want to hide the results on blur. // Overrided because we don't want to hide the results on blur.
@ -873,7 +873,7 @@ L.Storage.Search = L.PhotonSearch.extend({
}); });
L.Storage.SearchControl = L.Control.extend({ L.U.SearchControl = L.Control.extend({
options: { options: {
position: 'topleft', position: 'topleft',
@ -905,7 +905,7 @@ L.Storage.SearchControl = L.Control.extend({
title.textContent = L._('Search location'); title.textContent = L._('Search location');
var input = L.DomUtil.create('input', 'photon-input', container); var input = L.DomUtil.create('input', 'photon-input', container);
var resultsContainer = L.DomUtil.create('div', 'photon-autocomplete', container); var resultsContainer = L.DomUtil.create('div', 'photon-autocomplete', container);
this.search = new L.S.Search(map, input, options); this.search = new L.U.Search(map, input, options);
var id = Math.random(); var id = Math.random();
this.search.on('ajax:send', function () { this.search.on('ajax:send', function () {
map.fire('dataloading', {id: id}); map.fire('dataloading', {id: id});
@ -969,7 +969,7 @@ L.Control.Loading.include({
/* /*
* Make it dynamic * Make it dynamic
*/ */
L.S.ContextMenu = L.Map.ContextMenu.extend({ L.U.ContextMenu = L.Map.ContextMenu.extend({
_createItems: function (e) { _createItems: function (e) {
this._map.setContextMenuItems(e); this._map.setContextMenuItems(e);
@ -985,7 +985,7 @@ L.S.ContextMenu = L.Map.ContextMenu.extend({
}); });
L.S.IframeExporter = L.Class.extend({ L.U.IframeExporter = L.Class.extend({
includes: [L.Mixin.Events], includes: [L.Mixin.Events],
options: { options: {
@ -1048,7 +1048,7 @@ L.S.IframeExporter = L.Class.extend({
}); });
L.S.Editable = L.Editable.extend({ L.U.Editable = L.Editable.extend({
initialize: function (map, options) { initialize: function (map, options) {
L.Editable.prototype.initialize.call(this, map, options); L.Editable.prototype.initialize.call(this, map, options);
@ -1057,7 +1057,7 @@ L.S.Editable = L.Editable.extend({
// Layer for items added by users // Layer for items added by users
this.on('editable:drawing:cancel', function (e) { this.on('editable:drawing:cancel', function (e) {
if (e.layer._latlngs && e.layer._latlngs.length < e.layer.editor.MIN_VERTEX) e.layer.del(); if (e.layer._latlngs && e.layer._latlngs.length < e.layer.editor.MIN_VERTEX) e.layer.del();
if (e.layer instanceof L.S.Marker) e.layer.del(); if (e.layer instanceof L.U.Marker) e.layer.del();
}); });
this.on('editable:drawing:commit', function (e) { this.on('editable:drawing:commit', function (e) {
e.layer.isDirty = true; e.layer.isDirty = true;
@ -1082,16 +1082,16 @@ L.S.Editable = L.Editable.extend({
}, },
createPolyline: function (latlngs) { createPolyline: function (latlngs) {
return new L.Storage.Polyline(this.map, latlngs); return new L.U.Polyline(this.map, latlngs);
}, },
createPolygon: function (latlngs) { createPolygon: function (latlngs) {
var polygon = new L.Storage.Polygon(this.map, latlngs); var polygon = new L.U.Polygon(this.map, latlngs);
return polygon; return polygon;
}, },
createMarker: function (latlng) { createMarker: function (latlng) {
return new L.Storage.Marker(this.map, latlng); return new L.U.Marker(this.map, latlng);
}, },
connectCreatedToMap: function (layer) { connectCreatedToMap: function (layer) {

View file

@ -1,9 +1,8 @@
/* Poor man pub/sub handler, enough for now */ /* Poor man pub/sub handler, enough for now */
L.StorageSingleton = L.Evented.extend({}); L.UmapSingleton = L.Evented.extend({});
L.Storage = new L.StorageSingleton(); L.U = new L.UmapSingleton();
L.S = L.Storage; L.U.Map = L.Map.extend({});
L.Storage.Map = L.Map.extend({});
/* /*
* Utils * Utils
@ -268,7 +267,7 @@ L.DomEvent.once = function (el, types, fn, context) {
/* /*
* Global events * Global events
*/ */
L.S.Keys = { L.U.Keys = {
LEFT: 37, LEFT: 37,
UP: 38, UP: 38,
RIGHT: 39, RIGHT: 39,
@ -292,7 +291,7 @@ L.S.Keys = {
}; };
L.Storage.Help = L.Class.extend({ L.U.Help = L.Class.extend({
initialize: function (map) { initialize: function (map) {
this.map = map; this.map = map;
@ -432,7 +431,7 @@ L.Storage.Help = L.Class.extend({
}); });
L.Storage.Orderable = L.Evented.extend({ L.U.Orderable = L.Evented.extend({
options: { options: {
selector: 'li', selector: 'li',

View file

@ -1,4 +1,4 @@
L.Storage.FeatureMixin = { L.U.FeatureMixin = {
staticOptions: {}, staticOptions: {},
@ -76,7 +76,7 @@ L.Storage.FeatureMixin = {
if(!this.map.editEnabled || this.isReadOnly()) return; if(!this.map.editEnabled || this.isReadOnly()) return;
var container = L.DomUtil.create('div'); var container = L.DomUtil.create('div');
var builder = new L.S.FormBuilder(this, ['datalayer'], { var builder = new L.U.FormBuilder(this, ['datalayer'], {
callback: function () {this.edit(e);} // removeLayer step will close the edit panel, let's reopen it callback: function () {this.edit(e);} // removeLayer step will close the edit panel, let's reopen it
}); });
container.appendChild(builder.build()); container.appendChild(builder.build());
@ -90,7 +90,7 @@ L.Storage.FeatureMixin = {
// We always want name and description for now (properties management to come) // We always want name and description for now (properties management to come)
properties.unshift('properties.description'); properties.unshift('properties.description');
properties.unshift('properties.name'); properties.unshift('properties.name');
builder = new L.S.FormBuilder(this, properties, builder = new L.U.FormBuilder(this, properties,
{ {
id: 'storage-feature-properties', id: 'storage-feature-properties',
callback: this.resetTooltip callback: this.resetTooltip
@ -117,7 +117,7 @@ L.Storage.FeatureMixin = {
appendEditFieldsets: function (container) { appendEditFieldsets: function (container) {
var optionsFields = this.getShapeOptions(); var optionsFields = this.getShapeOptions();
var builder = new L.S.FormBuilder(this, optionsFields, { var builder = new L.U.FormBuilder(this, optionsFields, {
id: 'storage-feature-shape-properties', id: 'storage-feature-shape-properties',
callback: this._redraw callback: this._redraw
}); });
@ -125,7 +125,7 @@ L.Storage.FeatureMixin = {
shapeProperties.appendChild(builder.build()); shapeProperties.appendChild(builder.build());
var advancedOptions = this.getAdvancedOptions(); var advancedOptions = this.getAdvancedOptions();
var builder = new L.S.FormBuilder(this, advancedOptions, { var builder = new L.U.FormBuilder(this, advancedOptions, {
id: 'storage-feature-advanced-properties', id: 'storage-feature-advanced-properties',
callback: this._redraw callback: this._redraw
}); });
@ -133,7 +133,7 @@ L.Storage.FeatureMixin = {
advancedProperties.appendChild(builder.build()); advancedProperties.appendChild(builder.build());
var interactionOptions = this.getInteractionOptions(); var interactionOptions = this.getInteractionOptions();
builder = new L.S.FormBuilder(this, interactionOptions, { builder = new L.U.FormBuilder(this, interactionOptions, {
callback: this._redraw callback: this._redraw
}); });
var popupFieldset = L.DomUtil.createFieldset(container, L._('Interaction options')); var popupFieldset = L.DomUtil.createFieldset(container, L._('Interaction options'));
@ -166,7 +166,7 @@ L.Storage.FeatureMixin = {
}, },
getPopupClass: function () { getPopupClass: function () {
return L.Storage.Popup[this.getOption('popupTemplate')] || L.Storage.Popup; return L.U.Popup[this.getOption('popupTemplate')] || L.U.Popup;
}, },
attachPopup: function () { attachPopup: function () {
@ -327,7 +327,7 @@ L.Storage.FeatureMixin = {
}, },
getInplaceToolbarActions: function (e) { getInplaceToolbarActions: function (e) {
return [L.S.ToggleEditAction, L.S.DeleteFeatureAction]; return [L.U.ToggleEditAction, L.U.DeleteFeatureAction];
}, },
_showContextMenu: function (e) { _showContextMenu: function (e) {
@ -417,7 +417,7 @@ L.Storage.FeatureMixin = {
}, },
getVertexActions: function () { getVertexActions: function () {
return [L.S.DeleteVertexAction]; return [L.U.DeleteVertexAction];
}, },
isMulti: function () { isMulti: function () {
@ -426,16 +426,16 @@ L.Storage.FeatureMixin = {
}; };
L.Storage.Marker = L.Marker.extend({ L.U.Marker = L.Marker.extend({
parentClass: L.Marker, parentClass: L.Marker,
includes: [L.Storage.FeatureMixin, L.Mixin.Events], includes: [L.U.FeatureMixin, L.Mixin.Events],
preInit: function () { preInit: function () {
this.setIcon(this.getIcon()); this.setIcon(this.getIcon());
}, },
addInteractions: function () { addInteractions: function () {
L.Storage.FeatureMixin.addInteractions.call(this); L.U.FeatureMixin.addInteractions.call(this);
this.on('dragend', function (e) { this.on('dragend', function (e) {
this.isDirty = true; this.isDirty = true;
this.edit(e); this.edit(e);
@ -488,7 +488,7 @@ L.Storage.Marker = L.Marker.extend({
disconnectFromDataLayer: function (datalayer) { disconnectFromDataLayer: function (datalayer) {
this.options.icon.datalayer = null; this.options.icon.datalayer = null;
L.Storage.FeatureMixin.disconnectFromDataLayer.call(this, datalayer); L.U.FeatureMixin.disconnectFromDataLayer.call(this, datalayer);
}, },
_getIconUrl: function (name) { _getIconUrl: function (name) {
@ -501,7 +501,7 @@ L.Storage.Marker = L.Marker.extend({
}, },
getIcon: function () { getIcon: function () {
var Class = L.Storage.Icon[this.getIconClass()] || L.Storage.Icon.Default; var Class = L.U.Icon[this.getIconClass()] || L.U.Icon.Default;
return new Class(this.map, {feature: this}); return new Class(this.map, {feature: this});
}, },
@ -528,12 +528,12 @@ L.Storage.Marker = L.Marker.extend({
}, },
appendEditFieldsets: function (container) { appendEditFieldsets: function (container) {
L.Storage.FeatureMixin.appendEditFieldsets.call(this, container); L.U.FeatureMixin.appendEditFieldsets.call(this, container);
var coordinatesOptions = [ var coordinatesOptions = [
['_latlng.lat', {handler: 'FloatInput', label: L._('Latitude')}], ['_latlng.lat', {handler: 'FloatInput', label: L._('Latitude')}],
['_latlng.lng', {handler: 'FloatInput', label: L._('Longitude')}] ['_latlng.lng', {handler: 'FloatInput', label: L._('Longitude')}]
]; ];
var builder = new L.S.FormBuilder(this, coordinatesOptions, { var builder = new L.U.FormBuilder(this, coordinatesOptions, {
callback: function () { callback: function () {
this._redraw(); this._redraw();
this.bringToCenter(); this.bringToCenter();
@ -549,7 +549,7 @@ L.Storage.Marker = L.Marker.extend({
// callback is mandatory for zoomToShowLayer // callback is mandatory for zoomToShowLayer
this.datalayer.layer.zoomToShowLayer(this, e.callback || function (){}); this.datalayer.layer.zoomToShowLayer(this, e.callback || function (){});
} else { } else {
L.Storage.FeatureMixin.bringToCenter.call(this, e); L.U.FeatureMixin.bringToCenter.call(this, e);
} }
}, },
@ -565,10 +565,10 @@ L.Storage.Marker = L.Marker.extend({
}); });
L.Storage.PathMixin = { L.U.PathMixin = {
connectToDataLayer: function (datalayer) { connectToDataLayer: function (datalayer) {
L.S.FeatureMixin.connectToDataLayer.call(this, datalayer); L.U.FeatureMixin.connectToDataLayer.call(this, datalayer);
// We keep markers on their own layer on top of the paths. // We keep markers on their own layer on top of the paths.
this.options.pane = this.datalayer.pane; this.options.pane = this.datalayer.pane;
}, },
@ -576,7 +576,7 @@ L.Storage.PathMixin = {
edit: function (e) { edit: function (e) {
if(this.map.editEnabled) { if(this.map.editEnabled) {
if (!this.editEnabled()) this.enableEdit(); if (!this.editEnabled()) this.enableEdit();
L.Storage.FeatureMixin.edit.call(this, e); L.U.FeatureMixin.edit.call(this, e);
} }
}, },
@ -656,7 +656,7 @@ L.Storage.PathMixin = {
// this.map.off('showmeasure', this.showMeasureTooltip, this); // this.map.off('showmeasure', this.showMeasureTooltip, this);
// this.map.off('hidemeasure', this.removeTooltip, this); // this.map.off('hidemeasure', this.removeTooltip, this);
if (this.editing && this.editing.enabled()) this.editing.removeHooks(); if (this.editing && this.editing.enabled()) this.editing.removeHooks();
L.S.FeatureMixin.onRemove.call(this, map); L.U.FeatureMixin.onRemove.call(this, map);
}, },
getBestZoom: function () { getBestZoom: function () {
@ -667,7 +667,7 @@ L.Storage.PathMixin = {
endEdit: function () { endEdit: function () {
this.disableEdit(); this.disableEdit();
L.S.FeatureMixin.endEdit.call(this); L.U.FeatureMixin.endEdit.call(this);
}, },
_onMouseOver: function () { _onMouseOver: function () {
@ -679,7 +679,7 @@ L.Storage.PathMixin = {
}, },
addInteractions: function () { addInteractions: function () {
L.S.FeatureMixin.addInteractions.call(this); L.U.FeatureMixin.addInteractions.call(this);
this.on('mouseover', this._onMouseOver); this.on('mouseover', this._onMouseOver);
this.on('edit', this.makeDirty); this.on('edit', this.makeDirty);
this.on('drag editable:drag', this._onDrag); this.on('drag editable:drag', this._onDrag);
@ -703,14 +703,14 @@ L.Storage.PathMixin = {
this.disableEdit(); this.disableEdit();
if (!shape) return; if (!shape) return;
var properties = this.cloneProperties(); var properties = this.cloneProperties();
var other = new (this instanceof L.S.Polyline ? L.S.Polyline : L.S.Polygon)(this.map, shape, {geojson: {properties: properties}}); var other = new (this instanceof L.U.Polyline ? L.U.Polyline : L.U.Polygon)(this.map, shape, {geojson: {properties: properties}});
this.datalayer.addLayer(other); this.datalayer.addLayer(other);
other.edit(); other.edit();
return other; return other;
}, },
getContextMenuItems: function (e) { getContextMenuItems: function (e) {
var items = L.S.FeatureMixin.getContextMenuItems.call(this, e); var items = L.U.FeatureMixin.getContextMenuItems.call(this, e);
items.push({ items.push({
text: L._('Display measure'), text: L._('Display measure'),
callback: function () { callback: function () {
@ -747,7 +747,7 @@ L.Storage.PathMixin = {
}, },
getContextMenuEditItems: function (e) { getContextMenuEditItems: function (e) {
var items = L.S.FeatureMixin.getContextMenuEditItems.call(this, e); var items = L.U.FeatureMixin.getContextMenuEditItems.call(this, e);
items.push({ items.push({
text: L._('Clone this feature'), text: L._('Clone this feature'),
callback: this.clone, callback: this.clone,
@ -775,10 +775,10 @@ L.Storage.PathMixin = {
}, },
getInplaceToolbarActions: function (e) { getInplaceToolbarActions: function (e) {
var items = L.S.FeatureMixin.getInplaceToolbarActions.call(this, e); var items = L.U.FeatureMixin.getInplaceToolbarActions.call(this, e);
if (this.isMulti()) { if (this.isMulti()) {
items.push(L.S.DeleteShapeAction); items.push(L.U.DeleteShapeAction);
items.push(L.S.ExtractShapeFromMultiAction); items.push(L.U.ExtractShapeFromMultiAction);
} }
return items; return items;
}, },
@ -797,9 +797,9 @@ L.Storage.PathMixin = {
}; };
L.Storage.Polyline = L.Polyline.extend({ L.U.Polyline = L.Polyline.extend({
parentClass: L.Polyline, parentClass: L.Polyline,
includes: [L.Storage.FeatureMixin, L.Storage.PathMixin, L.Mixin.Events], includes: [L.U.FeatureMixin, L.U.PathMixin, L.Mixin.Events],
staticOptions: { staticOptions: {
stroke: true, stroke: true,
@ -807,7 +807,7 @@ L.Storage.Polyline = L.Polyline.extend({
}, },
isSameClass: function (other) { isSameClass: function (other) {
return other instanceof L.S.Polyline; return other instanceof L.U.Polyline;
}, },
getClassName: function () { getClassName: function () {
@ -820,7 +820,7 @@ L.Storage.Polyline = L.Polyline.extend({
}, },
getContextMenuEditItems: function (e) { getContextMenuEditItems: function (e) {
var items = L.S.PathMixin.getContextMenuEditItems.call(this, e), var items = L.U.PathMixin.getContextMenuEditItems.call(this, e),
vertexClicked = e.vertex, index; vertexClicked = e.vertex, index;
if (!this.isMulti()) { if (!this.isMulti()) {
items.push({ items.push({
@ -849,7 +849,7 @@ L.Storage.Polyline = L.Polyline.extend({
}, },
getContextMenuMultiItems: function (e) { getContextMenuMultiItems: function (e) {
var items = L.S.PathMixin.getContextMenuMultiItems.call(this, e); var items = L.U.PathMixin.getContextMenuMultiItems.call(this, e);
items.push({ items.push({
text: L._('Merge lines'), text: L._('Merge lines'),
callback: this.mergeShapes, callback: this.mergeShapes,
@ -868,7 +868,7 @@ L.Storage.Polyline = L.Polyline.extend({
}, },
getAdvancedEditActions: function (container) { getAdvancedEditActions: function (container) {
L.Storage.FeatureMixin.getAdvancedEditActions.call(this, container); L.U.FeatureMixin.getAdvancedEditActions.call(this, container);
var toPolygon = L.DomUtil.create('a', 'button storage-to-polygon', container); var toPolygon = L.DomUtil.create('a', 'button storage-to-polygon', container);
toPolygon.href = '#'; toPolygon.href = '#';
toPolygon.innerHTML = L._('Transform to polygon'); toPolygon.innerHTML = L._('Transform to polygon');
@ -925,21 +925,21 @@ L.Storage.Polyline = L.Polyline.extend({
}, },
getVertexActions: function (e) { getVertexActions: function (e) {
var actions = L.S.FeatureMixin.getVertexActions.call(this, e), var actions = L.U.FeatureMixin.getVertexActions.call(this, e),
index = e.vertex.getIndex(); index = e.vertex.getIndex();
if (index === 0 || index === e.vertex.getLastIndex()) actions.push(L.S.ContinueLineAction); if (index === 0 || index === e.vertex.getLastIndex()) actions.push(L.U.ContinueLineAction);
else actions.push(L.S.SplitLineAction); else actions.push(L.U.SplitLineAction);
return actions; return actions;
} }
}); });
L.Storage.Polygon = L.Polygon.extend({ L.U.Polygon = L.Polygon.extend({
parentClass: L.Polygon, parentClass: L.Polygon,
includes: [L.Storage.FeatureMixin, L.Storage.PathMixin, L.Mixin.Events], includes: [L.U.FeatureMixin, L.U.PathMixin, L.Mixin.Events],
isSameClass: function (other) { isSameClass: function (other) {
return other instanceof L.S.Polygon; return other instanceof L.U.Polygon;
}, },
getClassName: function () { getClassName: function () {
@ -947,7 +947,7 @@ L.Storage.Polygon = L.Polygon.extend({
}, },
getShapeOptions: function () { getShapeOptions: function () {
var options = L.Storage.PathMixin.getShapeOptions(); var options = L.U.PathMixin.getShapeOptions();
options.push('properties._storage_options.stroke', options.push('properties._storage_options.stroke',
'properties._storage_options.fill', 'properties._storage_options.fill',
'properties._storage_options.fillColor', 'properties._storage_options.fillColor',
@ -962,7 +962,7 @@ L.Storage.Polygon = L.Polygon.extend({
['properties._storage_options.outlink', {label: L._('Link to…'), helpEntries: 'outlink', placeholder: 'http://...', inheritable: true}], ['properties._storage_options.outlink', {label: L._('Link to…'), helpEntries: 'outlink', placeholder: 'http://...', inheritable: true}],
['properties._storage_options.outlinkTarget', {handler: 'OutlinkTarget', label: L._('Open link in…'), inheritable: true}] ['properties._storage_options.outlinkTarget', {handler: 'OutlinkTarget', label: L._('Open link in…'), inheritable: true}]
]; ];
return options.concat(L.Storage.FeatureMixin.getInteractionOptions()); return options.concat(L.U.FeatureMixin.getInteractionOptions());
}, },
getMeasure: function () { getMeasure: function () {
@ -971,7 +971,7 @@ L.Storage.Polygon = L.Polygon.extend({
}, },
getContextMenuEditItems: function (e) { getContextMenuEditItems: function (e) {
var items = L.S.PathMixin.getContextMenuEditItems.call(this, e), var items = L.U.PathMixin.getContextMenuEditItems.call(this, e),
shape = this.shapeAt(e.latlng); shape = this.shapeAt(e.latlng);
// No multi and no holes. // No multi and no holes.
if (shape && !this.isMulti() && (L.LineUtil.isFlat(shape) || shape.length === 1)) { if (shape && !this.isMulti() && (L.LineUtil.isFlat(shape) || shape.length === 1)) {
@ -1003,7 +1003,7 @@ L.Storage.Polygon = L.Polygon.extend({
}, },
getAdvancedEditActions: function (container) { getAdvancedEditActions: function (container) {
L.Storage.FeatureMixin.getAdvancedEditActions.call(this, container); L.U.FeatureMixin.getAdvancedEditActions.call(this, container);
var toPolyline = L.DomUtil.create('a', 'button storage-to-polyline', container); var toPolyline = L.DomUtil.create('a', 'button storage-to-polyline', container);
toPolyline.href = '#'; toPolyline.href = '#';
toPolyline.innerHTML = L._('Transform to lines'); toPolyline.innerHTML = L._('Transform to lines');
@ -1016,8 +1016,8 @@ L.Storage.Polygon = L.Polygon.extend({
}, },
getInplaceToolbarActions: function (e) { getInplaceToolbarActions: function (e) {
var items = L.S.PathMixin.getInplaceToolbarActions.call(this, e); var items = L.U.PathMixin.getInplaceToolbarActions.call(this, e);
items.push(L.S.CreateHoleAction); items.push(L.U.CreateHoleAction);
return items; return items;
} }

View file

@ -601,7 +601,7 @@ L.FormBuilder.Range = L.FormBuilder.Input.extend({
}); });
L.Storage.FormBuilder = L.FormBuilder.extend({ L.U.FormBuilder = L.FormBuilder.extend({
options: { options: {
className: 'storage-form' className: 'storage-form'

View file

@ -1,4 +1,4 @@
L.Storage.Icon = L.DivIcon.extend({ L.U.Icon = L.DivIcon.extend({
initialize: function(map, options) { initialize: function(map, options) {
this.map = map; this.map = map;
var default_options = { var default_options = {
@ -35,7 +35,7 @@ L.Storage.Icon = L.DivIcon.extend({
}); });
L.Storage.Icon.Default = L.Storage.Icon.extend({ L.U.Icon.Default = L.U.Icon.extend({
default_options: { default_options: {
iconAnchor: new L.Point(16, 40), iconAnchor: new L.Point(16, 40),
popupAnchor: new L.Point(0, -40), popupAnchor: new L.Point(0, -40),
@ -45,7 +45,7 @@ L.Storage.Icon.Default = L.Storage.Icon.extend({
initialize: function(map, options) { initialize: function(map, options) {
options = L.Util.extend({}, this.default_options, options); options = L.Util.extend({}, this.default_options, options);
L.Storage.Icon.prototype.initialize.call(this, map, options); L.U.Icon.prototype.initialize.call(this, map, options);
}, },
_setColor: function() { _setColor: function() {
@ -69,7 +69,7 @@ L.Storage.Icon.Default = L.Storage.Icon.extend({
}); });
L.Storage.Icon.Circle = L.Storage.Icon.extend({ L.U.Icon.Circle = L.U.Icon.extend({
initialize: function(map, options) { initialize: function(map, options) {
var default_options = { var default_options = {
iconAnchor: new L.Point(6, 6), iconAnchor: new L.Point(6, 6),
@ -78,7 +78,7 @@ L.Storage.Icon.Circle = L.Storage.Icon.extend({
className: 'storage-circle-icon' className: 'storage-circle-icon'
}; };
options = L.Util.extend({}, default_options, options); options = L.Util.extend({}, default_options, options);
L.Storage.Icon.prototype.initialize.call(this, map, options); L.U.Icon.prototype.initialize.call(this, map, options);
}, },
_setColor: function() { _setColor: function() {
@ -96,7 +96,7 @@ L.Storage.Icon.Circle = L.Storage.Icon.extend({
}); });
L.Storage.Icon.Drop = L.Storage.Icon.Default.extend({ L.U.Icon.Drop = L.U.Icon.Default.extend({
default_options: { default_options: {
iconAnchor: new L.Point(16, 42), iconAnchor: new L.Point(16, 42),
popupAnchor: new L.Point(0, -42), popupAnchor: new L.Point(0, -42),
@ -105,7 +105,7 @@ L.Storage.Icon.Drop = L.Storage.Icon.Default.extend({
} }
}); });
L.Storage.Icon.Ball = L.Storage.Icon.Default.extend({ L.U.Icon.Ball = L.U.Icon.Default.extend({
default_options: { default_options: {
iconAnchor: new L.Point(8, 30), iconAnchor: new L.Point(8, 30),
popupAnchor: new L.Point(0, -28), popupAnchor: new L.Point(0, -28),
@ -141,7 +141,7 @@ L.Storage.Icon.Ball = L.Storage.Icon.Default.extend({
}); });
var _CACHE_COLOR = {}; var _CACHE_COLOR = {};
L.Storage.Icon.Cluster = L.DivIcon.extend({ L.U.Icon.Cluster = L.DivIcon.extend({
options: { options: {
iconSize: [40, 40] iconSize: [40, 40]
}, },

View file

@ -48,7 +48,7 @@ L.Map.mergeOptions({
easing: true easing: true
}); });
L.Storage.Map.include({ L.U.Map.include({
HIDDABLE_CONTROLS: ['zoom', 'search', 'fullscreen', 'embed', 'locate', 'measure', 'tilelayers', 'editinosm', 'datalayers'], HIDDABLE_CONTROLS: ['zoom', 'search', 'fullscreen', 'embed', 'locate', 'measure', 'tilelayers', 'editinosm', 'datalayers'],
@ -64,8 +64,8 @@ L.Storage.Map.include({
L.Util.setBooleanFromQueryString(geojson.properties, 'scrollWheelZoom'); L.Util.setBooleanFromQueryString(geojson.properties, 'scrollWheelZoom');
L.Map.prototype.initialize.call(this, el, geojson.properties); L.Map.prototype.initialize.call(this, el, geojson.properties);
this.ui = new L.S.UI(this._container); this.ui = new L.U.UI(this._container);
this.xhr = new L.S.Xhr(this.ui); this.xhr = new L.U.Xhr(this.ui);
this.xhr.on('dataloding', function (e) { this.xhr.on('dataloding', function (e) {
this.fire('dataloding', e); this.fire('dataloding', e);
}); });
@ -196,11 +196,11 @@ L.Storage.Map.include({
} }
} }
this.help = new L.Storage.Help(this); this.help = new L.U.Help(this);
this.slideshow = new L.S.Slideshow(this, this.options.slideshow); this.slideshow = new L.U.Slideshow(this, this.options.slideshow);
this.initCaptionBar(); this.initCaptionBar();
if (this.options.allowEdit) { if (this.options.allowEdit) {
this.editTools = new L.S.Editable(this); this.editTools = new L.U.Editable(this);
this.ui.on('panel:closed panel:open', function () { this.ui.on('panel:closed panel:open', function () {
this.editedFeature = null; this.editedFeature = null;
}, this); }, this);
@ -226,33 +226,33 @@ L.Storage.Map.include({
this._controls = {}; this._controls = {};
if (this.options.allowEdit && !this.options.noControl) { if (this.options.allowEdit && !this.options.noControl) {
new L.Storage.EditControl(this).addTo(this); new L.U.EditControl(this).addTo(this);
new L.S.DrawToolbar({map: this}).addTo(this); new L.U.DrawToolbar({map: this}).addTo(this);
var editActions = [ var editActions = [
L.S.ImportAction, L.U.ImportAction,
L.S.EditPropertiesAction, L.U.EditPropertiesAction,
L.S.ChangeTileLayerAction, L.U.ChangeTileLayerAction,
L.S.ManageDatalayersAction, L.U.ManageDatalayersAction,
L.S.UpdateExtentAction L.U.UpdateExtentAction
]; ];
if (this.options.urls.map_update_permissions) editActions.push(L.Storage.UpdatePermsAction); if (this.options.urls.map_update_permissions) editActions.push(L.U.UpdatePermsAction);
new L.S.SettingsToolbar({actions: editActions}).addTo(this); new L.U.SettingsToolbar({actions: editActions}).addTo(this);
} }
this._controls.zoom = new L.Control.Zoom({zoomInTitle: L._('Zoom in'), zoomOutTitle: L._('Zoom out')}); this._controls.zoom = new L.Control.Zoom({zoomInTitle: L._('Zoom in'), zoomOutTitle: L._('Zoom out')});
this._controls.datalayers = new L.Storage.DataLayersControl(this); this._controls.datalayers = new L.U.DataLayersControl(this);
this._controls.locate = new L.S.LocateControl(); this._controls.locate = new L.U.LocateControl();
this._controls.fullscreen = new L.Control.Fullscreen({title: {'false': L._('View Fullscreen'), 'true': L._('Exit Fullscreen')}}); this._controls.fullscreen = new L.Control.Fullscreen({title: {'false': L._('View Fullscreen'), 'true': L._('Exit Fullscreen')}});
this._controls.search = new L.Storage.SearchControl(); this._controls.search = new L.U.SearchControl();
this._controls.embed = new L.Control.Embed(this, this.options.embedOptions); this._controls.embed = new L.Control.Embed(this, this.options.embedOptions);
this._controls.tilelayers = new L.Storage.TileLayerControl(); this._controls.tilelayers = new L.U.TileLayerControl();
this._controls.editinosm = new L.Control.EditInOSM({ this._controls.editinosm = new L.Control.EditInOSM({
position: 'topleft', position: 'topleft',
widgetOptions: {helpText: L._('Open this map extent in a map editor to provide more accurate data to OpenStreetMap')} widgetOptions: {helpText: L._('Open this map extent in a map editor to provide more accurate data to OpenStreetMap')}
}); });
this._controls.measure = (new L.MeasureControl()).initHandler(this); this._controls.measure = (new L.MeasureControl()).initHandler(this);
this._controls.more = new L.S.MoreControls(); this._controls.more = new L.U.MoreControls();
this._controls.scale = L.control.scale(); this._controls.scale = L.control.scale();
if (this.options.scrollWheelZoom) this.scrollWheelZoom.enable(); if (this.options.scrollWheelZoom) this.scrollWheelZoom.enable();
else this.scrollWheelZoom.disable(); else this.scrollWheelZoom.disable();
@ -267,7 +267,7 @@ L.Storage.Map.include({
} }
if (this.options.noControl) return; if (this.options.noControl) return;
this._controls.attribution = (new L.S.AttributionControl()).addTo(this); this._controls.attribution = (new L.U.AttributionControl()).addTo(this);
if (this.options.miniMap && !this.options.noControl) { if (this.options.miniMap && !this.options.noControl) {
this.whenReady(function () { this.whenReady(function () {
if (this.selected_tilelayer) { if (this.selected_tilelayer) {
@ -358,10 +358,10 @@ L.Storage.Map.include({
modifierKey = e.ctrlKey || e.metaKey; modifierKey = e.ctrlKey || e.metaKey;
/* Generic shortcuts */ /* Generic shortcuts */
if (key === L.S.Keys.F && modifierKey) { if (key === L.U.Keys.F && modifierKey) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.search(); this.search();
} else if (e.keyCode === L.S.Keys.ESC) { } else if (e.keyCode === L.U.Keys.ESC) {
if (this.help.visible()) this.help.hide(); if (this.help.visible()) this.help.hide();
else this.ui.closePanel(); else this.ui.closePanel();
} }
@ -369,45 +369,45 @@ L.Storage.Map.include({
if (!this.options.allowEdit) return; if (!this.options.allowEdit) return;
/* Edit mode only shortcuts */ /* Edit mode only shortcuts */
if (key === L.S.Keys.E && modifierKey && !this.editEnabled) { if (key === L.U.Keys.E && modifierKey && !this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.enableEdit(); this.enableEdit();
} else if (key === L.S.Keys.E && modifierKey && this.editEnabled && !this.isDirty) { } else if (key === L.U.Keys.E && modifierKey && this.editEnabled && !this.isDirty) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.disableEdit(); this.disableEdit();
this.ui.closePanel(); this.ui.closePanel();
} }
if (key === L.S.Keys.S && modifierKey) { if (key === L.U.Keys.S && modifierKey) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
if (this.isDirty) { if (this.isDirty) {
this.save(); this.save();
} }
} }
if (key === L.S.Keys.Z && modifierKey && this.isDirty) { if (key === L.U.Keys.Z && modifierKey && this.isDirty) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.askForReset(); this.askForReset();
} }
if (key === L.S.Keys.M && modifierKey && this.editEnabled) { if (key === L.U.Keys.M && modifierKey && this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.editTools.startMarker(); this.editTools.startMarker();
} }
if (key === L.S.Keys.P && modifierKey && this.editEnabled) { if (key === L.U.Keys.P && modifierKey && this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.editTools.startPolygon(); this.editTools.startPolygon();
} }
if (key === L.S.Keys.L && modifierKey && this.editEnabled) { if (key === L.U.Keys.L && modifierKey && this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.editTools.startPolyline(); this.editTools.startPolyline();
} }
if (key === L.S.Keys.I && modifierKey && this.editEnabled) { if (key === L.U.Keys.I && modifierKey && this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.importPanel(); this.importPanel();
} }
if (key === L.S.Keys.H && modifierKey && this.editEnabled) { if (key === L.U.Keys.H && modifierKey && this.editEnabled) {
L.DomEvent.stop(e); L.DomEvent.stop(e);
this.help.show('edit'); this.help.show('edit');
} }
if (e.keyCode === L.S.Keys.ESC) { if (e.keyCode === L.U.Keys.ESC) {
if (this.editEnabled) this.editTools.stopDrawing(); if (this.editEnabled) this.editTools.stopDrawing();
if (this.measureTools.enabled()) this.measureTools.stopDrawing(); if (this.measureTools.enabled()) this.measureTools.stopDrawing();
} }
@ -533,7 +533,7 @@ L.Storage.Map.include({
createDataLayer: function(datalayer) { createDataLayer: function(datalayer) {
datalayer = datalayer || {name: L._('Layer') + ' ' + (this.datalayers_index.length + 1)}; datalayer = datalayer || {name: L._('Layer') + ' ' + (this.datalayers_index.length + 1)};
return new L.Storage.DataLayer(this, datalayer); return new L.U.DataLayer(this, datalayer);
}, },
getDefaultOption: function (option) { getDefaultOption: function (option) {
@ -586,12 +586,12 @@ L.Storage.Map.include({
for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) {
UIFields.push('queryString.' + this.HIDDABLE_CONTROLS[i] + 'Control'); UIFields.push('queryString.' + this.HIDDABLE_CONTROLS[i] + 'Control');
} }
var iframeExporter = new L.S.IframeExporter(this); var iframeExporter = new L.U.IframeExporter(this);
var buildIframeCode = function () { var buildIframeCode = function () {
iframe.innerHTML = iframeExporter.build(); iframe.innerHTML = iframeExporter.build();
}; };
buildIframeCode(); buildIframeCode();
var builder = new L.S.FormBuilder(iframeExporter, UIFields, { var builder = new L.U.FormBuilder(iframeExporter, UIFields, {
callback: buildIframeCode callback: buildIframeCode
}); });
var iframeOptions = L.DomUtil.createFieldset(container, L._('Iframe export options')); var iframeOptions = L.DomUtil.createFieldset(container, L._('Iframe export options'));
@ -1158,7 +1158,7 @@ L.Storage.Map.include({
], ],
title = L.DomUtil.create('h4', '', container); title = L.DomUtil.create('h4', '', container);
title.innerHTML = L._('Edit map properties'); title.innerHTML = L._('Edit map properties');
var builder = new L.S.FormBuilder(this, metadataFields); var builder = new L.U.FormBuilder(this, metadataFields);
var form = builder.build(); var form = builder.build();
container.appendChild(form); container.appendChild(form);
var UIFields = []; var UIFields = [];
@ -1174,7 +1174,7 @@ L.Storage.Map.include({
'options.displayPopupFooter', 'options.displayPopupFooter',
'options.captionBar' 'options.captionBar'
]); ]);
builder = new L.S.FormBuilder(this, UIFields, { builder = new L.U.FormBuilder(this, UIFields, {
callback: this.renderControls, callback: this.renderControls,
callbackContext: this callbackContext: this
}); });
@ -1192,7 +1192,7 @@ L.Storage.Map.include({
'options.fillOpacity' 'options.fillOpacity'
]; ];
builder = new L.S.FormBuilder(this, shapeOptions, { builder = new L.U.FormBuilder(this, shapeOptions, {
callback: function (e) { callback: function (e) {
this.eachDataLayer(function (datalayer) { this.eachDataLayer(function (datalayer) {
datalayer.redraw(); datalayer.redraw();
@ -1212,7 +1212,7 @@ L.Storage.Map.include({
['options.filterKey', {handler: 'Input', helpEntries: 'filterKey', placeholder: L._('Default: name'), label: L._('Filter keys'), inheritable: true}] ['options.filterKey', {handler: 'Input', helpEntries: 'filterKey', placeholder: L._('Default: name'), label: L._('Filter keys'), inheritable: true}]
]; ];
builder = new L.S.FormBuilder(this, optionsFields, { builder = new L.U.FormBuilder(this, optionsFields, {
callback: function (e) { callback: function (e) {
this.eachDataLayer(function (datalayer) { this.eachDataLayer(function (datalayer) {
if (e.helper.field === 'options.sortKey') datalayer.reindex(); if (e.helper.field === 'options.sortKey') datalayer.reindex();
@ -1231,7 +1231,7 @@ L.Storage.Map.include({
'options.labelHover', 'options.labelHover',
'options.labelInteractive' 'options.labelInteractive'
]; ];
builder = new L.S.FormBuilder(this, popupFields, { builder = new L.U.FormBuilder(this, popupFields, {
callback: function (e) { callback: function (e) {
if (e.helper.field === 'options.popupTemplate' || e.helper.field === 'options.popupContentTemplate') return; if (e.helper.field === 'options.popupTemplate' || e.helper.field === 'options.popupContentTemplate') return;
this.eachDataLayer(function (datalayer) { this.eachDataLayer(function (datalayer) {
@ -1254,7 +1254,7 @@ L.Storage.Map.include({
['options.tilelayer.tms', {handler: 'Switch', label: L._('TMS format')}] ['options.tilelayer.tms', {handler: 'Switch', label: L._('TMS format')}]
]; ];
var customTilelayer = L.DomUtil.createFieldset(container, L._('Custom background')); var customTilelayer = L.DomUtil.createFieldset(container, L._('Custom background'));
builder = new L.S.FormBuilder(this, tilelayerFields, { builder = new L.U.FormBuilder(this, tilelayerFields, {
callback: this.initTileLayers, callback: this.initTileLayers,
callbackContext: this callbackContext: this
}); });
@ -1270,7 +1270,7 @@ L.Storage.Map.include({
['options.limitBounds.north', {handler: 'BlurFloatInput', placeholder: L._('max North')}], ['options.limitBounds.north', {handler: 'BlurFloatInput', placeholder: L._('max North')}],
['options.limitBounds.east', {handler: 'BlurFloatInput', placeholder: L._('max East')}] ['options.limitBounds.east', {handler: 'BlurFloatInput', placeholder: L._('max East')}]
]; ];
var boundsBuilder = new L.S.FormBuilder(this, boundsFields, { var boundsBuilder = new L.U.FormBuilder(this, boundsFields, {
callback: this.handleLimitBounds, callback: this.handleLimitBounds,
callbackContext: this callbackContext: this
}); });
@ -1311,7 +1311,7 @@ L.Storage.Map.include({
this.slideshow.setOptions(this.options.slideshow); this.slideshow.setOptions(this.options.slideshow);
this.renderControls(); this.renderControls();
}; };
var slideshowBuilder = new L.S.FormBuilder(this, slideshowFields, { var slideshowBuilder = new L.U.FormBuilder(this, slideshowFields, {
callback: slideshowHandler, callback: slideshowHandler,
callbackContext: this callbackContext: this
}); });
@ -1323,7 +1323,7 @@ L.Storage.Map.include({
['options.shortCredit', {handler: 'Input', label: L._('Short credits'), helpEntries: ['shortCredit', 'textFormatting']}], ['options.shortCredit', {handler: 'Input', label: L._('Short credits'), helpEntries: ['shortCredit', 'textFormatting']}],
['options.longCredit', {handler: 'Textarea', label: L._('Long credits'), helpEntries: ['longCredit', 'textFormatting']}] ['options.longCredit', {handler: 'Textarea', label: L._('Long credits'), helpEntries: ['longCredit', 'textFormatting']}]
]; ];
var creditsBuilder = new L.S.FormBuilder(this, creditsFields, { var creditsBuilder = new L.U.FormBuilder(this, creditsFields, {
callback: function () {this._controls.attribution._update();}, callback: function () {this._controls.attribution._update();},
callbackContext: this callbackContext: this
}); });
@ -1502,7 +1502,7 @@ L.Storage.Map.include({
}, },
initContextMenu: function () { initContextMenu: function () {
this.contextmenu = new L.S.ContextMenu(this); this.contextmenu = new L.U.ContextMenu(this);
this.contextmenu.enable(); this.contextmenu.enable();
}, },

View file

@ -1,4 +1,4 @@
L.S.Layer = { L.U.Layer = {
canBrowse: true, canBrowse: true,
getFeatures: function () { getFeatures: function () {
@ -11,9 +11,9 @@ L.S.Layer = {
}; };
L.S.Layer.Default = L.FeatureGroup.extend({ L.U.Layer.Default = L.FeatureGroup.extend({
_type: 'Default', _type: 'Default',
includes: [L.S.Layer], includes: [L.U.Layer],
initialize: function (datalayer) { initialize: function (datalayer) {
this.datalayer = datalayer; this.datalayer = datalayer;
@ -23,9 +23,9 @@ L.S.Layer.Default = L.FeatureGroup.extend({
}); });
L.S.Layer.Cluster = L.MarkerClusterGroup.extend({ L.U.Layer.Cluster = L.MarkerClusterGroup.extend({
_type: 'Cluster', _type: 'Cluster',
includes: [L.S.Layer], includes: [L.U.Layer],
initialize: function (datalayer) { initialize: function (datalayer) {
this.datalayer = datalayer; this.datalayer = datalayer;
@ -34,7 +34,7 @@ L.S.Layer.Cluster = L.MarkerClusterGroup.extend({
color: this.datalayer.getColor() color: this.datalayer.getColor()
}, },
iconCreateFunction: function (cluster) { iconCreateFunction: function (cluster) {
return new L.Storage.Icon.Cluster(datalayer, cluster); return new L.U.Icon.Cluster(datalayer, cluster);
} }
}; };
if (this.datalayer.options.cluster && this.datalayer.options.cluster.radius) { if (this.datalayer.options.cluster && this.datalayer.options.cluster.radius) {
@ -67,9 +67,9 @@ L.S.Layer.Cluster = L.MarkerClusterGroup.extend({
}); });
L.S.Layer.Heat = L.HeatLayer.extend({ L.U.Layer.Heat = L.HeatLayer.extend({
_type: 'Heat', _type: 'Heat',
includes: [L.S.Layer], includes: [L.U.Layer],
canBrowse: false, canBrowse: false,
initialize: function (datalayer) { initialize: function (datalayer) {
@ -132,7 +132,7 @@ L.S.Layer.Heat = L.HeatLayer.extend({
}); });
L.Storage.DataLayer = L.Class.extend({ L.U.DataLayer = L.Class.extend({
includes: [L.Mixin.Events], includes: [L.Mixin.Events],
@ -229,7 +229,7 @@ L.Storage.DataLayer = L.Class.extend({
var visible = this.isVisible(); var visible = this.isVisible();
if (this.layer) this.layer.clearLayers(); if (this.layer) this.layer.clearLayers();
if (visible) this.map.removeLayer(this.layer); if (visible) this.map.removeLayer(this.layer);
var Class = L.S.Layer[this.options.type] || L.S.Layer.Default; var Class = L.U.Layer[this.options.type] || L.U.Layer.Default;
this.layer = new Class(this); this.layer = new Class(this);
this.eachLayer(function (layer) { this.eachLayer(function (layer) {
this.layer.addLayer(layer); this.layer.addLayer(layer);
@ -365,7 +365,7 @@ L.Storage.DataLayer = L.Class.extend({
}, },
setOptions: function (options) { setOptions: function (options) {
this.options = L.Util.CopyJSON(L.Storage.DataLayer.prototype.options); // Start from fresh. this.options = L.Util.CopyJSON(L.U.DataLayer.prototype.options); // Start from fresh.
this.updateOptions(options); this.updateOptions(options);
}, },
@ -553,7 +553,7 @@ L.Storage.DataLayer = L.Class.extend({
}, },
_pointToLayer: function(geojson, latlng) { _pointToLayer: function(geojson, latlng) {
return new L.Storage.Marker( return new L.U.Marker(
this.map, this.map,
latlng, latlng,
{'geojson': geojson, 'datalayer': this} {'geojson': geojson, 'datalayer': this}
@ -561,7 +561,7 @@ L.Storage.DataLayer = L.Class.extend({
}, },
_lineToLayer: function(geojson, latlngs) { _lineToLayer: function(geojson, latlngs) {
return new L.Storage.Polyline( return new L.U.Polyline(
this.map, this.map,
latlngs, latlngs,
{'geojson': geojson, 'datalayer': this, color: null} {'geojson': geojson, 'datalayer': this, color: null}
@ -573,7 +573,7 @@ L.Storage.DataLayer = L.Class.extend({
// for (var i = latlngs.length - 1; i > 0; i--) { // for (var i = latlngs.length - 1; i > 0; i--) {
// if (!latlngs.slice()[i].length) latlngs.splice(i, 1); // if (!latlngs.slice()[i].length) latlngs.splice(i, 1);
// } // }
return new L.Storage.Polygon( return new L.U.Polygon(
this.map, this.map,
latlngs, latlngs,
{'geojson': geojson, 'datalayer': this} {'geojson': geojson, 'datalayer': this}
@ -706,7 +706,7 @@ L.Storage.DataLayer = L.Class.extend({
['options.browsable', {label: L._('Data is browsable'), handler: 'Switch', helpEntries: 'browsable'}] ['options.browsable', {label: L._('Data is browsable'), handler: 'Switch', helpEntries: 'browsable'}]
]; ];
var title = L.DomUtil.add('h3', '', container, L._('Layer properties')); var title = L.DomUtil.add('h3', '', container, L._('Layer properties'));
var builder = new L.S.FormBuilder(this, metadataFields, { var builder = new L.U.FormBuilder(this, metadataFields, {
callback: function (e) { callback: function (e) {
this.map.updateDatalayersControl(); this.map.updateDatalayersControl();
if (e.helper.field === 'options.type') { if (e.helper.field === 'options.type') {
@ -737,7 +737,7 @@ L.Storage.DataLayer = L.Class.extend({
this.show(); this.show();
}; };
builder = new L.S.FormBuilder(this, shapeOptions, { builder = new L.U.FormBuilder(this, shapeOptions, {
id: 'datalayer-advanced-properties', id: 'datalayer-advanced-properties',
callback: redrawCallback callback: redrawCallback
}); });
@ -753,7 +753,7 @@ L.Storage.DataLayer = L.Class.extend({
optionsFields = optionsFields.concat(this.layer.getEditableOptions()); optionsFields = optionsFields.concat(this.layer.getEditableOptions());
builder = new L.S.FormBuilder(this, optionsFields, { builder = new L.U.FormBuilder(this, optionsFields, {
id: 'datalayer-advanced-properties', id: 'datalayer-advanced-properties',
callback: redrawCallback callback: redrawCallback
}); });
@ -768,7 +768,7 @@ L.Storage.DataLayer = L.Class.extend({
'options.labelHover', 'options.labelHover',
'options.labelInteractive', 'options.labelInteractive',
]; ];
builder = new L.S.FormBuilder(this, popupFields, {callback: redrawCallback}); builder = new L.U.FormBuilder(this, popupFields, {callback: redrawCallback});
var popupFieldset = L.DomUtil.createFieldset(container, L._('Interaction options')); var popupFieldset = L.DomUtil.createFieldset(container, L._('Interaction options'));
popupFieldset.appendChild(builder.build()); popupFieldset.appendChild(builder.build());
@ -788,7 +788,7 @@ L.Storage.DataLayer = L.Class.extend({
} }
var remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data')); var remoteDataContainer = L.DomUtil.createFieldset(container, L._('Remote data'));
builder = new L.S.FormBuilder(this, remoteDataFields); builder = new L.U.FormBuilder(this, remoteDataFields);
remoteDataContainer.appendChild(builder.build()); remoteDataContainer.appendChild(builder.build());
if (this.map.options.urls.datalayer_versions) this.buildVersionsFieldset(container); if (this.map.options.urls.datalayer_versions) this.buildVersionsFieldset(container);
@ -1019,7 +1019,7 @@ L.Storage.DataLayer = L.Class.extend({
tableEdit: function () { tableEdit: function () {
if (this.isRemoteLayer() || !this.isVisible()) return; if (this.isRemoteLayer() || !this.isVisible()) return;
var editor = new L.S.TableEditor(this); var editor = new L.U.TableEditor(this);
editor.edit(); editor.edit();
} }

View file

@ -1,4 +1,4 @@
L.S.Popup = L.Popup.extend({ L.U.Popup = L.Popup.extend({
options: { options: {
parseTemplate: true parseTemplate: true
@ -95,14 +95,14 @@ L.S.Popup = L.Popup.extend({
}); });
L.S.Popup.Large = L.S.Popup.extend({ L.U.Popup.Large = L.U.Popup.extend({
options: { options: {
maxWidth: 500, maxWidth: 500,
className: 'storage-popup-large' className: 'storage-popup-large'
} }
}); });
L.S.Popup.BaseWithTitle = L.S.Popup.extend({ L.U.Popup.BaseWithTitle = L.U.Popup.extend({
renderTitle: function () { renderTitle: function () {
var title; var title;
@ -115,7 +115,7 @@ L.S.Popup.BaseWithTitle = L.S.Popup.extend({
}); });
L.S.Popup.Table = L.S.Popup.BaseWithTitle.extend({ L.U.Popup.Table = L.U.Popup.BaseWithTitle.extend({
formatRow: function (key, value) { formatRow: function (key, value) {
if (value.indexOf('http') === 0) { if (value.indexOf('http') === 0) {
@ -143,9 +143,9 @@ L.S.Popup.Table = L.S.Popup.BaseWithTitle.extend({
}); });
L.S.Popup.table = L.S.Popup.Table; // backward compatibility L.U.Popup.table = L.U.Popup.Table; // backward compatibility
L.S.Popup.GeoRSSImage = L.S.Popup.BaseWithTitle.extend({ L.U.Popup.GeoRSSImage = L.U.Popup.BaseWithTitle.extend({
options: { options: {
minWidth: 300, minWidth: 300,
@ -171,7 +171,7 @@ L.S.Popup.GeoRSSImage = L.S.Popup.BaseWithTitle.extend({
}); });
L.S.Popup.GeoRSSLink = L.S.Popup.extend({ L.U.Popup.GeoRSSLink = L.U.Popup.extend({
options: { options: {
className: 'storage-georss-link' className: 'storage-georss-link'
@ -187,7 +187,7 @@ L.S.Popup.GeoRSSLink = L.S.Popup.extend({
} }
}); });
L.S.Popup.SimplePanel = L.S.Popup.extend({ L.U.Popup.SimplePanel = L.U.Popup.extend({
options: { options: {
zoomAnimation: false zoomAnimation: false
@ -208,7 +208,7 @@ L.S.Popup.SimplePanel = L.S.Popup.extend({
onRemove: function (map) { onRemove: function (map) {
map.ui.closePanel(); map.ui.closePanel();
L.S.Popup.prototype.onRemove.call(this, map); L.U.Popup.prototype.onRemove.call(this, map);
}, },
_initLayout: function () {this._container = L.DomUtil.create('span');}, _initLayout: function () {this._container = L.DomUtil.create('span');},

View file

@ -1,4 +1,4 @@
L.S.Slideshow = L.Class.extend({ L.U.Slideshow = L.Class.extend({
statics: { statics: {
CLASSNAME: 'storage-slideshow-active' CLASSNAME: 'storage-slideshow-active'
@ -91,7 +91,7 @@ L.S.Slideshow = L.Class.extend({
play: function () { play: function () {
if (this._id) return; if (this._id) return;
if (this.map.editEnabled) return; if (this.map.editEnabled) return;
L.DomUtil.addClass(document.body, L.S.Slideshow.CLASSNAME); L.DomUtil.addClass(document.body, L.U.Slideshow.CL.USNAME);
this._id = window.setInterval(L.bind(this.loop, this), this.options.delay); this._id = window.setInterval(L.bind(this.loop, this), this.options.delay);
this.resetSpinners(); this.resetSpinners();
this.loop(); this.loop();
@ -104,7 +104,7 @@ L.S.Slideshow = L.Class.extend({
pause: function () { pause: function () {
if (this._id) { if (this._id) {
L.DomUtil.removeClass(document.body, L.S.Slideshow.CLASSNAME); L.DomUtil.removeClass(document.body, L.U.Slideshow.CL.USNAME);
window.clearInterval(this._id); window.clearInterval(this._id);
this._id = null; this._id = null;
} }

View file

@ -1,4 +1,4 @@
L.S.TableEditor = L.Class.extend({ L.U.TableEditor = L.Class.extend({
initialize: function (datalayer) { initialize: function (datalayer) {
this.datalayer = datalayer; this.datalayer = datalayer;
@ -48,7 +48,7 @@ L.S.TableEditor = L.Class.extend({
}, },
renderRow: function (feature) { renderRow: function (feature) {
var builder = new L.S.FormBuilder(feature, this.field_properties, var builder = new L.U.FormBuilder(feature, this.field_properties,
{ {
id: 'storage-feature-properties_' + L.stamp(feature), id: 'storage-feature-properties_' + L.stamp(feature),
className: 'trow', className: 'trow',

View file

@ -1,7 +1,7 @@
/* /*
* Modals * Modals
*/ */
L.S.UI = L.Evented.extend({ L.U.UI = L.Evented.extend({
ALERTS: Array(), ALERTS: Array(),
ALERT_ID: null, ALERT_ID: null,

View file

@ -1,4 +1,4 @@
L.Storage.Xhr = L.Evented.extend({ L.U.Xhr = L.Evented.extend({
initialize: function (ui) { initialize: function (ui) {
this.ui = ui; this.ui = ui;

View file

@ -26,8 +26,8 @@
{{ block.super }} {{ block.super }}
<script type="text/javascript"> <script type="text/javascript">
!(function() { !(function() {
var ui = new L.S.UI(document.querySelector('header')); var ui = new L.U.UI(document.querySelector('header'));
var xhr = new L.S.Xhr(ui); var xhr = new L.U.Xhr(ui);
var login = document.querySelector('a.login'); var login = document.querySelector('a.login');
if (login) { if (login) {
L.DomEvent.on(login, 'click', function (e) { L.DomEvent.on(login, 'click', function (e) {

View file

@ -20,10 +20,10 @@
{% include "umap/map_messages.html" %} {% include "umap/map_messages.html" %}
<script type="text/javascript"> <script type="text/javascript">
MAP.ui.on('panel:ready', function () { MAP.ui.on('panel:ready', function () {
L.S.AutoComplete.multiSelect('id_editors', { L.U.AutoComplete.multiSelect('id_editors', {
placeholder: "{% trans 'Type editors nick to add…' %}" placeholder: "{% trans 'Type editors nick to add…' %}"
}); });
L.S.AutoComplete.select('id_owner', { L.U.AutoComplete.select('id_owner', {
placeholder: "{% trans 'Type new owner nick…' %}" placeholder: "{% trans 'Type new owner nick…' %}"
}); });
}); });

View file

@ -1,5 +1,5 @@
{% load umap_tags %} {% load umap_tags %}
<div id="{{ prefix }}{{ map.pk }}" class="map_fragment"></div> <div id="{{ prefix }}{{ map.pk }}" class="map_fragment"></div>
<script type="text/javascript"> <script type="text/javascript">
new L.Storage.Map("{{ prefix }}{{ map.pk }}", {{ map_settings|notag|safe }}); new L.U.Map("{{ prefix }}{{ map.pk }}", {{ map_settings|notag|safe }});
</script> </script>

View file

@ -1,5 +1,5 @@
{% load umap_tags %} {% load umap_tags %}
<div id="map"></div> <div id="map"></div>
<script type="text/javascript"> <script type="text/javascript">
var MAP = new L.Storage.Map("map", {{ map_settings|notag|safe }}); var MAP = new L.U.Map("map", {{ map_settings|notag|safe }});
</script> </script>

View file

@ -2,10 +2,10 @@
{% for m in messages %} {% for m in messages %}
"loooping" "loooping"
{# We have just one, but we need to loop, as for messages API #} {# We have just one, but we need to loop, as for messages API #}
L.Storage.fire('ui:alert', { L.U.fire('ui:alert', {
content: "{{ m }}", content: "{{ m }}",
level: "{{ m.tags }}", level: "{{ m.tags }}",
duration: 100000 duration: 100000
}); });
{% endfor %} {% endfor %}
</script> </script>