| 1 | # Copyright (C) 2007 Samalyse SARL |
|---|
| 2 | # All rights reserved. |
|---|
| 3 | # |
|---|
| 4 | # This software is licensed as described in the file COPYING, which |
|---|
| 5 | # you should have received as part of this distribution. The terms |
|---|
| 6 | # are also available at http://svn.parisson.org/telemeta/TelemetaLicense. |
|---|
| 7 | # |
|---|
| 8 | # Author: Olivier Guilyardi <olivier@samalyse.com> |
|---|
| 9 | |
|---|
| 10 | from django.conf.urls.defaults import * |
|---|
| 11 | from telemeta.models import MediaItem, MediaCollection |
|---|
| 12 | from telemeta.core import ComponentManager |
|---|
| 13 | from telemeta.views.web import WebView |
|---|
| 14 | |
|---|
| 15 | # initialization |
|---|
| 16 | comp_mgr = ComponentManager() |
|---|
| 17 | web_view = WebView(comp_mgr) |
|---|
| 18 | |
|---|
| 19 | # query sets for Django generic views |
|---|
| 20 | all_items = { 'queryset': MediaItem.objects.all(), } |
|---|
| 21 | all_collections = { 'queryset': MediaCollection.objects.all(), } |
|---|
| 22 | |
|---|
| 23 | urlpatterns = patterns('', |
|---|
| 24 | (r'^$', web_view.index), |
|---|
| 25 | |
|---|
| 26 | # items |
|---|
| 27 | url(r'^items/$', 'django.views.generic.list_detail.object_list', |
|---|
| 28 | dict(all_items, paginate_by=20, template_name="mediaitem_list.html"), |
|---|
| 29 | name="telemeta-items"), |
|---|
| 30 | url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/$', web_view.item_detail, |
|---|
| 31 | name="telemeta-item-detail"), |
|---|
| 32 | url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/dc/$', web_view.item_detail, |
|---|
| 33 | {'template': 'mediaitem_detail_dc.html'}, |
|---|
| 34 | name="telemeta-item-dublincore"), |
|---|
| 35 | url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/dc/xml/$', web_view.item_detail, |
|---|
| 36 | {'format': 'dublin_core_xml'}, |
|---|
| 37 | name="telemeta-item-dublincore-xml"), |
|---|
| 38 | url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/download/(?P<format>[0-9A-Z]+)/$', |
|---|
| 39 | web_view.item_export, |
|---|
| 40 | name="telemeta-item-export"), |
|---|
| 41 | url(r'^items/(?P<item_id>[0-9A-Z._:%?-]+)/visualize/(?P<visualizer_id>[0-9a-z]+)/$', |
|---|
| 42 | web_view.item_visualize, |
|---|
| 43 | name="telemeta-item-visualize"), |
|---|
| 44 | |
|---|
| 45 | # collections |
|---|
| 46 | url(r'^collections/$', 'django.views.generic.list_detail.object_list', |
|---|
| 47 | dict(all_collections, paginate_by=20, |
|---|
| 48 | template_name="collection_list.html"), |
|---|
| 49 | name="telemeta-collections"), |
|---|
| 50 | url(r'^collections/?page=(?P<page>[0-9]+)$', |
|---|
| 51 | 'django.views.generic.list_detail.object_list', |
|---|
| 52 | dict(all_collections, paginate_by=20)), |
|---|
| 53 | url(r'^collections/(?P<object_id>[0-9A-Z._%?-]+)/$', |
|---|
| 54 | 'django.views.generic.list_detail.object_detail', |
|---|
| 55 | dict(all_collections, template_name="collection_detail.html"), |
|---|
| 56 | name="telemeta-collection-detail"), |
|---|
| 57 | url(r'^collections/(?P<object_id>[0-9A-Z._%?-]+)/dc/$', |
|---|
| 58 | 'django.views.generic.list_detail.object_detail', |
|---|
| 59 | dict(all_collections, template_name="collection_detail_dc.html"), |
|---|
| 60 | name="telemeta-collection-dublincore"), |
|---|
| 61 | |
|---|
| 62 | # search |
|---|
| 63 | url(r'^search/$', web_view.quick_search, name="telemeta-quicksearch"), |
|---|
| 64 | |
|---|
| 65 | # administration |
|---|
| 66 | url(r'^admin/$', web_view.admin_index, name="telemeta-admin"), |
|---|
| 67 | |
|---|
| 68 | # dictionaries administration |
|---|
| 69 | url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/$', |
|---|
| 70 | web_view.edit_dictionary , |
|---|
| 71 | name="telemeta-dictionary-edit"), |
|---|
| 72 | url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/add/$', |
|---|
| 73 | web_view.add_to_dictionary, |
|---|
| 74 | name="telemeta-dictionary-add"), |
|---|
| 75 | url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/update/$', |
|---|
| 76 | web_view.update_dictionary, |
|---|
| 77 | name="telemeta-dictionary-update"), |
|---|
| 78 | url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/(?P<value_id>[0-9]+)/$', |
|---|
| 79 | web_view.edit_dictionary_value, |
|---|
| 80 | name="telemeta-dictionary-record-edit"), |
|---|
| 81 | |
|---|
| 82 | url(r'^admin/dictionaries/(?P<dictionary_id>[0-9a-z]+)/(?P<value_id>[0-9]+)/update/$', |
|---|
| 83 | web_view.update_dictionary_value, |
|---|
| 84 | name="telemeta-dictionary-record-update"), |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | # CSS+Images (FIXME: for developement only) |
|---|
| 88 | (r'^css/(?P<path>.*)$', 'django.views.static.serve', |
|---|
| 89 | {'document_root': './telemeta/htdocs/css'}), |
|---|
| 90 | (r'^images/(?P<path>.*)$', 'django.views.static.serve', |
|---|
| 91 | {'document_root': './telemeta/htdocs/images'}), |
|---|
| 92 | ) |
|---|