From 887a9fc7e0d135385c3e484d9dc37f87e1fd4390 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sat, 2 Jun 2018 12:36:28 +0200 Subject: [PATCH] Renamed L.Storage in L.U --- umap/static/umap/js/umap.autocomplete.js | 48 +++++----- umap/static/umap/js/umap.controls.js | 106 +++++++++++------------ umap/static/umap/js/umap.core.js | 13 ++- umap/static/umap/js/umap.features.js | 94 ++++++++++---------- umap/static/umap/js/umap.forms.js | 2 +- umap/static/umap/js/umap.icon.js | 16 ++-- umap/static/umap/js/umap.js | 92 ++++++++++---------- umap/static/umap/js/umap.layer.js | 40 ++++----- umap/static/umap/js/umap.popup.js | 18 ++-- umap/static/umap/js/umap.slideshow.js | 6 +- umap/static/umap/js/umap.tableeditor.js | 4 +- umap/static/umap/js/umap.ui.js | 2 +- umap/static/umap/js/umap.xhr.js | 2 +- umap/templates/umap/content.html | 4 +- umap/templates/umap/map_detail.html | 4 +- umap/templates/umap/map_fragment.html | 2 +- umap/templates/umap/map_init.html | 2 +- umap/templates/umap/map_messages.html | 4 +- 18 files changed, 229 insertions(+), 230 deletions(-) diff --git a/umap/static/umap/js/umap.autocomplete.js b/umap/static/umap/js/umap.autocomplete.js index 44cafc05..5cb887a9 100644 --- a/umap/static/umap/js/umap.autocomplete.js +++ b/umap/static/umap/js/umap.autocomplete.js @@ -1,4 +1,4 @@ -L.S.AutoComplete = L.Class.extend({ +L.U.AutoComplete = L.Class.extend({ options: { placeholder: 'Start typing...', @@ -62,22 +62,22 @@ L.S.AutoComplete = L.Class.extend({ onKeyDown: function (e) { switch (e.keyCode) { - case L.S.Keys.TAB: + case L.U.Keys.TAB: if(this.CURRENT !== null) { this.setChoice(); } L.DomEvent.stop(e); break; - case L.S.Keys.ENTER: + case L.U.Keys.ENTER: L.DomEvent.stop(e); this.setChoice(); break; - case L.S.Keys.ESC: + case L.U.Keys.ESC: L.DomEvent.stop(e); this.hide(); break; - case L.S.Keys.DOWN: + case L.U.Keys.DOWN: if(this.RESULTS.length > 0) { if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl? this.CURRENT++; @@ -89,7 +89,7 @@ L.S.AutoComplete = L.Class.extend({ } } break; - case L.S.Keys.UP: + case L.U.Keys.UP: if(this.CURRENT !== null) { L.DomEvent.stop(e); } @@ -109,16 +109,16 @@ L.S.AutoComplete = L.Class.extend({ onKeyUp: function (e) { var special = [ - L.S.Keys.TAB, - L.S.Keys.ENTER, - L.S.Keys.LEFT, - L.S.Keys.RIGHT, - L.S.Keys.DOWN, - L.S.Keys.UP, - L.S.Keys.APPLE, - L.S.Keys.SHIFT, - L.S.Keys.ALT, - L.S.Keys.CTRL + L.U.Keys.TAB, + L.U.Keys.ENTER, + L.U.Keys.LEFT, + L.U.Keys.RIGHT, + L.U.Keys.DOWN, + L.U.Keys.UP, + L.U.Keys.APPLE, + L.U.Keys.SHIFT, + L.U.Keys.ALT, + L.U.Keys.CTRL ]; 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) { - L.S.AutoComplete.prototype.initialize.call(this, el, options); + L.U.AutoComplete.prototype.initialize.call(this, el, options); if (!this.el) return this; this.el.style.display = 'none'; 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 () { 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) { - return new L.S.AutoComplete.MultiSelect(el, options); +L.U.AutoComplete.multiSelect = function (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 () { 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) { - return new L.S.AutoComplete.Select(el, options); +L.U.AutoComplete.select = function (el, options) { + return new L.U.AutoComplete.Select(el, options); }; diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 0f6aad8b..811e3ab2 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1,4 +1,4 @@ -L.Storage.BaseAction = L.ToolbarAction.extend({ +L.U.BaseAction = L.ToolbarAction.extend({ initialize: function (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: { 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: { 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: { 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: { 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: { 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: { 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: { 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: { 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: { 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: { 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: { 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) { 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: { 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: { 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: { 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: { 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: { 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) { 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: { 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: { 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: { toolbarIcon: { @@ -315,8 +315,8 @@ L.Storage.ContinueLineAction = L.S.BaseVertexAction.extend({ }); // Leaflet.Toolbar doesn't allow twice same toolbar class… -L.Storage.SettingsToolbar = L.Toolbar.Control.extend({}); -L.Storage.DrawToolbar = L.Toolbar.Control.extend({ +L.U.SettingsToolbar = L.Toolbar.Control.extend({}); +L.U.DrawToolbar = L.Toolbar.Control.extend({ initialize: function (options) { L.Toolbar.Control.prototype.initialize.call(this, options); @@ -327,18 +327,18 @@ L.Storage.DrawToolbar = L.Toolbar.Control.extend({ appendToContainer: function (container) { this.options.actions = []; if (this.map.options.enableMarkerDraw) { - this.options.actions.push(L.S.DrawMarkerAction); + this.options.actions.push(L.U.DrawMarkerAction); } if (this.map.options.enablePolylineDraw) { - this.options.actions.push(L.S.DrawPolylineAction); - if (this.map.editedFeature && this.map.editedFeature instanceof L.S.Polyline) { - this.options.actions.push(L.S.AddPolylineShapeAction); + this.options.actions.push(L.U.DrawPolylineAction); + if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polyline) { + this.options.actions.push(L.U.AddPolylineShapeAction); } } if (this.map.options.enablePolygonDraw) { - this.options.actions.push(L.S.DrawPolygonAction); - if (this.map.editedFeature && this.map.editedFeature instanceof L.S.Polygon) { - this.options.actions.push(L.S.AddPolygonShapeAction); + this.options.actions.push(L.U.DrawPolygonAction); + if (this.map.editedFeature && this.map.editedFeature instanceof L.U.Polygon) { + this.options.actions.push(L.U.AddPolygonShapeAction); } } 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: { 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: { 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: { position: 'topleft' @@ -543,7 +543,7 @@ L.Storage.DataLayersControl = L.Control.extend({ this.map.eachDataLayerReverse(function (datalayer) { this.addDataLayer(container, datalayer, true); }, this); - var orderable = new L.S.Orderable(container); + var orderable = new L.U.Orderable(container); orderable.on('drop', function (e) { var layer = this.map.datalayers[e.src.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) { 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('show', this.propagateShow); this.propagateShow(); }); -L.Storage.Map.include({ +L.U.Map.include({ _openBrowser: function () { 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), color = L.DomUtil.create('i', 'feature-color', 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'); edit.title = L._('Edit this feature'); 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: { 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: { 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: { 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) { // 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: { position: 'topleft', @@ -905,7 +905,7 @@ L.Storage.SearchControl = L.Control.extend({ title.textContent = L._('Search location'); var input = L.DomUtil.create('input', 'photon-input', 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(); this.search.on('ajax:send', function () { map.fire('dataloading', {id: id}); @@ -969,7 +969,7 @@ L.Control.Loading.include({ /* * Make it dynamic */ -L.S.ContextMenu = L.Map.ContextMenu.extend({ +L.U.ContextMenu = L.Map.ContextMenu.extend({ _createItems: function (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], 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) { L.Editable.prototype.initialize.call(this, map, options); @@ -1057,7 +1057,7 @@ L.S.Editable = L.Editable.extend({ // Layer for items added by users 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 instanceof L.S.Marker) e.layer.del(); + if (e.layer instanceof L.U.Marker) e.layer.del(); }); this.on('editable:drawing:commit', function (e) { e.layer.isDirty = true; @@ -1082,16 +1082,16 @@ L.S.Editable = L.Editable.extend({ }, createPolyline: function (latlngs) { - return new L.Storage.Polyline(this.map, latlngs); + return new L.U.Polyline(this.map, latlngs); }, createPolygon: function (latlngs) { - var polygon = new L.Storage.Polygon(this.map, latlngs); + var polygon = new L.U.Polygon(this.map, latlngs); return polygon; }, createMarker: function (latlng) { - return new L.Storage.Marker(this.map, latlng); + return new L.U.Marker(this.map, latlng); }, connectCreatedToMap: function (layer) { diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 3dd091c5..6347c92d 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -1,9 +1,8 @@ /* Poor man pub/sub handler, enough for now */ -L.StorageSingleton = L.Evented.extend({}); -L.Storage = new L.StorageSingleton(); -L.S = L.Storage; -L.Storage.Map = L.Map.extend({}); +L.UmapSingleton = L.Evented.extend({}); +L.U = new L.UmapSingleton(); +L.U.Map = L.Map.extend({}); /* * Utils @@ -268,7 +267,7 @@ L.DomEvent.once = function (el, types, fn, context) { /* * Global events */ -L.S.Keys = { +L.U.Keys = { LEFT: 37, UP: 38, RIGHT: 39, @@ -292,7 +291,7 @@ L.S.Keys = { }; -L.Storage.Help = L.Class.extend({ +L.U.Help = L.Class.extend({ initialize: function (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: { selector: 'li', diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index acbdb314..a92f5316 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -1,4 +1,4 @@ -L.Storage.FeatureMixin = { +L.U.FeatureMixin = { staticOptions: {}, @@ -76,7 +76,7 @@ L.Storage.FeatureMixin = { if(!this.map.editEnabled || this.isReadOnly()) return; 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 }); container.appendChild(builder.build()); @@ -90,7 +90,7 @@ L.Storage.FeatureMixin = { // We always want name and description for now (properties management to come) properties.unshift('properties.description'); properties.unshift('properties.name'); - builder = new L.S.FormBuilder(this, properties, + builder = new L.U.FormBuilder(this, properties, { id: 'storage-feature-properties', callback: this.resetTooltip @@ -117,7 +117,7 @@ L.Storage.FeatureMixin = { appendEditFieldsets: function (container) { 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', callback: this._redraw }); @@ -125,7 +125,7 @@ L.Storage.FeatureMixin = { shapeProperties.appendChild(builder.build()); 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', callback: this._redraw }); @@ -133,7 +133,7 @@ L.Storage.FeatureMixin = { advancedProperties.appendChild(builder.build()); var interactionOptions = this.getInteractionOptions(); - builder = new L.S.FormBuilder(this, interactionOptions, { + builder = new L.U.FormBuilder(this, interactionOptions, { callback: this._redraw }); var popupFieldset = L.DomUtil.createFieldset(container, L._('Interaction options')); @@ -166,7 +166,7 @@ L.Storage.FeatureMixin = { }, getPopupClass: function () { - return L.Storage.Popup[this.getOption('popupTemplate')] || L.Storage.Popup; + return L.U.Popup[this.getOption('popupTemplate')] || L.U.Popup; }, attachPopup: function () { @@ -327,7 +327,7 @@ L.Storage.FeatureMixin = { }, getInplaceToolbarActions: function (e) { - return [L.S.ToggleEditAction, L.S.DeleteFeatureAction]; + return [L.U.ToggleEditAction, L.U.DeleteFeatureAction]; }, _showContextMenu: function (e) { @@ -417,7 +417,7 @@ L.Storage.FeatureMixin = { }, getVertexActions: function () { - return [L.S.DeleteVertexAction]; + return [L.U.DeleteVertexAction]; }, isMulti: function () { @@ -426,16 +426,16 @@ L.Storage.FeatureMixin = { }; -L.Storage.Marker = L.Marker.extend({ +L.U.Marker = L.Marker.extend({ parentClass: L.Marker, - includes: [L.Storage.FeatureMixin, L.Mixin.Events], + includes: [L.U.FeatureMixin, L.Mixin.Events], preInit: function () { this.setIcon(this.getIcon()); }, addInteractions: function () { - L.Storage.FeatureMixin.addInteractions.call(this); + L.U.FeatureMixin.addInteractions.call(this); this.on('dragend', function (e) { this.isDirty = true; this.edit(e); @@ -488,7 +488,7 @@ L.Storage.Marker = L.Marker.extend({ disconnectFromDataLayer: function (datalayer) { this.options.icon.datalayer = null; - L.Storage.FeatureMixin.disconnectFromDataLayer.call(this, datalayer); + L.U.FeatureMixin.disconnectFromDataLayer.call(this, datalayer); }, _getIconUrl: function (name) { @@ -501,7 +501,7 @@ L.Storage.Marker = L.Marker.extend({ }, 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}); }, @@ -528,12 +528,12 @@ L.Storage.Marker = L.Marker.extend({ }, appendEditFieldsets: function (container) { - L.Storage.FeatureMixin.appendEditFieldsets.call(this, container); + L.U.FeatureMixin.appendEditFieldsets.call(this, container); var coordinatesOptions = [ ['_latlng.lat', {handler: 'FloatInput', label: L._('Latitude')}], ['_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 () { this._redraw(); this.bringToCenter(); @@ -549,7 +549,7 @@ L.Storage.Marker = L.Marker.extend({ // callback is mandatory for zoomToShowLayer this.datalayer.layer.zoomToShowLayer(this, e.callback || function (){}); } 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) { - 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. this.options.pane = this.datalayer.pane; }, @@ -576,7 +576,7 @@ L.Storage.PathMixin = { edit: function (e) { if(this.map.editEnabled) { 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('hidemeasure', this.removeTooltip, this); 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 () { @@ -667,7 +667,7 @@ L.Storage.PathMixin = { endEdit: function () { this.disableEdit(); - L.S.FeatureMixin.endEdit.call(this); + L.U.FeatureMixin.endEdit.call(this); }, _onMouseOver: function () { @@ -679,7 +679,7 @@ L.Storage.PathMixin = { }, addInteractions: function () { - L.S.FeatureMixin.addInteractions.call(this); + L.U.FeatureMixin.addInteractions.call(this); this.on('mouseover', this._onMouseOver); this.on('edit', this.makeDirty); this.on('drag editable:drag', this._onDrag); @@ -703,14 +703,14 @@ L.Storage.PathMixin = { this.disableEdit(); if (!shape) return; 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); other.edit(); return other; }, getContextMenuItems: function (e) { - var items = L.S.FeatureMixin.getContextMenuItems.call(this, e); + var items = L.U.FeatureMixin.getContextMenuItems.call(this, e); items.push({ text: L._('Display measure'), callback: function () { @@ -747,7 +747,7 @@ L.Storage.PathMixin = { }, getContextMenuEditItems: function (e) { - var items = L.S.FeatureMixin.getContextMenuEditItems.call(this, e); + var items = L.U.FeatureMixin.getContextMenuEditItems.call(this, e); items.push({ text: L._('Clone this feature'), callback: this.clone, @@ -775,10 +775,10 @@ L.Storage.PathMixin = { }, getInplaceToolbarActions: function (e) { - var items = L.S.FeatureMixin.getInplaceToolbarActions.call(this, e); + var items = L.U.FeatureMixin.getInplaceToolbarActions.call(this, e); if (this.isMulti()) { - items.push(L.S.DeleteShapeAction); - items.push(L.S.ExtractShapeFromMultiAction); + items.push(L.U.DeleteShapeAction); + items.push(L.U.ExtractShapeFromMultiAction); } return items; }, @@ -797,9 +797,9 @@ L.Storage.PathMixin = { }; -L.Storage.Polyline = L.Polyline.extend({ +L.U.Polyline = L.Polyline.extend({ parentClass: L.Polyline, - includes: [L.Storage.FeatureMixin, L.Storage.PathMixin, L.Mixin.Events], + includes: [L.U.FeatureMixin, L.U.PathMixin, L.Mixin.Events], staticOptions: { stroke: true, @@ -807,7 +807,7 @@ L.Storage.Polyline = L.Polyline.extend({ }, isSameClass: function (other) { - return other instanceof L.S.Polyline; + return other instanceof L.U.Polyline; }, getClassName: function () { @@ -820,7 +820,7 @@ L.Storage.Polyline = L.Polyline.extend({ }, 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; if (!this.isMulti()) { items.push({ @@ -849,7 +849,7 @@ L.Storage.Polyline = L.Polyline.extend({ }, getContextMenuMultiItems: function (e) { - var items = L.S.PathMixin.getContextMenuMultiItems.call(this, e); + var items = L.U.PathMixin.getContextMenuMultiItems.call(this, e); items.push({ text: L._('Merge lines'), callback: this.mergeShapes, @@ -868,7 +868,7 @@ L.Storage.Polyline = L.Polyline.extend({ }, 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); toPolygon.href = '#'; toPolygon.innerHTML = L._('Transform to polygon'); @@ -925,21 +925,21 @@ L.Storage.Polyline = L.Polyline.extend({ }, 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(); - if (index === 0 || index === e.vertex.getLastIndex()) actions.push(L.S.ContinueLineAction); - else actions.push(L.S.SplitLineAction); + if (index === 0 || index === e.vertex.getLastIndex()) actions.push(L.U.ContinueLineAction); + else actions.push(L.U.SplitLineAction); return actions; } }); -L.Storage.Polygon = L.Polygon.extend({ +L.U.Polygon = L.Polygon.extend({ 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) { - return other instanceof L.S.Polygon; + return other instanceof L.U.Polygon; }, getClassName: function () { @@ -947,7 +947,7 @@ L.Storage.Polygon = L.Polygon.extend({ }, getShapeOptions: function () { - var options = L.Storage.PathMixin.getShapeOptions(); + var options = L.U.PathMixin.getShapeOptions(); options.push('properties._storage_options.stroke', 'properties._storage_options.fill', '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.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 () { @@ -971,7 +971,7 @@ L.Storage.Polygon = L.Polygon.extend({ }, 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); // No multi and no holes. if (shape && !this.isMulti() && (L.LineUtil.isFlat(shape) || shape.length === 1)) { @@ -1003,7 +1003,7 @@ L.Storage.Polygon = L.Polygon.extend({ }, 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); toPolyline.href = '#'; toPolyline.innerHTML = L._('Transform to lines'); @@ -1016,8 +1016,8 @@ L.Storage.Polygon = L.Polygon.extend({ }, getInplaceToolbarActions: function (e) { - var items = L.S.PathMixin.getInplaceToolbarActions.call(this, e); - items.push(L.S.CreateHoleAction); + var items = L.U.PathMixin.getInplaceToolbarActions.call(this, e); + items.push(L.U.CreateHoleAction); return items; } diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index c4fb8c39..484f336a 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -601,7 +601,7 @@ L.FormBuilder.Range = L.FormBuilder.Input.extend({ }); -L.Storage.FormBuilder = L.FormBuilder.extend({ +L.U.FormBuilder = L.FormBuilder.extend({ options: { className: 'storage-form' diff --git a/umap/static/umap/js/umap.icon.js b/umap/static/umap/js/umap.icon.js index dbf50ab6..4086bd17 100644 --- a/umap/static/umap/js/umap.icon.js +++ b/umap/static/umap/js/umap.icon.js @@ -1,4 +1,4 @@ -L.Storage.Icon = L.DivIcon.extend({ +L.U.Icon = L.DivIcon.extend({ initialize: function(map, options) { this.map = map; 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: { iconAnchor: new L.Point(16, 40), popupAnchor: new L.Point(0, -40), @@ -45,7 +45,7 @@ L.Storage.Icon.Default = L.Storage.Icon.extend({ initialize: function(map, 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() { @@ -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) { var default_options = { iconAnchor: new L.Point(6, 6), @@ -78,7 +78,7 @@ L.Storage.Icon.Circle = L.Storage.Icon.extend({ className: 'storage-circle-icon' }; 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() { @@ -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: { iconAnchor: new L.Point(16, 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: { iconAnchor: new L.Point(8, 30), popupAnchor: new L.Point(0, -28), @@ -141,7 +141,7 @@ L.Storage.Icon.Ball = L.Storage.Icon.Default.extend({ }); var _CACHE_COLOR = {}; -L.Storage.Icon.Cluster = L.DivIcon.extend({ +L.U.Icon.Cluster = L.DivIcon.extend({ options: { iconSize: [40, 40] }, diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 400d8f85..aafd2271 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -48,7 +48,7 @@ L.Map.mergeOptions({ easing: true }); -L.Storage.Map.include({ +L.U.Map.include({ 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.Map.prototype.initialize.call(this, el, geojson.properties); - this.ui = new L.S.UI(this._container); - this.xhr = new L.S.Xhr(this.ui); + this.ui = new L.U.UI(this._container); + this.xhr = new L.U.Xhr(this.ui); this.xhr.on('dataloding', function (e) { this.fire('dataloding', e); }); @@ -196,11 +196,11 @@ L.Storage.Map.include({ } } - this.help = new L.Storage.Help(this); - this.slideshow = new L.S.Slideshow(this, this.options.slideshow); + this.help = new L.U.Help(this); + this.slideshow = new L.U.Slideshow(this, this.options.slideshow); this.initCaptionBar(); 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.editedFeature = null; }, this); @@ -226,33 +226,33 @@ L.Storage.Map.include({ this._controls = {}; 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 = [ - L.S.ImportAction, - L.S.EditPropertiesAction, - L.S.ChangeTileLayerAction, - L.S.ManageDatalayersAction, - L.S.UpdateExtentAction + L.U.ImportAction, + L.U.EditPropertiesAction, + L.U.ChangeTileLayerAction, + L.U.ManageDatalayersAction, + L.U.UpdateExtentAction ]; - if (this.options.urls.map_update_permissions) editActions.push(L.Storage.UpdatePermsAction); - new L.S.SettingsToolbar({actions: editActions}).addTo(this); + if (this.options.urls.map_update_permissions) editActions.push(L.U.UpdatePermsAction); + 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.datalayers = new L.Storage.DataLayersControl(this); - this._controls.locate = new L.S.LocateControl(); + this._controls.datalayers = new L.U.DataLayersControl(this); + 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.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.tilelayers = new L.Storage.TileLayerControl(); + this._controls.tilelayers = new L.U.TileLayerControl(); this._controls.editinosm = new L.Control.EditInOSM({ position: 'topleft', 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.more = new L.S.MoreControls(); + this._controls.more = new L.U.MoreControls(); this._controls.scale = L.control.scale(); if (this.options.scrollWheelZoom) this.scrollWheelZoom.enable(); else this.scrollWheelZoom.disable(); @@ -267,7 +267,7 @@ L.Storage.Map.include({ } 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) { this.whenReady(function () { if (this.selected_tilelayer) { @@ -358,10 +358,10 @@ L.Storage.Map.include({ modifierKey = e.ctrlKey || e.metaKey; /* Generic shortcuts */ - if (key === L.S.Keys.F && modifierKey) { + if (key === L.U.Keys.F && modifierKey) { L.DomEvent.stop(e); 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(); else this.ui.closePanel(); } @@ -369,45 +369,45 @@ L.Storage.Map.include({ if (!this.options.allowEdit) return; /* 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); 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); this.disableEdit(); this.ui.closePanel(); } - if (key === L.S.Keys.S && modifierKey) { + if (key === L.U.Keys.S && modifierKey) { L.DomEvent.stop(e); if (this.isDirty) { this.save(); } } - if (key === L.S.Keys.Z && modifierKey && this.isDirty) { + if (key === L.U.Keys.Z && modifierKey && this.isDirty) { L.DomEvent.stop(e); this.askForReset(); } - if (key === L.S.Keys.M && modifierKey && this.editEnabled) { + if (key === L.U.Keys.M && modifierKey && this.editEnabled) { L.DomEvent.stop(e); 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); 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); 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); this.importPanel(); } - if (key === L.S.Keys.H && modifierKey && this.editEnabled) { + if (key === L.U.Keys.H && modifierKey && this.editEnabled) { L.DomEvent.stop(e); 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.measureTools.enabled()) this.measureTools.stopDrawing(); } @@ -533,7 +533,7 @@ L.Storage.Map.include({ createDataLayer: function(datalayer) { 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) { @@ -586,12 +586,12 @@ L.Storage.Map.include({ for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { 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 () { iframe.innerHTML = iframeExporter.build(); }; buildIframeCode(); - var builder = new L.S.FormBuilder(iframeExporter, UIFields, { + var builder = new L.U.FormBuilder(iframeExporter, UIFields, { callback: buildIframeCode }); 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.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(); container.appendChild(form); var UIFields = []; @@ -1174,7 +1174,7 @@ L.Storage.Map.include({ 'options.displayPopupFooter', 'options.captionBar' ]); - builder = new L.S.FormBuilder(this, UIFields, { + builder = new L.U.FormBuilder(this, UIFields, { callback: this.renderControls, callbackContext: this }); @@ -1192,7 +1192,7 @@ L.Storage.Map.include({ 'options.fillOpacity' ]; - builder = new L.S.FormBuilder(this, shapeOptions, { + builder = new L.U.FormBuilder(this, shapeOptions, { callback: function (e) { this.eachDataLayer(function (datalayer) { 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}] ]; - builder = new L.S.FormBuilder(this, optionsFields, { + builder = new L.U.FormBuilder(this, optionsFields, { callback: function (e) { this.eachDataLayer(function (datalayer) { if (e.helper.field === 'options.sortKey') datalayer.reindex(); @@ -1231,7 +1231,7 @@ L.Storage.Map.include({ 'options.labelHover', 'options.labelInteractive' ]; - builder = new L.S.FormBuilder(this, popupFields, { + builder = new L.U.FormBuilder(this, popupFields, { callback: function (e) { if (e.helper.field === 'options.popupTemplate' || e.helper.field === 'options.popupContentTemplate') return; this.eachDataLayer(function (datalayer) { @@ -1254,7 +1254,7 @@ L.Storage.Map.include({ ['options.tilelayer.tms', {handler: 'Switch', label: L._('TMS format')}] ]; 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, callbackContext: this }); @@ -1270,7 +1270,7 @@ L.Storage.Map.include({ ['options.limitBounds.north', {handler: 'BlurFloatInput', placeholder: L._('max North')}], ['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, callbackContext: this }); @@ -1311,7 +1311,7 @@ L.Storage.Map.include({ this.slideshow.setOptions(this.options.slideshow); this.renderControls(); }; - var slideshowBuilder = new L.S.FormBuilder(this, slideshowFields, { + var slideshowBuilder = new L.U.FormBuilder(this, slideshowFields, { callback: slideshowHandler, callbackContext: this }); @@ -1323,7 +1323,7 @@ L.Storage.Map.include({ ['options.shortCredit', {handler: 'Input', label: L._('Short credits'), helpEntries: ['shortCredit', '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();}, callbackContext: this }); @@ -1502,7 +1502,7 @@ L.Storage.Map.include({ }, initContextMenu: function () { - this.contextmenu = new L.S.ContextMenu(this); + this.contextmenu = new L.U.ContextMenu(this); this.contextmenu.enable(); }, diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index e4fd6e37..69f464db 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -1,4 +1,4 @@ -L.S.Layer = { +L.U.Layer = { canBrowse: true, 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', - includes: [L.S.Layer], + includes: [L.U.Layer], initialize: function (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', - includes: [L.S.Layer], + includes: [L.U.Layer], initialize: function (datalayer) { this.datalayer = datalayer; @@ -34,7 +34,7 @@ L.S.Layer.Cluster = L.MarkerClusterGroup.extend({ color: this.datalayer.getColor() }, 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) { @@ -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', - includes: [L.S.Layer], + includes: [L.U.Layer], canBrowse: false, 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], @@ -229,7 +229,7 @@ L.Storage.DataLayer = L.Class.extend({ var visible = this.isVisible(); if (this.layer) this.layer.clearLayers(); 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.eachLayer(function (layer) { this.layer.addLayer(layer); @@ -365,7 +365,7 @@ L.Storage.DataLayer = L.Class.extend({ }, 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); }, @@ -553,7 +553,7 @@ L.Storage.DataLayer = L.Class.extend({ }, _pointToLayer: function(geojson, latlng) { - return new L.Storage.Marker( + return new L.U.Marker( this.map, latlng, {'geojson': geojson, 'datalayer': this} @@ -561,7 +561,7 @@ L.Storage.DataLayer = L.Class.extend({ }, _lineToLayer: function(geojson, latlngs) { - return new L.Storage.Polyline( + return new L.U.Polyline( this.map, latlngs, {'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--) { // if (!latlngs.slice()[i].length) latlngs.splice(i, 1); // } - return new L.Storage.Polygon( + return new L.U.Polygon( this.map, latlngs, {'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'}] ]; 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) { this.map.updateDatalayersControl(); if (e.helper.field === 'options.type') { @@ -737,7 +737,7 @@ L.Storage.DataLayer = L.Class.extend({ this.show(); }; - builder = new L.S.FormBuilder(this, shapeOptions, { + builder = new L.U.FormBuilder(this, shapeOptions, { id: 'datalayer-advanced-properties', callback: redrawCallback }); @@ -753,7 +753,7 @@ L.Storage.DataLayer = L.Class.extend({ optionsFields = optionsFields.concat(this.layer.getEditableOptions()); - builder = new L.S.FormBuilder(this, optionsFields, { + builder = new L.U.FormBuilder(this, optionsFields, { id: 'datalayer-advanced-properties', callback: redrawCallback }); @@ -768,7 +768,7 @@ L.Storage.DataLayer = L.Class.extend({ 'options.labelHover', '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')); popupFieldset.appendChild(builder.build()); @@ -788,7 +788,7 @@ L.Storage.DataLayer = L.Class.extend({ } 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()); if (this.map.options.urls.datalayer_versions) this.buildVersionsFieldset(container); @@ -1019,7 +1019,7 @@ L.Storage.DataLayer = L.Class.extend({ tableEdit: function () { if (this.isRemoteLayer() || !this.isVisible()) return; - var editor = new L.S.TableEditor(this); + var editor = new L.U.TableEditor(this); editor.edit(); } diff --git a/umap/static/umap/js/umap.popup.js b/umap/static/umap/js/umap.popup.js index cf28c981..afedd6fa 100644 --- a/umap/static/umap/js/umap.popup.js +++ b/umap/static/umap/js/umap.popup.js @@ -1,4 +1,4 @@ -L.S.Popup = L.Popup.extend({ +L.U.Popup = L.Popup.extend({ options: { 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: { maxWidth: 500, className: 'storage-popup-large' } }); -L.S.Popup.BaseWithTitle = L.S.Popup.extend({ +L.U.Popup.BaseWithTitle = L.U.Popup.extend({ renderTitle: function () { 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) { 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: { 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: { 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: { zoomAnimation: false @@ -208,7 +208,7 @@ L.S.Popup.SimplePanel = L.S.Popup.extend({ onRemove: function (map) { 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');}, diff --git a/umap/static/umap/js/umap.slideshow.js b/umap/static/umap/js/umap.slideshow.js index 96f260a0..1c7b6c89 100644 --- a/umap/static/umap/js/umap.slideshow.js +++ b/umap/static/umap/js/umap.slideshow.js @@ -1,4 +1,4 @@ -L.S.Slideshow = L.Class.extend({ +L.U.Slideshow = L.Class.extend({ statics: { CLASSNAME: 'storage-slideshow-active' @@ -91,7 +91,7 @@ L.S.Slideshow = L.Class.extend({ play: function () { if (this._id) 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.resetSpinners(); this.loop(); @@ -104,7 +104,7 @@ L.S.Slideshow = L.Class.extend({ pause: function () { 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); this._id = null; } diff --git a/umap/static/umap/js/umap.tableeditor.js b/umap/static/umap/js/umap.tableeditor.js index 86e256e9..fd054d9c 100644 --- a/umap/static/umap/js/umap.tableeditor.js +++ b/umap/static/umap/js/umap.tableeditor.js @@ -1,4 +1,4 @@ -L.S.TableEditor = L.Class.extend({ +L.U.TableEditor = L.Class.extend({ initialize: function (datalayer) { this.datalayer = datalayer; @@ -48,7 +48,7 @@ L.S.TableEditor = L.Class.extend({ }, 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), className: 'trow', diff --git a/umap/static/umap/js/umap.ui.js b/umap/static/umap/js/umap.ui.js index 089bc592..567c58e1 100644 --- a/umap/static/umap/js/umap.ui.js +++ b/umap/static/umap/js/umap.ui.js @@ -1,7 +1,7 @@ /* * Modals */ -L.S.UI = L.Evented.extend({ +L.U.UI = L.Evented.extend({ ALERTS: Array(), ALERT_ID: null, diff --git a/umap/static/umap/js/umap.xhr.js b/umap/static/umap/js/umap.xhr.js index 2de8deea..1d4fa56d 100644 --- a/umap/static/umap/js/umap.xhr.js +++ b/umap/static/umap/js/umap.xhr.js @@ -1,4 +1,4 @@ -L.Storage.Xhr = L.Evented.extend({ +L.U.Xhr = L.Evented.extend({ initialize: function (ui) { this.ui = ui; diff --git a/umap/templates/umap/content.html b/umap/templates/umap/content.html index 7d807abe..ca7fb698 100644 --- a/umap/templates/umap/content.html +++ b/umap/templates/umap/content.html @@ -26,8 +26,8 @@ {{ block.super }} diff --git a/umap/templates/umap/map_init.html b/umap/templates/umap/map_init.html index f0f8142e..50af1a17 100644 --- a/umap/templates/umap/map_init.html +++ b/umap/templates/umap/map_init.html @@ -1,5 +1,5 @@ {% load umap_tags %}
diff --git a/umap/templates/umap/map_messages.html b/umap/templates/umap/map_messages.html index 0ce6adf7..5ee2c2fb 100644 --- a/umap/templates/umap/map_messages.html +++ b/umap/templates/umap/map_messages.html @@ -2,10 +2,10 @@ {% for m in messages %} "loooping" {# 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 }}", level: "{{ m.tags }}", duration: 100000 }); {% endfor %} - \ No newline at end of file +