umap-project 2.7.3__py3-none-any.whl → 2.8.0a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- umap/__init__.py +1 -1
- umap/forms.py +4 -14
- umap/locale/am_ET/LC_MESSAGES/django.mo +0 -0
- umap/locale/am_ET/LC_MESSAGES/django.po +278 -151
- umap/locale/ar/LC_MESSAGES/django.mo +0 -0
- umap/locale/ar/LC_MESSAGES/django.po +335 -141
- umap/locale/bg/LC_MESSAGES/django.mo +0 -0
- umap/locale/bg/LC_MESSAGES/django.po +279 -152
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +95 -79
- umap/locale/ca/LC_MESSAGES/django.mo +0 -0
- umap/locale/ca/LC_MESSAGES/django.po +85 -68
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +78 -66
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +280 -153
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +80 -64
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +82 -66
- umap/locale/en/LC_MESSAGES/django.po +73 -61
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +75 -63
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +280 -153
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +82 -66
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +80 -64
- umap/locale/fi/LC_MESSAGES/django.mo +0 -0
- umap/locale/fi/LC_MESSAGES/django.po +278 -151
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +75 -63
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +280 -153
- umap/locale/he/LC_MESSAGES/django.mo +0 -0
- umap/locale/he/LC_MESSAGES/django.po +281 -154
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +80 -64
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +280 -153
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +82 -66
- umap/locale/ja/LC_MESSAGES/django.mo +0 -0
- umap/locale/ja/LC_MESSAGES/django.po +280 -153
- umap/locale/ko/LC_MESSAGES/django.mo +0 -0
- umap/locale/ko/LC_MESSAGES/django.po +280 -153
- umap/locale/lt/LC_MESSAGES/django.mo +0 -0
- umap/locale/lt/LC_MESSAGES/django.po +280 -153
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +82 -66
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +280 -153
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +82 -66
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +75 -63
- umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_BR/LC_MESSAGES/django.po +280 -153
- umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_PT/LC_MESSAGES/django.po +280 -153
- umap/locale/ru/LC_MESSAGES/django.mo +0 -0
- umap/locale/ru/LC_MESSAGES/django.po +280 -153
- umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
- umap/locale/sk_SK/LC_MESSAGES/django.po +280 -153
- umap/locale/sl/LC_MESSAGES/django.mo +0 -0
- umap/locale/sl/LC_MESSAGES/django.po +280 -153
- umap/locale/sr/LC_MESSAGES/django.mo +0 -0
- umap/locale/sr/LC_MESSAGES/django.po +280 -153
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +81 -65
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +257 -185
- umap/locale/tr/LC_MESSAGES/django.mo +0 -0
- umap/locale/tr/LC_MESSAGES/django.po +280 -153
- umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
- umap/locale/uk_UA/LC_MESSAGES/django.po +280 -153
- umap/locale/vi/LC_MESSAGES/django.mo +0 -0
- umap/locale/vi/LC_MESSAGES/django.po +278 -151
- umap/locale/zh/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh/LC_MESSAGES/django.po +278 -151
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +97 -81
- umap/management/commands/empty_trash.py +32 -0
- umap/management/commands/migrate_to_S3.py +29 -0
- umap/migrations/0023_alter_datalayer_uuid.py +19 -0
- umap/migrations/0024_alter_map_share_status.py +30 -0
- umap/migrations/0025_alter_datalayer_geojson.py +24 -0
- umap/models.py +68 -116
- umap/settings/base.py +22 -2
- umap/static/umap/base.css +3 -603
- umap/static/umap/content.css +5 -3
- umap/static/umap/css/bar.css +202 -0
- umap/static/umap/css/form.css +617 -0
- umap/static/umap/css/icon.css +21 -1
- umap/static/umap/css/popup.css +125 -0
- umap/static/umap/img/16-white.svg +16 -4
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/source/16-white.svg +46 -45
- umap/static/umap/img/source/16.svg +1 -753
- umap/static/umap/js/components/fragment.js +3 -1
- umap/static/umap/js/modules/browser.js +20 -19
- umap/static/umap/js/modules/caption.js +21 -22
- umap/static/umap/js/modules/data/features.js +101 -74
- umap/static/umap/js/modules/data/layer.js +157 -137
- umap/static/umap/js/modules/facets.js +9 -9
- umap/static/umap/js/modules/formatter.js +5 -5
- umap/static/umap/js/modules/global.js +4 -52
- umap/static/umap/js/modules/help.js +18 -21
- umap/static/umap/js/modules/importer.js +71 -39
- umap/static/umap/js/modules/importers/cadastrefr.js +4 -0
- umap/static/umap/js/modules/importers/geodatamine.js +3 -3
- umap/static/umap/js/modules/importers/overpass.js +5 -0
- umap/static/umap/js/modules/permissions.js +85 -87
- umap/static/umap/js/modules/rendering/layers/base.js +15 -15
- umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
- umap/static/umap/js/modules/rendering/layers/cluster.js +1 -1
- umap/static/umap/js/modules/rendering/layers/heat.js +1 -1
- umap/static/umap/js/modules/rendering/map.js +390 -0
- umap/static/umap/js/modules/rendering/popup.js +10 -9
- umap/static/umap/js/modules/rendering/template.js +35 -12
- umap/static/umap/js/modules/rendering/ui.js +57 -12
- umap/static/umap/js/modules/rules.js +22 -25
- umap/static/umap/js/modules/saving.js +47 -0
- umap/static/umap/js/modules/schema.js +5 -0
- umap/static/umap/js/modules/share.js +21 -24
- umap/static/umap/js/modules/slideshow.js +24 -20
- umap/static/umap/js/modules/sync/updaters.js +7 -9
- umap/static/umap/js/modules/tableeditor.js +20 -19
- umap/static/umap/js/modules/ui/bar.js +196 -0
- umap/static/umap/js/modules/ui/panel.js +10 -9
- umap/static/umap/js/modules/umap.js +1668 -0
- umap/static/umap/js/modules/urls.js +2 -2
- umap/static/umap/js/modules/utils.js +20 -6
- umap/static/umap/js/umap.controls.js +74 -301
- umap/static/umap/js/umap.core.js +29 -50
- umap/static/umap/js/umap.forms.js +34 -27
- umap/static/umap/keycloak.png +0 -0
- umap/static/umap/locale/am_ET.js +26 -10
- umap/static/umap/locale/am_ET.json +26 -10
- umap/static/umap/locale/ar.js +26 -10
- umap/static/umap/locale/ar.json +26 -10
- umap/static/umap/locale/ast.js +26 -10
- umap/static/umap/locale/ast.json +26 -10
- umap/static/umap/locale/bg.js +26 -10
- umap/static/umap/locale/bg.json +26 -10
- umap/static/umap/locale/br.js +27 -20
- umap/static/umap/locale/br.json +27 -20
- umap/static/umap/locale/ca.js +32 -29
- umap/static/umap/locale/ca.json +32 -29
- umap/static/umap/locale/cs_CZ.js +24 -17
- umap/static/umap/locale/cs_CZ.json +24 -17
- umap/static/umap/locale/da.js +26 -10
- umap/static/umap/locale/da.json +26 -10
- umap/static/umap/locale/de.js +21 -14
- umap/static/umap/locale/de.json +21 -14
- umap/static/umap/locale/el.js +28 -12
- umap/static/umap/locale/el.json +28 -12
- umap/static/umap/locale/en.js +12 -9
- umap/static/umap/locale/en.json +12 -9
- umap/static/umap/locale/en_US.json +26 -10
- umap/static/umap/locale/es.js +16 -13
- umap/static/umap/locale/es.json +16 -13
- umap/static/umap/locale/et.js +26 -10
- umap/static/umap/locale/et.json +26 -10
- umap/static/umap/locale/eu.js +16 -9
- umap/static/umap/locale/eu.json +16 -9
- umap/static/umap/locale/fa_IR.js +16 -9
- umap/static/umap/locale/fa_IR.json +16 -9
- umap/static/umap/locale/fi.js +26 -10
- umap/static/umap/locale/fi.json +26 -10
- umap/static/umap/locale/fr.js +12 -9
- umap/static/umap/locale/fr.json +12 -9
- umap/static/umap/locale/gl.js +26 -10
- umap/static/umap/locale/gl.json +26 -10
- umap/static/umap/locale/he.js +26 -10
- umap/static/umap/locale/he.json +26 -10
- umap/static/umap/locale/hr.js +26 -10
- umap/static/umap/locale/hr.json +26 -10
- umap/static/umap/locale/hu.js +16 -9
- umap/static/umap/locale/hu.json +16 -9
- umap/static/umap/locale/id.js +26 -10
- umap/static/umap/locale/id.json +26 -10
- umap/static/umap/locale/is.js +26 -10
- umap/static/umap/locale/is.json +26 -10
- umap/static/umap/locale/it.js +26 -10
- umap/static/umap/locale/it.json +26 -10
- umap/static/umap/locale/ja.js +26 -10
- umap/static/umap/locale/ja.json +26 -10
- umap/static/umap/locale/ko.js +26 -10
- umap/static/umap/locale/ko.json +26 -10
- umap/static/umap/locale/lt.js +26 -10
- umap/static/umap/locale/lt.json +26 -10
- umap/static/umap/locale/ms.js +28 -12
- umap/static/umap/locale/ms.json +28 -12
- umap/static/umap/locale/nl.js +28 -12
- umap/static/umap/locale/nl.json +28 -12
- umap/static/umap/locale/no.js +26 -10
- umap/static/umap/locale/no.json +26 -10
- umap/static/umap/locale/pl.js +28 -12
- umap/static/umap/locale/pl.json +28 -12
- umap/static/umap/locale/pl_PL.json +26 -10
- umap/static/umap/locale/pt.js +16 -9
- umap/static/umap/locale/pt.json +16 -9
- umap/static/umap/locale/pt_BR.js +26 -10
- umap/static/umap/locale/pt_BR.json +26 -10
- umap/static/umap/locale/pt_PT.js +16 -9
- umap/static/umap/locale/pt_PT.json +16 -9
- umap/static/umap/locale/ro.js +26 -10
- umap/static/umap/locale/ro.json +26 -10
- umap/static/umap/locale/ru.js +26 -10
- umap/static/umap/locale/ru.json +26 -10
- umap/static/umap/locale/si.js +7 -7
- umap/static/umap/locale/si.json +7 -7
- umap/static/umap/locale/sk_SK.js +26 -10
- umap/static/umap/locale/sk_SK.json +26 -10
- umap/static/umap/locale/sl.js +26 -10
- umap/static/umap/locale/sl.json +26 -10
- umap/static/umap/locale/sr.js +26 -10
- umap/static/umap/locale/sr.json +26 -10
- umap/static/umap/locale/sv.js +27 -11
- umap/static/umap/locale/sv.json +27 -11
- umap/static/umap/locale/th_TH.js +28 -12
- umap/static/umap/locale/th_TH.json +28 -12
- umap/static/umap/locale/tr.js +26 -10
- umap/static/umap/locale/tr.json +26 -10
- umap/static/umap/locale/uk_UA.js +26 -10
- umap/static/umap/locale/uk_UA.json +26 -10
- umap/static/umap/locale/vi.js +26 -10
- umap/static/umap/locale/vi.json +26 -10
- umap/static/umap/locale/vi_VN.json +26 -10
- umap/static/umap/locale/zh.js +26 -10
- umap/static/umap/locale/zh.json +26 -10
- umap/static/umap/locale/zh_CN.json +26 -10
- umap/static/umap/locale/zh_TW.Big5.json +26 -10
- umap/static/umap/locale/zh_TW.js +34 -27
- umap/static/umap/locale/zh_TW.json +34 -27
- umap/static/umap/map.css +5 -364
- umap/static/umap/unittests/URLs.js +15 -15
- umap/static/umap/unittests/utils.js +23 -1
- umap/static/umap/vars.css +2 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
- umap/storage.py +152 -0
- umap/templates/registration/login.html +7 -6
- umap/templates/umap/css.html +3 -0
- umap/templates/umap/js.html +1 -2
- umap/templates/umap/map_init.html +4 -5
- umap/templates/umap/user_dashboard.html +18 -19
- umap/tests/base.py +5 -1
- umap/tests/integration/conftest.py +2 -1
- umap/tests/integration/test_anonymous_owned_map.py +18 -10
- umap/tests/integration/test_browser.py +16 -1
- umap/tests/integration/test_dashboard.py +1 -1
- umap/tests/integration/test_edit_datalayer.py +18 -7
- umap/tests/integration/test_import.py +8 -5
- umap/tests/integration/test_optimistic_merge.py +31 -8
- umap/tests/integration/test_owned_map.py +22 -16
- umap/tests/integration/test_popup.py +44 -0
- umap/tests/integration/test_save.py +35 -0
- umap/tests/integration/test_view_marker.py +12 -0
- umap/tests/integration/test_view_polyline.py +257 -0
- umap/tests/integration/test_websocket_sync.py +81 -9
- umap/tests/test_datalayer.py +6 -7
- umap/tests/test_datalayer_s3.py +135 -0
- umap/tests/test_datalayer_views.py +28 -10
- umap/tests/test_empty_trash.py +34 -0
- umap/tests/test_map.py +12 -3
- umap/tests/test_map_views.py +69 -37
- umap/tests/test_views.py +53 -0
- umap/urls.py +3 -3
- umap/views.py +107 -76
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/METADATA +16 -13
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/RECORD +276 -262
- umap/management/commands/purge_purgatory.py +0 -28
- umap/static/umap/js/umap.js +0 -1903
- umap/tests/test_purge_purgatory.py +0 -25
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/WHEEL +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
2
|
import { translate } from './i18n.js'
|
|
3
3
|
import { uMapAlert as Alert } from '../components/alerts/alert.js'
|
|
4
|
+
import { ServerStored } from './saving.js'
|
|
4
5
|
import * as Utils from './utils.js'
|
|
5
6
|
|
|
6
7
|
// Dedicated object so we can deal with a separate dirty status, and thus
|
|
7
8
|
// call the endpoint only when needed, saving one call at each save.
|
|
8
|
-
export class MapPermissions {
|
|
9
|
-
constructor(
|
|
10
|
-
|
|
11
|
-
this.
|
|
9
|
+
export class MapPermissions extends ServerStored {
|
|
10
|
+
constructor(umap) {
|
|
11
|
+
super()
|
|
12
|
+
this.setProperties(umap.properties.permissions)
|
|
13
|
+
this._umap = umap
|
|
12
14
|
this._isDirty = false
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
if (status) this.map.isDirty = status
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get isDirty() {
|
|
21
|
-
return this._isDirty
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
setOptions(options) {
|
|
25
|
-
this.options = Object.assign(
|
|
17
|
+
setProperties(properties) {
|
|
18
|
+
this.properties = Object.assign(
|
|
26
19
|
{
|
|
27
20
|
owner: null,
|
|
28
21
|
team: null,
|
|
@@ -30,42 +23,54 @@ export class MapPermissions {
|
|
|
30
23
|
share_status: null,
|
|
31
24
|
edit_status: null,
|
|
32
25
|
},
|
|
33
|
-
|
|
26
|
+
properties
|
|
34
27
|
)
|
|
35
28
|
}
|
|
36
29
|
|
|
30
|
+
render() {
|
|
31
|
+
this._umap.render(['properties.permissions'])
|
|
32
|
+
}
|
|
33
|
+
|
|
37
34
|
isOwner() {
|
|
38
|
-
return Boolean(this.
|
|
35
|
+
return Boolean(this._umap.properties.user?.is_owner)
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
isAnonymousMap() {
|
|
42
|
-
return !this.
|
|
39
|
+
return !this._umap.properties.permissions.owner
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
_editAnonymous(container) {
|
|
46
43
|
const fields = []
|
|
47
44
|
if (this.isOwner()) {
|
|
48
45
|
fields.push([
|
|
49
|
-
'
|
|
46
|
+
'properties.edit_status',
|
|
50
47
|
{
|
|
51
48
|
handler: 'IntSelect',
|
|
52
49
|
label: translate('Who can edit'),
|
|
53
|
-
selectOptions: this.
|
|
50
|
+
selectOptions: this._umap.properties.edit_statuses,
|
|
51
|
+
},
|
|
52
|
+
])
|
|
53
|
+
fields.push([
|
|
54
|
+
'properties.share_status',
|
|
55
|
+
{
|
|
56
|
+
handler: 'IntSelect',
|
|
57
|
+
label: translate('Who can view'),
|
|
58
|
+
selectOptions: this._umap.properties.share_statuses,
|
|
54
59
|
},
|
|
55
60
|
])
|
|
56
61
|
const builder = new U.FormBuilder(this, fields)
|
|
57
62
|
const form = builder.build()
|
|
58
63
|
container.appendChild(form)
|
|
59
64
|
|
|
60
|
-
if (this.
|
|
65
|
+
if (this.properties.anonymous_edit_url) {
|
|
61
66
|
DomUtil.createCopiableInput(
|
|
62
67
|
container,
|
|
63
68
|
translate('Secret edit link:'),
|
|
64
|
-
this.
|
|
69
|
+
this.properties.anonymous_edit_url
|
|
65
70
|
)
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
if (this.
|
|
73
|
+
if (this._umap.properties.user?.id) {
|
|
69
74
|
// We have a user, and this user has come through here, so they can edit the map, so let's allow to own the map.
|
|
70
75
|
// Note: real check is made on the back office anyway.
|
|
71
76
|
const advancedActions = DomUtil.createFieldset(
|
|
@@ -93,38 +98,38 @@ export class MapPermissions {
|
|
|
93
98
|
container.appendChild(fieldset)
|
|
94
99
|
if (this.isOwner()) {
|
|
95
100
|
topFields.push([
|
|
96
|
-
'
|
|
101
|
+
'properties.edit_status',
|
|
97
102
|
{
|
|
98
103
|
handler: 'IntSelect',
|
|
99
104
|
label: translate('Who can edit'),
|
|
100
|
-
selectOptions: this.
|
|
105
|
+
selectOptions: this._umap.properties.edit_statuses,
|
|
101
106
|
},
|
|
102
107
|
])
|
|
103
108
|
topFields.push([
|
|
104
|
-
'
|
|
109
|
+
'properties.share_status',
|
|
105
110
|
{
|
|
106
111
|
handler: 'IntSelect',
|
|
107
112
|
label: translate('Who can view'),
|
|
108
|
-
selectOptions: this.
|
|
113
|
+
selectOptions: this._umap.properties.share_statuses,
|
|
109
114
|
},
|
|
110
115
|
])
|
|
111
116
|
collaboratorsFields.push([
|
|
112
|
-
'
|
|
117
|
+
'properties.owner',
|
|
113
118
|
{ handler: 'ManageOwner', label: translate("Map's owner") },
|
|
114
119
|
])
|
|
115
|
-
if (this.
|
|
120
|
+
if (this._umap.properties.user?.teams?.length) {
|
|
116
121
|
collaboratorsFields.push([
|
|
117
|
-
'
|
|
122
|
+
'properties.team',
|
|
118
123
|
{
|
|
119
124
|
handler: 'ManageTeam',
|
|
120
125
|
label: translate('Attach map to a team'),
|
|
121
|
-
teams: this.
|
|
126
|
+
teams: this._umap.properties.user.teams,
|
|
122
127
|
},
|
|
123
128
|
])
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
collaboratorsFields.push([
|
|
127
|
-
'
|
|
132
|
+
'properties.editors',
|
|
128
133
|
{ handler: 'ManageEditors', label: translate("Map's editors") },
|
|
129
134
|
])
|
|
130
135
|
|
|
@@ -143,20 +148,20 @@ export class MapPermissions {
|
|
|
143
148
|
}
|
|
144
149
|
|
|
145
150
|
_editDatalayers(container) {
|
|
146
|
-
if (this.
|
|
151
|
+
if (this._umap.hasLayers()) {
|
|
147
152
|
const fieldset = Utils.loadTemplate(
|
|
148
153
|
`<fieldset class="separator"><legend>${translate('Datalayers')}</legend></fieldset>`
|
|
149
154
|
)
|
|
150
155
|
container.appendChild(fieldset)
|
|
151
|
-
this.
|
|
156
|
+
this._umap.eachDataLayer((datalayer) => {
|
|
152
157
|
datalayer.permissions.edit(fieldset)
|
|
153
158
|
})
|
|
154
159
|
}
|
|
155
160
|
}
|
|
156
161
|
|
|
157
162
|
edit() {
|
|
158
|
-
if (this.
|
|
159
|
-
if (!this.
|
|
163
|
+
if (this._umap.properties.editMode !== 'advanced') return
|
|
164
|
+
if (!this._umap.id) {
|
|
160
165
|
Alert.info(translate('Please save the map first'))
|
|
161
166
|
return
|
|
162
167
|
}
|
|
@@ -165,77 +170,83 @@ export class MapPermissions {
|
|
|
165
170
|
if (this.isAnonymousMap()) this._editAnonymous(container)
|
|
166
171
|
else this._editWithOwner(container)
|
|
167
172
|
this._editDatalayers(container)
|
|
168
|
-
this.
|
|
173
|
+
this._umap.editPanel.open({ content: container, className: 'dark' })
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
async attach() {
|
|
172
|
-
const [data, response, error] = await this.
|
|
177
|
+
const [data, response, error] = await this._umap.server.post(this.getAttachUrl())
|
|
173
178
|
if (!error) {
|
|
174
|
-
this.
|
|
179
|
+
this.properties.owner = this._umap.properties.user
|
|
175
180
|
Alert.success(translate('Map has been attached to your account'))
|
|
176
|
-
this.
|
|
181
|
+
this._umap.editPanel.close()
|
|
177
182
|
}
|
|
178
183
|
}
|
|
179
184
|
|
|
180
185
|
async save() {
|
|
181
186
|
if (!this.isDirty) return
|
|
182
187
|
const formData = new FormData()
|
|
183
|
-
if (!this.isAnonymousMap() && this.
|
|
184
|
-
const editors = this.
|
|
185
|
-
for (let i = 0; i < this.
|
|
186
|
-
formData.append('editors', this.
|
|
188
|
+
if (!this.isAnonymousMap() && this.properties.editors) {
|
|
189
|
+
const editors = this.properties.editors.map((u) => u.id)
|
|
190
|
+
for (let i = 0; i < this.properties.editors.length; i++)
|
|
191
|
+
formData.append('editors', this.properties.editors[i].id)
|
|
187
192
|
}
|
|
188
193
|
if (this.isOwner() || this.isAnonymousMap()) {
|
|
189
|
-
formData.append('edit_status', this.
|
|
194
|
+
formData.append('edit_status', this.properties.edit_status)
|
|
195
|
+
formData.append('share_status', this.properties.share_status)
|
|
190
196
|
}
|
|
191
197
|
if (this.isOwner()) {
|
|
192
|
-
formData.append('owner', this.
|
|
193
|
-
formData.append('team', this.
|
|
194
|
-
formData.append('share_status', this.options.share_status)
|
|
198
|
+
formData.append('owner', this.properties.owner?.id)
|
|
199
|
+
formData.append('team', this.properties.team?.id || '')
|
|
195
200
|
}
|
|
196
|
-
const [data, response, error] = await this.
|
|
201
|
+
const [data, response, error] = await this._umap.server.post(
|
|
197
202
|
this.getUrl(),
|
|
198
203
|
{},
|
|
199
204
|
formData
|
|
200
205
|
)
|
|
201
206
|
if (!error) {
|
|
202
207
|
this.commit()
|
|
203
|
-
|
|
204
|
-
this.map.fire('postsync')
|
|
208
|
+
return true
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
|
|
208
212
|
getUrl() {
|
|
209
|
-
return
|
|
210
|
-
map_id: this.
|
|
213
|
+
return this._umap.urls.get('map_update_permissions', {
|
|
214
|
+
map_id: this._umap.id,
|
|
211
215
|
})
|
|
212
216
|
}
|
|
213
217
|
|
|
214
218
|
getAttachUrl() {
|
|
215
|
-
return
|
|
216
|
-
map_id: this.
|
|
219
|
+
return this._umap.urls.get('map_attach_owner', {
|
|
220
|
+
map_id: this._umap.id,
|
|
217
221
|
})
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
commit() {
|
|
221
|
-
this.
|
|
222
|
-
|
|
223
|
-
this.
|
|
225
|
+
this._umap.properties.permissions = Object.assign(
|
|
226
|
+
{},
|
|
227
|
+
this._umap.properties.permissions,
|
|
228
|
+
this.properties
|
|
224
229
|
)
|
|
225
230
|
}
|
|
226
231
|
|
|
227
232
|
getShareStatusDisplay() {
|
|
228
|
-
if (this.
|
|
229
|
-
return Object.fromEntries(this.
|
|
230
|
-
this.
|
|
233
|
+
if (this._umap.properties.share_statuses) {
|
|
234
|
+
return Object.fromEntries(this._umap.properties.share_statuses)[
|
|
235
|
+
this.properties.share_status
|
|
231
236
|
]
|
|
232
237
|
}
|
|
233
238
|
}
|
|
239
|
+
|
|
240
|
+
isDraft() {
|
|
241
|
+
return this.properties.share_status === 0
|
|
242
|
+
}
|
|
234
243
|
}
|
|
235
244
|
|
|
236
|
-
export class DataLayerPermissions {
|
|
237
|
-
constructor(datalayer) {
|
|
238
|
-
|
|
245
|
+
export class DataLayerPermissions extends ServerStored {
|
|
246
|
+
constructor(umap, datalayer) {
|
|
247
|
+
super()
|
|
248
|
+
this._umap = umap
|
|
249
|
+
this.properties = Object.assign(
|
|
239
250
|
{
|
|
240
251
|
edit_status: null,
|
|
241
252
|
},
|
|
@@ -243,32 +254,18 @@ export class DataLayerPermissions {
|
|
|
243
254
|
)
|
|
244
255
|
|
|
245
256
|
this.datalayer = datalayer
|
|
246
|
-
this._isDirty = false
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
set isDirty(status) {
|
|
250
|
-
this._isDirty = status
|
|
251
|
-
if (status) this.datalayer.isDirty = status
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
get isDirty() {
|
|
255
|
-
return this._isDirty
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
get map() {
|
|
259
|
-
return this.datalayer.map
|
|
260
257
|
}
|
|
261
258
|
|
|
262
259
|
edit(container) {
|
|
263
260
|
const fields = [
|
|
264
261
|
[
|
|
265
|
-
'
|
|
262
|
+
'properties.edit_status',
|
|
266
263
|
{
|
|
267
264
|
handler: 'IntSelect',
|
|
268
265
|
label: translate('Who can edit "{layer}"', {
|
|
269
266
|
layer: this.datalayer.getName(),
|
|
270
267
|
}),
|
|
271
|
-
selectOptions: this.
|
|
268
|
+
selectOptions: this._umap.properties.datalayer_edit_statuses,
|
|
272
269
|
},
|
|
273
270
|
],
|
|
274
271
|
]
|
|
@@ -280,31 +277,32 @@ export class DataLayerPermissions {
|
|
|
280
277
|
}
|
|
281
278
|
|
|
282
279
|
getUrl() {
|
|
283
|
-
return this.
|
|
284
|
-
map_id: this.
|
|
285
|
-
pk: this.datalayer.
|
|
280
|
+
return this._umap.urls.get('datalayer_permissions', {
|
|
281
|
+
map_id: this._umap.id,
|
|
282
|
+
pk: this.datalayer.id,
|
|
286
283
|
})
|
|
287
284
|
}
|
|
288
285
|
|
|
289
286
|
async save() {
|
|
290
287
|
if (!this.isDirty) return
|
|
291
288
|
const formData = new FormData()
|
|
292
|
-
formData.append('edit_status', this.
|
|
293
|
-
const [data, response, error] = await this.
|
|
289
|
+
formData.append('edit_status', this.properties.edit_status)
|
|
290
|
+
const [data, response, error] = await this._umap.server.post(
|
|
294
291
|
this.getUrl(),
|
|
295
292
|
{},
|
|
296
293
|
formData
|
|
297
294
|
)
|
|
298
295
|
if (!error) {
|
|
299
296
|
this.commit()
|
|
300
|
-
|
|
297
|
+
return true
|
|
301
298
|
}
|
|
302
299
|
}
|
|
303
300
|
|
|
304
301
|
commit() {
|
|
305
302
|
this.datalayer.options.permissions = Object.assign(
|
|
303
|
+
{},
|
|
306
304
|
this.datalayer.options.permissions,
|
|
307
|
-
this.
|
|
305
|
+
this.properties
|
|
308
306
|
)
|
|
309
307
|
}
|
|
310
308
|
}
|
|
@@ -5,20 +5,20 @@ import * as Utils from '../../utils.js'
|
|
|
5
5
|
export const LayerMixin = {
|
|
6
6
|
browsable: true,
|
|
7
7
|
|
|
8
|
-
onInit: function (
|
|
9
|
-
if (this.datalayer.autoLoaded())
|
|
8
|
+
onInit: function (leafletMap) {
|
|
9
|
+
if (this.datalayer.autoLoaded()) leafletMap.on('zoomend', this.onZoomEnd, this)
|
|
10
10
|
},
|
|
11
11
|
|
|
12
|
-
onDelete: function (
|
|
13
|
-
|
|
12
|
+
onDelete: function (leafletMap) {
|
|
13
|
+
leafletMap.off('zoomend', this.onZoomEnd, this)
|
|
14
14
|
},
|
|
15
15
|
|
|
16
|
-
onAdd: function (
|
|
17
|
-
|
|
16
|
+
onAdd: function (leafletMap) {
|
|
17
|
+
leafletMap.on('moveend', this.onMoveEnd, this)
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
-
onRemove: function (
|
|
21
|
-
|
|
20
|
+
onRemove: function (leafletMap) {
|
|
21
|
+
leafletMap.off('moveend', this.onMoveEnd, this)
|
|
22
22
|
},
|
|
23
23
|
|
|
24
24
|
getType: function () {
|
|
@@ -73,17 +73,17 @@ export const Default = FeatureGroup.extend({
|
|
|
73
73
|
initialize: function (datalayer) {
|
|
74
74
|
this.datalayer = datalayer
|
|
75
75
|
FeatureGroup.prototype.initialize.call(this)
|
|
76
|
-
LayerMixin.onInit.call(this, this.datalayer.
|
|
76
|
+
LayerMixin.onInit.call(this, this.datalayer._leafletMap)
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
onAdd: function (
|
|
80
|
-
LayerMixin.onAdd.call(this,
|
|
81
|
-
return FeatureGroup.prototype.onAdd.call(this,
|
|
79
|
+
onAdd: function (leafletMap) {
|
|
80
|
+
LayerMixin.onAdd.call(this, leafletMap)
|
|
81
|
+
return FeatureGroup.prototype.onAdd.call(this, leafletMap)
|
|
82
82
|
},
|
|
83
83
|
|
|
84
|
-
onRemove: function (
|
|
85
|
-
LayerMixin.onRemove.call(this,
|
|
86
|
-
return FeatureGroup.prototype.onRemove.call(this,
|
|
84
|
+
onRemove: function (leafletMap) {
|
|
85
|
+
LayerMixin.onRemove.call(this, leafletMap)
|
|
86
|
+
return FeatureGroup.prototype.onRemove.call(this, leafletMap)
|
|
87
87
|
},
|
|
88
88
|
})
|
|
89
89
|
|
|
@@ -20,7 +20,7 @@ const ClassifiedMixin = {
|
|
|
20
20
|
}
|
|
21
21
|
this.ensureOptions(this.datalayer.options[key])
|
|
22
22
|
FeatureGroup.prototype.initialize.call(this, [], this.datalayer.options[key])
|
|
23
|
-
LayerMixin.onInit.call(this, this.datalayer.
|
|
23
|
+
LayerMixin.onInit.call(this, this.datalayer._leafletMap)
|
|
24
24
|
},
|
|
25
25
|
|
|
26
26
|
ensureOptions: () => {},
|
|
@@ -40,7 +40,7 @@ export const Cluster = L.MarkerClusterGroup.extend({
|
|
|
40
40
|
options.maxClusterRadius = this.datalayer.options.cluster.radius
|
|
41
41
|
}
|
|
42
42
|
L.MarkerClusterGroup.prototype.initialize.call(this, options)
|
|
43
|
-
LayerMixin.onInit.call(this, this.datalayer.
|
|
43
|
+
LayerMixin.onInit.call(this, this.datalayer._leafletMap)
|
|
44
44
|
this._markerCluster = MarkerCluster
|
|
45
45
|
this._layers = []
|
|
46
46
|
},
|
|
@@ -21,7 +21,7 @@ export const Heat = L.HeatLayer.extend({
|
|
|
21
21
|
initialize: function (datalayer) {
|
|
22
22
|
this.datalayer = datalayer
|
|
23
23
|
L.HeatLayer.prototype.initialize.call(this, [], this.datalayer.options.heat)
|
|
24
|
-
LayerMixin.onInit.call(this, this.datalayer.
|
|
24
|
+
LayerMixin.onInit.call(this, this.datalayer._leafletMap)
|
|
25
25
|
if (!Utils.isObject(this.datalayer.options.heat)) {
|
|
26
26
|
this.datalayer.options.heat = {}
|
|
27
27
|
}
|