summaryrefslogtreecommitdiff
path: root/chimere/urls_chimere.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/urls_chimere.py')
-rw-r--r--chimere/urls_chimere.py158
1 files changed, 158 insertions, 0 deletions
diff --git a/chimere/urls_chimere.py b/chimere/urls_chimere.py
new file mode 100644
index 0000000..96de01a
--- /dev/null
+++ b/chimere/urls_chimere.py
@@ -0,0 +1,158 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2008-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# See the file COPYING for details.
+
+from django.conf import settings
+from django.conf.urls import url
+from django.contrib import admin
+from django.core.exceptions import ImproperlyConfigured
+
+from chimere import views
+from chimere.forms import SearchForm
+from chimere.views import CategoryDirectoryView, CategoryView, SearchView
+from chimere.feeds import LatestPOIsByCategory, LatestPOIsBySubCategory, \
+ LatestPOIs, LatestPOIsByZone, LatestPOIsByZoneID
+
+
+def i18n_javascript(request):
+ return admin.site.i18n_javascript(request)
+
+
+urlpatterns = [
+ url(r'^status/$', views.status, name='status'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?simple$', views.index,
+ {'simple': True}, name="simple_index")
+]
+
+if settings.CHIMERE_FEEDS:
+ urlpatterns += [
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds$', views.rss,
+ name='feeds-form'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/category/'
+ r'(?P<category_id>\d+)$',
+ LatestPOIsByCategory(), name='feeds-cat'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/subcategory/'
+ r'(?P<category_id>\d+)$',
+ LatestPOIsBySubCategory(), name='feeds-subcat'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/global/$', LatestPOIs(),
+ name='feeds-global'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/area/(?P<area>[0-9-_.]+)$',
+ LatestPOIsByZone(), name='feeds-area'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/areaid/(?P<area_id>\d+)$',
+ LatestPOIsByZoneID(), name='feeds-areaid'),
+ ]
+
+if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') \
+ and settings.CHIMERE_ENABLE_ROUTING:
+ if not hasattr(settings, 'CHIMERE_ROUTING_TRANSPORT') \
+ or not settings.CHIMERE_ROUTING_TRANSPORT:
+ raise ImproperlyConfigured(u"CHIMERE_ROUTING_TRANSPORT must be set in"
+ u" settings if you enable routing")
+ urlpatterns += [
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?route/'
+ r'(?P<transport>(%s))/((?P<speed>[0-9][0-9]*)/)?'
+ r'(?P<lon1>[-]?[0-9]+[.]?[0-9]*)_(?P<lat1>[-]?[0-9]+[.]?[0-9]*)_'
+ r'(?P<lonlat_steps>([-]?[0-9]+[.]?[0-9]*_[-]?[0-9]+[.]?[0-9]*_)*)'
+ r'(?P<lon2>[-]?[0-9]+[.]?[0-9]*)_(?P<lat2>[-]?[0-9]+[.]?[0-9]*)$' %
+ ('|'.join([key
+ for key, lbl in settings.CHIMERE_ROUTING_TRANSPORT])),
+ views.route, name="route"),
+ ]
+
+
+if getattr(settings, 'HAYSTACK_SEARCH_ENGINE', None):
+ from haystack.views import search_view_factory
+ urlpatterns += [
+ url(r'^search/?$', search_view_factory(
+ view_class=SearchView,
+ template='search/search_haystack.html',
+ form_class=SearchForm
+ ), name='search'),
+ url(r'^search/autocomplete/$', views.autocomplete,
+ name='autocomplete-search')
+ ]
+else:
+ urlpatterns += [
+ url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]+)/)?search/?$',
+ views.SearchView.as_view(), name='search'),
+ ]
+
+urlpatterns += [
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?dyn/(?P<page_id>\w+)/$',
+ views.extraPage, name='extra_page'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?contact/?$',
+ views.contactus, name="contact"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit/$', views.edit,
+ name="edit"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-marker/'
+ r'(?P<submited>\w+)?$', views.editMarker, name="editmarker"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-marker/(?P<item_id>\w+)/'
+ r'(?P<submited>\w+)?$', views.editMarker,
+ name="editmarker-item"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-route/$',
+ views.editRoute, name="editroute"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-route/(?P<item_id>\w+)/'
+ r'(?P<submited>\w+)?$',
+ views.editRoute, name="editroute-item"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-polygon/$',
+ views.editPolygon, name="editpolygon"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-polygon/(?P<item_id>\w+)/'
+ r'(?P<submited>\w+)?$',
+ views.editPolygon, name="editpolygon-item"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDetail/'
+ r'(?P<key>[a-zA-Z_-]*\d+)/?$',
+ views.getDetail, name="get_detail"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDetail/popup/'
+ r'(?P<key>[a-zA-Z_-]*\d+)/?$',
+ views.getDetail, {'popup': True}, name="get_detail"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDetail/undefined',
+ views.getDetailUndefined, name="get_detail_undefined"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDescriptionDetail/'
+ r'?(?P<category_id>\d+)/?$', views.getDescriptionDetail,
+ name="get_description_detail"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getGeoObjects/'
+ r'(?P<category_ids>[a-zA-Z0-9_-]+)(/(?P<status>\w+))?$',
+ views.getGeoObjects, name="getgeoobjects"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?get-marker/'
+ r'(?P<pk>[0-9]+)$', views.getMarker, name="get-marker"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getAvailableCategories/$',
+ views.get_available_categories, name="get_categories"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getAllCategories/$',
+ views.get_all_categories, name="get_all_categories"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getCategory/(?P<category_id>\d+)/?$',
+ views.getCategory, name="get_category"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?get-share-url/(?:(?P<network>\w+)/'
+ r'(?:(?P<attrs>[a-zA-Z0-9_;.:-]+))?)?/?$',
+ views.getShareUrl, name="get-share-url"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?ty/(?P<tiny_urn>\w+)$',
+ views.redirectFromTinyURN, name="tiny"),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?upload_file/'
+ r'((?P<category_id>\w+)/)?$', views.uploadFile,
+ name='upload_file'),
+ url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?process_route_file/'
+ r'(?P<file_id>\d+)/$', views.processRouteFile,
+ name='process_route_file'),
+ url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?categories/$',
+ CategoryDirectoryView.as_view(), name='category-directory'),
+ url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?categories/'
+ r'(?P<category_slug>[a-zA-Z0-9_-]+)$',
+ CategoryView.as_view(), name='category-directory-detail'),
+ url(r'^(?:(?P<area_name>[a-zA-Z0-9_-]*)/)?property-choices/'
+ r'(?P<property_slug>[a-zA-Z0-9_-]+)/$',
+ views.property_choice_list, name='property-choices'),
+]