from django.conf.urls.defaults import *
import bbotui

urlpatterns = patterns('bbotweb.views',

    url(r'^$',
        view = 'index',
        name = 'bbotweb_index',
    ),
    
    url(r'^logout/$',
        view = 'logout',
        name = 'bbotweb_logout',
    ),
    
    url(r'^dashboard/$',
        view = 'dashboard',
        name = 'bbotweb_dashboard',
    ),
    
    url(r'^project/new/$',
        view = 'project_new',
        name = 'bbotweb_project_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/edit/$',
        view = 'project_edit',
        name = 'bbotweb_project_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/$',
        view = 'project_show',
        name = 'bbotweb_project_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/repos/$',
        view = 'repos_show',
        name = 'bbotweb_repos_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/repos/new/(?P<rtype>\w+)/$',
        view = 'repos_new',
        name = 'bbotweb_repos_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/repos/(?P<rid>\d+)/edit/$',
        view = 'repos_edit',
        name = 'bbotweb_repos_edit',
    ),

    url(r'^project/(?P<pid>\d+)/adm/$',
        view = 'adm_show',
        name = 'bbotweb_adm_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/adm/new/$',
        view = 'adm_new',
        name = 'bbotweb_adm_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/adm/(?P<aid>\d+)/edit/$',
        view = 'adm_edit',
        name = 'bbotweb_adm_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/slv/$',
        view = 'slv_show',
        name = 'bbotweb_slv_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/slv/new/$',
        view = 'slv_new',
        name = 'bbotweb_slv_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/slv/(?P<sid>\d+)/edit/$',
        view = 'slv_edit',
        name = 'bbotweb_slv_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/notif/$',
        view = 'notif_show',
        name = 'bbotweb_notif_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/notif/new/(?P<ntype>\w+)/$',
        view = 'notif_new',
        name = 'bbotweb_notif_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/notif/(?P<nid>\d+)/edit/$',
        view = 'notif_edit',
        name = 'bbotweb_notif_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/$',
        view = 'builder_show',
        name = 'bbotweb_builder_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/new/$',
        view = 'builder_new',
        name = 'bbotweb_builder_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/(?P<bid>\d+)/edit/$',
        view = 'builder_edit',
        name = 'bbotweb_builder_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/(?P<bid>\d+)/steps/$',
        view = 'builder_steps',
        name = 'bbotweb_builder_steps',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/(?P<bid>\d+)/steps/new/(?P<stype>[a-z]+)/$',
        view = 'builder_step_new',
        name = 'bbotweb_builder_step_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/builder/(?P<bid>\d+)/steps/(?P<sid>\d+)/edit/$',
        view = 'builder_step_edit',
        name = 'bbotweb_builder_step_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/sched/$',
        view = 'sched_show',
        name = 'bbotweb_sched_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/sched/new/(?P<stype>\w+)/$',
        view = 'sched_new',
        name = 'bbotweb_sched_new',
    ),
    
    url(r'^project/(?P<pid>\d+)/sched/(?P<sid>\d+)/edit/$',
        view = 'sched_edit',
        name = 'bbotweb_sched_edit',
    ),
    
    url(r'^project/(?P<pid>\d+)/config/show/$',
        view = 'config_show',
        name = 'bbotweb_config_show',
    ),
    
    url(r'^project/(?P<pid>\d+)/config/download/$',
        view = 'config_show',
        name = 'bbotweb_config_download',
        kwargs = { "download":True },
    ),
)


urlpatterns += patterns('bbotweb.ajax_views',
    
    url(r'ajax/p/(?P<pid>\d+)/r/(?P<rid>\d+)/$',
        view = 'repos_get',
        name = 'bbotweb_a_repos_get',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/s/(?P<sid>\d+)/admins/$',
        view = 'slave_admin_get_html',
        name = 'bbotweb_a_slave_admin_get',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/s/admins/assign/$',
        view = 'slave_admin_assign',
        name = 'bbotweb_a_post_slave_assign_admin',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/s/admins/remove/$',
        view = 'slave_admin_remove',
        name = 'bbotweb_a_post_slave_remove_admin',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/b/(?P<bid>\d+)/slave/assign/$',
        view = 'builder_slave_assign',
        name = 'bbotweb_a_post_builder_assign_slave',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/b/(?P<bid>\d+)/slave/remove/$',
        view = 'builder_slave_remove',
        name = 'bbotweb_a_post_builder_remove_slave',
    ),

    url(r'ajax/p/(?P<pid>\d+)/b/(?P<bid>\d+)/step/move/$',
        view = 'builder_step_move',
        name = 'bbotweb_a_post_step_move',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/b/(?P<bid>\d+)/step/shuffle/$',
        view = 'builder_step_shuffle',
        name = 'bbotweb_a_post_step_shuffle',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/(?P<sid>\d+)/repos/assign/$',
        view = 'sched_repos_assign',
        name = 'bbotweb_a_post_sched_assign_repos',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/(?P<sid>\d+)/builder/assign/$',
        view = 'sched_builder_assign',
        name = 'bbotweb_a_post_sched_assign_builder',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/(?P<sid>\d+)/repos/remove/$',
        view = 'sched_repos_remove',
        name = 'bbotweb_a_post_sched_remove_repos',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/(?P<sid>\d+)/builder/remove/$',
        view = 'sched_builder_remove',
        name = 'bbotweb_a_post_sched_remove_builder',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/(?P<sid>\d+)/cron/set/$',
        view = 'sched_cron_set',
        name = 'bbotweb_a_post_sched_cron_set',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/sc/setifchange/$',
        view = 'sched_cron_set_ifchange',
        name = 'bbotweb_a_post_sched_cron_set_ifchange',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/a/setnotify/(?P<ntype>\w+)/$',
        view = 'admin_set_notify',
        name = 'bbotweb_a_post_admin_set_notify',
    ),

    url(r'ajax/p/(?P<pid>\d+)/b/(?P<bid>\d+)/st/setparam/(?P<ptype>\w+)/$',
        view = 'step_set_param',
        name = 'bbotweb_a_post_step_set_param',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/n/web/adm/$',
        view = 'web_set_admin',
        name = 'bbotweb_a_post_web_set_admin',
    ),
    
    url(r'ajax/p/(?P<pid>\d+)/s/set/(?P<ntype>\w+)/$',
        view = 'slave_set_param',
        name = 'bbotweb_a_post_slave_set_param',
    ),

    url(r'ajax/obj/del/get_confirmation_text/$',
        view = 'get_delete_confirmation',
        name = 'bbotweb_a_post_del_get_confirmation',
    ),
    url(r'ajax/obj/del/do_it/$',
        view = 'do_delete',
        name = 'bbotweb_a_post_del',
    ),
    
)

