umap-project 2.7.2__py3-none-any.whl → 2.8.0__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.
Files changed (293) hide show
  1. umap/__init__.py +1 -1
  2. umap/forms.py +4 -14
  3. umap/locale/am_ET/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/am_ET/LC_MESSAGES/django.po +278 -151
  5. umap/locale/ar/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/ar/LC_MESSAGES/django.po +335 -141
  7. umap/locale/bg/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/bg/LC_MESSAGES/django.po +279 -152
  9. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  10. umap/locale/br/LC_MESSAGES/django.po +95 -79
  11. umap/locale/ca/LC_MESSAGES/django.mo +0 -0
  12. umap/locale/ca/LC_MESSAGES/django.po +85 -68
  13. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  14. umap/locale/cs_CZ/LC_MESSAGES/django.po +78 -66
  15. umap/locale/da/LC_MESSAGES/django.mo +0 -0
  16. umap/locale/da/LC_MESSAGES/django.po +280 -153
  17. umap/locale/de/LC_MESSAGES/django.mo +0 -0
  18. umap/locale/de/LC_MESSAGES/django.po +80 -64
  19. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  20. umap/locale/el/LC_MESSAGES/django.po +82 -66
  21. umap/locale/en/LC_MESSAGES/django.po +73 -61
  22. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/es/LC_MESSAGES/django.po +75 -63
  24. umap/locale/et/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/et/LC_MESSAGES/django.po +280 -153
  26. umap/locale/eu/LC_MESSAGES/django.mo +0 -0
  27. umap/locale/eu/LC_MESSAGES/django.po +82 -66
  28. umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
  29. umap/locale/fa_IR/LC_MESSAGES/django.po +80 -64
  30. umap/locale/fi/LC_MESSAGES/django.mo +0 -0
  31. umap/locale/fi/LC_MESSAGES/django.po +278 -151
  32. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  33. umap/locale/fr/LC_MESSAGES/django.po +75 -63
  34. umap/locale/gl/LC_MESSAGES/django.mo +0 -0
  35. umap/locale/gl/LC_MESSAGES/django.po +280 -153
  36. umap/locale/he/LC_MESSAGES/django.mo +0 -0
  37. umap/locale/he/LC_MESSAGES/django.po +281 -154
  38. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  39. umap/locale/hu/LC_MESSAGES/django.po +80 -64
  40. umap/locale/is/LC_MESSAGES/django.mo +0 -0
  41. umap/locale/is/LC_MESSAGES/django.po +280 -153
  42. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  43. umap/locale/it/LC_MESSAGES/django.po +82 -66
  44. umap/locale/ja/LC_MESSAGES/django.mo +0 -0
  45. umap/locale/ja/LC_MESSAGES/django.po +280 -153
  46. umap/locale/ko/LC_MESSAGES/django.mo +0 -0
  47. umap/locale/ko/LC_MESSAGES/django.po +280 -153
  48. umap/locale/lt/LC_MESSAGES/django.mo +0 -0
  49. umap/locale/lt/LC_MESSAGES/django.po +280 -153
  50. umap/locale/ms/LC_MESSAGES/django.mo +0 -0
  51. umap/locale/ms/LC_MESSAGES/django.po +82 -66
  52. umap/locale/nl/LC_MESSAGES/django.mo +0 -0
  53. umap/locale/nl/LC_MESSAGES/django.po +280 -153
  54. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  55. umap/locale/pl/LC_MESSAGES/django.po +82 -66
  56. umap/locale/pt/LC_MESSAGES/django.mo +0 -0
  57. umap/locale/pt/LC_MESSAGES/django.po +75 -63
  58. umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
  59. umap/locale/pt_BR/LC_MESSAGES/django.po +280 -153
  60. umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
  61. umap/locale/pt_PT/LC_MESSAGES/django.po +280 -153
  62. umap/locale/ru/LC_MESSAGES/django.mo +0 -0
  63. umap/locale/ru/LC_MESSAGES/django.po +280 -153
  64. umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
  65. umap/locale/sk_SK/LC_MESSAGES/django.po +280 -153
  66. umap/locale/sl/LC_MESSAGES/django.mo +0 -0
  67. umap/locale/sl/LC_MESSAGES/django.po +280 -153
  68. umap/locale/sr/LC_MESSAGES/django.mo +0 -0
  69. umap/locale/sr/LC_MESSAGES/django.po +280 -153
  70. umap/locale/sv/LC_MESSAGES/django.mo +0 -0
  71. umap/locale/sv/LC_MESSAGES/django.po +81 -65
  72. umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
  73. umap/locale/th_TH/LC_MESSAGES/django.po +257 -185
  74. umap/locale/tr/LC_MESSAGES/django.mo +0 -0
  75. umap/locale/tr/LC_MESSAGES/django.po +280 -153
  76. umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
  77. umap/locale/uk_UA/LC_MESSAGES/django.po +280 -153
  78. umap/locale/vi/LC_MESSAGES/django.mo +0 -0
  79. umap/locale/vi/LC_MESSAGES/django.po +278 -151
  80. umap/locale/zh/LC_MESSAGES/django.mo +0 -0
  81. umap/locale/zh/LC_MESSAGES/django.po +278 -151
  82. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  83. umap/locale/zh_TW/LC_MESSAGES/django.po +97 -81
  84. umap/management/commands/empty_trash.py +35 -0
  85. umap/management/commands/migrate_to_S3.py +29 -0
  86. umap/migrations/0023_alter_datalayer_uuid.py +19 -0
  87. umap/migrations/0024_alter_map_share_status.py +30 -0
  88. umap/migrations/0025_alter_datalayer_geojson.py +24 -0
  89. umap/models.py +68 -116
  90. umap/settings/base.py +23 -3
  91. umap/settings/local_s3.py +45 -0
  92. umap/static/umap/base.css +3 -603
  93. umap/static/umap/content.css +5 -3
  94. umap/static/umap/css/bar.css +202 -0
  95. umap/static/umap/css/form.css +620 -0
  96. umap/static/umap/css/icon.css +21 -1
  97. umap/static/umap/css/popup.css +125 -0
  98. umap/static/umap/img/16-white.svg +16 -4
  99. umap/static/umap/img/16.svg +1 -1
  100. umap/static/umap/img/source/16-white.svg +46 -45
  101. umap/static/umap/img/source/16.svg +1 -753
  102. umap/static/umap/js/components/fragment.js +3 -1
  103. umap/static/umap/js/modules/browser.js +20 -19
  104. umap/static/umap/js/modules/caption.js +21 -22
  105. umap/static/umap/js/modules/data/features.js +120 -78
  106. umap/static/umap/js/modules/data/layer.js +195 -153
  107. umap/static/umap/js/modules/facets.js +9 -9
  108. umap/static/umap/js/modules/formatter.js +5 -5
  109. umap/static/umap/js/modules/global.js +4 -52
  110. umap/static/umap/js/modules/help.js +18 -21
  111. umap/static/umap/js/modules/importer.js +133 -56
  112. umap/static/umap/js/modules/importers/cadastrefr.js +4 -0
  113. umap/static/umap/js/modules/importers/geodatamine.js +3 -3
  114. umap/static/umap/js/modules/importers/overpass.js +5 -0
  115. umap/static/umap/js/modules/permissions.js +85 -87
  116. umap/static/umap/js/modules/rendering/icon.js +2 -1
  117. umap/static/umap/js/modules/rendering/layers/base.js +15 -15
  118. umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
  119. umap/static/umap/js/modules/rendering/layers/cluster.js +1 -1
  120. umap/static/umap/js/modules/rendering/layers/heat.js +1 -1
  121. umap/static/umap/js/modules/rendering/map.js +390 -0
  122. umap/static/umap/js/modules/rendering/popup.js +19 -19
  123. umap/static/umap/js/modules/rendering/template.js +88 -21
  124. umap/static/umap/js/modules/rendering/ui.js +63 -14
  125. umap/static/umap/js/modules/request.js +2 -2
  126. umap/static/umap/js/modules/rules.js +22 -25
  127. umap/static/umap/js/modules/saving.js +47 -0
  128. umap/static/umap/js/modules/schema.js +6 -0
  129. umap/static/umap/js/modules/share.js +21 -24
  130. umap/static/umap/js/modules/slideshow.js +24 -20
  131. umap/static/umap/js/modules/sync/updaters.js +7 -9
  132. umap/static/umap/js/modules/tableeditor.js +20 -19
  133. umap/static/umap/js/modules/ui/bar.js +196 -0
  134. umap/static/umap/js/modules/ui/dialog.js +6 -1
  135. umap/static/umap/js/modules/ui/panel.js +10 -9
  136. umap/static/umap/js/modules/umap.js +1691 -0
  137. umap/static/umap/js/modules/urls.js +2 -2
  138. umap/static/umap/js/modules/utils.js +22 -6
  139. umap/static/umap/js/umap.controls.js +81 -305
  140. umap/static/umap/js/umap.core.js +29 -50
  141. umap/static/umap/js/umap.forms.js +78 -27
  142. umap/static/umap/keycloak.png +0 -0
  143. umap/static/umap/locale/am_ET.js +26 -10
  144. umap/static/umap/locale/am_ET.json +26 -10
  145. umap/static/umap/locale/ar.js +26 -10
  146. umap/static/umap/locale/ar.json +26 -10
  147. umap/static/umap/locale/ast.js +26 -10
  148. umap/static/umap/locale/ast.json +26 -10
  149. umap/static/umap/locale/bg.js +26 -10
  150. umap/static/umap/locale/bg.json +26 -10
  151. umap/static/umap/locale/br.js +27 -20
  152. umap/static/umap/locale/br.json +27 -20
  153. umap/static/umap/locale/ca.js +32 -29
  154. umap/static/umap/locale/ca.json +32 -29
  155. umap/static/umap/locale/cs_CZ.js +24 -17
  156. umap/static/umap/locale/cs_CZ.json +24 -17
  157. umap/static/umap/locale/da.js +26 -10
  158. umap/static/umap/locale/da.json +26 -10
  159. umap/static/umap/locale/de.js +21 -14
  160. umap/static/umap/locale/de.json +21 -14
  161. umap/static/umap/locale/el.js +28 -12
  162. umap/static/umap/locale/el.json +28 -12
  163. umap/static/umap/locale/en.js +14 -9
  164. umap/static/umap/locale/en.json +14 -9
  165. umap/static/umap/locale/en_US.json +26 -10
  166. umap/static/umap/locale/es.js +16 -13
  167. umap/static/umap/locale/es.json +16 -13
  168. umap/static/umap/locale/et.js +26 -10
  169. umap/static/umap/locale/et.json +26 -10
  170. umap/static/umap/locale/eu.js +16 -9
  171. umap/static/umap/locale/eu.json +16 -9
  172. umap/static/umap/locale/fa_IR.js +16 -9
  173. umap/static/umap/locale/fa_IR.json +16 -9
  174. umap/static/umap/locale/fi.js +26 -10
  175. umap/static/umap/locale/fi.json +26 -10
  176. umap/static/umap/locale/fr.js +14 -9
  177. umap/static/umap/locale/fr.json +14 -9
  178. umap/static/umap/locale/gl.js +26 -10
  179. umap/static/umap/locale/gl.json +26 -10
  180. umap/static/umap/locale/he.js +26 -10
  181. umap/static/umap/locale/he.json +26 -10
  182. umap/static/umap/locale/hr.js +26 -10
  183. umap/static/umap/locale/hr.json +26 -10
  184. umap/static/umap/locale/hu.js +16 -9
  185. umap/static/umap/locale/hu.json +16 -9
  186. umap/static/umap/locale/id.js +26 -10
  187. umap/static/umap/locale/id.json +26 -10
  188. umap/static/umap/locale/is.js +26 -10
  189. umap/static/umap/locale/is.json +26 -10
  190. umap/static/umap/locale/it.js +26 -10
  191. umap/static/umap/locale/it.json +26 -10
  192. umap/static/umap/locale/ja.js +26 -10
  193. umap/static/umap/locale/ja.json +26 -10
  194. umap/static/umap/locale/ko.js +26 -10
  195. umap/static/umap/locale/ko.json +26 -10
  196. umap/static/umap/locale/lt.js +26 -10
  197. umap/static/umap/locale/lt.json +26 -10
  198. umap/static/umap/locale/ms.js +28 -12
  199. umap/static/umap/locale/ms.json +28 -12
  200. umap/static/umap/locale/nl.js +28 -12
  201. umap/static/umap/locale/nl.json +28 -12
  202. umap/static/umap/locale/no.js +26 -10
  203. umap/static/umap/locale/no.json +26 -10
  204. umap/static/umap/locale/pl.js +28 -12
  205. umap/static/umap/locale/pl.json +28 -12
  206. umap/static/umap/locale/pl_PL.json +26 -10
  207. umap/static/umap/locale/pt.js +16 -9
  208. umap/static/umap/locale/pt.json +16 -9
  209. umap/static/umap/locale/pt_BR.js +26 -10
  210. umap/static/umap/locale/pt_BR.json +26 -10
  211. umap/static/umap/locale/pt_PT.js +16 -9
  212. umap/static/umap/locale/pt_PT.json +16 -9
  213. umap/static/umap/locale/ro.js +26 -10
  214. umap/static/umap/locale/ro.json +26 -10
  215. umap/static/umap/locale/ru.js +26 -10
  216. umap/static/umap/locale/ru.json +26 -10
  217. umap/static/umap/locale/si.js +7 -7
  218. umap/static/umap/locale/si.json +7 -7
  219. umap/static/umap/locale/sk_SK.js +26 -10
  220. umap/static/umap/locale/sk_SK.json +26 -10
  221. umap/static/umap/locale/sl.js +26 -10
  222. umap/static/umap/locale/sl.json +26 -10
  223. umap/static/umap/locale/sr.js +26 -10
  224. umap/static/umap/locale/sr.json +26 -10
  225. umap/static/umap/locale/sv.js +27 -11
  226. umap/static/umap/locale/sv.json +27 -11
  227. umap/static/umap/locale/th_TH.js +28 -12
  228. umap/static/umap/locale/th_TH.json +28 -12
  229. umap/static/umap/locale/tr.js +26 -10
  230. umap/static/umap/locale/tr.json +26 -10
  231. umap/static/umap/locale/uk_UA.js +26 -10
  232. umap/static/umap/locale/uk_UA.json +26 -10
  233. umap/static/umap/locale/vi.js +26 -10
  234. umap/static/umap/locale/vi.json +26 -10
  235. umap/static/umap/locale/vi_VN.json +26 -10
  236. umap/static/umap/locale/zh.js +26 -10
  237. umap/static/umap/locale/zh.json +26 -10
  238. umap/static/umap/locale/zh_CN.json +26 -10
  239. umap/static/umap/locale/zh_TW.Big5.json +26 -10
  240. umap/static/umap/locale/zh_TW.js +34 -27
  241. umap/static/umap/locale/zh_TW.json +34 -27
  242. umap/static/umap/map.css +39 -530
  243. umap/static/umap/unittests/URLs.js +15 -15
  244. umap/static/umap/unittests/utils.js +23 -1
  245. umap/static/umap/vars.css +2 -1
  246. umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
  247. umap/storage/__init__.py +3 -0
  248. umap/storage/fs.py +101 -0
  249. umap/storage/s3.py +61 -0
  250. umap/templates/base.html +2 -0
  251. umap/templates/registration/login.html +7 -6
  252. umap/templates/umap/components/alerts/alert.html +4 -0
  253. umap/templates/umap/css.html +6 -0
  254. umap/templates/umap/js.html +3 -2
  255. umap/templates/umap/map_init.html +6 -5
  256. umap/templates/umap/user_dashboard.html +20 -19
  257. umap/tests/base.py +11 -1
  258. umap/tests/fixtures/empty_tile.png +0 -0
  259. umap/tests/fixtures/test_upload_simple_marker.json +19 -0
  260. umap/tests/integration/conftest.py +4 -1
  261. umap/tests/integration/test_anonymous_owned_map.py +18 -10
  262. umap/tests/integration/test_browser.py +16 -1
  263. umap/tests/integration/test_dashboard.py +1 -1
  264. umap/tests/integration/test_edit_datalayer.py +29 -7
  265. umap/tests/integration/test_import.py +28 -4
  266. umap/tests/integration/test_optimistic_merge.py +31 -8
  267. umap/tests/integration/test_owned_map.py +22 -16
  268. umap/tests/integration/test_popup.py +44 -0
  269. umap/tests/integration/test_save.py +35 -0
  270. umap/tests/integration/test_view_marker.py +12 -0
  271. umap/tests/integration/test_view_polyline.py +257 -0
  272. umap/tests/integration/test_websocket_sync.py +81 -9
  273. umap/tests/test_dashboard.py +82 -0
  274. umap/tests/test_datalayer.py +6 -7
  275. umap/tests/test_datalayer_s3.py +135 -0
  276. umap/tests/test_datalayer_views.py +28 -10
  277. umap/tests/test_empty_trash.py +34 -0
  278. umap/tests/test_map.py +12 -3
  279. umap/tests/test_map_views.py +69 -37
  280. umap/tests/test_statics.py +1 -1
  281. umap/tests/test_team_views.py +35 -1
  282. umap/tests/test_views.py +31 -52
  283. umap/urls.py +3 -3
  284. umap/views.py +126 -90
  285. {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/METADATA +16 -14
  286. {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/RECORD +290 -269
  287. {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/WHEEL +1 -1
  288. umap/management/commands/purge_purgatory.py +0 -28
  289. umap/static/umap/js/umap.js +0 -1903
  290. umap/tests/test_purge_purgatory.py +0 -25
  291. /umap/{storage.py → storage/staticfiles.py} +0 -0
  292. {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/entry_points.txt +0 -0
  293. {umap_project-2.7.2.dist-info → umap_project-2.8.0.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(map) {
10
- this.setOptions(map.options.permissions)
11
- this.map = map
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
- set isDirty(status) {
16
- this._isDirty = status
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
- options
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.map.options.user?.is_owner)
35
+ return Boolean(this._umap.properties.user?.is_owner)
39
36
  }
40
37
 
41
38
  isAnonymousMap() {
42
- return !this.map.options.permissions.owner
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
- 'options.edit_status',
46
+ 'properties.edit_status',
50
47
  {
51
48
  handler: 'IntSelect',
52
49
  label: translate('Who can edit'),
53
- selectOptions: this.map.options.edit_statuses,
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.options.anonymous_edit_url) {
65
+ if (this.properties.anonymous_edit_url) {
61
66
  DomUtil.createCopiableInput(
62
67
  container,
63
68
  translate('Secret edit link:'),
64
- this.options.anonymous_edit_url
69
+ this.properties.anonymous_edit_url
65
70
  )
66
71
  }
67
72
 
68
- if (this.map.options.user?.id) {
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
- 'options.edit_status',
101
+ 'properties.edit_status',
97
102
  {
98
103
  handler: 'IntSelect',
99
104
  label: translate('Who can edit'),
100
- selectOptions: this.map.options.edit_statuses,
105
+ selectOptions: this._umap.properties.edit_statuses,
101
106
  },
102
107
  ])
103
108
  topFields.push([
104
- 'options.share_status',
109
+ 'properties.share_status',
105
110
  {
106
111
  handler: 'IntSelect',
107
112
  label: translate('Who can view'),
108
- selectOptions: this.map.options.share_statuses,
113
+ selectOptions: this._umap.properties.share_statuses,
109
114
  },
110
115
  ])
111
116
  collaboratorsFields.push([
112
- 'options.owner',
117
+ 'properties.owner',
113
118
  { handler: 'ManageOwner', label: translate("Map's owner") },
114
119
  ])
115
- if (this.map.options.user?.teams?.length) {
120
+ if (this._umap.properties.user?.teams?.length) {
116
121
  collaboratorsFields.push([
117
- 'options.team',
122
+ 'properties.team',
118
123
  {
119
124
  handler: 'ManageTeam',
120
125
  label: translate('Attach map to a team'),
121
- teams: this.map.options.user.teams,
126
+ teams: this._umap.properties.user.teams,
122
127
  },
123
128
  ])
124
129
  }
125
130
  }
126
131
  collaboratorsFields.push([
127
- 'options.editors',
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.map.hasLayers()) {
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.map.eachDataLayer((datalayer) => {
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.map.options.editMode !== 'advanced') return
159
- if (!this.map.options.umap_id) {
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.map.editPanel.open({ content: container, className: 'dark' })
173
+ this._umap.editPanel.open({ content: container, className: 'dark' })
169
174
  }
170
175
 
171
176
  async attach() {
172
- const [data, response, error] = await this.map.server.post(this.getAttachUrl())
177
+ const [data, response, error] = await this._umap.server.post(this.getAttachUrl())
173
178
  if (!error) {
174
- this.options.owner = this.map.options.user
179
+ this.properties.owner = this._umap.properties.user
175
180
  Alert.success(translate('Map has been attached to your account'))
176
- this.map.editPanel.close()
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.options.editors) {
184
- const editors = this.options.editors.map((u) => u.id)
185
- for (let i = 0; i < this.options.editors.length; i++)
186
- formData.append('editors', this.options.editors[i].id)
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.options.edit_status)
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.options.owner?.id)
193
- formData.append('team', this.options.team?.id || '')
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.map.server.post(
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
- this.isDirty = false
204
- this.map.fire('postsync')
208
+ return true
205
209
  }
206
210
  }
207
211
 
208
212
  getUrl() {
209
- return Utils.template(this.map.options.urls.map_update_permissions, {
210
- map_id: this.map.options.umap_id,
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 Utils.template(this.map.options.urls.map_attach_owner, {
216
- map_id: this.map.options.umap_id,
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.map.options.permissions = Object.assign(
222
- this.map.options.permissions,
223
- this.options
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.map.options.share_statuses) {
229
- return Object.fromEntries(this.map.options.share_statuses)[
230
- this.options.share_status
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
- this.options = Object.assign(
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
- 'options.edit_status',
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.map.options.datalayer_edit_statuses,
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.map.urls.get('datalayer_permissions', {
284
- map_id: this.map.options.umap_id,
285
- pk: this.datalayer.umap_id,
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.options.edit_status)
293
- const [data, response, error] = await this.map.server.post(
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
- this.isDirty = false
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.options
305
+ this.properties
308
306
  )
309
307
  }
310
308
  }
@@ -22,7 +22,7 @@ export function getClass(name) {
22
22
 
23
23
  export const RECENT = []
24
24
 
25
- const BaseIcon = L.DivIcon.extend({
25
+ const BaseIcon = DivIcon.extend({
26
26
  initialize: function (options) {
27
27
  const default_options = {
28
28
  iconSize: null, // Made in css
@@ -86,6 +86,7 @@ const DefaultIcon = BaseIcon.extend({
86
86
  },
87
87
 
88
88
  _setIconStyles: function (img, name) {
89
+ if (this.feature.isActive()) this.options.className += ' umap-icon-active'
89
90
  BaseIcon.prototype._setIconStyles.call(this, img, name)
90
91
  const color = this._getColor()
91
92
  const opacity = this._getOpacity()
@@ -5,20 +5,20 @@ import * as Utils from '../../utils.js'
5
5
  export const LayerMixin = {
6
6
  browsable: true,
7
7
 
8
- onInit: function (map) {
9
- if (this.datalayer.autoLoaded()) map.on('zoomend', this.onZoomEnd, this)
8
+ onInit: function (leafletMap) {
9
+ if (this.datalayer.autoLoaded()) leafletMap.on('zoomend', this.onZoomEnd, this)
10
10
  },
11
11
 
12
- onDelete: function (map) {
13
- map.off('zoomend', this.onZoomEnd, this)
12
+ onDelete: function (leafletMap) {
13
+ leafletMap.off('zoomend', this.onZoomEnd, this)
14
14
  },
15
15
 
16
- onAdd: function (map) {
17
- map.on('moveend', this.onMoveEnd, this)
16
+ onAdd: function (leafletMap) {
17
+ leafletMap.on('moveend', this.onMoveEnd, this)
18
18
  },
19
19
 
20
- onRemove: function (map) {
21
- map.off('moveend', this.onMoveEnd, this)
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.map)
76
+ LayerMixin.onInit.call(this, this.datalayer._leafletMap)
77
77
  },
78
78
 
79
- onAdd: function (map) {
80
- LayerMixin.onAdd.call(this, map)
81
- return FeatureGroup.prototype.onAdd.call(this, map)
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 (map) {
85
- LayerMixin.onRemove.call(this, map)
86
- return FeatureGroup.prototype.onRemove.call(this, map)
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.map)
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.map)
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.map)
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
  }