from jocondelab.views.back_office import (TermListView, TermEditView, TermModifyWpLink, 
    TermRemoveWpLink, TermValidate, TermWikipediaEdition, 
    TermLinkSemanticLevelEdition, ThesaurusTree, TermListTableView)
from jocondelab.views.front_office import (MultilingualSearch, NoticeView)
from core import urls as core_urls
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth import urls as auth_urls
from django.contrib.auth.decorators import login_required

js_info_dict = {
    'packages': ('core', 'jocondelab'),
}

admin.autodiscover()

urlpatterns = patterns('',    
    url(r'^auth/', include(auth_urls)),
    url(r'^core/', include(core_urls)),    
    url(r'^logout/$', 'django.contrib.auth.views.logout_then_login', name='joconde_logout'),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^i18n/', include('django.conf.urls.i18n')),
    url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
    url(r'^$', login_required(TermListView.as_view()), name='home'),
    url(r'^bo/$', login_required(TermListView.as_view()), name='bo_home'),
    url(r'^bo/term/list/table$', login_required(TermListTableView.as_view()), name='term_list_table'),
    url(r'^bo/term/(?P<term_id>\d+)/$', login_required(TermEditView.as_view()), name='term'),
    url(r'^bo/term/modify-wp/$', login_required(TermModifyWpLink.as_view()), name='modify_wp_link'),
    url(r'^bo/term/remove-wp/$', login_required(TermRemoveWpLink.as_view()), name='remove_wp_link'),
    url(r'^bo/term/edition-wp/$', login_required(TermWikipediaEdition.as_view()), name='edition_wp_link'),
    url(r'^bo/term/edition-link-level/$', login_required(TermLinkSemanticLevelEdition.as_view()), name='editon_link_semantic_level'),
    url(r'^bo/term/validate/$', login_required(TermValidate.as_view()), name='validate_term'),
    url(r'^bo/tree/(?P<thes_id>\d+)/$', login_required(ThesaurusTree.as_view()), name='term_tree'),
    url(r'^mlsearch/$', MultilingualSearch.as_view(), name='multilingual_search'),
    url(r'^notice/(?P<notice_id>\d+)/$', NoticeView.as_view(), name='front_notice'),
)

