diff options
12 files changed, 31 insertions, 27 deletions
diff --git a/CHANGES.md b/CHANGES.md index 18d0937cb..59afd4e59 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -39,6 +39,7 @@ Ishtar changelog - Document - source type is now a hierarchic search - Find form: remove TAQ/TPQ check - File: filter plan action when preventive_operator is activated in profile +- Profile: do not display geo item list when mapping is deactivated - Sheet: - fix treatment and file treatment sheet display (bad QR code link) - Operation - statistics number of parcels fix diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index bfdda4bfe..3ff8f9d3f 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1114,7 +1114,8 @@ class ContextRecord( actions = super(ContextRecord, self).get_extra_actions(request) # is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) - can_add_geo = self.can_do(request, "add_geovectordata") + profile = get_current_profile() + can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata") if can_add_geo: actions.append(self.get_add_geo_action()) can_create_find = self.can_do(request, "add_find") diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html index d82766305..79f58b94d 100644 --- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html +++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html @@ -30,7 +30,6 @@ {% with has_finds=item|safe_or:"base_finds.count" %} {% with display_finds=has_finds|and_:can_view_finds %} {% with display_data=item.data %} -{% with display_geo=item.geodata.count %} {% if output != "ODT" and output != "PDF"%} <ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist"> @@ -93,7 +92,7 @@ </a> </li> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <li class="nav-item"> <a class="nav-link" id="{{window_id}}-geodata-tab" data-toggle="tab" href="#{{window_id}}-geodata" role="tab" @@ -332,7 +331,7 @@ </div> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <div class="tab-pane fade" id="{{window_id}}-geodata" role="tabpanel" aria-labelledby="{{window_id}}-geodata-tab"> {% with geo_item=item %}{% include "ishtar/blocks/sheet_geographic.html" %}{% endwith %} @@ -347,6 +346,6 @@ {% endif %} </div> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %} diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 5a9f9e3ae..4b976a730 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -2349,7 +2349,8 @@ class Find( actions = super(Find, self).get_extra_actions(request) is_locked = hasattr(self, "is_locked") and self.is_locked(request.user) - can_add_geo = self.can_do(request, "add_geovectordata") + profile = get_current_profile() + can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata") if can_add_geo: if self.base_finds.count() == 1: actions.append(self.base_finds.all()[0].get_add_geo_action()) diff --git a/archaeological_finds/templates/ishtar/sheet_basefind.html b/archaeological_finds/templates/ishtar/sheet_basefind.html index c3ab1c792..2de9f5afe 100644 --- a/archaeological_finds/templates/ishtar/sheet_basefind.html +++ b/archaeological_finds/templates/ishtar/sheet_basefind.html @@ -55,12 +55,14 @@ <div class="clearfix"> </div> + {% if not is_external and SHOW_GEO %} <h3>{% trans "Geographic localisation" %}</h3> <div class='row'> {% with geo_item=base_find %} {% include "ishtar/blocks/sheet_map.html"%} {% endwith %} </div> + {% endif %} <div class="row"> {% field_flex_full "Point of topographic reference" base_find.topographic_localisation %} </div> diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 9cfcfe707..a628498e0 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -30,7 +30,6 @@ {% with display_warehouse_treatments=item.container|or_:item.container_ref|or_:item.upstream_treatment|or_:item.downstream_treatment|or_:non_modif_treatments_count|or_:associated_treatment_files_count %} {% with can_view_documents=permission_view_own_document|or_:permission_view_document %} {% with display_documents=can_view_documents|and_:item.documents_count %} -{% with display_geo=item.geodata.count %} {% with has_image=item.images_number %} {% if output != "ODT" and output != "PDF"%} @@ -67,7 +66,7 @@ </a> </li> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <li class="nav-item"> <a class="nav-link" id="{{window_id}}-geodata-tab" data-toggle="tab" href="#{{window_id}}-geodata" role="tab" @@ -539,7 +538,7 @@ </div> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <div class="tab-pane fade" id="{{window_id}}-geodata" role="tabpanel" aria-labelledby="{{window_id}}-geodata-tab"> <h3>{% trans "Geographic data" %}</h3> @@ -563,7 +562,7 @@ {% endif %} </div> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %}{% endwith %} {% endblock %} diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 204385c25..a7a9823b8 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -614,7 +614,8 @@ class ArchaeologicalSite( # url, base_text, icon, extra_text, extra css class, is a quick action actions = super(ArchaeologicalSite, self).get_extra_actions(request) # is_locked = self.is_locked(request.user) - can_add_geo = self.can_do(request, "add_geovectordata") + profile = get_current_profile() + can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata") if can_add_geo: actions.append(self.get_add_geo_action()) @@ -1852,8 +1853,9 @@ class Operation( True, ), ] + actions - - can_add_geo = self.can_do(request, "add_geovectordata") + + profile = get_current_profile() + can_add_geo = profile.mapping and self.can_do(request, "add_geovectordata") if can_add_geo: actions.append(self.get_add_geo_action()) can_add_cr = self.can_do(request, "add_contextrecord") diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 8d0b717a3..43148d7e4 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -35,7 +35,6 @@ {% with perm_find=permission_view_own_find|or_:permission_view_find %} {% with has_finds=item|safe_or:"has_finds" %} {% with display_finds=perm_find|and_:has_finds %} -{% with display_geo=item.geodata.count %} {% if output != "ODT" and output != "PDF" %} <ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist"> @@ -91,7 +90,7 @@ </a> </li> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <li class="nav-item"> <a class="nav-link" id="{{window_id}}-geodata-tab" data-toggle="tab" href="#{{window_id}}-geodata" role="tab" @@ -449,7 +448,7 @@ </div> {% endif %} - {% if not is_external and display_geo %} + {% if not is_external and SHOW_GEO %} <div class="tab-pane fade" id="{{window_id}}-geodata" role="tabpanel" aria-labelledby="{{window_id}}-geodata-tab"> {% with geo_item=item %}{% include "ishtar/blocks/sheet_geographic.html" %}{% endwith %} @@ -608,6 +607,6 @@ $(document).ready( function () { } ); </script> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %}
\ No newline at end of file diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 9c78a7ffb..d8d5549b6 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -12,7 +12,6 @@ {% with permission_change_geovectordata=permission_change_geovectordata %} {% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %} -{% with display_geo=item.geodata.count %} <div class="row"> <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> @@ -101,9 +100,10 @@ {% endif %} {% endif %} -{% if not is_external and display_geo %} +{% if not is_external and SHOW_GEO %} +<h3>{% trans "Geographic data" %}</h3> {% with geo_item=item %}{% include "ishtar/blocks/sheet_geographic.html" %}{% endwith %} {% endif %} -{% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endblock %} diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html index 4cea9b732..84e46fdf7 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_container.html +++ b/archaeological_warehouse/templates/ishtar/sheet_container.html @@ -15,7 +15,6 @@ {% with has_documents=item.documents.count %} {% with display_documents=can_view_documents|and_:has_documents %} -{% with display_geo=item.geodata.count %} {% with permission_change_own_geovectordata=permission_change_own_geovectordata %} {% with permission_change_geovectordata=permission_change_geovectordata %} {% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %} @@ -164,7 +163,7 @@ </div> {% endif %} {% endwith %} - {% if PROFILE.locate_warehouses and display_geo %} + {% if PROFILE.locate_warehouses and SHOW_GEO %} <h3>{% trans "Geographic localisation" %}</h3> <div class='row'> {% with geo_item=item %} @@ -321,5 +320,5 @@ $(document).ready( function () { } ); </script> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %} diff --git a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html index 10363e403..b74d056a8 100644 --- a/archaeological_warehouse/templates/ishtar/sheet_warehouse.html +++ b/archaeological_warehouse/templates/ishtar/sheet_warehouse.html @@ -11,7 +11,6 @@ {% with has_documents=item.documents.count %} {% with display_documents=can_view_documents|and_:has_documents %} -{% with display_geo=item.geodata.count %} {% with permission_change_own_geovectordata=permission_change_own_geovectordata %} {% with permission_change_geovectordata=permission_change_geovectordata %} {% with permission_change_geo=permission_change_own_geovectordata|or_:permission_change_geovectordata %} @@ -112,9 +111,9 @@ </div> {% include "ishtar/blocks/sheet_json.html" %} - {% if display_geo or item.get_address or item.get_address_complement or item.get_postal_code or item.get_town %} + {% if item.get_address or item.get_address_complement or item.get_postal_code or item.get_town %} <h3>{% trans "Geographic localisation" %}</h3> - {% if PROFILE.locate_warehouses and display_geo %} + {% if PROFILE.locate_warehouses and SHOW_GEO %} <div class='row'> {% with geo_item=item %} {% include "ishtar/blocks/sheet_map.html"%} @@ -277,5 +276,5 @@ $(document).ready( function () { } ); </script> -{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} +{% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endwith %} {% endblock %} diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 6f9372dc7..3d43541e5 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -317,6 +317,7 @@ def show_source_item(request, source_id, model, name, base_dct, extra_dct): item["current_source"] = src.name dct["item"], dct["item_name"] = item, name dct["is_external"] = True + dct["SHOW_GEO"] = False if extra_dct: dct.update(extra_dct(request, dct)) @@ -358,6 +359,7 @@ def show_item(model, name, extra_dct=None, model_for_perms=None): dct["CURRENCY"] = profile.currency dct["ENCODING"] = settings.ENCODING dct["DOT_GENERATION"] = settings.DOT_BINARY and profile.relation_graph + dct["SHOW_GEO"] = profile.mapping dct["current_window_url"] = url_name date = None if "date" in dct: |