Skip to content

Commit

Permalink
- merging mapstore adapter (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani authored Feb 23, 2021
1 parent 2702acc commit b08a8f3
Show file tree
Hide file tree
Showing 46 changed files with 2,741 additions and 42 deletions.
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Authors
=======

Alessio Fabiani

Contributors
============
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ Update your `GeoNode` > `settings.py` as follows:
# To enable the MapStore2 based Client enable those
if 'geonode_mapstore_client' not in INSTALLED_APPS:
INSTALLED_APPS += (
'mapstore2_adapter',
'geonode_mapstore_client.mapstore2_adapter',
'geonode_mapstore_client',)
GEONODE_CLIENT_LAYER_PREVIEW_LIBRARY = 'mapstore' # DEPRECATED use HOOKSET instead
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

13 changes: 12 additions & 1 deletion geonode_mapstore_client/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
#
#########################################################################
from django.apps import AppConfig as BaseAppConfig
from django.utils.translation import ugettext_lazy as _


def run_setup_hooks(*args, **kwargs):
from geonode.urls import urlpatterns
from django.conf.urls import url, include

urlpatterns += [
url(r'^mapstore/', include('mapstore2_adapter.urls')),
url(r'^', include('mapstore2_adapter.geoapps.geostories.api.urls')),
]


class AppConfig(BaseAppConfig):
Expand All @@ -17,5 +28,5 @@ class AppConfig(BaseAppConfig):
label = "geonode_mapstore_client"

def ready(self):
run_setup_hooks()
super(AppConfig, self).ready()
# run_setup_hooks()
108 changes: 108 additions & 0 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-22 12:32+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: mapstore2_adapter/api/models.py:74
msgid "String"
msgstr ""

#: mapstore2_adapter/api/models.py:75
msgid "Number"
msgstr ""

#: mapstore2_adapter/api/models.py:76
msgid "Integer"
msgstr ""

#: mapstore2_adapter/api/models.py:77
msgid "Boolean"
msgstr ""

#: mapstore2_adapter/api/models.py:78
msgid "Binary"
msgstr ""

#: mapstore2_adapter/apps.py:30
msgid "Django MapStore2 Adapter"
msgstr ""

#: mapstore2_adapter/geoapps/apps.py:28
msgid "MapStore2 Geonode Apps Plugins"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:32
msgid "GeoStory Created"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:32
msgid "A GeoStory was created"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:33
msgid "GeoStory Updated"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:33
msgid "A GeoStory was updated"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:34
msgid "GeoStory Approved"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:34
msgid "A GeoStory was approved by a Manager"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:35
msgid "GeoStory Published"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:35
msgid "A GeoStory was published"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:36
msgid "GeoStory Deleted"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:36
msgid "A GeoStory was deleted"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:37
msgid "Comment on GeoStory"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:37
msgid "A GeoStory was commented on"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:38
msgid "Rating for GeoStory"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/__init__.py:38
msgid "A rating was given to a GeoStory"
msgstr ""

#: mapstore2_adapter/geoapps/geostories/models.py:36
#, python-format
msgid "%s Type"
msgstr ""
Binary file added locale/it/LC_MESSAGES/django.mo
Binary file not shown.
108 changes: 108 additions & 0 deletions locale/it/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-22 12:32+0100\n"
"PO-Revision-Date: 2021-01-22 12:36+0100\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Last-Translator: \n"
"Language-Team: \n"
"X-Generator: Poedit 2.4.2\n"

#: mapstore2_adapter/api/models.py:74
msgid "String"
msgstr "Stringa"

#: mapstore2_adapter/api/models.py:75
msgid "Number"
msgstr "Numero"

#: mapstore2_adapter/api/models.py:76
msgid "Integer"
msgstr "Intero"

#: mapstore2_adapter/api/models.py:77
msgid "Boolean"
msgstr "Booleano"

#: mapstore2_adapter/api/models.py:78
msgid "Binary"
msgstr "Binario"

#: mapstore2_adapter/apps.py:30
msgid "Django MapStore2 Adapter"
msgstr "Django MapStore2 Adapter"

#: mapstore2_adapter/geoapps/apps.py:28
msgid "MapStore2 Geonode Apps Plugins"
msgstr "MapStore2 Geonode Apps Plugins"

#: mapstore2_adapter/geoapps/geostories/__init__.py:32
msgid "GeoStory Created"
msgstr "GeoStory creata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:32
msgid "A GeoStory was created"
msgstr "È stata creata una GeoStory"

#: mapstore2_adapter/geoapps/geostories/__init__.py:33
msgid "GeoStory Updated"
msgstr "GeoStory aggiornata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:33
msgid "A GeoStory was updated"
msgstr "Una GeoStory è stata aggiornata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:34
msgid "GeoStory Approved"
msgstr "GeoStory approvata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:34
msgid "A GeoStory was approved by a Manager"
msgstr "Una GeoStory è stata approvata da un geostore"

#: mapstore2_adapter/geoapps/geostories/__init__.py:35
msgid "GeoStory Published"
msgstr "GeoStory pubblicata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:35
msgid "A GeoStory was published"
msgstr "È stata pubblicata una GeoStory"

#: mapstore2_adapter/geoapps/geostories/__init__.py:36
msgid "GeoStory Deleted"
msgstr "GeoStory eliminata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:36
msgid "A GeoStory was deleted"
msgstr "Una GeoStory è stata eliminata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:37
msgid "Comment on GeoStory"
msgstr "Commento su una GeoStory"

#: mapstore2_adapter/geoapps/geostories/__init__.py:37
msgid "A GeoStory was commented on"
msgstr "Una GeoStory è stata commentata"

#: mapstore2_adapter/geoapps/geostories/__init__.py:38
msgid "Rating for GeoStory"
msgstr "Valutazione per GeoStories"

#: mapstore2_adapter/geoapps/geostories/__init__.py:38
msgid "A rating was given to a GeoStory"
msgstr "Una valutazione è stata data a una GeoStory"

#: mapstore2_adapter/geoapps/geostories/models.py:36
#, python-format
msgid "%s Type"
msgstr "%s Tipo"
40 changes: 40 additions & 0 deletions mapstore2_adapter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright 2018, GeoSolutions Sas.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
#########################################################################
import logging

logger = logging.getLogger(__name__)


def fixup_map(map_id):
""" ------------------------------------- Maps Fix """
from geonode.maps.models import Map
from django.contrib.auth import get_user_model
from mapstore2_adapter.api.models import MapStoreResource
for _m in Map.objects.filter(id=map_id):
try:
_u = get_user_model().objects.get(username=_m.owner.username)
_mm = MapStoreResource.objects.filter(id=_m.id)
if _mm.count():
_mm = _mm.get()
else:
_mm = MapStoreResource.objects.create(id=_m.id, user_id=_u.id)
_mm.user = _u
_mm.save()
except Exception as e:
logger.exception(e)


class DjangoMapstore2AdapterBaseException(Exception):
"""Base class for exceptions in this module."""
pass


default_app_config = "mapstore2_adapter.apps.AppConfig"
10 changes: 10 additions & 0 deletions mapstore2_adapter/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright 2018, GeoSolutions Sas.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
#########################################################################
10 changes: 10 additions & 0 deletions mapstore2_adapter/api/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright 2018, GeoSolutions Sas.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
#########################################################################
Loading

0 comments on commit b08a8f3

Please sign in to comment.