-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
336 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django.contrib import admin | ||
|
||
from .models import GazetteerEntry, GazetteerAttribute | ||
|
||
|
||
class GazetteerEntryAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'layer_name', | ||
'layer_attribute', | ||
'feature_type', | ||
'place_name', | ||
'project', | ||
'username', | ||
) | ||
|
||
class GazetteerAttributeAdmin(admin.ModelAdmin): | ||
list_display = ( | ||
'layer_name', | ||
'attribute', | ||
'in_gazetteer', | ||
'is_start_date', | ||
'is_end_date', | ||
'date_format', | ||
) | ||
|
||
admin.site.register(GazetteerEntry, GazetteerEntryAdmin) | ||
admin.site.register(GazetteerAttribute, GazetteerAttributeAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
geonode/contrib/worldmap/gazetteer/migrations/0002_gazetteerattribute.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('layers', '0029_layer_service'), | ||
('gazetteer', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='GazetteerAttribute', | ||
fields=[ | ||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | ||
('in_gazetteer', models.BooleanField(default=False)), | ||
('attribute', models.OneToOneField(to='layers.Attribute')), | ||
], | ||
), | ||
] |
29 changes: 29 additions & 0 deletions
29
geonode/contrib/worldmap/gazetteer/migrations/0003_auto_20180316_1109.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('gazetteer', '0002_gazetteerattribute'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='gazetteerattribute', | ||
name='date_format', | ||
field=models.TextField(null=True, blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='gazetteerattribute', | ||
name='is_end_date', | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name='gazetteerattribute', | ||
name='is_start_date', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
geonode/contrib/worldmap/gazetteer/templates/gazetteer/edit_layer_gazetteer.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{% extends "geonode_base.html" %} | ||
|
||
{% load i18n %} | ||
{% load staticfiles %} | ||
{% load bootstrap_tags %} | ||
{% load base_tags %} | ||
{% load url from future %} | ||
|
||
{% block title %}{{ layer.title }} — {{ block.super }}{% endblock %} | ||
|
||
{% block body_outer %} | ||
|
||
<div class="page-header"> | ||
<h2 class="page-title">{{ layer.title }}</h2> | ||
</div> | ||
|
||
<p> | ||
{% trans "By adding your layer features to the gazetteer, they will be searchable and viewable by anyone regardless of your layer's security permissions. If you do not choose at least one depict-date field, the system will use the depict-date in the layer metadata (if any)." %}</p> | ||
|
||
<form method="POST"> | ||
|
||
<div class="form-group"> | ||
<label for="fields">{% trans "Select fields for this layer to be part of the gazetteer" %}</label> | ||
{% for attribute in gazetteer_attributes %} | ||
<div class="checkbox"> | ||
<label> | ||
<input type="checkbox" name="attributes" value="{{ attribute.attribute }}" | ||
{% if attribute.in_gazetteer %}checked{% endif %}> | ||
{{ attribute.attribute }} | ||
</label> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
<label for="optional">{% trans "Optional Parameters" %}</label> | ||
|
||
<div class="form-group"> | ||
<label for="name">{% trans "Custom Gazetteer Name" %}</label> | ||
<input type="text" class="form-control" id="gazetteer-name" name="gazetteer-name" /> | ||
</div> | ||
|
||
<div class="form-group"> | ||
|
||
<label for="start-attribute">{% trans "Start depict-date field" %}</label> | ||
<select class="form-control" id="start-attribute" name="start-attribute" /> | ||
<option value="">-----</option> | ||
{% for attribute in gazetteer_attributes %} | ||
{% if attribute.attribute_type != 'xsd:string' %} | ||
<option>{{ attribute.attribute }}</option> | ||
{% endif %} | ||
{% endfor %} | ||
</select> | ||
|
||
<label for="sel-start-date-format">{% trans "Date Format (Examples: 'YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD')" %}</label> | ||
<input type="text" class="form-control" id="sel-start-date-format" name="sel-start-date-format" /> | ||
</div> | ||
|
||
<div class="form-group"> | ||
|
||
<label for="end-attribute">{% trans "End depict-date field" %}</label> | ||
<select class="form-control" id="end-attribute" name="end-attribute" /> | ||
<option value="">-----</option> | ||
{% for attribute in gazetteer_attributes %} | ||
{% if attribute.attribute_type != 'xsd:string' %} | ||
<option>{{ attribute.attribute }}</option> | ||
{% endif %} | ||
{% endfor %} | ||
</select> | ||
|
||
<label for="sel-end-date-format">{% trans "Date Format (Examples: 'YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD')" %}</label> | ||
<input type="text" class="form-control" id="sel-end-date-format" name="sel-end-date-format" /> | ||
</div> | ||
|
||
<div class="form-actions"> | ||
<a href="{% url 'layer_detail' layername=resource.alternate %}" class="btn btn-primary">{% trans "Return to Layer" %}</a> | ||
<input type="submit" id="btn_upd_md_up" class="btn btn-primary" value="{% trans "Update Gazetteer" %}"/> | ||
</div> | ||
|
||
</form> | ||
|
||
|
||
|
||
{{ block.super }} | ||
{% endblock body_outer %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
from django.conf.urls import * | ||
from geonode.gazetteer.views import search | ||
from .views import search, edit_layer_gazetteer | ||
|
||
urlpatterns = patterns('', | ||
url(r'^(?P<place_name>[^/]+)' + | ||
url(r'^gazetteer/edit/(?P<layername>[^/]*)$', | ||
edit_layer_gazetteer, | ||
name = 'edit_layer_gazetteer'), | ||
url(r'^gazetteer/(?P<place_name>[^/]+)' + | ||
'(/Service/(?P<services>[\w\,]+))?' + | ||
'(/Project/(?P<project>[A-Za-z0-9_-]+))?' + | ||
'(/Map/(?P<map>[\d]+))?' + | ||
'(/Layer/(?P<layer>[A-Za-z0-9_-]+))?' + | ||
'(/StartDate/(?P<start_date>[\d\s\/\-\:]+(\sBC|\sAD)?))?' + | ||
'(/EndDate/(?P<end_date>[\d\s\/\-\:]+(\sBC|\sAD)?))?' + | ||
'(/User/(?P<user>[A-Za-z0-9_-]+))?' + | ||
'(/(?P<format>(json|xml)))?$', search) | ||
'(/(?P<format>(json|xml)))?$', search), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.